2020-02-02 02:14:03 +00:00
|
|
|
set(CMAKE_SYSTEM_NAME Windows)
|
|
|
|
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR ${CROSS_ARCH})
|
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2020-02-02 02:14:03 +00:00
|
|
|
# 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)
|
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
|
|
|
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}
|
|
|
|
)
|
|
|
|
|
|
|
|
# find wx-config
|
|
|
|
foreach(p ${CMAKE_FIND_ROOT_PATH})
|
|
|
|
file(GLOB paths ${p}/lib/wx/config/${COMPILER_PREFIX}-msw-*)
|
|
|
|
|
|
|
|
list(APPEND wx_confs ${paths})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(p ${wx_confs})
|
|
|
|
if(CMAKE_TOOLCHAIN_FILE MATCHES -static)
|
|
|
|
string(REGEX MATCH "(static-)?([0-9]+\\.?)+$" wx_conf_ver ${p})
|
|
|
|
else()
|
|
|
|
string(REGEX MATCH "([0-9]+\\.?)+$" wx_conf_ver ${p})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND wx_conf_vers ${wx_conf_ver})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
list(SORT wx_conf_vers)
|
|
|
|
list(REVERSE wx_conf_vers)
|
|
|
|
list(GET wx_conf_vers 0 wx_conf_ver)
|
|
|
|
|
|
|
|
foreach(p ${wx_confs})
|
|
|
|
if(p MATCHES "${wx_conf_ver}$")
|
|
|
|
set(wx_conf ${p})
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE ${wx_conf} CACHE FILEPATH "path to wx-config script for the desired wxWidgets configuration" FORCE)
|
|
|
|
|
|
|
|
if(CMAKE_TOOLCHAIN_FILE MATCHES -static)
|
2020-02-02 02:14:03 +00:00
|
|
|
# find the right static zlib
|
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
|
|
|
foreach(p ${CMAKE_FIND_ROOT_PATH})
|
|
|
|
if(EXISTS ${p}/lib/libz.a)
|
|
|
|
set(ZLIB_ROOT ${p} CACHE FILEPATH "where to find zlib" FORCE)
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
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)
|