build: remove CMAKE_CROSSCOMPILING code #18914

This is rarely, if ever, used and certainly not tested. It's likely this
isn't functional anymore.
This commit is contained in:
dundargoc 2022-06-13 00:11:14 +02:00 committed by GitHub
parent f90174c98c
commit 3c7b91da10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 88 deletions

View File

@ -71,13 +71,8 @@ else()
endif() endif()
endif() endif()
if(CMAKE_CROSSCOMPILING AND NOT UNIX)
list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX})
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin)
else()
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX})
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig") set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig")
endif()
# used for check_c_compiler_flag # used for check_c_compiler_flag
include(CheckCCompilerFlag) include(CheckCCompilerFlag)

View File

@ -119,23 +119,11 @@ if(CMAKE_OSX_SYSROOT)
endif() endif()
endif() endif()
# Cross compiling: use these for dependencies built for the
# HOST system, when not crosscompiling these should be the
# same as DEPS_*. Except when targeting Unix in which case
# want all the dependencies to use the same compiler.
if(CMAKE_CROSSCOMPILING AND NOT UNIX)
set(HOSTDEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/host")
set(HOSTDEPS_BIN_DIR "${HOSTDEPS_INSTALL_DIR}/bin")
set(HOSTDEPS_LIB_DIR "${HOSTDEPS_INSTALL_DIR}/lib")
set(HOSTDEPS_C_COMPILER "${HOST_C_COMPILER}")
set(HOSTDEPS_CXX_COMPILER "${HOST_CXX_COMPILER}")
else()
set(HOSTDEPS_INSTALL_DIR "${DEPS_INSTALL_DIR}") set(HOSTDEPS_INSTALL_DIR "${DEPS_INSTALL_DIR}")
set(HOSTDEPS_BIN_DIR "${DEPS_BIN_DIR}") set(HOSTDEPS_BIN_DIR "${DEPS_BIN_DIR}")
set(HOSTDEPS_LIB_DIR "${DEPS_LIB_DIR}") set(HOSTDEPS_LIB_DIR "${DEPS_LIB_DIR}")
set(HOSTDEPS_C_COMPILER "${DEPS_C_COMPILER}") set(HOSTDEPS_C_COMPILER "${DEPS_C_COMPILER}")
set(HOSTDEPS_CXX_COMPILER "${DEPS_CXX_COMPILER}") set(HOSTDEPS_CXX_COMPILER "${DEPS_CXX_COMPILER}")
endif()
include(ExternalProject) include(ExternalProject)
@ -222,7 +210,7 @@ if(USE_BUNDLED_LUAJIT)
include(BuildLuajit) include(BuildLuajit)
endif() endif()
if(USE_BUNDLED_LUA AND NOT CMAKE_CROSSCOMPILING) if(USE_BUNDLED_LUA)
include(BuildLua) include(BuildLua)
endif() endif()

View File

@ -45,17 +45,6 @@ if(UNIX)
CONFIGURE_COMMAND ${UNIX_CFGCMD} MAKE=${MAKE_PRG} CONFIGURE_COMMAND ${UNIX_CFGCMD} MAKE=${MAKE_PRG}
INSTALL_COMMAND ${MAKE_PRG} V=1 install) INSTALL_COMMAND ${MAKE_PRG} V=1 install)
elseif(MINGW AND CMAKE_CROSSCOMPILING)
# Build libuv for the host
BuildLibuv(TARGET libuv_host
CONFIGURE_COMMAND sh ${DEPS_BUILD_DIR}/src/libuv_host/autogen.sh && ${DEPS_BUILD_DIR}/src/libuv_host/configure --with-pic --disable-shared --prefix=${HOSTDEPS_INSTALL_DIR} CC=${HOST_C_COMPILER}
INSTALL_COMMAND ${MAKE_PRG} V=1 install)
# Build libuv for the target
BuildLibuv(
CONFIGURE_COMMAND ${UNIX_CFGCMD} --host=${CROSS_TARGET}
INSTALL_COMMAND ${MAKE_PRG} V=1 install)
elseif(WIN32) elseif(WIN32)
set(UV_OUTPUT_DIR ${DEPS_BUILD_DIR}/src/libuv/${CMAKE_BUILD_TYPE}) set(UV_OUTPUT_DIR ${DEPS_BUILD_DIR}/src/libuv/${CMAKE_BUILD_TYPE})

View File

