diff --git a/CMakeLists.txt b/CMakeLists.txt index d8dc2beae4..51124de96a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,13 +71,8 @@ else() 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}) - set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig") -endif() +list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig") # used for check_c_compiler_flag include(CheckCCompilerFlag) diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 84b360b9d9..9f1b3f0706 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -119,23 +119,11 @@ if(CMAKE_OSX_SYSROOT) 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_BIN_DIR "${DEPS_BIN_DIR}") - set(HOSTDEPS_LIB_DIR "${DEPS_LIB_DIR}") - set(HOSTDEPS_C_COMPILER "${DEPS_C_COMPILER}") - set(HOSTDEPS_CXX_COMPILER "${DEPS_CXX_COMPILER}") -endif() +set(HOSTDEPS_INSTALL_DIR "${DEPS_INSTALL_DIR}") +set(HOSTDEPS_BIN_DIR "${DEPS_BIN_DIR}") +set(HOSTDEPS_LIB_DIR "${DEPS_LIB_DIR}") +set(HOSTDEPS_C_COMPILER "${DEPS_C_COMPILER}") +set(HOSTDEPS_CXX_COMPILER "${DEPS_CXX_COMPILER}") include(ExternalProject) @@ -222,7 +210,7 @@ if(USE_BUNDLED_LUAJIT) include(BuildLuajit) endif() -if(USE_BUNDLED_LUA AND NOT CMAKE_CROSSCOMPILING) +if(USE_BUNDLED_LUA) include(BuildLua) endif() diff --git a/third-party/cmake/BuildLibuv.cmake b/third-party/cmake/BuildLibuv.cmake index 42650308a8..ba5de38714 100644 --- a/third-party/cmake/BuildLibuv.cmake +++ b/third-party/cmake/BuildLibuv.cmake @@ -45,17 +45,6 @@ if(UNIX) CONFIGURE_COMMAND ${UNIX_CFGCMD} MAKE=${MAKE_PRG} 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) set(UV_OUTPUT_DIR ${DEPS_BUILD_DIR}/src/libuv/${CMAKE_BUILD_TYPE}) diff --git a/third-party/cmake/BuildLuajit.cmake b/third-party/cmake/BuildLuajit.cmake index e02d7fe609..fc8558588b 100644 --- a/third-party/cmake/BuildLuajit.cmake +++ b/third-party/cmake/BuildLuajit.cmake @@ -76,29 +76,6 @@ if(UNIX) CC=${DEPS_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR} ${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) if(CMAKE_GENERATOR MATCHES "Ninja") diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake index 244d1d9fb8..6d73a02b5a 100644 --- a/third-party/cmake/BuildLuarocks.cmake +++ b/third-party/cmake/BuildLuarocks.cmake @@ -56,7 +56,7 @@ endif() # Defaults to 5.1 for bundled LuaJIT/Lua. set(LUA_VERSION "5.1") -if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING)) +if(UNIX) if(USE_BUNDLED_LUAJIT) list(APPEND LUAROCKS_OPTS @@ -123,9 +123,6 @@ list(APPEND THIRD_PARTY_DEPS luarocks) if(USE_BUNDLED_LUAJIT) add_dependencies(luarocks luajit) - if(MINGW AND CMAKE_CROSSCOMPILING) - add_dependencies(luarocks luajit_host) - endif() elseif(USE_BUNDLED_LUA) add_dependencies(luarocks lua) endif() @@ -196,9 +193,6 @@ if(USE_BUNDLED_BUSTED) set(LUV_DEPS luacheck) if(USE_BUNDLED_LUV) 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") if(USE_BUNDLED_LIBUV) list(APPEND LUV_ARGS LIBUV_DIR=${HOSTDEPS_INSTALL_DIR}) diff --git a/third-party/cmake/BuildLuv.cmake b/third-party/cmake/BuildLuv.cmake index 99822249c2..001f5a325a 100644 --- a/third-party/cmake/BuildLuv.cmake +++ b/third-party/cmake/BuildLuv.cmake @@ -91,16 +91,7 @@ if(USE_BUNDLED_LIBUV) -DCMAKE_PREFIX_PATH=${DEPS_INSTALL_DIR}) endif() -if(MINGW AND CMAKE_CROSSCOMPILING) - 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) +if(MSVC) set(LUV_CONFIGURE_COMMAND ${LUV_CONFIGURE_COMMAND_COMMON} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} diff --git a/third-party/cmake/BuildMsgpack.cmake b/third-party/cmake/BuildMsgpack.cmake index f66a3bdd32..a89c1e34d0 100644 --- a/third-party/cmake/BuildMsgpack.cmake +++ b/third-party/cmake/BuildMsgpack.cmake @@ -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_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}) -if(MINGW AND CMAKE_CROSSCOMPILING) - 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) +if(MSVC) # Same as Unix without fPIC set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack -DMSGPACK_BUILD_TESTS=OFF