Remove support for MXE

fix-squashed-planets
MrSimbax 2021-09-04 21:08:04 +02:00
parent d06b7e1456
commit d39f1999e7
9 changed files with 20 additions and 189 deletions

View File

@ -11,10 +11,6 @@ jobs:
target_os: [linux] target_os: [linux]
host_os: [ubuntu-18.04, ubuntu-20.04] host_os: [ubuntu-18.04, ubuntu-20.04]
container: [''] container: ['']
include:
- target_os: windows
host_os: ubuntu-latest
container: krzysh/colobot-build:latest
fail-fast: false fail-fast: false
steps: steps:
- name: Install Colobot dependencies - name: Install Colobot dependencies
@ -25,11 +21,6 @@ jobs:
run: git submodule update --init -- lib/googletest run: git submodule update --init -- lib/googletest
- name: Create build directory - name: Create build directory
run: cmake -E make_directory build run: cmake -E make_directory build
- name: Run CMake (for Windows using MXE)
working-directory: build
# FIXME: without -lsetupapi linking sdl2 fails
run: /opt/mxe/usr/bin/i686-w64-mingw32.static-cmake -DCMAKE_CXX_STANDARD_LIBRARIES="-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lsetupapi -limm32 -lwinmm -lversion" -DCMAKE_INSTALL_PREFIX=/install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=0 -DMXE_USE_CCACHE=0 ..
if: matrix.target_os == 'windows'
- name: Run CMake (for Linux) - name: Run CMake (for Linux)
working-directory: build working-directory: build
run: cmake -DCMAKE_INSTALL_PREFIX=/install -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=1 .. run: cmake -DCMAKE_INSTALL_PREFIX=/install -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=1 ..
@ -49,7 +40,7 @@ jobs:
with: with:
name: ${{matrix.target_os}}-debug name: ${{matrix.target_os}}-debug
path: build/install path: build/install
if: matrix.target_os == 'windows' || matrix.host_os == 'ubuntu-18.04' if: matrix.host_os == 'ubuntu-18.04'
- name: Create AppImage - name: Create AppImage
working-directory: build working-directory: build
run: | run: |

View File

@ -292,12 +292,6 @@ if(DEV_BUILD)
message(STATUS "Building with development extensions") message(STATUS "Building with development extensions")
endif() endif()
##
# Additional settings to use when cross-compiling with MXE (http://mxe.cc/)
##
include("${colobot_SOURCE_DIR}/cmake/mxe.cmake")
## ##
# Additional settings for MSYS # Additional settings for MSYS
## ##
@ -395,7 +389,7 @@ endif()
## ##
# Installation paths defined before compiling sources # Installation paths defined before compiling sources
if(PORTABLE OR (PLATFORM_WINDOWS AND MXE)) if(PORTABLE)
set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot binary directory") set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot binary directory")
set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot libraries directory") set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/ CACHE PATH "Colobot libraries directory")
set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/data CACHE PATH "Colobot shared data directory") set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/data CACHE PATH "Colobot shared data directory")

View File

