visualboyadvance-m/cmake/Toolchain-cross-MinGW-w64-i...

31 lines
1.3 KiB
CMake
Raw Normal View History

SET(CMAKE_SYSTEM_NAME Windows)
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
set(CROSS_ARCH i686)
set(COMPILER_PREFIX "${CROSS_ARCH}-w64-mingw32")
unset(CMAKE_RC_COMPILER CACHE)
unset(CMAKE_C_COMPILER CACHE)
unset(CMAKE_CXX_COMPILER CACHE)
unset(PKG_CONFIG_EXECUTABLE CACHE)
# which compilers to use for C and C++
find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/usr /usr/${COMPILER_PREFIX}/sys-root/mingw /usr/local/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX} /home/linuxbrew/.linuxbrew/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX} $ENV{HOME}/.linuxbrew/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX})
if(CMAKE_PREFIX_PATH)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_PREFIX_PATH})
endif()
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment too
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# pkg-config may be under the prefix
find_program(PKG_CONFIG_EXECUTABLE NAMES ${COMPILER_PREFIX}-pkg-config)