From d39f1999e7c1bb205432a23b95d29a1dec9641b2 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Sat, 4 Sep 2021 21:08:04 +0200 Subject: [PATCH] Remove support for MXE --- .github/workflows/build.yml | 11 +---- CMakeLists.txt | 8 +--- INSTALL-MXE.md | 91 ------------------------------------- INSTALL.md | 35 ++++++-------- cmake/FindGLEW.cmake | 2 +- cmake/msys.cmake | 2 +- cmake/mxe.cmake | 52 --------------------- src/CMakeLists.txt | 6 +-- test/CMakeLists.txt | 2 +- 9 files changed, 20 insertions(+), 189 deletions(-) delete mode 100644 INSTALL-MXE.md delete mode 100644 cmake/mxe.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 31a24f75..f730ff7d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,10 +11,6 @@ jobs: target_os: [linux] host_os: [ubuntu-18.04, ubuntu-20.04] container: [''] - include: - - target_os: windows - host_os: ubuntu-latest - container: krzysh/colobot-build:latest fail-fast: false steps: - name: Install Colobot dependencies @@ -25,11 +21,6 @@ jobs: run: git submodule update --init -- lib/googletest - name: Create build directory 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) 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 .. @@ -49,7 +40,7 @@ jobs: with: name: ${{matrix.target_os}}-debug path: build/install - if: matrix.target_os == 'windows' || matrix.host_os == 'ubuntu-18.04' + if: matrix.host_os == 'ubuntu-18.04' - name: Create AppImage working-directory: build run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 16ed2061..7830c157 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,12 +292,6 @@ if(DEV_BUILD) message(STATUS "Building with development extensions") endif() -## -# Additional settings to use when cross-compiling with MXE (http://mxe.cc/) -## - -include("${colobot_SOURCE_DIR}/cmake/mxe.cmake") - ## # Additional settings for MSYS ## @@ -395,7 +389,7 @@ endif() ## # 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_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") diff --git a/INSTALL-MXE.md b/INSTALL-MXE.md deleted file mode 100644 index addbbaab..00000000 --- a/INSTALL-MXE.md +++ /dev/null @@ -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. diff --git a/INSTALL.md b/INSTALL.md index fc69342c..0f442ba2 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -27,24 +27,15 @@ any of the missions. ### Compiling on Windows -The recommended way of compiling for Windows is using Linux in a cross-compilation environment called MXE. -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. +You can also compile directly on Windows with MSYS2/MinGW-w64 or Visual Studio since version 2015. #### Compiling with MSYS2/MinGW-w64 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 @@ -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: - * recent compiler (GCC >= 4.7, or Clang >= 3.1) since we are using some features of C++11 - * CMake >= 2.8 - * Boost >= 1.51 (header files + components: filesystem and regex) + * C++17 compiler + * CMake >= 3.16 + * Boost * SDL2 * SDL2_image * SDL2_ttf - * GLEW >= 1.8.0 - * libpng >= 1.2 - * gettext >= 0.18 - * libsndfile >= 1.0.25 - * libvorbis >= 1.3.2 - * libogg >= 1.3.0 - * OpenAL (OpenAL-Soft) >= 1.13 + * GLEW + * libpng + * gettext + * libsndfile + * libvorbis + * libogg + * OpenAL (OpenAL-Soft) * PhysFS * oggenc (to generate music files) diff --git a/cmake/FindGLEW.cmake b/cmake/FindGLEW.cmake index fbcaa323..2886d6d6 100644 --- a/cmake/FindGLEW.cmake +++ b/cmake/FindGLEW.cmake @@ -99,7 +99,7 @@ function(__glew_set_find_library_suffix shared_or_static) elseif(WIN32 AND "${shared_or_static}" MATCHES "SHARED") set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" PARENT_SCOPE) 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() if(GLEW_VERBOSE) diff --git a/cmake/msys.cmake b/cmake/msys.cmake index 8a622335..bd8ae1a0 100644 --- a/cmake/msys.cmake +++ b/cmake/msys.cmake @@ -1,5 +1,5 @@ # Hacks for MSYS -if (MSYS AND (NOT MXE)) +if (MSYS) message(STATUS "Detected MSYS build") set(PLATFORM_WINDOWS 1) diff --git a/cmake/mxe.cmake b/cmake/mxe.cmake deleted file mode 100644 index aa904cf0..00000000 --- a/cmake/mxe.cmake +++ /dev/null @@ -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() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 375207a6..353d09ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ # 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_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG}) @@ -516,9 +516,7 @@ if(WINGETOPT) endif() # Additional libraries per platform -if(MXE) # MXE requires special treatment - target_link_libraries(colobotbase PUBLIC ${MXE_LIBS}) -elseif(PLATFORM_WINDOWS) +if(PLATFORM_WINDOWS) # because it isn't included in standard linking libraries if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") # TODO: this shouldn't be needed, the libraries targets should care of those transitive dependencies diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 508056b4..6d9ec86b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ # 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_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})