File tree Expand file tree Collapse file tree 8 files changed +116
-0
lines changed Expand file tree Collapse file tree 8 files changed +116
-0
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,9 @@ else()
279279endif ()
280280declare_project(thirdparty/kobo-usbms ${EXCLUDE_FROM_ALL} )
281281
282+ # lanes
283+ declare_project(thirdparty/lanes DEPENDS luajit)
284+
282285# leptonica
283286declare_project(thirdparty/leptonica DEPENDS libpng)
284287
Original file line number Diff line number Diff line change 1+ cdecl_func (luaopen_lanes_core )
Original file line number Diff line number Diff line change @@ -298,6 +298,7 @@ if(MONOLIBTIC)
298298 freetype2::freetype
299299 giflib::gif
300300 harfbuzz::harfbuzz
301+ lanes::core
301302 leptonica::leptonica
302303 libjpeg-turbo::turbojpeg
303304 libk2pdfopt::k2pdfopt
@@ -347,6 +348,7 @@ if(MONOLIBTIC)
347348 giflib_decl
348349 harfbuzz_cdecl
349350 koptcontext_cdecl
351+ lanes_cdecl
350352 leptonica_cdecl
351353 libarchive_cdecl
352354 libwebp_decl
Original file line number Diff line number Diff line change @@ -87,6 +87,11 @@ declare_dependency(giflib::gif MONOLIBTIC gif)
8787# harfbuzz
8888declare_dependency(harfbuzz::harfbuzz INCLUDES freetype2 harfbuzz MONOLIBTIC harfbuzz)
8989
90+ # lanes
91+ if (MONOLIBTIC)
92+ declare_dependency(lanes::core LIBRARIES ${STAGING_DIR} /lib/lanes/core.a)
93+ endif ()
94+
9095# libarchive
9196declare_dependency(libarchive::libarchive MONOLIBTIC archive)
9297
Original file line number Diff line number Diff line change 1+ list (APPEND PATCH_FILES
2+ # Fix inline shenanigans.
3+ fix_debug_build.patch
4+ # Allow compiling with `-fvisibility=hidden`.
5+ visibility.patch
6+ )
7+
8+ list (APPEND CMAKE_ARGS
9+ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
10+ -DBUILD_SHARED_LIBS=$<NOT :$<BOOL :${MONOLIBTIC} >>
11+ # Project options.
12+ -DANDROID=${ANDROID}
13+ )
14+
15+ list (APPEND BUILD_CMD COMMAND ninja)
16+
17+ append_install_commands(INSTALL_CMD ${SOURCE_DIR} /src/lanes.lua DESTINATION common)
18+ if (MONOLIBTIC)
19+ append_install_commands(INSTALL_CMD core.a DESTINATION ${STAGING_DIR} /lib/lanes)
20+ else ()
21+ append_binary_install_command(INSTALL_CMD core.so DESTINATION common/lanes)
22+ endif ()
23+
24+ external_project(
25+ DOWNLOAD GIT v3.17.1
26+ https://github.com/LuaLanes/lanes.git
27+ PATCH_FILES ${PATCH_FILES}
28+ PATCH_OVERLAY overlay
29+ CMAKE_ARGS ${CMAKE_ARGS}
30+ BUILD_COMMAND ${BUILD_CMD}
31+ INSTALL_COMMAND ${INSTALL_CMD}
32+ )
Original file line number Diff line number Diff line change 1+ --- a/src/macros_and_utils.h
2+ +++ b/src/macros_and_utils.h
3+ @@ -82,6 +82,7 @@
4+
5+ #define ASSERT_L(c) _ASSERT_L(L,c)
6+
7+ + __attribute__ ((always_inline))
8+ inline void STACK_GROW(lua_State * L, int n_)
9+ {
10+ if (!lua_checkstack(L, n_))
11+ --- a/src/lanes_private.h
12+ +++ b/src/lanes_private.h
13+ @@ -79,6 +79,7 @@
14+ // 'Lane' are malloc/free'd and the handle only carries a pointer.
15+ // This is not deep userdata since the handle's not portable among lanes.
16+ //
17+ + __attribute__ ((always_inline))
18+ inline Lane* lua_toLane(lua_State* L, int i_)
19+ {
20+ return *(Lane**)(luaL_checkudata(L, i_, "Lane"));
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.17.5)
2+ project (lanes LANGUAGES C)
3+
4+ set (THREADS_PREFER_PTHREAD_FLAG TRUE )
5+ find_package (Threads REQUIRED)
6+
7+ find_package (PkgConfig REQUIRED)
8+ pkg_check_modules(LuaJIT luajit REQUIRED IMPORTED_TARGET)
9+
10+ if (BUILD_SHARED_LIBS )
11+ add_library (core MODULE)
12+ else ()
13+ add_library (core STATIC )
14+ endif ()
15+ set_target_properties (core PROPERTIES C_VISIBILITY_PRESET hidden PREFIX "" )
16+ target_link_libraries (core PRIVATE PkgConfig::LuaJIT Threads::Threads m)
17+ if (ANDROID)
18+ target_link_libraries (core PRIVATE log )
19+ endif ()
20+ target_sources (core PRIVATE
21+ src/lanes.c
22+ src/cancel.c
23+ src/compat.c
24+ src/threading.c
25+ src/tools.c
26+ src/state.c
27+ src/linda.c
28+ src/deep.c
29+ src/keeper.c
30+ src/universe.c
31+ )
Original file line number Diff line number Diff line change 1+ --- a/src/deep.h
2+ +++ b/src/deep.h
3+ @@ -18,7 +18,7 @@
4+ #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC)
5+ #define LANES_API __declspec(dllexport)
6+ #else
7+ - #define LANES_API
8+ + #define LANES_API __attribute__ ((visibility("default")))
9+ #endif // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC)
10+ #endif // LANES_API
11+
12+ --- a/src/lanes.h
13+ +++ b/src/lanes.h
14+ @@ -7,7 +7,7 @@
15+ #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC)
16+ #define LANES_API __declspec(dllexport)
17+ #else
18+ - #define LANES_API
19+ + #define LANES_API __attribute__ ((visibility("default")))
20+ #endif // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC)
21+
22+ #define LANES_VERSION_MAJOR 3
You can’t perform that action at this time.
0 commit comments