@ -1,91 +0,0 @@
# Cross-compiling with MXE
MXE works for any BSD-compatible system (including Linux).
It is a complete package with cross-compiler to Win32 (a MinGW variant)
and includes scripts to automatically download and build many 3rd party
libraries and tools.
To cross-compile Colobot using MXE:
1. See the MXE website (http://mxe.cc) for list of required packages and make sure
you have them installed.
2. Download MXE and unpack it in the directory, where you want to keep it
permanently. During the build, MXE will write that path to many files,
so moving that directory can be tricky.
3. `cd` to the MXE root directory.
It already contains a universal Makefile for everything.
Usage is simply `make name_of_package`.
It will automatically check for dependencies, etc.
The packages will be installed in the MXE directory under `usr/i686-w64-mingw32.static`.
You need to `make gcc` first for basic compiler and then do the same
for some additional libraries. In the end, you should have the following
packages installed (this is the final listing of `usr/i686-w64-mingw32.static/installed/`):
* binutils
* boost
* bzip2
* cairo
* dbus
* expat
* flac
* fontconfig
* freetype
* freetype-bootstrap
* gcc
* gcc-gmp
* gcc-isl
* gcc-mpc
* gcc-mpfr
* gettext
* glew
* glib
* harfbuzz
* icu4c
* jpeg
* libffi
* libiconv
* libpng
* libsndfile
* libwebp
* lzo
* mingw-w64
* mxe-conf
* ogg
* openal
* pcre
* physfs
* pixman
* pkgconf
* portaudio
* sdl2
* sdl2_image
* sdl2_ttf
* tiff
* vorbis
* xz
* zlib
4. Now `cd` to directory with colobot sources.
It is recommended that you create a separate directory for out-of-source build:
`mkdir build-mxe && cd build-mxe`
In order to cross-compile a CMake project, you have to specify a CMake toolchain file.
MXE has such file in MXE's directory: `usr/i686-w64-mingw32.static/share/cmake/mxe-conf.cmake`
So you should use the following cmake command: `cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/mxe-conf.cmake ..`
CMake files in Colobot should detect that MXE is being used and they will
modify flags, paths, etc. as required. You should not run into any problems.
5. `make` should now compile the game with the resulting executable as `colobot.exe`.
The exe is linked against all libraries *statically*, so there are no dependencies
on external DLLs. However, the resulting binary will be huge with all these libraries,
so you might want to do: `strip colobot.exe`.
6. If you want to create a Colobot installer, you need to additionally build `nsis`
in MXE. Then you can create the NSIS installer that way:
`PATH=/path/to/mxe/binaries:$PATH make package`
where `/path/to/mxe/binaries` is path to cross-compiled MXE binaries available
in MXE's directory under `usr/i686-w64-mingw32.static/bin`.
This will create a versioned colobot-$version.exe installer that will install Colobot
in system directories, add a shortcut in the start menu and setup an uninstaller.

View File

@ -27,24 +27,15 @@ any of the missions.
### Compiling on Windows ### Compiling on Windows
The recommended way of compiling for Windows is using Linux in a cross-compilation environment called MXE. You can also compile directly on Windows with MSYS2/MinGW-w64 or Visual Studio since version 2015.
This is the way our build bot service (http://compiled.colobot.info/) prepares the release packages.
You can also compile directly on Windows with MSYS2/MinGW-w64 or MSVC 2013 but this is a bit more difficult to set up.
#### Cross-compiling using MXE
MXE (M cross environment, http://mxe.cc/) is a very good cross-compiling framework, complete with a suite of libraries
that make it extremely easy to port applications to Win32. It runs on pretty much any *nix flavor and generates generic,
statically linked Win32 binaries. More information is available in
[INSTALL-MXE.md](INSTALL-MXE.md) file.
#### Compiling with MSYS2/MinGW-w64 #### Compiling with MSYS2/MinGW-w64
See the [INSTALL-MSYS2.md](INSTALL-MSYS2.md) file for details. See the [INSTALL-MSYS2.md](INSTALL-MSYS2.md) file for details.
#### Compiling with MSVC #### Compiling with MSVC (Visual Studio)
As of 0.1.5-alpha it's possible to compile binary with MSVC 2013. See [this post](http://colobot.info/forum/showthread.php?tid=595&pid=5831#pid5831) for details. See [this wiki page](https://github.com/colobot/colobot/wiki/How-to-Build-Colobot:-Gold-Edition-Using-MSVC) for details.
### Compiling on Linux ### Compiling on Linux
@ -53,19 +44,19 @@ Since there are so many Linux flavors, it is difficult to write generic instruct
you will need to compile colobot. you will need to compile colobot.
You will need: You will need:
* recent compiler (GCC >= 4.7, or Clang >= 3.1) since we are using some features of C++11 * C++17 compiler
* CMake >= 2.8 * CMake >= 3.16
* Boost >= 1.51 (header files + components: filesystem and regex) * Boost
* SDL2 * SDL2
* SDL2_image * SDL2_image
* SDL2_ttf * SDL2_ttf
* GLEW >= 1.8.0 * GLEW
* libpng >= 1.2 * libpng
* gettext >= 0.18 * gettext
* libsndfile >= 1.0.25 * libsndfile
* libvorbis >= 1.3.2 * libvorbis
* libogg >= 1.3.0 * libogg
* OpenAL (OpenAL-Soft) >= 1.13 * OpenAL (OpenAL-Soft)
* PhysFS * PhysFS
* oggenc (to generate music files) * oggenc (to generate music files)

View File

@ -99,7 +99,7 @@ function(__glew_set_find_library_suffix shared_or_static)
elseif(WIN32 AND "${shared_or_static}" MATCHES "SHARED") elseif(WIN32 AND "${shared_or_static}" MATCHES "SHARED")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" PARENT_SCOPE) set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" PARENT_SCOPE)
elseif(WIN32 AND "${shared_or_static}" MATCHES "STATIC") elseif(WIN32 AND "${shared_or_static}" MATCHES "STATIC")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll.a;.a" PARENT_SCOPE) # MXE has .a suffixes set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll.a" PARENT_SCOPE)
endif() endif()
if(GLEW_VERBOSE) if(GLEW_VERBOSE)

View File

@ -1,5 +1,5 @@
# Hacks for MSYS # Hacks for MSYS
if (MSYS AND (NOT MXE)) if (MSYS)
message(STATUS "Detected MSYS build") message(STATUS "Detected MSYS build")
set(PLATFORM_WINDOWS 1) set(PLATFORM_WINDOWS 1)

View File

@ -1,52 +0,0 @@
# When cross-compiling with MXE, we need to straighten some things
# Checking is a bit primitive, but this should detect MXE toolchain file
if((${CMAKE_CROSSCOMPILING}) AND (DEFINED MSYS))
message(STATUS "Detected MXE build")
set(MXE 1)
set(PLATFORM_WINDOWS 1)
set(PLATFORM_LINUX 0)
set(PLATFORM_OTHER 0)
# All must be static, CBOT and GLEW too
set(CBOT_STATIC ON)
set(BOOST_STATIC ON)
set(GLEW_STATIC ON)
set(SNDFILE_STATIC ON)
if (${OPENAL_SOUND})
set(OPENAL_MXE_LIBS
${CMAKE_FIND_ROOT_PATH}/lib/libFLAC.a
${CMAKE_FIND_ROOT_PATH}/lib/libvorbis.a
${CMAKE_FIND_ROOT_PATH}/lib/libvorbisenc.a
${CMAKE_FIND_ROOT_PATH}/lib/libvorbisfile.a
${CMAKE_FIND_ROOT_PATH}/lib/libogg.a
)
endif()
set(MXE_CFLAGS "-DAL_LIBTYPE_STATIC")
set(MXE_LIBS
# For some reason, these have to be absolute paths
${CMAKE_FIND_ROOT_PATH}/lib/libintl.a
${CMAKE_FIND_ROOT_PATH}/lib/libiconv.a
${CMAKE_FIND_ROOT_PATH}/lib/libglew32s.a
${CMAKE_FIND_ROOT_PATH}/lib/libfreetype.a
${CMAKE_FIND_ROOT_PATH}/lib/libopengl32.a
${CMAKE_FIND_ROOT_PATH}/lib/libjpeg.a
${CMAKE_FIND_ROOT_PATH}/lib/libwinmm.a
${CMAKE_FIND_ROOT_PATH}/lib/libdxguid.a
${CMAKE_FIND_ROOT_PATH}/lib/libbz2.a
${CMAKE_FIND_ROOT_PATH}/lib/libimm32.a
${CMAKE_FIND_ROOT_PATH}/lib/libole32.a
${CMAKE_FIND_ROOT_PATH}/lib/liboleaut32.a
${CMAKE_FIND_ROOT_PATH}/lib/libharfbuzz.a
${CMAKE_FIND_ROOT_PATH}/lib/libwebp.a
${CMAKE_FIND_ROOT_PATH}/lib/libversion.a
${CMAKE_FIND_ROOT_PATH}/lib/libglib-2.0.a
${CMAKE_FIND_ROOT_PATH}/lib/libwsock32.a
${CMAKE_FIND_ROOT_PATH}/lib/libws2_32.a
${CMAKE_FIND_ROOT_PATH}/lib/libintl.a
${OPENAL_MXE_LIBS}
)
else()
set(MXE 0)
endif()

View File

@ -1,5 +1,5 @@
# Compile flags as defined in global CMakeLists # Compile flags as defined in global CMakeLists
set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS} ${MXE_CFLAGS}") set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE}) set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG}) set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})
@ -516,9 +516,7 @@ if(WINGETOPT)
endif() endif()
# Additional libraries per platform # Additional libraries per platform
if(MXE) # MXE requires special treatment if(PLATFORM_WINDOWS)
target_link_libraries(colobotbase PUBLIC ${MXE_LIBS})
elseif(PLATFORM_WINDOWS)
# because it isn't included in standard linking libraries # because it isn't included in standard linking libraries
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# TODO: this shouldn't be needed, the libraries targets should care of those transitive dependencies # TODO: this shouldn't be needed, the libraries targets should care of those transitive dependencies

View File

@ -1,5 +1,5 @@
# Compile flags as defined in global CMakeLists # Compile flags as defined in global CMakeLists
set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS} ${MXE_CFLAGS} ${COLOBOT_GTEST_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS} ${COLOBOT_GTEST_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE}) set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG}) set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})