From db08ca93afdbee3ad4f35c4ed98aaa6ae9fff4a0 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Mon, 1 Apr 2024 21:02:19 -0700 Subject: [PATCH] [Build] Improve CI build coverage This reworks the CI coverage to add `TRANSLATIONS_ONLY=ON` and libretro builds to GitHub Actions. --- .github/workflows/macos-build.yml | 36 +++++++++++++++--- .github/workflows/msys2-build.yml | 41 +++++++++++++++----- .github/workflows/ubuntu-build.yml | 46 ++++++++++++++++++----- .github/workflows/visual-studio-build.yml | 34 ++++++++++++----- src/libretro/Makefile | 8 ++-- src/libretro/link.T | 4 -- 6 files changed, 126 insertions(+), 43 deletions(-) delete mode 100644 src/libretro/link.T diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml index 73d04143..3cca32e5 100644 --- a/.github/workflows/macos-build.yml +++ b/.github/workflows/macos-build.yml @@ -1,27 +1,51 @@ name: macOS Latest Build on: [push, pull_request] -#on: workflow_dispatch jobs: build: strategy: matrix: - cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug'] - cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON'] + build_type: [release, debug] + build_options: [default, link_off, translations_only, libretro] + include: + - cmake_build: '-DCMAKE_BUILD_TYPE=Release' + build_type: release + - cmake_build: '-DCMAKE_BUILD_TYPE=Debug' + build_type: debug + - cmake_options: '-DENABLE_LINK=OFF' + build_options: link_off + - cmake_options: '-DTRANSLATIONS_ONLY=ON' + build_options: translations_only + - libretro_build: 'DEBUG=0' + build_type: release + build_options: libretro + - libretro_build: 'DEBUG=1' + build_type: debug + build_options: libretro runs-on: macos-latest steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive - name: Install nix uses: cachix/install-nix-action@v22 with: nix_path: nixpkgs=channel:nixos-unstable - - name: Configure + + # Cmake build + - if: matrix.build_options != 'libretro' + name: Configure CMake run: >- nix-shell --command 'cmake -B build -G Ninja ${{ matrix.cmake_build }} -DENABLE_LTO=OFF ${{ matrix.cmake_options }}' - - name: Build + - if: matrix.build_options != 'libretro' + name: Build run: >- nix-shell --command 'ninja -C build' + + # Libretro build + - if: matrix.build_options == 'libretro' + name: Build libretro core + run: >- + nix-shell --command 'make -C src/libretro ${{ matrix.libretro_build }}' diff --git a/.github/workflows/msys2-build.yml b/.github/workflows/msys2-build.yml index 805fcf9b..f9e12e10 100644 --- a/.github/workflows/msys2-build.yml +++ b/.github/workflows/msys2-build.yml @@ -5,8 +5,23 @@ jobs: build: strategy: matrix: - cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug'] - cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON'] + build_type: [release, debug] + build_options: [default, link_off, translations_only, libretro] + include: + - cmake_build: '-DCMAKE_BUILD_TYPE=Release' + build_type: release + - cmake_build: '-DCMAKE_BUILD_TYPE=Debug' + build_type: debug + - cmake_options: '-DENABLE_LINK=OFF' + build_options: link_off + - cmake_options: '-DTRANSLATIONS_ONLY=ON' + build_options: translations_only + - libretro_build: 'DEBUG=0' + build_type: release + build_options: libretro + - libretro_build: 'DEBUG=1' + build_type: debug + build_options: libretro runs-on: windows-latest env: MSYSTEM: CLANG64 @@ -16,7 +31,7 @@ jobs: steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive - name: Setup msys2 @@ -27,11 +42,19 @@ jobs: - name: Install deps run: >- bash installdeps - - name: Configure - run: >- - cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} - - name: Build - run: ninja -C build - - name: Install + # CMake build + - if: matrix.build_options != 'libretro' + name: Configure CMake + run: cmake -B build -G Ninja ${{ matrix.cmake_build }} -DENABLE_LTO=OFF ${{ matrix.cmake_options }} + - if: matrix.build_options != 'libretro' + name: Build + run: ninja -C build + - if: matrix.build_options != 'libretro' + name: Install run: ninja -C build install + + # Libretro build + - if: matrix.build_options == 'libretro' + name: Build libretro core + run: make -C src/libretro ${{ matrix.libretro_build }} CC=clang CXX=clang++ diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml index 3e27b99f..e71c80ac 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu-build.yml @@ -5,26 +5,52 @@ jobs: build: strategy: matrix: - cmake_compiler: ['-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++', '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++'] - cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug'] - cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON'] + build_compiler: [gcc, clang] + build_type: [release, debug] + build_options: [default, link_off, translations_only, libretro] + include: + - cmake_compiler: '-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++' + build_compiler: gcc + - cmake_compiler: '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++' + build_compiler: clang + - cmake_build: '-DCMAKE_BUILD_TYPE=Release' + build_type: release + - cmake_build: '-DCMAKE_BUILD_TYPE=Debug' + build_type: debug + - cmake_options: '-DENABLE_LINK=OFF' + build_options: link_off + - cmake_options: '-DTRANSLATIONS_ONLY=ON' + build_options: translations_only + - libretro_build: 'DEBUG=0' + build_type: release + build_options: libretro + - libretro_build: 'DEBUG=1' + build_type: debug + build_options: libretro runs-on: ubuntu-latest steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive - name: Install Dependencies run: >- - bash installdeps; if [ "${{ matrix.compiler }}" = clang ]; then sudo apt -y install clang; fi + bash installdeps; if [ "${{ matrix.build_compiler }}" = clang ]; then sudo apt -y install clang; fi - - name: Configure + # CMake build + - if: matrix.build_options != 'libretro' + name: Configure CMake run: >- cmake -B build -G Ninja ${{ matrix.cmake_compiler }} ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} - - - name: Build + - if: matrix.build_options != 'libretro' + name: Build run: ninja -C build - - - name: Install + - if: matrix.build_options != 'libretro' + name: Install run: sudo ninja -C build install + + # Libretro build + - name: Build libretro core + if: matrix.build_options == 'libretro' + run: make -C src/libretro ${{ matrix.libretro_build }} diff --git a/.github/workflows/visual-studio-build.yml b/.github/workflows/visual-studio-build.yml index f512e194..230be781 100644 --- a/.github/workflows/visual-studio-build.yml +++ b/.github/workflows/visual-studio-build.yml @@ -5,32 +5,46 @@ jobs: build: strategy: matrix: - msvc_arch: ['x64', 'x64_x86'] + msvc_arch: ['x64', 'amd64_x86', 'amd64_arm64'] + # TODO: Re-add "Visual Studio 17 2022" once it's working. cmake_generator: ['Ninja'] -# cmake_generator: ['Ninja', '"Visual Studio 17 2022"'] - cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug'] - cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON'] + build_type: [release, debug] + build_options: [default, link_off, translations_only] + include: + - cmake_build: '-DCMAKE_BUILD_TYPE=Release' + build_type: release + - cmake_build: '-DCMAKE_BUILD_TYPE=Debug' + build_type: debug + - cmake_options: '-DENABLE_LINK=OFF' + build_options: link_off + - cmake_options: '-DTRANSLATIONS_ONLY=ON' + build_options: translations_only runs-on: windows-latest steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive - name: Prepare Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1.12.0 + uses: ilammy/msvc-dev-cmd@v1.13.0 with: arch: ${{ matrix.msvc_arch }} - - name: Configure (x64) - if: matrix.msvc_arch == 'x64' + - if: matrix.msvc_arch == 'x64' + name: Configure (x64) run: >- cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=x64-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} - - name: Configure (x86) - if: matrix.msvc_arch == 'x64_x86' + - if: matrix.msvc_arch == 'amd64_x86' + name: Configure (x86) run: >- cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=x86-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} + - if: matrix.msvc_arch == 'amd64_arm64' + name: Configure (arm64) + run: >- + cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=arm64-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }} + - name: Build run: cmake --build build diff --git a/src/libretro/Makefile b/src/libretro/Makefile index 03a8db20..2b4bb828 100644 --- a/src/libretro/Makefile +++ b/src/libretro/Makefile @@ -66,7 +66,7 @@ endif ifneq (,$(findstring unix,$(platform))) TARGET := $(TARGET_NAME)_libretro.so fpic := -fPIC - SHARED := -shared -Wl,-version-script=$(LIBRETRO_DIR)/link.T -Wl,-no-undefined + SHARED := -shared -Wl,-no-undefined TILED_RENDERING=1 # Classic Platforms #################### @@ -78,7 +78,7 @@ ifneq (,$(findstring unix,$(platform))) else ifeq ($(platform), classic_armv7_a7) TARGET := $(TARGET_NAME)_libretro.so fpic := -fPIC - SHARED := -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined -fPIC + SHARED := -shared -Wl,--no-undefined -fPIC CFLAGS += -Ofast \ -flto=4 -fwhole-program -fuse-linker-plugin \ -fdata-sections -ffunction-sections -Wl,--gc-sections \ @@ -216,7 +216,7 @@ else ifeq ($(platform), theos_ios) else ifeq ($(platform), qnx) TARGET := $(TARGET_NAME)_libretro_$(platform).so fpic := -fPIC - SHARED := -lcpp -lm -shared -Wl,-version-script=$(LIBRETRO_DIR)/link.T -Wl,-no-undefined + SHARED := -lcpp -lm -shared -Wl,-no-undefined CC = qcc -Vgcc_ntoarmv7le CXX = QCC -Vgcc_ntoarmv7le_cpp AR = QCC -Vgcc_ntoarmv7le @@ -527,7 +527,7 @@ else TARGET := $(TARGET_NAME)_libretro.dll CC ?= gcc CXX ?= g++ - SHARED := -shared -static-libgcc -static-libstdc++ -Wl,-no-undefined -Wl,-version-script=$(LIBRETRO_DIR)/link.T + SHARED := -shared -static-libgcc -static-libstdc++ -Wl,-no-undefined TILED_RENDERING=1 endif diff --git a/src/libretro/link.T b/src/libretro/link.T deleted file mode 100644 index 9e82b5dd..00000000 --- a/src/libretro/link.T +++ /dev/null @@ -1,4 +0,0 @@ -{ - global: retro_*; - local: *; -};