Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
berseker authored Feb 13, 2024
2 parents 81ccf8e + 1f5113e commit 3045090
Show file tree
Hide file tree
Showing 248 changed files with 22,718 additions and 61,675 deletions.
4 changes: 2 additions & 2 deletions .ci_scripts/build_upload.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if ($repo -eq "release") {
mkdir build
cd build

cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DSYSTEM_LIBS=OFF -D CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..
cmake --build . -j 4 --config Release
if ($?) {
.\asset_packer.exe ..\..\
Expand Down Expand Up @@ -121,7 +121,7 @@ if (!$packed_assets) {
mkdir build
cd build

cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DSYSTEM_LIBS=OFF -D CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..
cmake --build . -j 4 --config Release
if ($?) {
.\asset_packer.exe ..\..\
Expand Down
5 changes: 5 additions & 0 deletions .ci_scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ function install_sdl_macos {
mkdir -p ~/Library/Frameworks
echo "Installing framework:" "/Volumes/SDL2"/*.framework
cp -rp "$VOLUME"/*.framework ~/Library/Frameworks
if [ -d "$VOLUME/optional" ]
then
echo "Installing optional framework:" "/Volumes/SDL2/optional"/*.framework
cp -rp "$VOLUME"/optional/*.framework ~/Library/Frameworks
fi
hdiutil detach "$VOLUME"
}

Expand Down
2 changes: 1 addition & 1 deletion .ci_scripts/install_sdl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if ("${env:COMPILER}" -eq "msvc") {
mkdir build
cd build

cmake -G "Visual Studio 17 2022" -A ARM64 -DCMAKE_BUILD_TYPE=Release -DSDL2MIXER_MP3=ON -DSDL2MIXER_MP3_DRMP3=ON -DSDL2MIXER_VENDORED=OFF -DSDL2MIXER_SAMPLES=OFF -DSDL2MIXER_FLAC=OFF -DSDL2MIXER_CMD=OFF -DSDL2MIXER_MOD=OFF -DSDL2MIXER_MIDI=OFF -DSDL2MIXER_MIDI_TIMIDITY=OFF -DSDL2MIXER_OPUS=OFF -DSDL2MIXER_VORBIS=OFF ..
cmake -G "Visual Studio 17 2022" -A ARM64 -DCMAKE_BUILD_TYPE=Release -DSDL2MIXER_MP3=ON -DSDL2MIXER_MP3_MINIMP3=ON -DSDL2MIXER_VENDORED=OFF -DSDL2MIXER_SAMPLES=OFF -DSDL2MIXER_FLAC=OFF -DSDL2MIXER_CMD=OFF -DSDL2MIXER_MOD=OFF -DSDL2MIXER_MIDI=OFF -DSDL2MIXER_MIDI_TIMIDITY=OFF -DSDL2MIXER_OPUS=OFF -DSDL2MIXER_VORBIS=STB -DSDL2MIXER_WAVPACK=OFF ..
cmake --build . -j 4 --config Release

mv ..\include $Env:SDL2_MIXER_DIR
Expand Down
8 changes: 1 addition & 7 deletions .ci_scripts/pack_assets.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
#!/bin/bash

set -e

if [[ "$BUILD_TARGET" == "mac" ]]
then
DISABLE_SYSTEM_LIBS="-DSYSTEM_LIBS=OFF"
fi

mkdir res/asset_packer/build && cd res/asset_packer/build
cmake -DCMAKE_BUILD_TYPE=Release $DISABLE_SYSTEM_LIBS ..
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
./asset_packer ../../
if [ $? -ne 0 ]
Expand Down
8 changes: 4 additions & 4 deletions .ci_scripts/run_build.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
mkdir -Force build
cd build
if ("${env:COMPILER}" -eq "msvc") {
cmake -G "Visual Studio 17 2022" -A x64 -DSYSTEM_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build . -j 4 --config RelWithDebInfo
} elseif ("${env:COMPILER}" -eq "msvc-arm64") {
cmake -G "Visual Studio 17 2022" -A ARM64 -DSYSTEM_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake -G "Visual Studio 17 2022" -A ARM64 -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build . -j 4 --config RelWithDebInfo
} elseif ("${env:COMPILER}" -eq "mingw-32") {
$env:path = "D:\msys64\mingw32\bin;${env:path}"
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSYSTEM_LIBS=OFF -D CMAKE_C_COMPILER=i686-w64-mingw32-gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=i686-w64-mingw32-gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..
cmake --build . -j 4 --config RelWithDebInfo
} elseif ("${env:COMPILER}" -eq "mingw-64") {
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSYSTEM_LIBS=OFF -D CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..
cmake --build . -j 4 --config RelWithDebInfo
} else {
throw "Unknown compiler: ${env:COMPILER}"
Expand Down
8 changes: 4 additions & 4 deletions .ci_scripts/run_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ case "$BUILD_TARGET" in
docker exec switchdev /bin/bash -c "git config --global --add safe.directory /build/git && /opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_PLATFORM=switch -B build -S ."
;;
"mac")
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DSYSTEM_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ..
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ..
;;
"appimage")
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DSYSTEM_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr ..
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
;;
"linux")
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DSYSTEM_LIBS=OFF ..
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..
;;
"android")
mkdir build
;;
"emscripten")
export EMSDK=${PWD}/emsdk
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DSYSTEM_LIBS=OFF -DTARGET_PLATFORM=emscripten ..
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_PLATFORM=emscripten ..
;;
*)
mkdir build && cd build && cmake ..
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- name: Linux x64
os: ubuntu-22.04
cache-key: linux-x64
SDL_VERSION: 2.28.5
SDL_MIXER_VERSION: 2.6.3
SDL_VERSION: 2.30.0
SDL_MIXER_VERSION: 2.8.0
BUILD_TARGET: linux
DEPLOY: linux
- name: Linux x64 (old SDL versions)
Expand All @@ -35,8 +35,8 @@ jobs:
- name: macOS
os: macos-latest
cache-key: macos
SDL_VERSION: 2.28.5
SDL_MIXER_VERSION: 2.6.3
SDL_VERSION: 2.30.0
SDL_MIXER_VERSION: 2.8.0
BUILD_TARGET: mac
DEPLOY: mac
- name: PS Vita
Expand All @@ -50,8 +50,8 @@ jobs:
- name: Android
os: ubuntu-20.04
cache-key: android
SDL_VERSION: 2.28.5
SDL_MIXER_VERSION: 2.6.3
SDL_VERSION: 2.30.0
SDL_MIXER_VERSION: 2.8.0
BUILD_TARGET: android
DEPLOY: android
- name: Emscripten
Expand All @@ -69,18 +69,18 @@ jobs:
SKIP_UPLOAD: ${{ matrix.SKIP_UPLOAD }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
if: ${{ matrix.cache-key }}
with:
path: deps
key: ${{ matrix.cache-key }}-${{ env.SDL_VERSION }}-${{ env.SDL_MIXER_VERSION }}
- name: Setup JDK 17
if: matrix.BUILD_TARGET == 'android'
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
Expand All @@ -106,7 +106,7 @@ jobs:
./.ci_scripts/build_upload.sh
continue-on-error: true
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: deploy/
Expand Down Expand Up @@ -134,16 +134,16 @@ jobs:
runs-on: windows-latest
env:
SDL_VERSION: 2.28.5
SDL_MIXER_VERSION: 2.6.3
SDL_MIXER_VERSION: 2.8.0
COMPILER: ${{ matrix.COMPILER }}
SKIP_UPLOAD: ${{ matrix.SKIP_UPLOAD }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: deps
key: windows-${{ matrix.cache-key }}-${{ env.SDL_VERSION }}-${{ env.SDL_MIXER_VERSION }}
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
run: ./.ci_scripts/build_upload.ps1
continue-on-error: true
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: deploy\
Expand Down
85 changes: 13 additions & 72 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ option(DRAW_ROUTING "Draw routing debug information." OFF)
option(DRAW_HIGHWAY_TERRAIN "Draw highway debug information." OFF)
option(DRAW_ROAD_NETWORK_IDS "Draw road network IDs for debugging." OFF)
option(DRAW_TILE_COORDS "Draw tile coordinates." OFF)
option(SYSTEM_LIBS "Use system libraries when available." ON)

if(${TARGET_PLATFORM} STREQUAL "vita" AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(DEFINED ENV{VITASDK})
Expand Down Expand Up @@ -170,43 +169,20 @@ if (EXISTS ${PROJECT_SOURCE_DIR}/res/packed_assets)
set(ASSETS_DIR ${PROJECT_SOURCE_DIR}/res/packed_assets)
endif()

set(EXPAT_FILES
ext/expat/xmlparse.c
ext/expat/xmlrole.c
ext/expat/xmltok.c
set(TINYFD_FILES
${PROJECT_SOURCE_DIR}/ext/tinyfiledialogs/tinyfiledialogs.c
)

set(TINYFD_FILES
ext/tinyfiledialogs/tinyfiledialogs.c
set(SPNG_FILES
${PROJECT_SOURCE_DIR}/ext/spng/spng.c
)

set(PNG_FILES
ext/png/png.c
ext/png/pngerror.c
ext/png/pngget.c
ext/png/pngmem.c
ext/png/pngpread.c
ext/png/pngread.c
ext/png/pngrio.c
ext/png/pngrtran.c
ext/png/pngrutil.c
ext/png/pngset.c
ext/png/pngtrans.c
ext/png/pngwio.c
ext/png/pngwrite.c
ext/png/pngwtran.c
ext/png/pngwutil.c
set(SXML_FILES
${PROJECT_SOURCE_DIR}/ext/sxml/sxml.c
)

set(ZLIB_FILES
ext/zlib/adler32.c
ext/zlib/crc32.c
ext/zlib/deflate.c
ext/zlib/inffast.c
ext/zlib/inflate.c
ext/zlib/inftrees.c
ext/zlib/trees.c
ext/zlib/zutil.c
set(ZIP_FILES
${PROJECT_SOURCE_DIR}/ext/zip/zip.c
)

set(PLATFORM_FILES
Expand Down Expand Up @@ -745,6 +721,9 @@ set(SOURCE_FILES
${EDITOR_FILES}
${TRANSLATION_FILES}
${TINYFD_FILES}
${SPNG_FILES}
${SXML_FILES}
${ZIP_FILES}
${PROJECT_SOURCE_DIR}/res/augustus.rc
${MACOSX_FILES}
)
Expand Down Expand Up @@ -799,8 +778,6 @@ if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set_source_files_properties(${EXPAT_FILES} PROPERTIES COMPILE_FLAGS "/W3")
set_source_files_properties(${PNG_FILES} PROPERTIES COMPILE_FLAGS "/W3")
set_source_files_properties(${ZLIB_FILES} PROPERTIES COMPILE_FLAGS "/W3")
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "/W4")
set_source_files_properties(${PROJECT_SOURCE_DIR}/res/augustus.rc PROPERTIES COMPILE_FLAGS "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /wd4100 /wd4244")
Expand Down Expand Up @@ -889,42 +866,6 @@ if(SDL2_MIXER_INCLUDE_DIR)
include_directories(SYSTEM ${SDL2_MIXER_INCLUDE_DIR})
endif()

if(SYSTEM_LIBS)
find_package(ZLIB)
find_package(PNG)
find_package(EXPAT)
endif()

if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
target_link_libraries(${SHORT_NAME} ${ZLIB_LIBRARIES})
else()
include_directories("ext/zlib")
target_sources(${SHORT_NAME} PRIVATE "${ZLIB_FILES}")
endif()

if(PNG_FOUND)
include_directories(SYSTEM ${PNG_INCLUDE_DIRS})
target_link_libraries(${SHORT_NAME} ${PNG_LIBRARIES})
else()
if(SYSTEM_LIBS)
message(STATUS "PNG was not found but that's ok: falling back to internal version")
endif()
include_directories("ext/png")
target_sources(${SHORT_NAME} PRIVATE "${PNG_FILES}")
endif()

if(EXPAT_FOUND)
include_directories(${EXPAT_INCLUDE_DIRS})
target_link_libraries(${SHORT_NAME} ${EXPAT_LIBRARIES})
else()
include_directories("ext/expat")
target_sources(${SHORT_NAME} PRIVATE "${EXPAT_FILES}")
if(NOT WIN32)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXML_DEV_URANDOM")
endif()
endif()

if(${TARGET_PLATFORM} STREQUAL "vita")
include_directories(SYSTEM
$ENV{VITASDK}/arm-vita-eabi/include
Expand Down Expand Up @@ -971,7 +912,7 @@ if(${TARGET_PLATFORM} STREQUAL "vita")
ScePgf_stub
SceAppMgr_stub
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__vita__ -DPNG_ARM_NEON_OPT=0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__vita__")
# this setting enables larger heap memory sizes on Vita, up to ~330 MB
# useful for pre-loading videos into memory
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d ATTRIBUTE2=12")
Expand Down Expand Up @@ -1007,7 +948,7 @@ else()
target_link_libraries(${SHORT_NAME} m)
endif()
if(${TARGET_PLATFORM} STREQUAL "android")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPNG_ARM_NEON_OPT=0 -D_BSD_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE")
find_library(log-lib log)
find_library(android-lib android)
target_link_libraries(${SHORT_NAME} ${log-lib} ${android-lib})
Expand Down
5 changes: 1 addition & 4 deletions android/SDL2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ android {
}
externalNativeBuild {
ndkBuild {
arguments 'SUPPORT_FLAC=false',
'SUPPORT_OGG=false',
'SUPPORT_MOD_MODPLUG=false',
'SUPPORT_MID_TIMIDITY=false'
arguments 'SUPPORT_WAVPACK=false'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/augustus/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ android {
externalNativeBuild {
cmake {
version "3.22.1"
arguments "-DTARGET_PLATFORM=android", "-DSYSTEM_LIBS=OFF","-DANDROID_STL=none"
arguments "-DTARGET_PLATFORM=android", "-DANDROID_STL=none"
}
}
ndk {
Expand Down
21 changes: 0 additions & 21 deletions ext/expat/COPYING

This file was deleted.

Loading

0 comments on commit 3045090

Please sign in to comment.