2016-04-10 19:49:23 -07:00
|
|
|
set(LUV_SRC_DIR ${DEPS_BUILD_DIR}/src/luv)
|
|
|
|
set(LUV_INCLUDE_FLAGS
|
2019-09-30 03:50:22 -07:00
|
|
|
"-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.1")
|
2016-04-10 19:49:23 -07:00
|
|
|
|
|
|
|
set(LUV_CONFIGURE_COMMAND_COMMON
|
|
|
|
${CMAKE_COMMAND} ${LUV_SRC_DIR}
|
2016-05-26 12:45:33 -07:00
|
|
|
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
|
2022-08-05 15:20:10 -07:00
|
|
|
${BUILD_TYPE_STRING}
|
2016-04-10 19:49:23 -07:00
|
|
|
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
|
2022-06-24 08:43:11 -07:00
|
|
|
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_ALT_SEP}
|
2016-04-10 19:49:23 -07:00
|
|
|
-DLUA_BUILD_TYPE=System
|
2020-11-16 05:47:19 -07:00
|
|
|
-DLUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua-compat-5.3
|
2016-04-10 19:49:23 -07:00
|
|
|
-DWITH_SHARED_LIBUV=ON
|
|
|
|
-DBUILD_SHARED_LIBS=OFF
|
2021-07-06 23:24:08 -07:00
|
|
|
-DBUILD_STATIC_LIBS=ON
|
2016-04-10 19:49:23 -07:00
|
|
|
-DBUILD_MODULE=OFF)
|
|
|
|
|
2019-07-09 12:55:01 -07:00
|
|
|
if(USE_BUNDLED_LUAJIT)
|
|
|
|
list(APPEND LUV_CONFIGURE_COMMAND_COMMON -DWITH_LUA_ENGINE=LuaJit)
|
|
|
|
elseif(USE_BUNDLED_LUA)
|
|
|
|
list(APPEND LUV_CONFIGURE_COMMAND_COMMON -DWITH_LUA_ENGINE=Lua)
|
|
|
|
else()
|
|
|
|
find_package(LuaJit)
|
|
|
|
if(LUAJIT_FOUND)
|
|
|
|
list(APPEND LUV_CONFIGURE_COMMAND_COMMON -DWITH_LUA_ENGINE=LuaJit)
|
|
|
|
else()
|
|
|
|
list(APPEND LUV_CONFIGURE_COMMAND_COMMON -DWITH_LUA_ENGINE=Lua)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-05-27 02:16:29 -07:00
|
|
|
if(USE_BUNDLED_LIBUV)
|
|
|
|
set(LUV_CONFIGURE_COMMAND_COMMON
|
|
|
|
${LUV_CONFIGURE_COMMAND_COMMON}
|
2022-08-12 08:59:40 -07:00
|
|
|
-DCMAKE_PREFIX_PATH=${DEPS_INSTALL_DIR}
|
|
|
|
-DLIBUV_LIBRARIES=uv_a)
|
2018-05-27 02:16:29 -07:00
|
|
|
endif()
|
|
|
|
|
2022-06-12 15:11:14 -07:00
|
|
|
if(MSVC)
|
2016-04-10 19:49:23 -07:00
|
|
|
set(LUV_CONFIGURE_COMMAND
|
|
|
|
${LUV_CONFIGURE_COMMAND_COMMON}
|
|
|
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
2021-10-23 18:38:58 -07:00
|
|
|
-DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
|
2022-09-11 04:39:49 -07:00
|
|
|
"-DCMAKE_C_FLAGS:STRING=${LUV_INCLUDE_FLAGS}"
|
2016-04-10 19:49:23 -07:00
|
|
|
# Make sure we use the same generator, otherwise we may
|
2020-01-30 23:56:34 -07:00
|
|
|
# accidentally end up using different MSVC runtimes
|
2020-02-29 14:47:56 -07:00
|
|
|
-DCMAKE_GENERATOR=${CMAKE_GENERATOR})
|
2016-04-10 19:49:23 -07:00
|
|
|
else()
|
|
|
|
set(LUV_CONFIGURE_COMMAND
|
|
|
|
${LUV_CONFIGURE_COMMAND_COMMON}
|
|
|
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
2022-09-11 04:39:49 -07:00
|
|
|
"-DCMAKE_C_FLAGS:STRING=${LUV_INCLUDE_FLAGS} -fPIC")
|
2020-02-29 14:47:56 -07:00
|
|
|
if(CMAKE_GENERATOR MATCHES "Unix Makefiles" AND
|
|
|
|
(CMAKE_SYSTEM_NAME MATCHES ".*BSD" OR CMAKE_SYSTEM_NAME MATCHES "DragonFly"))
|
|
|
|
set(LUV_CONFIGURE_COMMAND ${LUV_CONFIGURE_COMMAND} -DCMAKE_MAKE_PROGRAM=gmake)
|
|
|
|
endif()
|
2016-04-10 19:49:23 -07:00
|
|
|
endif()
|
|
|
|
|
2022-10-06 06:14:38 -07:00
|
|
|
if(USE_EXISTING_SRC_DIR)
|
|
|
|
unset(LUA_COMPAT53_URL)
|
|
|
|
endif()
|
2022-08-29 07:57:46 -07:00
|
|
|
ExternalProject_Add(lua-compat-5.3
|
|
|
|
URL ${LUA_COMPAT53_URL}
|
2022-09-29 12:46:14 -07:00
|
|
|
URL_HASH SHA256=${LUA_COMPAT53_SHA256}
|
|
|
|
DOWNLOAD_NO_PROGRESS TRUE
|
2022-08-29 07:57:46 -07:00
|
|
|
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua-compat-5.3
|
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
BUILD_COMMAND ""
|
|
|
|
INSTALL_COMMAND "")
|
2016-04-10 19:49:23 -07:00
|
|
|
|
2022-10-06 06:14:38 -07:00
|
|
|
if(USE_EXISTING_SRC_DIR)
|
|
|
|
unset(LUV_URL)
|
|
|
|
endif()
|
2022-08-29 07:57:46 -07:00
|
|
|
ExternalProject_Add(luv-static
|
|
|
|
DEPENDS lua-compat-5.3
|
|
|
|
URL ${LUV_URL}
|
2022-09-29 12:46:14 -07:00
|
|
|
URL_HASH SHA256=${LUV_SHA256}
|
|
|
|
DOWNLOAD_NO_PROGRESS TRUE
|
2022-08-29 07:57:46 -07:00
|
|
|
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luv
|
2022-09-29 12:46:14 -07:00
|
|
|
SOURCE_DIR ${DEPS_BUILD_DIR}/src/luv
|
2022-08-29 07:57:46 -07:00
|
|
|
CONFIGURE_COMMAND "${LUV_CONFIGURE_COMMAND}"
|
|
|
|
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
|
|
|
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config $<CONFIG>
|
|
|
|
LIST_SEPARATOR |)
|
2016-04-10 19:49:23 -07:00
|
|
|
|
|
|
|
list(APPEND THIRD_PARTY_DEPS luv-static)
|
2017-03-25 16:22:15 -07:00
|
|
|
if(USE_BUNDLED_LUAJIT)
|
|
|
|
add_dependencies(luv-static luajit)
|
2022-08-12 08:59:40 -07:00
|
|
|
elseif(USE_BUNDLED_LUA)
|
|
|
|
add_dependencies(luv-static lua)
|
2017-03-25 16:22:15 -07:00
|
|
|
endif()
|
|
|
|
if(USE_BUNDLED_LIBUV)
|
|
|
|
add_dependencies(luv-static libuv)
|
|
|
|
endif()
|