@ -76,29 +76,6 @@ if(UNIX)
CC=${DEPS_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR} CC=${DEPS_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR}
${DEPLOYMENT_TARGET}) ${DEPLOYMENT_TARGET})
elseif(MINGW AND CMAKE_CROSSCOMPILING)
# Build luajit for the host
BuildLuaJit(TARGET luajit_host
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${INSTALLCMD_UNIX}
CC=${HOST_C_COMPILER} PREFIX=${HOSTDEPS_INSTALL_DIR})
# Build luajit for the target
BuildLuaJit(
# Similar to Unix + cross - fPIC
INSTALL_COMMAND
${MAKE_PRG} PREFIX=${DEPS_INSTALL_DIR}
BUILDMODE=static install
TARGET_SYS=${CMAKE_SYSTEM_NAME}
CROSS=${CROSS_TARGET}-
HOST_CC=${HOST_C_COMPILER} HOST_CFLAGS=${HOST_C_FLAGS}
HOST_LDFLAGS=${HOST_EXE_LINKER_FLAGS}
FILE_T=luajit.exe
Q=
INSTALL_TSYMNAME=luajit.exe)
elseif(MINGW) elseif(MINGW)
if(CMAKE_GENERATOR MATCHES "Ninja") if(CMAKE_GENERATOR MATCHES "Ninja")

View File

@ -56,7 +56,7 @@ endif()
# Defaults to 5.1 for bundled LuaJIT/Lua. # Defaults to 5.1 for bundled LuaJIT/Lua.
set(LUA_VERSION "5.1") set(LUA_VERSION "5.1")
if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING)) if(UNIX)
if(USE_BUNDLED_LUAJIT) if(USE_BUNDLED_LUAJIT)
list(APPEND LUAROCKS_OPTS list(APPEND LUAROCKS_OPTS
@ -123,9 +123,6 @@ list(APPEND THIRD_PARTY_DEPS luarocks)
if(USE_BUNDLED_LUAJIT) if(USE_BUNDLED_LUAJIT)
add_dependencies(luarocks luajit) add_dependencies(luarocks luajit)
if(MINGW AND CMAKE_CROSSCOMPILING)
add_dependencies(luarocks luajit_host)
endif()
elseif(USE_BUNDLED_LUA) elseif(USE_BUNDLED_LUA)
add_dependencies(luarocks lua) add_dependencies(luarocks lua)
endif() endif()
@ -196,9 +193,6 @@ if(USE_BUNDLED_BUSTED)
set(LUV_DEPS luacheck) set(LUV_DEPS luacheck)
if(USE_BUNDLED_LUV) if(USE_BUNDLED_LUV)
list(APPEND LUV_DEPS luv-static lua-compat-5.3) list(APPEND LUV_DEPS luv-static lua-compat-5.3)
if(MINGW AND CMAKE_CROSSCOMPILING)
list(APPEND LUV_DEPS libuv_host)
endif()
set(LUV_ARGS "CFLAGS=-O0 -g3 -fPIC") set(LUV_ARGS "CFLAGS=-O0 -g3 -fPIC")
if(USE_BUNDLED_LIBUV) if(USE_BUNDLED_LIBUV)
list(APPEND LUV_ARGS LIBUV_DIR=${HOSTDEPS_INSTALL_DIR}) list(APPEND LUV_ARGS LIBUV_DIR=${HOSTDEPS_INSTALL_DIR})

View File

@ -91,16 +91,7 @@ if(USE_BUNDLED_LIBUV)
-DCMAKE_PREFIX_PATH=${DEPS_INSTALL_DIR}) -DCMAKE_PREFIX_PATH=${DEPS_INSTALL_DIR})
endif() endif()
if(MINGW AND CMAKE_CROSSCOMPILING) if(MSVC)
get_filename_component(TOOLCHAIN ${CMAKE_TOOLCHAIN_FILE} REALPATH)
set(LUV_CONFIGURE_COMMAND
${LUV_CONFIGURE_COMMAND_COMMON}
# Pass toolchain
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
"-DCMAKE_C_FLAGS:STRING=${LUV_INCLUDE_FLAGS} -D_WIN32_WINNT=0x0600"
# Hack to avoid -rdynamic in Mingw
-DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS="")
elseif(MSVC)
set(LUV_CONFIGURE_COMMAND set(LUV_CONFIGURE_COMMAND
${LUV_CONFIGURE_COMMAND_COMMON} ${LUV_CONFIGURE_COMMAND_COMMON}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}

View File

@ -42,18 +42,7 @@ set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack
set(MSGPACK_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}) set(MSGPACK_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE})
set(MSGPACK_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}) set(MSGPACK_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
if(MINGW AND CMAKE_CROSSCOMPILING) if(MSVC)
get_filename_component(TOOLCHAIN ${CMAKE_TOOLCHAIN_FILE} REALPATH)
set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack
-DMSGPACK_BUILD_TESTS=OFF
-DMSGPACK_BUILD_EXAMPLES=OFF
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
# Pass toolchain
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
# Hack to avoid -rdynamic in Mingw
-DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS="")
elseif(MSVC)
# Same as Unix without fPIC # Same as Unix without fPIC
set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack
-DMSGPACK_BUILD_TESTS=OFF -DMSGPACK_BUILD_TESTS=OFF