aboutsummaryrefslogtreecommitdiff
path: root/cmake.deps/cmake/BuildLuv.cmake
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-01-20 23:48:46 +0100
committerGitHub <noreply@github.com>2023-01-20 23:48:46 +0100
commit4c5c6ca8009dd68a68bc31caef509cb15ebef7ca (patch)
tree9085a57ff0fbfb3eeefea462ed53723ba48ad9c5 /cmake.deps/cmake/BuildLuv.cmake
parentc41214c7d43038c872625c224ce59443127b692d (diff)
downloadrneovim-4c5c6ca8009dd68a68bc31caef509cb15ebef7ca.tar.gz
rneovim-4c5c6ca8009dd68a68bc31caef509cb15ebef7ca.tar.bz2
rneovim-4c5c6ca8009dd68a68bc31caef509cb15ebef7ca.zip
build: various cmake fixes (#21902)
* build: various cmake refactors and simplifications - Add STATUS keyword to message to ensure messages are shown in the correct order. - Remove DEPS_CXX_COMPILER as we don't rely on C++ for any of our dependencies. - Simplify how msgpack and luv configure options are constructed. - Rely on the default installation for luv instead of manually passing configure, build and install commands. - Simplify return code conditional. * build: remove CMAKE_OSX_ARCHITECTURES_ALT_SEP workaround CMAKE_OSX_ARCHITECTURES_ALT_SEP was defined as a workaround to prevent the shell from interpreting `;`, which CMake uses as a list separator. However, the same thing can be achieved by instead passing CMAKE_OSX_ARCHITECTURES as a cache variable instead, which is a more idiomatic way of achieving the same thing. * build: define CMAKE_BUILD_TYPE before adding it to BUILD_TYPE_STRING The problem with the current setup is that CMAKE_BUILD_TYPE is defined after BUILD_TYPE_STRING. BUILD_TYPE_STRING will then be empty on the first run, meaning that dependencies are built without a build type. However, since CMAKE_BUILD_TYPE is a cache variable its value will persist in subsequent runs. On the second run BUILD_TYPE_STRING will have the correct value, but it's a different value from the ones the dependencies were built with. This will force some dependencies to be built again. Fixes https://github.com/neovim/neovim/issues/21672.
Diffstat (limited to 'cmake.deps/cmake/BuildLuv.cmake')
-rw-r--r--cmake.deps/cmake/BuildLuv.cmake41
1 files changed, 15 insertions, 26 deletions
diff --git a/cmake.deps/cmake/BuildLuv.cmake b/cmake.deps/cmake/BuildLuv.cmake
index 1a599a9ee2..c37a870b3d 100644
--- a/cmake.deps/cmake/BuildLuv.cmake
+++ b/cmake.deps/cmake/BuildLuv.cmake
@@ -1,13 +1,12 @@
-set(LUV_SRC_DIR ${DEPS_BUILD_DIR}/src/luv)
set(LUV_INCLUDE_FLAGS
"-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.1")
-set(LUV_CONFIGURE_COMMAND_COMMON
- ${CMAKE_COMMAND} ${LUV_SRC_DIR}
+set(LUV_CMAKE_ARGS
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
${BUILD_TYPE_STRING}
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
- -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_ALT_SEP}
-DLUA_BUILD_TYPE=System
-DLUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua-compat-5.3
-DWITH_SHARED_LIBUV=ON
@@ -16,42 +15,33 @@ set(LUV_CONFIGURE_COMMAND_COMMON
-DBUILD_MODULE=OFF)
if(USE_BUNDLED_LUAJIT)
- list(APPEND LUV_CONFIGURE_COMMAND_COMMON -DWITH_LUA_ENGINE=LuaJit)
+ list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=LuaJit)
elseif(USE_BUNDLED_LUA)
- list(APPEND LUV_CONFIGURE_COMMAND_COMMON -DWITH_LUA_ENGINE=Lua)
+ list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=Lua)
else()
find_package(LuaJit)
if(LUAJIT_FOUND)
- list(APPEND LUV_CONFIGURE_COMMAND_COMMON -DWITH_LUA_ENGINE=LuaJit)
+ list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=LuaJit)
else()
- list(APPEND LUV_CONFIGURE_COMMAND_COMMON -DWITH_LUA_ENGINE=Lua)
+ list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=Lua)
endif()
endif()
if(USE_BUNDLED_LIBUV)
- set(LUV_CONFIGURE_COMMAND_COMMON
- ${LUV_CONFIGURE_COMMAND_COMMON}
+ list(APPEND LUV_CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${DEPS_INSTALL_DIR}
-DLIBUV_LIBRARIES=uv_a)
endif()
if(MSVC)
- set(LUV_CONFIGURE_COMMAND
- ${LUV_CONFIGURE_COMMAND_COMMON}
- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
- -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
- "-DCMAKE_C_FLAGS:STRING=${LUV_INCLUDE_FLAGS}"
- # Make sure we use the same generator, otherwise we may
- # accidentally end up using different MSVC runtimes
- -DCMAKE_GENERATOR=${CMAKE_GENERATOR})
+ list(APPEND LUV_CMAKE_ARGS
+ "-DCMAKE_C_FLAGS:STRING=${LUV_INCLUDE_FLAGS}")
else()
- set(LUV_CONFIGURE_COMMAND
- ${LUV_CONFIGURE_COMMAND_COMMON}
- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ list(APPEND LUV_CMAKE_ARGS
"-DCMAKE_C_FLAGS:STRING=${LUV_INCLUDE_FLAGS} -fPIC")
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)
+ list(APPEND LUV_CMAKE_ARGS -DCMAKE_MAKE_PROGRAM=gmake)
endif()
endif()
@@ -77,10 +67,9 @@ ExternalProject_Add(luv-static
DOWNLOAD_NO_PROGRESS TRUE
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luv
SOURCE_DIR ${DEPS_BUILD_DIR}/src/luv
- CONFIGURE_COMMAND "${LUV_CONFIGURE_COMMAND}"
- BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
- INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config $<CONFIG>
- LIST_SEPARATOR |)
+ CMAKE_ARGS ${LUV_CMAKE_ARGS}
+ CMAKE_CACHE_ARGS
+ -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES})
list(APPEND THIRD_PARTY_DEPS luv-static)
if(USE_BUNDLED_LUAJIT)