-
Michał Janiszewski authored
This makes sure that shared library built with MinGW toolchain is linked statically to *all* its dependencies, including libc, libstdc++, libsdl2 and all the others. This allows producing of working `openrct2.dll` by cross-compiling. I hit a bug with libcrypto, a dependency of libssl, which in turn is a dependency of curl, which creates a `DllMain` entrypoint for static lib too, but since we don't do anything in ours, this should be safe. I have only had chance to try it out when cross-compiling, ideally it should be tested under Cygwin/MSYS too, but it is too bothersome to setup for me.
6a5fc90c
SET(CMAKE_SYSTEM_NAME Windows)
SET(COMPILER_PREFIX i686-w64-mingw32)
SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc)
SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-c++)
SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres)
SET(CMAKE_PKGCONFIG_EXECUTABLE ${COMPILER_PREFIX}-pkg-config)
SET(PKG_CONFIG_EXECUTABLE ${COMPILER_PREFIX}-pkg-config)
if(APPLE)
SET(TARGET_ENVIRONMENT /usr/local/mingw-w32-bin_i686-darwin/i686-w64-mingw32)
else()
SET(TARGET_ENVIRONMENT /usr/i686-w64-mingw32)
endif(APPLE)
# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH ${TARGET_ENVIRONMENT})
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# INCLUDE_DIRECTORIES(${ORCTLIBS_INCLUDE} ${JANSSON_INCLUDE})