build(deps): support universal builds on macOS

CMake can handle building universal binaries on macOS using the
`CMAKE_OSX_ARCHITECTURES` variable. Let's pass this variable to the
relevant dep builds. We use the `LIST_SEPARATOR` argument to prevent the
shell from interpreting the `;` that CMake uses as a list separator.

For dependencies that don't build using CMake, we only need to make sure
that the compiler is invoked with the correct `-arch` flags. The
compiler does the rest.

The only exception to this is the LuaJIT build, which we handle
separately as a special case.
This commit is contained in:
Carlo Cabrera
2022-06-24 23:43:11 +08:00
committed by Christian Clason
parent 0d230d3f01
commit dca69c90d4
4 changed files with 22 additions and 3 deletions

View File

@@ -48,7 +48,8 @@ function(BuildLuv)
PATCH_COMMAND "${_luv_PATCH_COMMAND}"
CONFIGURE_COMMAND "${_luv_CONFIGURE_COMMAND}"
BUILD_COMMAND "${_luv_BUILD_COMMAND}"
INSTALL_COMMAND "${_luv_INSTALL_COMMAND}")
INSTALL_COMMAND "${_luv_INSTALL_COMMAND}"
LIST_SEPARATOR |)
endfunction()
set(LUV_SRC_DIR ${DEPS_BUILD_DIR}/src/luv)
@@ -65,6 +66,7 @@ set(LUV_CONFIGURE_COMMAND_COMMON
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-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