aboutsummaryrefslogtreecommitdiff
path: root/cmake.deps/cmake/BuildLuajit.cmake
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /cmake.deps/cmake/BuildLuajit.cmake
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'cmake.deps/cmake/BuildLuajit.cmake')
-rw-r--r--cmake.deps/cmake/BuildLuajit.cmake55
1 files changed, 5 insertions, 50 deletions
diff --git a/cmake.deps/cmake/BuildLuajit.cmake b/cmake.deps/cmake/BuildLuajit.cmake
index 81fa6446c4..db37d79099 100644
--- a/cmake.deps/cmake/BuildLuajit.cmake
+++ b/cmake.deps/cmake/BuildLuajit.cmake
@@ -1,20 +1,13 @@
-# BuildLuajit(TARGET targetname CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
-# Reusable function to build luajit, wraps ExternalProject_Add.
-# Failing to pass a command argument will result in no command being run
function(BuildLuajit)
cmake_parse_arguments(_luajit
""
- "TARGET"
+ ""
"CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND;DEPENDS"
${ARGN})
- if(NOT _luajit_TARGET)
- set(_luajit_TARGET "luajit")
- endif()
- ExternalProject_Add(${_luajit_TARGET}
- URL ${LUAJIT_URL}
- URL_HASH SHA256=${LUAJIT_SHA256}
- DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${_luajit_TARGET}
+ get_externalproject_options(luajit ${DEPS_IGNORE_SHA})
+ ExternalProject_Add(luajit
+ DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luajit
CONFIGURE_COMMAND "${_luajit_CONFIGURE_COMMAND}"
BUILD_IN_SOURCE 1
BUILD_COMMAND "${_luajit_BUILD_COMMAND}"
@@ -48,49 +41,11 @@ if(APPLE)
set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
-if((UNIX AND NOT APPLE) OR (APPLE AND NOT CMAKE_OSX_ARCHITECTURES))
+if(UNIX)
BuildLuaJit(INSTALL_COMMAND ${BUILDCMD_UNIX}
CC=${DEPS_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR}
${DEPLOYMENT_TARGET} install)
-elseif(CMAKE_OSX_ARCHITECTURES AND APPLE)
-
- set(LUAJIT_C_COMPILER "${CMAKE_C_COMPILER}")
- if(CMAKE_OSX_SYSROOT)
- set(LUAJIT_C_COMPILER "${LUAJIT_C_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}")
- endif()
-
- # Passing multiple `-arch` flags to the LuaJIT build will cause it to fail.
- # To get a working universal build, we build each requested architecture slice
- # individually then `lipo` them all up.
- set(LUAJIT_SRC_DIR "${DEPS_BUILD_DIR}/src/luajit")
- foreach(ARCH IN LISTS CMAKE_OSX_ARCHITECTURES)
- set(STATIC_CC "${LUAJIT_C_COMPILER} -arch ${ARCH}")
- set(DYNAMIC_CC "${LUAJIT_C_COMPILER} -arch ${ARCH} -fPIC")
- set(TARGET_LD "${LUAJIT_C_COMPILER} -arch ${ARCH}")
- list(APPEND LUAJIT_THIN_EXECUTABLES "${LUAJIT_SRC_DIR}-${ARCH}/src/luajit")
- list(APPEND LUAJIT_THIN_STATIC_LIBS "${LUAJIT_SRC_DIR}-${ARCH}/src/libluajit.a")
- list(APPEND LUAJIT_THIN_DYLIBS "${LUAJIT_SRC_DIR}-${ARCH}/src/libluajit.so")
- list(APPEND LUAJIT_THIN_TARGETS "luajit-${ARCH}")
-
- # See https://luajit.org/install.html#cross.
- BuildLuaJit(TARGET "luajit-${ARCH}"
- BUILD_COMMAND ${BUILDCMD_UNIX}
- CC=${LUAJIT_C_COMPILER} STATIC_CC=${STATIC_CC}
- DYNAMIC_CC=${DYNAMIC_CC} TARGET_LD=${TARGET_LD}
- PREFIX=${DEPS_INSTALL_DIR}
- ${DEPLOYMENT_TARGET})
- endforeach()
- BuildLuaJit(
- CONFIGURE_COMMAND ${BUILDCMD_UNIX} CC=${LUAJIT_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR} ${DEPLOYMENT_TARGET}
- COMMAND ${CMAKE_COMMAND} -E rm -f ${LUAJIT_SRC_DIR}/src/luajit ${LUAJIT_SRC_DIR}/src/libluajit.so ${LUAJIT_SRC_DIR}/src/libluajit.a
- BUILD_COMMAND lipo ${LUAJIT_THIN_EXECUTABLES} -create -output ${LUAJIT_SRC_DIR}/src/luajit
- COMMAND lipo ${LUAJIT_THIN_STATIC_LIBS} -create -output ${LUAJIT_SRC_DIR}/src/libluajit.a
- COMMAND lipo ${LUAJIT_THIN_DYLIBS} -create -output ${LUAJIT_SRC_DIR}/src/libluajit.so
- INSTALL_COMMAND ${BUILDCMD_UNIX} CC=${LUAJIT_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR} ${DEPLOYMENT_TARGET} install
- DEPENDS ${LUAJIT_THIN_TARGETS}
- )
-
elseif(MINGW)
if(CMAKE_GENERATOR MATCHES "Ninja")