diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 093bdd05a..ad6aea5b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,12 +112,12 @@ 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 -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_ALL=ON -DBUILD_WITH_JANET=OFF .. + cmake --build . --parallel # === Ubuntu === - linux: - runs-on: ubuntu-20.04 + linux-gcc12-glibc235: + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -132,18 +132,62 @@ 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 - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -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 + uses: actions/upload-artifact@v4 + with: + name: "tic80-linux-gcc12" + 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 + # === Ubuntu gcc14 === + linux-gcc14-glibc239: + runs-on: ubuntu-24.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 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++ + + - 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" + name: "tic80-linux-gcc14" path: | build/bin/tic80 build/bin/*.so @@ -173,8 +217,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 -DBUILD_STATIC=ON -DCMAKE_TOOLCHAIN_FILE=rpi/toolchain.cmake -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v3 @@ -226,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) @@ -287,7 +331,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) @@ -343,9 +387,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 @@ -359,8 +403,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_STATIC=ON -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v4 @@ -373,8 +417,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: @@ -392,8 +436,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_STATIC=ON -DBUILD_SDLGPU=On -DBUILD_WITH_ALL=ON .. + cmake --build . --parallel - name: Deploy uses: actions/upload-artifact@v4 @@ -406,8 +450,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: @@ -468,74 +512,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 -DBUILD_STATIC=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 dde391755..6f08b9c9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,16 @@ 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") +endif() + if(APPLE) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") endif() 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" } } }