From 15098158ea1752dec3b0e6e8f9a457eccddd24b8 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sat, 5 Oct 2024 21:00:43 +0200 Subject: [PATCH 01/19] use O3 with flto --- .github/workflows/build.yml | 82 ++++++++++++++++++------------------- CMakeLists.txt | 3 ++ 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a17f62441..6df331211 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,8 @@ jobs: run: | COPY /Y build\janet\janetconf.h vendor\janet\src\conf\janetconf.h cd build - cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. - cmake --build . --config MinSizeRel --parallel + cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v4 @@ -63,8 +63,8 @@ jobs: shell: cmd run: | cd build - cmake -G "Visual Studio 16 2019" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. - cmake --build . --config MinSizeRel --parallel + cmake -G "Visual Studio 16 2019" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v4 @@ -112,8 +112,8 @@ jobs: shell: bash run: | cd build - cmake -G "MSYS Makefiles" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_WITH_JANET=OFF .. - cmake --build . --config MinSizeRel --parallel + cmake -G "MSYS Makefiles" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON -DBUILD_WITH_JANET=OFF .. + cmake --build . --parallel # === Ubuntu === linux: @@ -137,8 +137,8 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. - cmake --build . --config MinSizeRel --parallel + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v4 @@ -173,8 +173,8 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=rpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. - cmake --build . --config MinSizeRel --parallel + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=rpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v3 @@ -226,7 +226,7 @@ jobs: run: | git apply build/baremetalpi/circle.patch cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. make tic80studio -j$(nproc) cd baremetalpi make -j$(nproc) @@ -286,7 +286,7 @@ jobs: run: | git apply build/baremetalpi/circle.patch cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. make tic80studio -j$(nproc) cd baremetalpi make -j$(nproc) @@ -332,7 +332,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. make -j$(nproc) - name: Deploy @@ -371,8 +371,8 @@ jobs: - name: Build Pro run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. - cmake --build . --config MinSizeRel --parallel + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel # === MacOS 14 / arm64 === macos-arm64: @@ -404,8 +404,8 @@ jobs: - name: Build Pro run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. - cmake --build . --config MinSizeRel --parallel + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel # === Android === android: @@ -466,74 +466,74 @@ jobs: - name: Build lua run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=ON -DTIC80_TARGET=tic80lua .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=ON -DTIC80_TARGET=tic80lua .. --fresh + cmake --build . --parallel - name: Build ruby run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_RUBY=ON -DTIC80_TARGET=tic80ruby .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_RUBY=ON -DTIC80_TARGET=tic80ruby .. --fresh + cmake --build . --parallel - name: Build js run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_JS=ON -DTIC80_TARGET=tic80js .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_JS=ON -DTIC80_TARGET=tic80js .. --fresh + cmake --build . --parallel - name: Build moon run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_MOON=ON -DTIC80_TARGET=tic80moon .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_MOON=ON -DTIC80_TARGET=tic80moon .. --fresh + cmake --build . --parallel - name: Build fennel run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_FENNEL=ON -DTIC80_TARGET=tic80fennel .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_FENNEL=ON -DTIC80_TARGET=tic80fennel .. --fresh + cmake --build . --parallel - name: Build scheme run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_SCHEME=ON -DTIC80_TARGET=tic80scheme .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_SCHEME=ON -DTIC80_TARGET=tic80scheme .. --fresh + cmake --build . --parallel - name: Build squirrel run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_SQUIRREL=ON -DTIC80_TARGET=tic80squirrel .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_SQUIRREL=ON -DTIC80_TARGET=tic80squirrel .. --fresh + cmake --build . --parallel - name: Build wren run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_WREN=ON -DTIC80_TARGET=tic80wren .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_WREN=ON -DTIC80_TARGET=tic80wren .. --fresh + cmake --build . --parallel - name: Build wasm run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_WASM=ON -DTIC80_TARGET=tic80wasm .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_WASM=ON -DTIC80_TARGET=tic80wasm .. --fresh + cmake --build . --parallel - name: Build janet run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_JANET=ON -DTIC80_TARGET=tic80janet .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_JANET=ON -DTIC80_TARGET=tic80janet .. --fresh + cmake --build . --parallel - name: Build python run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_LUA=OFF -DBUILD_WITH_PYTHON=ON -DTIC80_TARGET=tic80python .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_PYTHON=ON -DTIC80_TARGET=tic80python .. --fresh + cmake --build . --parallel - name: Build all run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. --fresh - cmake --build . --config MinSizeRel --parallel + emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. --fresh + cmake --build . --parallel cp html/index.html bin/index.html - name: Deploy diff --git a/CMakeLists.txt b/CMakeLists.txt index 03abac804..1561732ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3) include(cmake/version.cmake) +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -flto") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto") + project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX) if(APPLE) From f110074c6f62d7c713161e4d5574882589152a1f Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sat, 5 Oct 2024 21:39:27 +0200 Subject: [PATCH 02/19] fix msvc builds --- src/tic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tic.h b/src/tic.h index 27b63fdb2..efe94cce2 100644 --- a/src/tic.h +++ b/src/tic.h @@ -430,8 +430,8 @@ static INLINE u16 tic_sound_register_get_freq(const tic_sound_register* reg) static INLINE void tic_sound_register_set_freq(tic_sound_register* reg, u16 val) { - reg->freq_low = val; - reg->freq_high = val >> 8; + reg->freq_low = (u8)(val); // Explicit cast to u8 + reg->freq_high = (u8)(val >> 8); // Explicit cast to u8 after shifting } typedef struct From 93f39b0c2154786cde5645cb374f26ab1d68a02a Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sat, 5 Oct 2024 22:18:32 +0200 Subject: [PATCH 03/19] back to minsizerel in msvc, baremetal and 3ds --- .github/workflows/build.yml | 22 +++++++++++----------- src/tic.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6df331211..176ba5a1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,8 @@ jobs: run: | COPY /Y build\janet\janetconf.h vendor\janet\src\conf\janetconf.h cd build - cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. - cmake --build . --parallel + cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. + cmake --build . --config MinSizeRel --parallel - name: Deploy uses: actions/upload-artifact@v4 @@ -63,8 +63,8 @@ jobs: shell: cmd run: | cd build - cmake -G "Visual Studio 16 2019" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. - cmake --build . --parallel + cmake -G "Visual Studio 16 2019" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. + cmake --build . --config MinSizeRel --parallel - name: Deploy uses: actions/upload-artifact@v4 @@ -226,7 +226,7 @@ jobs: run: | git apply build/baremetalpi/circle.patch cd build - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. make tic80studio -j$(nproc) cd baremetalpi make -j$(nproc) @@ -286,7 +286,7 @@ jobs: run: | git apply build/baremetalpi/circle.patch cd build - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. make tic80studio -j$(nproc) cd baremetalpi make -j$(nproc) @@ -332,7 +332,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. make -j$(nproc) - name: Deploy @@ -357,8 +357,8 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. - cmake --build . --config MinSizeRel --parallel + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v4 @@ -390,8 +390,8 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. - cmake --build . --config MinSizeRel --parallel + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v4 diff --git a/src/tic.h b/src/tic.h index efe94cce2..27b63fdb2 100644 --- a/src/tic.h +++ b/src/tic.h @@ -430,8 +430,8 @@ static INLINE u16 tic_sound_register_get_freq(const tic_sound_register* reg) static INLINE void tic_sound_register_set_freq(tic_sound_register* reg, u16 val) { - reg->freq_low = (u8)(val); // Explicit cast to u8 - reg->freq_high = (u8)(val >> 8); // Explicit cast to u8 after shifting + reg->freq_low = val; + reg->freq_high = val >> 8; } typedef struct From f7fb88a19e34df43e7105c489db7f79bf3dcc577 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sat, 5 Oct 2024 23:38:18 +0200 Subject: [PATCH 04/19] default to static in builds with flto --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 176ba5a1f..123a17af6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,7 +112,7 @@ jobs: shell: bash run: | cd build - cmake -G "MSYS Makefiles" -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON -DBUILD_WITH_JANET=OFF .. + cmake -G "MSYS Makefiles" -DBUILD_SDLGPU=On -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON -DBUILD_WITH_JANET=OFF .. cmake --build . --parallel # === Ubuntu === @@ -137,7 +137,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_STATIC=ON -DBUILD_WITH_ALL=ON .. cmake --build . --parallel - name: Deploy @@ -173,7 +173,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=rpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DCMAKE_TOOLCHAIN_FILE=rpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. cmake --build . --parallel - name: Deploy @@ -357,7 +357,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. cmake --build . --parallel - name: Deploy @@ -390,7 +390,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. cmake --build . --parallel - name: Deploy @@ -532,7 +532,7 @@ jobs: - name: Build all run: | cd build - emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. --fresh + emcmake cmake -DBUILD_SDLGPU=On -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. --fresh cmake --build . --parallel cp html/index.html bin/index.html From 31643c1b58b3e880c167da1a9f1d15466af2c622 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 10:09:54 +0200 Subject: [PATCH 05/19] use ubuntu 22.04 for linux amd64 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 123a17af6..4fc8bbeda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,7 +117,7 @@ jobs: # === Ubuntu === linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 From 98c42b953dbd97a0da5a2fe14ea55cf151c0c1bf Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 10:31:23 +0200 Subject: [PATCH 06/19] use gcc12 in ubuntu 22.04 --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fc8bbeda..aad4d2913 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,8 +132,10 @@ jobs: - name: Install run: | sudo apt-get update - sudo apt-get install libglu1-mesa-dev libasound2-dev libpulse-dev libaudio-dev libsamplerate0-dev libcurl4-openssl-dev -y - + sudo apt-get install gcc-12 g++-12 libglu1-mesa-dev libasound2-dev libpulse-dev libaudio-dev libsamplerate0-dev libcurl4-openssl-dev -y + sudo ln -s -f /usr/bin/gcc-12 /usr/bin/gcc + sudo ln -s -f /usr/bin/g++-12 /usr/bin/g++ + - name: Build run: | cd build From e09db9110d62bb4e7fabb6495c0c1056b675cb5f Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 10:57:28 +0200 Subject: [PATCH 07/19] include ubuntu24.04 + gcc14 for linux amd64 --- .github/workflows/build.yml | 43 ++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aad4d2913..806e871b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: cmake --build . --parallel # === Ubuntu === - linux: + linux-gcc12-glibc2.35: runs-on: ubuntu-22.04 steps: @@ -156,6 +156,47 @@ jobs: cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel + # === Ubuntu === + linux-gcc14-glibc2.39: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + + - name: Install + run: | + sudo apt-get update + sudo apt-get install gcc-14 g++-14 libglu1-mesa-dev libasound2-dev libpulse-dev libaudio-dev libsamplerate0-dev libcurl4-openssl-dev -y + sudo ln -s -f /usr/bin/gcc-14 /usr/bin/gcc + sudo ln -s -f /usr/bin/g++-14 /usr/bin/g++ + + - name: Build + run: | + cd build + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SDLGPU=On -DBUILD_STATIC=ON -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel + + - name: Deploy + uses: actions/upload-artifact@v4 + with: + name: "tic80-linux" + path: | + build/bin/tic80 + build/bin/*.so + + - name: Build Pro + run: | + cd build + cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. + cmake --build . --config MinSizeRel --parallel + # === Raspberry PI === rpi: runs-on: ubuntu-latest From 0d87324925060187bbe2dcf08a38fa0406e92ebe Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 10:59:27 +0200 Subject: [PATCH 08/19] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 806e871b7..70e7df4c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: cmake --build . --parallel # === Ubuntu === - linux-gcc12-glibc2.35: + linux-gcc12-glibc235: runs-on: ubuntu-22.04 steps: @@ -157,7 +157,7 @@ jobs: cmake --build . --config MinSizeRel --parallel # === Ubuntu === - linux-gcc14-glibc2.39: + linux-gcc14-glibc239: runs-on: ubuntu-22.04 steps: From dcf552a30712cb42ac170dff6eccab1ec14c0197 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 11:13:30 +0200 Subject: [PATCH 09/19] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70e7df4c8..11b5c53b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -158,7 +158,7 @@ jobs: # === Ubuntu === linux-gcc14-glibc239: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 From e8d0c0bdeab514aa1bdd6f36edd776b54d2754e5 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 11:25:32 +0200 Subject: [PATCH 10/19] add required dep for ubuntu24.04 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11b5c53b9..ba2accabb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -173,7 +173,7 @@ jobs: - name: Install run: | sudo apt-get update - sudo apt-get install gcc-14 g++-14 libglu1-mesa-dev libasound2-dev libpulse-dev libaudio-dev libsamplerate0-dev libcurl4-openssl-dev -y + sudo apt-get install gcc-14 g++-14 libxext-dev libglu1-mesa-dev libasound2-dev libpulse-dev libaudio-dev libsamplerate0-dev libcurl4-openssl-dev -y sudo ln -s -f /usr/bin/gcc-14 /usr/bin/gcc sudo ln -s -f /usr/bin/g++-14 /usr/bin/g++ From f8d087dc630fd18568d2f35e96c8b6a3327aa9bd Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 11:39:43 +0200 Subject: [PATCH 11/19] Update build.yml --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba2accabb..84e379a1d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -145,7 +145,7 @@ jobs: - name: Deploy uses: actions/upload-artifact@v4 with: - name: "tic80-linux" + name: "tic80-linux-gcc12" path: | build/bin/tic80 build/bin/*.so @@ -156,7 +156,7 @@ jobs: cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SDLGPU=On -DBUILD_PRO=On -DBUILD_WITH_ALL=ON .. cmake --build . --config MinSizeRel --parallel - # === Ubuntu === + # === Ubuntu gcc14 === linux-gcc14-glibc239: runs-on: ubuntu-24.04 @@ -186,7 +186,7 @@ jobs: - name: Deploy uses: actions/upload-artifact@v4 with: - name: "tic80-linux" + name: "tic80-linux-gcc14" path: | build/bin/tic80 build/bin/*.so From a6cd9afe92d9327a50b6e35577aa4bcfa72fd168 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 14:06:38 +0200 Subject: [PATCH 12/19] try to force strict aliasing --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1561732ff..6ac67d332 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.3) include(cmake/version.cmake) -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -flto") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fstrict-aliasing -flto") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fstrict-aliasing -flto") project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX) From f37c6a002fb15a506caa131f5f641517d6916bd7 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:30:37 +0200 Subject: [PATCH 13/19] revert and try to get latest gcc14 --- .github/workflows/build.yml | 3 ++- CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84e379a1d..e1fa1c68b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -172,7 +172,8 @@ jobs: - name: Install run: | - sudo apt-get update + sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa + sudo apt update sudo apt-get install gcc-14 g++-14 libxext-dev libglu1-mesa-dev libasound2-dev libpulse-dev libaudio-dev libsamplerate0-dev libcurl4-openssl-dev -y sudo ln -s -f /usr/bin/gcc-14 /usr/bin/gcc sudo ln -s -f /usr/bin/g++-14 /usr/bin/g++ diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ac67d332..1561732ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.3) include(cmake/version.cmake) -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fstrict-aliasing -flto") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fstrict-aliasing -flto") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -flto") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto") project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX) From 7642807041b5dceb19f6fbcde164fe65282733e0 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 16:55:34 +0200 Subject: [PATCH 14/19] build with Os + flto to compare --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1561732ff..397409e51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.3) include(cmake/version.cmake) -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -flto") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os -flto") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -flto") project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX) From 6b6f47e018ed22f86b868d876d06e0e6eaf343c9 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 18:33:19 +0200 Subject: [PATCH 15/19] compile with O2 with flto to compare --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 397409e51..3b8831928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.3) include(cmake/version.cmake) -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os -flto") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -flto") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -flto") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -flto") project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX) From 08a7ce29450a52c56812911af2a6de553291db11 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 6 Oct 2024 19:04:52 +0200 Subject: [PATCH 16/19] go back to O3+flto as is the faster option --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b8831928..1561732ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.3) include(cmake/version.cmake) -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -flto") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -flto") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -flto") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto") project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX) From 33b09b64b5193334dd3369f9b969aecaa87ab772 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:43:10 +0200 Subject: [PATCH 17/19] forgot to use release in android --- build/android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/android/app/build.gradle b/build/android/app/build.gradle index d936c98b3..186b0636c 100644 --- a/build/android/app/build.gradle +++ b/build/android/app/build.gradle @@ -25,7 +25,7 @@ android { arguments "APP_PLATFORM=android-31" } cmake { - arguments "-DBUILD_WITH_RUBY=OFF", "-DBUILD_PRO=Off", "-DCMAKE_BUILD_TYPE=MinSizeRel", "-DBUILD_WITH_ALL=ON" + arguments "-DBUILD_WITH_RUBY=OFF", "-DBUILD_PRO=Off", "-DCMAKE_BUILD_TYPE=Release", "-DBUILD_WITH_ALL=ON" } } } From 19e9ec61fa8853192604b34ed916d3544e61d720 Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:10:04 +0200 Subject: [PATCH 18/19] use macos13 as 12 is being deprecated --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1fa1c68b..71e43974f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -385,9 +385,9 @@ jobs: name: "tic80-nintendo-3ds" path: build/bin/tic80.3dsx - # === MacOS 12 === + # === MacOS 13 === macos: - runs-on: macos-12 + runs-on: macos-13 steps: - uses: actions/checkout@v4 From 80c58585fa454c72894d7bd05c7b945065d4669f Mon Sep 17 00:00:00 2001 From: Miguel <81558772+Miguel-hrvs@users.noreply.github.com> Date: Sun, 13 Oct 2024 02:08:09 +0200 Subject: [PATCH 19/19] more platforms --- .github/workflows/build.yml | 6 +++--- CMakeLists.txt | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71e43974f..a66a5b46c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -270,7 +270,7 @@ jobs: run: | git apply build/baremetalpi/circle.patch cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. make tic80studio -j$(nproc) cd baremetalpi make -j$(nproc) @@ -330,7 +330,7 @@ jobs: run: | git apply build/baremetalpi/circle.patch cd build - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. make tic80studio -j$(nproc) cd baremetalpi make -j$(nproc) @@ -376,7 +376,7 @@ jobs: - name: Build run: | cd build - cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON .. + cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON .. make -j$(nproc) - name: Deploy diff --git a/CMakeLists.txt b/CMakeLists.txt index 1561732ff..a5bb9793a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,17 @@ cmake_minimum_required(VERSION 3.3) include(cmake/version.cmake) +project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -flto -ffat-lto-objects") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto -ffat-lto-objects") +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -flto") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto") - -project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX) +endif() if(APPLE) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")