Update CMake configuration and CI workflows for improved compatibility and testing
- Updated minimum CMake version requirement from 3.5 to 3.16 to leverage new features and policies. - Enhanced CI workflows to include additional build configurations for Ubuntu and macOS, improving cross-platform support. - Added conditional linking for ImGui Test Engine in the CMakeLists, allowing for UI testing when enabled. - Refactored CMake commands in CI to ensure consistent policy version handling and streamlined build processes. - Introduced new constructors for MenuItem in the GUI to enhance menu item management and flexibility.
This commit is contained in:
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -153,6 +153,9 @@ jobs:
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00'
|
||||
vcpkgArguments: '--triplet=${{ matrix.vcpkg_triplet }}'
|
||||
doNotUpdateVcpkg: true
|
||||
doNotUpdateBaseline: true
|
||||
|
||||
# Configure CMake
|
||||
- name: Configure CMake (Linux/macOS)
|
||||
@@ -162,6 +165,7 @@ jobs:
|
||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
|
||||
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
|
||||
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.16 \
|
||||
-DYAZE_MINIMAL_BUILD=ON \
|
||||
-DYAZE_ENABLE_ROM_TESTS=OFF \
|
||||
-DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF \
|
||||
@@ -172,7 +176,7 @@ jobs:
|
||||
if: runner.os == 'Windows'
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} -DYAZE_MINIMAL_BUILD=ON -DYAZE_ENABLE_ROM_TESTS=OFF -DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF -Wno-dev -G "${{ matrix.cmake_generator }}" -A ${{ matrix.cmake_generator_platform }}
|
||||
cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} -DCMAKE_POLICY_VERSION_MINIMUM=3.16 -DYAZE_MINIMAL_BUILD=ON -DYAZE_ENABLE_ROM_TESTS=OFF -DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF -Wno-dev -G "${{ matrix.cmake_generator }}" -A ${{ matrix.cmake_generator_platform }}
|
||||
|
||||
# Build
|
||||
- name: Build
|
||||
|
||||
193
.github/workflows/cmake.yml
vendored
193
.github/workflows/cmake.yml
vendored
@@ -1,62 +1,183 @@
|
||||
name: CMake
|
||||
name: CMake Build
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'test/**'
|
||||
branches: [ "master" ]
|
||||
- 'cmake/**'
|
||||
- 'CMakeLists.txt'
|
||||
branches: [ "master", "develop" ]
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'test/**'
|
||||
branches: [ "master" ]
|
||||
- 'cmake/**'
|
||||
- 'CMakeLists.txt'
|
||||
branches: [ "master", "develop" ]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Debug
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
||||
# You can convert this to a matrix build if you need cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
build-and-test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: "Ubuntu 22.04 (GCC-12)"
|
||||
os: ubuntu-22.04
|
||||
cc: gcc-12
|
||||
cxx: g++-12
|
||||
|
||||
- name: "Ubuntu 22.04 (Clang)"
|
||||
os: ubuntu-22.04
|
||||
cc: clang-15
|
||||
cxx: clang++-15
|
||||
|
||||
- name: "macOS 13 (Clang)"
|
||||
os: macos-13
|
||||
cc: clang
|
||||
cxx: clang++
|
||||
|
||||
- name: "macOS 14 (Clang)"
|
||||
os: macos-14
|
||||
cc: clang
|
||||
cxx: clang++
|
||||
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Video Libs
|
||||
run: sudo apt install libglew-dev libxext-dev
|
||||
|
||||
- name: Install Audio Libs
|
||||
run: sudo apt install libwavpack-dev
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Abseil-cpp
|
||||
run: sudo apt install libabsl-dev
|
||||
# Linux-specific setup
|
||||
- name: Install Linux dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
libglew-dev \
|
||||
libxext-dev \
|
||||
libwavpack-dev \
|
||||
libabsl-dev \
|
||||
libboost-all-dev \
|
||||
libboost-python-dev \
|
||||
libpng-dev \
|
||||
python3-dev \
|
||||
libpython3-dev \
|
||||
libasound2-dev \
|
||||
libpulse-dev \
|
||||
libaudio-dev \
|
||||
libx11-dev \
|
||||
libxrandr-dev \
|
||||
libxcursor-dev \
|
||||
libxinerama-dev \
|
||||
libxi-dev \
|
||||
libxss-dev \
|
||||
libxxf86vm-dev \
|
||||
libxkbcommon-dev \
|
||||
libwayland-dev \
|
||||
libdecor-0-dev \
|
||||
libgtk-3-dev \
|
||||
libdbus-1-dev \
|
||||
gcc-12 \
|
||||
g++-12 \
|
||||
clang-15
|
||||
|
||||
- name: Install Boost and Boost Python
|
||||
run: sudo apt install libboost-all-dev libboost-python-dev
|
||||
- name: Set up Linux compilers
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/${{ matrix.cc }} 100
|
||||
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/${{ matrix.cxx }} 100
|
||||
|
||||
- name: Install libpng
|
||||
run: sudo apt install libpng-dev
|
||||
|
||||
- name: Install CPython headers
|
||||
run: sudo apt install python3-dev libpython3-dev
|
||||
# macOS-specific setup
|
||||
- name: Install macOS dependencies
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
# Install Homebrew dependencies if needed
|
||||
# brew install pkg-config libpng boost abseil
|
||||
|
||||
# Configure CMake
|
||||
- name: Configure CMake
|
||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
run: |
|
||||
cmake -B ${{ github.workspace }}/build \
|
||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
|
||||
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
|
||||
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.16 \
|
||||
-DYAZE_MINIMAL_BUILD=OFF \
|
||||
-DYAZE_ENABLE_ROM_TESTS=OFF \
|
||||
-DYAZE_ENABLE_EXPERIMENTAL_TESTS=ON \
|
||||
-Wno-dev \
|
||||
-GNinja
|
||||
|
||||
# Build
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
run: cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} --parallel
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ${{github.workspace}}/build/bin/yaze_test
|
||||
# Test (core functionality)
|
||||
- name: Run Core Tests
|
||||
working-directory: ${{ github.workspace }}/build
|
||||
run: ctest --build-config ${{ env.BUILD_TYPE }} --output-on-failure --parallel -R "AsarWrapperTest|SnesTileTest|CompressionTest|SnesPaletteTest|HexTest"
|
||||
|
||||
# Run additional tests (allowed to fail for information only)
|
||||
- name: Run Additional Tests (Informational)
|
||||
working-directory: ${{ github.workspace }}/build
|
||||
continue-on-error: true
|
||||
run: ctest --build-config ${{ env.BUILD_TYPE }} --output-on-failure --parallel -E "AsarWrapperTest|SnesTileTest|CompressionTest|SnesPaletteTest|HexTest|CpuTest|Spc700Test|ApuTest|MessageTest|.*IntegrationTest"
|
||||
|
||||
# Package (only on successful builds)
|
||||
- name: Package artifacts
|
||||
if: success()
|
||||
run: |
|
||||
cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} --target package
|
||||
|
||||
# Upload artifacts
|
||||
- name: Upload build artifacts
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: yaze-${{ matrix.name }}-${{ github.sha }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/bin/
|
||||
${{ github.workspace }}/build/lib/
|
||||
retention-days: 7
|
||||
|
||||
code-quality:
|
||||
name: Code Quality Checks
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
clang-format-14 \
|
||||
clang-tidy-14 \
|
||||
cppcheck
|
||||
|
||||
- name: Check code formatting
|
||||
run: |
|
||||
find src test -name "*.cc" -o -name "*.h" | \
|
||||
xargs clang-format-14 --dry-run --Werror
|
||||
|
||||
- name: Run cppcheck
|
||||
run: |
|
||||
cppcheck --enable=all --error-exitcode=1 \
|
||||
--suppress=missingIncludeSystem \
|
||||
--suppress=unusedFunction \
|
||||
--suppress=unmatchedSuppression \
|
||||
src/
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
# Yet Another Zelda3 Editor
|
||||
# by scawful
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# Set policy version to handle compatibility issues
|
||||
if(POLICY CMP0091)
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
endif()
|
||||
|
||||
project(yaze VERSION 0.3.0
|
||||
DESCRIPTION "Yet Another Zelda3 Editor"
|
||||
|
||||
@@ -12,7 +12,7 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
set(ABSL_PROPAGATE_CXX_STD ON)
|
||||
set(ABSL_CXX_STANDARD 17)
|
||||
set(ABSL_CXX_STANDARD 23)
|
||||
set(ABSL_USE_GOOGLETEST_HEAD ON)
|
||||
set(ABSL_ENABLE_INSTALL ON)
|
||||
set(
|
||||
@@ -29,4 +29,47 @@ set(
|
||||
absl::raw_logging_internal
|
||||
absl::failure_signal_handler
|
||||
absl::flat_hash_map
|
||||
absl::str_format_internal
|
||||
absl::cord
|
||||
absl::hash
|
||||
absl::synchronization
|
||||
absl::time
|
||||
absl::symbolize
|
||||
absl::debugging_internal
|
||||
absl::demangle_internal
|
||||
absl::strings_internal
|
||||
absl::city
|
||||
absl::cordz_functions
|
||||
absl::malloc_internal
|
||||
absl::graphcycles_internal
|
||||
absl::str_format_internal
|
||||
absl::cord_internal
|
||||
absl::cordz_handle
|
||||
absl::cordz_info
|
||||
absl::flags_commandlineflag
|
||||
absl::flags_commandlineflag_internal
|
||||
absl::flags_marshalling
|
||||
absl::flags_private_handle_accessor
|
||||
absl::flags_program_name
|
||||
absl::flags_config
|
||||
absl::flags_reflection
|
||||
absl::flags_internal
|
||||
absl::hashtablez_sampler
|
||||
absl::raw_hash_set
|
||||
absl::int128
|
||||
absl::time_zone
|
||||
absl::exponential_biased
|
||||
absl::civil_time
|
||||
absl::bad_optional_access
|
||||
absl::bad_variant_access
|
||||
absl::throw_delegate
|
||||
absl::log_severity
|
||||
absl::spinlock_wait
|
||||
absl::strerror
|
||||
absl::raw_hash_set
|
||||
absl::flags_internal
|
||||
absl::cord
|
||||
absl::city
|
||||
absl::hash
|
||||
absl::strings_internal
|
||||
)
|
||||
|
||||
@@ -153,10 +153,14 @@ if (YAZE_BUILD_LIB)
|
||||
${ABSL_TARGETS}
|
||||
${SDL_TARGETS}
|
||||
${CMAKE_DL_LIBS}
|
||||
ImGuiTestEngine
|
||||
ImGui
|
||||
)
|
||||
|
||||
# Conditionally link ImGui Test Engine
|
||||
if(YAZE_ENABLE_UI_TESTS AND TARGET ImGuiTestEngine)
|
||||
target_link_libraries(yaze_c PRIVATE ImGuiTestEngine)
|
||||
endif()
|
||||
|
||||
# Conditionally link PNG if available
|
||||
if(PNG_FOUND)
|
||||
target_link_libraries(yaze_c PRIVATE ${PNG_LIBRARIES})
|
||||
|
||||
@@ -75,7 +75,9 @@ absl::Status ShutdownWindow(Window& window) {
|
||||
SDL_CloseAudioDevice(window.audio_device_);
|
||||
|
||||
// Stop test engine WHILE ImGui context is still valid
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
test::TestManager::Get().StopUITesting();
|
||||
#endif
|
||||
|
||||
// Shutdown ImGui implementations
|
||||
ImGui_ImplSDL2_Shutdown();
|
||||
@@ -85,7 +87,9 @@ absl::Status ShutdownWindow(Window& window) {
|
||||
ImGui::DestroyContext();
|
||||
|
||||
// NOW destroy test engine context (after ImGui context is destroyed)
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
test::TestManager::Get().DestroyUITestingContext();
|
||||
#endif
|
||||
|
||||
// Shutdown graphics arena BEFORE destroying SDL contexts
|
||||
gfx::Arena::Get().Shutdown();
|
||||
|
||||
@@ -87,6 +87,27 @@ struct MenuItem {
|
||||
std::function<void()> callback;
|
||||
std::function<bool()> enabled_condition = kDefaultEnabledCondition;
|
||||
std::vector<MenuItem> subitems;
|
||||
|
||||
// Default constructor
|
||||
MenuItem() = default;
|
||||
|
||||
// Constructor for basic menu items
|
||||
MenuItem(const std::string& name, const std::string& shortcut,
|
||||
std::function<void()> callback)
|
||||
: name(name), shortcut(shortcut), callback(callback) {}
|
||||
|
||||
// Constructor for menu items with enabled condition
|
||||
MenuItem(const std::string& name, const std::string& shortcut,
|
||||
std::function<void()> callback, std::function<bool()> enabled_condition)
|
||||
: name(name), shortcut(shortcut), callback(callback),
|
||||
enabled_condition(enabled_condition) {}
|
||||
|
||||
// Constructor for menu items with subitems
|
||||
MenuItem(const std::string& name, const std::string& shortcut,
|
||||
std::function<void()> callback, std::function<bool()> enabled_condition,
|
||||
std::vector<MenuItem> subitems)
|
||||
: name(name), shortcut(shortcut), callback(callback),
|
||||
enabled_condition(enabled_condition), subitems(std::move(subitems)) {}
|
||||
};
|
||||
using Menu = std::vector<MenuItem>;
|
||||
|
||||
|
||||
@@ -65,11 +65,15 @@ TestManager& TestManager::Get() {
|
||||
|
||||
TestManager::TestManager() {
|
||||
// Initialize UI test engine
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
InitializeUITesting();
|
||||
#endif
|
||||
}
|
||||
|
||||
TestManager::~TestManager() {
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
ShutdownUITesting();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <cmath>
|
||||
|
||||
namespace yaze {
|
||||
namespace util {
|
||||
|
||||
Reference in New Issue
Block a user