From 1e0db4938f6536ff04c421137af99f7ccec79878 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Sun, 18 Aug 2019 16:54:43 +0300 Subject: [PATCH 01/22] Add experimental conan support Try to use conan package manager to handle build dependencies. Additional updates to CMake --- CMakeLists.txt | 37 +++++++++++++++---------------------- conanfile.txt | 22 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 conanfile.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 625694de0..4de6d2801 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,8 @@ project(shockolate VERSION 0.7.8) include(FeatureSummary) -#set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF) -#set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON) -set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS OFF) -set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON) +# Added for conan generator +set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH}) # Required for stdbool.h set(CMAKE_C_STANDARD 99) @@ -15,9 +13,6 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g ") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -D__STDC_LIMIT_MACROS") - option(ENABLE_EXAMPLES "Enable example applications" OFF) add_feature_info(ENABLE_EXAMPLES ENABLE_EXAMPLES "Enable example application (can be broken!)") option(ENABLE_DEBUG_BLIT "Enable debugging blitter" OFF) @@ -38,7 +33,7 @@ set_property(CACHE ENABLE_FLUIDSYNTH PROPERTY STRINGS "ON" "BUNDLED" "OFF") add_feature_info(ENABLE_FLUIDSYNTH ENABLE_FLUIDSYNTH "Enable FluidSynth MIDI support") # HAAAAX!! -add_definitions(-DSVGA_SUPPORT) +add_definitions(-DSVGA_SUPPORT -D__STDC_LIMIT_MACROS) if(ENABLE_DEBUG_BLIT) add_definitions(-DDEBUGGING_BLIT) @@ -51,8 +46,9 @@ if(ENABLE_OPENGL) find_package(OpenGL REQUIRED) add_definitions(-DUSE_OPENGL) if(WIN32) - list(APPEND OPENGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/built_glew/include) - list(APPEND OPENGL_LIBRARIES ${CMAKE_SOURCE_DIR}/build_ext/built_glew/lib/libglew32.dll.a winmm) + find_package(glew REQUIRED) + list(APPEND OPENGL_INCLUDE_DIRS ${glew_INCLUDE_DIRS}) + list(APPEND OPENGL_LIBRARIES glew:glew winmm) endif(WIN32) endif(ENABLE_OPENGL) @@ -63,11 +59,9 @@ if(ENABLE_SDL2 MATCHES "ON") endif(SDL2_FOUND) endif(ENABLE_SDL2 MATCHES "ON") if(ENABLE_SDL2 MATCHES "BUNDLED") - set(SDL2_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl) - find_library(SDL2_LIBRARY SDL2 PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH) - find_library(SDL2MAIN_LIBRARY SDL2main PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH) - set(SDL2_INCLUDE_DIRS ${SDL2_DIR}/include/SDL2) - set(SDL2_LIBRARIES "${SDL2MAIN_LIBRARY};${SDL2_LIBRARY}") + find_package(sdl2 REQUIRED) + set(SDL2_INCLUDE_DIRS ${sdl2_INCLUDE_DIRS}) + set(SDL2_LIBRARIES sdl2::sdl2) endif(ENABLE_SDL2 MATCHES "BUNDLED") if(ENABLE_SOUND MATCHES "ON") @@ -77,10 +71,9 @@ if(ENABLE_SOUND MATCHES "ON") add_definitions(-DUSE_SDL_MIXER=1) endif(ENABLE_SOUND MATCHES "ON") if(ENABLE_SOUND MATCHES "BUNDLED") - set(SDL2_MIXER_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl_mixer) - set(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_DIR}/include/SDL2) - find_library(SDL2_MIXER_LIBRARY SDL2_mixer PATHS ${SDL2_MIXER_DIR}/lib) - set(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY}) + find_package(sdl2_mixer REQUIRED) + set(SDL2_MIXER_INCLUDE_DIRS ${sdl2_mixer_INCLUDE_DIRS}) + set(SDL2_MIXER_LIBRARIES sdl2_mixer::sdl2_mixer) add_definitions(-DUSE_SDL_MIXER=1) endif(ENABLE_SOUND MATCHES "BUNDLED") @@ -90,9 +83,9 @@ if(ENABLE_FLUIDSYNTH MATCHES "ON") add_definitions("-DUSE_FLUIDSYNTH=1") endif(ENABLE_FLUIDSYNTH MATCHES "ON") if(ENABLE_FLUIDSYNTH MATCHES "BUNDLED") - find_library(FLUIDSYNTH_LIBRARY fluidsynth PATHS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/src) - set(FLUIDSYNTH_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/include) - set(FLUIDSYNTH_LIBRARIES ${FLUIDSYNTH_LIBRARY}) + find_package(fluidsynth REQUIRED) + set(FLUIDSYNTH_INCLUDE_DIRS ${fluidsynth_INCLUDE_DIRS}) + set(FLUIDSYNTH_LIBRARIES fluidsynth::fluidsynth) add_definitions("-DUSE_FLUIDSYNTH=1") endif(ENABLE_FLUIDSYNTH MATCHES "BUNDLED") diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 000000000..894d04fd7 --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,22 @@ +[build_requires] +fluidsynth/2.0.5@bincrafters/stable +glew/2.1.0@bincrafters/stable +sdl2/2.0.9@bincrafters/stable +sdl2_mixer/2.0.4@bincrafters/stable + +[options] +# Disable unused dependencies + +sdl2:jack=False +sdl2:nas=False + +sdl2_mixer:mad=False +sdl2_mixer:modplug=False +sdl2_mixer:mpg123=False +sdl2_mixer:ogg=False +sdl2_mixer:opus=False +sdl2_mixer:tinymidi=False + +[generators] +cmake_find_package + From 9053388e69d1f8814d7f78e688238bcd989c09b0 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 02:06:06 +0300 Subject: [PATCH 02/22] Updates to travis Switch to conan package manager, it will handle all dependencies. --- .travis.yml | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index b37059433..9aeaaf911 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,20 @@ -language: c +language: python +python: "3.7" notifications: email: false +addons: + apt: + packages: + - cmake-data cmake libglu1-mesa-dev libgl1-mesa-dev + +install: + - pip install --upgrade pip + - pip install conan + - conan user + - conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan + matrix: include: - os: linux @@ -13,46 +25,26 @@ matrix: - SDL2_MIXER_LIB=BUNDLED - FLUIDSYNTH_LIB=BUNDLED - BITS=64 - addons: - apt: - packages: - - cmake-data cmake libglu1-mesa-dev libgl1-mesa-dev # libfluidsynth-dev libsdl2-dev libsdl2-mixer-dev - compiler: gcc - - os: linux - dist: trusty - sudo: required - env: - - SDL2_LIB=BUNDLED - - SDL2_MIXER_LIB=BUNDLED - - FLUIDSYNTH_LIB=BUNDLED - - CMAKE_LIBRARY_PATH=/usr/lib/i386-linux-gnu - - BITS=32 - before_script: - - cp ./CMakeLists.32bit.txt ./CMakeLists.txt - addons: - apt: - packages: - - cmake-data cmake libx32gcc-4.8-dev libc6-dev-i386 gcc-multilib g++-multilib libglu1-mesa-dev:i386 libgl1-mesa-dev:i386 compiler: gcc - os: osx compiler: clang env: - SDL2_LIB=BUNDLED - SDL2_MIXER_LIB=BUNDLED - - FLUIDSYNTH_LIB=OFF # Bundled lib failed to compile + - FLUIDSYNTH_LIB=BUNDLED - BITS=64 - os: osx compiler: gcc env: - SDL2_LIB=BUNDLED - SDL2_MIXER_LIB=BUNDLED - - FLUIDSYNTH_LIB=OFF # Bundled lib failed to compile + - FLUIDSYNTH_LIB=BUNDLED - BITS=64 script: - - chmod a+rx ./osx-linux/*.sh - - sudo TRAVIS=$TRAVIS ./osx-linux/install_${BITS}bit_sdl.sh - - cmake -DENABLE_SDL2=${SDL2_LIB} -DENABLE_SOUND=${SDL2_MIXER_LIB} -DENABLE_FLUIDSYNTH=${FLUIDSYNTH_LIB} . + - mkdir build && cd build + - conan install .. --build=missing + - cmake .. -DCMAKE_LIBRARY_PATH=/usr/lib/i386-linux-gnu -DENABLE_SDL2=${SDL2_LIB} -DENABLE_SOUND=${SDL2_MIXER_LIB} -DENABLE_FLUIDSYNTH=${FLUIDSYNTH_LIB} - make -j2 systemshock before_deploy: From abe362edefa4cc5600100a09398011c9116df546 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 02:32:15 +0300 Subject: [PATCH 03/22] Unify settings for osx and linux --- .travis.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9aeaaf911..52e0af731 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ language: python python: "3.7" +compiler: + - clang + - gcc + notifications: email: false @@ -10,8 +14,6 @@ addons: - cmake-data cmake libglu1-mesa-dev libgl1-mesa-dev install: - - pip install --upgrade pip - - pip install conan - conan user - conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan @@ -19,22 +21,20 @@ matrix: include: - os: linux dist: bionic + before_install: + - pip install --upgrade pip + - pip install conan sudo: required env: - SDL2_LIB=BUNDLED - SDL2_MIXER_LIB=BUNDLED - FLUIDSYNTH_LIB=BUNDLED - BITS=64 - compiler: gcc - - os: osx - compiler: clang - env: - - SDL2_LIB=BUNDLED - - SDL2_MIXER_LIB=BUNDLED - - FLUIDSYNTH_LIB=BUNDLED - - BITS=64 - os: osx - compiler: gcc + language: shell + before_install: + - pip3 install --upgrade pip + - pip3 install conan env: - SDL2_LIB=BUNDLED - SDL2_MIXER_LIB=BUNDLED From 274a84ed485cde55f77c8c2233888ebb6a4182c2 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 03:03:56 +0300 Subject: [PATCH 04/22] Swith to conanfile.py --- conanfile.py | 24 ++++++++++++++++++++++++ conanfile.txt | 22 ---------------------- 2 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 000000000..f56a7d8b1 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,24 @@ +from conans import ConanFile, CMake + +class SystemShockConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + # Comma-separated list of requirements + build_requires = \ + "fluidsynth/2.0.5@bincrafters/stable", \ + "glew/2.1.0@bincrafters/stable", \ + "sdl2/2.0.9@bincrafters/stable", \ + "sdl2_mixer/2.0.4@bincrafters/stable" + generators = "cmake_find_package" + + def configure(self): + if self.settings.os == "Linux": + # Disable unused dependencies + self.options["sdl2"].jack = False + self.options["sdl2"].nas = False + self.options["sdl2_mixer"].mad = False + self.options["sdl2_mixer"].modplug = False + self.options["sdl2_mixer"].mpg123 = False + self.options["sdl2_mixer"].ogg = False + self.options["sdl2_mixer"].opus = False + self.options["sdl2_mixer"].tinymidi = False + diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 894d04fd7..000000000 --- a/conanfile.txt +++ /dev/null @@ -1,22 +0,0 @@ -[build_requires] -fluidsynth/2.0.5@bincrafters/stable -glew/2.1.0@bincrafters/stable -sdl2/2.0.9@bincrafters/stable -sdl2_mixer/2.0.4@bincrafters/stable - -[options] -# Disable unused dependencies - -sdl2:jack=False -sdl2:nas=False - -sdl2_mixer:mad=False -sdl2_mixer:modplug=False -sdl2_mixer:mpg123=False -sdl2_mixer:ogg=False -sdl2_mixer:opus=False -sdl2_mixer:tinymidi=False - -[generators] -cmake_find_package - From f28eae62d56fc4bcb5d833a3d3c69600a4fad583 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 04:37:04 +0300 Subject: [PATCH 05/22] Redefine building matrix --- .travis.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 52e0af731..0e4f7c13c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,23 +8,29 @@ compiler: notifications: email: false +dist: bionic addons: apt: packages: - cmake-data cmake libglu1-mesa-dev libgl1-mesa-dev install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; pip3 install --upgrade pip ; pip3 install conan ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; pip install --upgrade pip ; pip install conan ; fi - conan user - conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan matrix: include: - os: linux - dist: bionic - before_install: - - pip install --upgrade pip - - pip install conan - sudo: required + compiler: clang + env: + - SDL2_LIB=BUNDLED + - SDL2_MIXER_LIB=BUNDLED + - FLUIDSYNTH_LIB=BUNDLED + - BITS=64 + - os: linux + compiler: gcc env: - SDL2_LIB=BUNDLED - SDL2_MIXER_LIB=BUNDLED @@ -32,9 +38,6 @@ matrix: - BITS=64 - os: osx language: shell - before_install: - - pip3 install --upgrade pip - - pip3 install conan env: - SDL2_LIB=BUNDLED - SDL2_MIXER_LIB=BUNDLED From d6e8f73fcd6c6fe780e371fa0634572e58ada580 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 04:41:45 +0300 Subject: [PATCH 06/22] Redefine building matrix --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e4f7c13c..025012ce1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,7 @@ addons: - cmake-data cmake libglu1-mesa-dev libgl1-mesa-dev install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; pip3 install --upgrade pip ; pip3 install conan ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; pip install --upgrade pip ; pip install conan ; fi + - pip3 install --upgrade pip ; pip3 install conan - conan user - conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan @@ -47,7 +46,7 @@ matrix: script: - mkdir build && cd build - conan install .. --build=missing - - cmake .. -DCMAKE_LIBRARY_PATH=/usr/lib/i386-linux-gnu -DENABLE_SDL2=${SDL2_LIB} -DENABLE_SOUND=${SDL2_MIXER_LIB} -DENABLE_FLUIDSYNTH=${FLUIDSYNTH_LIB} + - cmake .. -DENABLE_SDL2=${SDL2_LIB} -DENABLE_SOUND=${SDL2_MIXER_LIB} -DENABLE_FLUIDSYNTH=${FLUIDSYNTH_LIB} - make -j2 systemshock before_deploy: From 577eb9ba561e36416590e7467d9f0e5dc3ac9c01 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 22:50:00 +0300 Subject: [PATCH 07/22] Update to appveyor with conan This should be greatly simplify overall build process. --- appveyor.yml | 59 ++++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 46 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f8a4eae44..24fd22aaf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,62 +13,29 @@ environment: platform: - x64 - x86 - -# Avoid rebuilding external dependencies (ie. SDL and SDL_mixer) -# Uncache build_ext if external deps change + +# Avoid rebuilding external dependencies cache: - res/music.sf2 - - build_ext - -# Set up environment variable values for 32 and 64 bit builds -for: - - - matrix: - only: - - platform: x86 - before_build: - - set BUILD_SCRIPT=build_win32.sh - - set ARTIFACT=systemshock-x86.zip - - set MINGW_PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\ - - copy CMakeLists.32bit.txt CMakeLists.txt - - - matrix: - only: - - platform: x64 - before_build: - - set BUILD_SCRIPT=build_win64.sh - - set ARTIFACT=systemshock-x64.zip - - set MINGW_PATH=C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\ - -# Actual build script.. -# Step 1: Git has to reside in a path without spaces because the SDL build script is weird like that. -# So we create a symlink to the real Git, remove it from PATH and add our own. -# Step 2: We need to use our own make.exe to build stuff, so we add that -# Step 3: Do the actual building +install: + - cmd: set PATH=%PATH%;%PYTHON%/Scripts/ + - cmd: pip.exe install conan + - cmd: conan user + - cmd: conan --version build_script: - - mklink /D c:\git "C:\Program Files\Git" - - set PATH=%PATH:C:\Program Files (x86)\Git\bin;=% - - set PATH=c:\git\usr\bin;%PATH%;%MINGW_PATH% - - copy windows\make.exe \git\usr\bin - - set CMAKE_MAKE_PROGRAM=c:\git\usr\bin\make.exe - - sh %BUILD_SCRIPT% - - build.bat + - cmd: mkdir build + - cmd: cd build + - cmd: conan install .. --build=missing + - cmd: cmake .. -DENABLE_SDL2=BUNDLE -DENABLE_SOUND=BUNDLE -DENABLE_FLUIDSYNTH=BUNDLE -G "Ninja" + - cmd: ninja -j2 - # For now, we don't have any automatic tests to run -test: off +test: false # Once building is done, we gather all the necessary DLL files and build our ZIP file. after_build: - - copy %MINGW_PATH%\libgcc*.dll . - - copy %MINGW_PATH%\libstd*.dll . - - copy %MINGW_PATH%\libwinpthread-1.dll . - - copy build_ext\built_sdl\bin\SDL*.dll . - - copy build_ext\built_sdl_mixer\bin\SDL*.dll . - - copy build_ext\built_glew\lib\glew32.dll . - - copy build_ext\fluidsynth-lite\src\libfluidsynth.dll . - 7z a %ARTIFACT% systemshock.exe *.dll shaders/ res/ artifacts: From 0ca7d8b56fd139a986fadf185d276608a0ae6b71 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 22:58:27 +0300 Subject: [PATCH 08/22] appveyor fixup --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 24fd22aaf..6994f79d0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,6 +9,7 @@ image: Visual Studio 2015 # Tell build_windows.sh that we're building for AppVeyor environment: APPVEYOR: TRUE + PYTHON_HOME: "C:\\Python37" platform: - x64 @@ -19,7 +20,7 @@ cache: - res/music.sf2 install: - - cmd: set PATH=%PATH%;%PYTHON%/Scripts/ + - cmd: set PATH=%PYTHON_HOME%;%PYTHON_HOME%/Scripts/;%PATH% - cmd: pip.exe install conan - cmd: conan user - cmd: conan --version From 93d7456e35050a9a596b9df808c8e6e51d85a41b Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 23:01:28 +0300 Subject: [PATCH 09/22] appveyor fixup --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 6994f79d0..c93f45100 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,6 +23,7 @@ install: - cmd: set PATH=%PYTHON_HOME%;%PYTHON_HOME%/Scripts/;%PATH% - cmd: pip.exe install conan - cmd: conan user + - cmd: conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan - cmd: conan --version build_script: From 22643770a4523fca0a0ab041e5e1ad7e28e98acb Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 23:04:58 +0300 Subject: [PATCH 10/22] appveyor fixup --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c93f45100..369f6978c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,7 +30,7 @@ build_script: - cmd: mkdir build - cmd: cd build - cmd: conan install .. --build=missing - - cmd: cmake .. -DENABLE_SDL2=BUNDLE -DENABLE_SOUND=BUNDLE -DENABLE_FLUIDSYNTH=BUNDLE -G "Ninja" + - cmd: cmake .. -DENABLE_SDL2=BUNDLED -DENABLE_SOUND=BUNDLED -DENABLE_FLUIDSYNTH=BUNDLED -G "Ninja" - cmd: ninja -j2 # For now, we don't have any automatic tests to run From 4f8b67bfd926baa77266cea5d818b2b5d7e01d84 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 23:33:55 +0300 Subject: [PATCH 11/22] appveyor fixup --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 369f6978c..db1efa7b2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,8 +30,8 @@ build_script: - cmd: mkdir build - cmd: cd build - cmd: conan install .. --build=missing - - cmd: cmake .. -DENABLE_SDL2=BUNDLED -DENABLE_SOUND=BUNDLED -DENABLE_FLUIDSYNTH=BUNDLED -G "Ninja" - - cmd: ninja -j2 + - cmd: cmake .. -DENABLE_SDL2=BUNDLED -DENABLE_SOUND=BUNDLED -DENABLE_FLUIDSYNTH=BUNDLED -G "MinGW Makefiles" + - cmd: cmake --build . # For now, we don't have any automatic tests to run test: false From 901d87996bbd99fd370636f94ebd5b9324838f7f Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 23:38:46 +0300 Subject: [PATCH 12/22] appveyor fixup --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index db1efa7b2..ada96613a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,6 +20,8 @@ cache: - res/music.sf2 install: + # Workaround for CMake not wanting sh.exe on PATH for MinGW + - set PATH=%PATH:C:\Program Files\Git\bin;=% - cmd: set PATH=%PYTHON_HOME%;%PYTHON_HOME%/Scripts/;%PATH% - cmd: pip.exe install conan - cmd: conan user From 5c597bee3b7f60593804def6cd43bab633212d83 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 21 Jan 2020 23:49:53 +0300 Subject: [PATCH 13/22] appveyor fixup --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index ada96613a..407fa9eae 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,7 +21,8 @@ cache: install: # Workaround for CMake not wanting sh.exe on PATH for MinGW - - set PATH=%PATH:C:\Program Files\Git\bin;=% + - cmd: set PATH=%PATH:C:\Program Files\Git\bin;=% + - cmd: set PATH=%PATH:C:\Program Files\Git\usr\bin;=% - cmd: set PATH=%PYTHON_HOME%;%PYTHON_HOME%/Scripts/;%PATH% - cmd: pip.exe install conan - cmd: conan user From 799a0894624428447f2001f2b38c02d265c5e5da Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Wed, 22 Jan 2020 00:56:07 +0300 Subject: [PATCH 14/22] appveyor fixup --- appveyor.yml | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 407fa9eae..6137b898d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,10 +10,17 @@ image: Visual Studio 2015 environment: APPVEYOR: TRUE PYTHON_HOME: "C:\\Python37" - -platform: - - x64 - - x86 + matrix: + - COMPILER: mingw + ARCH: x86_64 + MINGW_DIR_BIN: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin + CMAKE_C_COMPILER: C:/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev1/mingw64/bin/gcc.exe + CMAKE_CXX_COMPILER: C:/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev1/mingw64/bin/g++.exe + - COMPILER: mingw + ARCH: i686 + MINGW_DIR_BIN: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin + CMAKE_C_COMPILER: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/gcc.exe + CMAKE_CXX_COMPILER: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/g++.exe # Avoid rebuilding external dependencies cache: @@ -21,20 +28,20 @@ cache: install: # Workaround for CMake not wanting sh.exe on PATH for MinGW - - cmd: set PATH=%PATH:C:\Program Files\Git\bin;=% - - cmd: set PATH=%PATH:C:\Program Files\Git\usr\bin;=% - - cmd: set PATH=%PYTHON_HOME%;%PYTHON_HOME%/Scripts/;%PATH% - - cmd: pip.exe install conan - - cmd: conan user - - cmd: conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan - - cmd: conan --version + - set PATH=%PATH:C:\Program Files\Git\usr\bin;=% + - set PATH=%PYTHON_HOME%;%PYTHON_HOME%/Scripts/;%PATH% + - set PATH=%MINGW_DIR_BIN%;%PATH% + - pip.exe install conan + - conan user + - conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan + - conan --version build_script: - - cmd: mkdir build - - cmd: cd build - - cmd: conan install .. --build=missing - - cmd: cmake .. -DENABLE_SDL2=BUNDLED -DENABLE_SOUND=BUNDLED -DENABLE_FLUIDSYNTH=BUNDLED -G "MinGW Makefiles" - - cmd: cmake --build . + - mkdir build + - cd build + - conan install .. --build=missing + - cmake .. -DENABLE_SDL2=BUNDLED -DENABLE_SOUND=BUNDLED -DENABLE_FLUIDSYNTH=BUNDLED -G "MinGW Makefiles" + - cmake --build . # For now, we don't have any automatic tests to run test: false From 878302c1a5874ee7a12b469dd7855c3007c1ba08 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Wed, 22 Jan 2020 01:01:33 +0300 Subject: [PATCH 15/22] cmake fixup --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4de6d2801..99c26054b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ if(ENABLE_OPENGL) if(WIN32) find_package(glew REQUIRED) list(APPEND OPENGL_INCLUDE_DIRS ${glew_INCLUDE_DIRS}) - list(APPEND OPENGL_LIBRARIES glew:glew winmm) + list(APPEND OPENGL_LIBRARIES glew::glew winmm) endif(WIN32) endif(ENABLE_OPENGL) From 3e064814805d21ee7e462deb201ea125e659486a Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Wed, 22 Jan 2020 01:15:18 +0300 Subject: [PATCH 16/22] appveyor fixup --- appveyor.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6137b898d..fd830f9cd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,14 +13,14 @@ environment: matrix: - COMPILER: mingw ARCH: x86_64 - MINGW_DIR_BIN: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin - CMAKE_C_COMPILER: C:/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev1/mingw64/bin/gcc.exe - CMAKE_CXX_COMPILER: C:/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev1/mingw64/bin/g++.exe + MINGW_DIR_BIN: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin + CMAKE_C_COMPILER: C:/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe + CMAKE_CXX_COMPILER: C:/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/g++.exe - COMPILER: mingw ARCH: i686 - MINGW_DIR_BIN: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin - CMAKE_C_COMPILER: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/gcc.exe - CMAKE_CXX_COMPILER: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/g++.exe + MINGW_DIR_BIN: C:\mingw-w64\i686-7.3.0-posix-seh-rt_v5-rev0\mingw32\bin + CMAKE_C_COMPILER: C:/mingw-w64/i686-7.3.0-posix-seh-rt_v5-rev0/mingw32/bin/gcc.exe + CMAKE_CXX_COMPILER: C:/mingw-w64/i686-7.3.0-posix-seh-rt_v5-rev0/mingw32/bin/g++.exe # Avoid rebuilding external dependencies cache: From b57de28950445f2b88b11b4f452c6924baedb1ea Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Mon, 10 Feb 2020 01:42:15 +0300 Subject: [PATCH 17/22] Update conanfile.py --- conanfile.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/conanfile.py b/conanfile.py index f56a7d8b1..274ae0a12 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,22 +3,27 @@ class SystemShockConan(ConanFile): settings = "os", "compiler", "build_type", "arch" # Comma-separated list of requirements - build_requires = \ - "fluidsynth/2.0.5@bincrafters/stable", \ - "glew/2.1.0@bincrafters/stable", \ - "sdl2/2.0.9@bincrafters/stable", \ - "sdl2_mixer/2.0.4@bincrafters/stable" + build_requires = [ + "glew/2.1.0@bincrafters/stable", + "sdl2_mixer/2.0.4@bincrafters/stable", + ] generators = "cmake_find_package" def configure(self): + # Disable unused dependencies if self.settings.os == "Linux": - # Disable unused dependencies self.options["sdl2"].jack = False self.options["sdl2"].nas = False + self.options["sdl2_mixer"].tinymidi = False + if self.settings.os == "Windows": + self.options["sdl2_mixer"].flac = False self.options["sdl2_mixer"].mad = False self.options["sdl2_mixer"].modplug = False self.options["sdl2_mixer"].mpg123 = False self.options["sdl2_mixer"].ogg = False self.options["sdl2_mixer"].opus = False - self.options["sdl2_mixer"].tinymidi = False + self.options["glew"].shared = True # Should be shared for MinGW + + def imports(self): + self.copy("*.dll", "", "bin") From b388f1950345354958b794b39677bf3cfebbc965 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Mon, 10 Feb 2020 01:47:20 +0300 Subject: [PATCH 18/22] Reorganize includes in OpenGL.cc --- src/MacSrc/OpenGL.cc | 65 ++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/src/MacSrc/OpenGL.cc b/src/MacSrc/OpenGL.cc index bcc4379c0..3d08862e4 100644 --- a/src/MacSrc/OpenGL.cc +++ b/src/MacSrc/OpenGL.cc @@ -1,47 +1,45 @@ #ifdef USE_OPENGL #include -#include "OpenGL.h" +#include +#include +#include #ifdef _WIN32 - #define GLEW_STATIC 1 - #include - #include +#include #else - #define GL_GLEXT_PROTOTYPES - #ifdef __APPLE__ - #include - #else - #include - #include - #endif - - #include - #include +#define GL_GLEXT_PROTOTYPES +#ifdef __APPLE__ +#include +#else +#include +#include +#endif + +#include #endif +#include "OpenGL.h" + extern "C" { - #include "mainloop.h" - #include "map.h" - #include "frintern.h" - #include "frflags.h" - #include "player.h" - #include "textmaps.h" - #include "star.h" - #include "tools.h" - #include "Prefs.h" - #include "Shock.h" - #include "faketime.h" - #include "render.h" - #include "wares.h" - - extern SDL_Renderer *renderer; - extern SDL_Palette *sdlPalette; +#include "mainloop.h" +#include "map.h" +#include "frintern.h" +#include "frflags.h" +#include "player.h" +#include "textmaps.h" +#include "star.h" +#include "tools.h" +#include "Prefs.h" +#include "Shock.h" +#include "faketime.h" +#include "render.h" +#include "wares.h" + +extern SDL_Renderer *renderer; +extern SDL_Palette *sdlPalette; } -#include -#include - struct CachedTexture { SDL_Surface *bitmap; SDL_Surface *converted; @@ -50,6 +48,7 @@ struct CachedTexture { bool locked; }; + struct Shader { GLuint shaderProgram; GLint uniView; From 511795f3978e6b48c0b6650642b9dfd9def4b5bc Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Mon, 10 Feb 2020 02:21:33 +0300 Subject: [PATCH 19/22] Add Windows log console option -mwindows totally suppress log output, hard to debug. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99c26054b..8678090e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +option(ENABLE_WIN32_CONSOLE "Enable log console in Windows" ON) +add_feature_info(ENABLE_WIN32_CONSOLE ENABLE_WIN32_CONSOLE "Enable log console in Windows") option(ENABLE_EXAMPLES "Enable example applications" OFF) add_feature_info(ENABLE_EXAMPLES ENABLE_EXAMPLES "Enable example application (can be broken!)") option(ENABLE_DEBUG_BLIT "Enable debugging blitter" OFF) @@ -380,7 +382,11 @@ add_library(GAME_LIB ${GAME_SRC}) # MINGW additional linker options if(MINGW) - set(WINDOWS_LIBRARIES "mingw32 -mwindows") + set(WINDOWS_LIBRARIES mingw32) + if(NOT ENABLE_WIN32_CONSOLE) + list(APPEND WINDOWS_LIBRARIES "-mwindows") + endif(NOT ENABLE_WIN32_CONSOLE) + endif(MINGW) target_link_libraries(systemshock From feb6bc4f98f041a1253deefc6f4d4286da106ffa Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Mon, 10 Feb 2020 03:12:44 +0300 Subject: [PATCH 20/22] Updates to CI --- .travis.yml | 2 +- appveyor.yml | 5 +++-- windows/mingw_i686 | 20 ++++++++++++++++++++ windows/mingw_x86_64 | 20 ++++++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 windows/mingw_i686 create mode 100644 windows/mingw_x86_64 diff --git a/.travis.yml b/.travis.yml index 025012ce1..f8eb5a2db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ dist: bionic addons: apt: packages: - - cmake-data cmake libglu1-mesa-dev libgl1-mesa-dev + - cmake-data cmake libglu1-mesa-dev libgl1-mesa-dev libpulse-dev install: - pip3 install --upgrade pip ; pip3 install conan diff --git a/appveyor.yml b/appveyor.yml index fd830f9cd..3b5099824 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,12 +35,13 @@ install: - conan user - conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan - conan --version + - copy windows\mingw* %USERPROFILE%\.conan\profiles\ build_script: - mkdir build - cd build - - conan install .. --build=missing - - cmake .. -DENABLE_SDL2=BUNDLED -DENABLE_SOUND=BUNDLED -DENABLE_FLUIDSYNTH=BUNDLED -G "MinGW Makefiles" + - conan install .. --build=missing --profile=mingw_$ARCH + - cmake .. -DENABLE_SDL2=BUNDLED -DENABLE_SOUND=BUNDLED -DENABLE_FLUIDSYNTH=BUNDLED -G "Ninja" - cmake --build . # For now, we don't have any automatic tests to run diff --git a/windows/mingw_i686 b/windows/mingw_i686 new file mode 100644 index 000000000..a4c756dab --- /dev/null +++ b/windows/mingw_i686 @@ -0,0 +1,20 @@ +[settings] +os=Windows +os_build=Windows +arch=x86 +arch_build=x86 +compiler=gcc +compiler.version=8 +compiler.libcxx=libstdc++11 +build_type=Release +compiler.exception=seh +compiler.threads=posix +[options] + +[build_requires] +mingw_installer/1.0@conan/stable +ninja/1.9.0 + +[env] +CONAN_CMAKE_GENERATOR=Ninja + diff --git a/windows/mingw_x86_64 b/windows/mingw_x86_64 new file mode 100644 index 000000000..d6ec8871e --- /dev/null +++ b/windows/mingw_x86_64 @@ -0,0 +1,20 @@ +[settings] +os=Windows +os_build=Windows +arch=x86_64 +arch_build=x86_64 +compiler=gcc +compiler.version=8 +compiler.libcxx=libstdc++11 +build_type=Release +compiler.exception=seh +compiler.threads=posix +[options] + +[build_requires] +mingw_installer/1.0@conan/stable +ninja/1.9.0 + +[env] +CONAN_CMAKE_GENERATOR=Ninja + From 0e12b350295e57ffba7e9d67ea6e3b7a2e50fb1d Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Mon, 10 Feb 2020 03:17:21 +0300 Subject: [PATCH 21/22] update appveyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 3b5099824..e8000c365 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,6 +35,7 @@ install: - conan user - conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan - conan --version + - mkdir %USERPROFILE%\.conan\profiles\ - copy windows\mingw* %USERPROFILE%\.conan\profiles\ build_script: From 0d2e0fb12af76de9b4745550d463d06fd3c9aa2b Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Mon, 10 Feb 2020 03:18:39 +0300 Subject: [PATCH 22/22] Update appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index e8000c365..3d5613375 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,7 +41,7 @@ install: build_script: - mkdir build - cd build - - conan install .. --build=missing --profile=mingw_$ARCH + - conan install .. --build=missing --profile=mingw_%ARCH% - cmake .. -DENABLE_SDL2=BUNDLED -DENABLE_SOUND=BUNDLED -DENABLE_FLUIDSYNTH=BUNDLED -G "Ninja" - cmake --build .