diff options
| author | briaguya <70942617+briaguya0@users.noreply.github.com> | 2026-07-22 20:59:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-22 20:59:03 -0400 |
| commit | cd33252589a61d044138f449041a87adee2a8291 (patch) | |
| tree | ba10b70a3af3fc97d4dd90865cf7ea27ac68954e | |
| parent | 205bd3e8be07df1544d7938ae8f5827f5d90b77f (diff) | |
fix ci (#232)
| -rw-r--r-- | .github/workflows/linux_build.yml | 6 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/windows_build.yml | 2 | ||||
| -rw-r--r-- | CMakeLists.txt | 36 |
4 files changed, 32 insertions, 14 deletions
diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml index f5f35c7..ecb1624 100644 --- a/.github/workflows/linux_build.yml +++ b/.github/workflows/linux_build.yml @@ -25,10 +25,10 @@ jobs: run: | sudo apt-get update # Base build tools plus the libultraship/Fast3D deps the interactive - # viewer (BUILD_UI) needs: SDL2, OpenGL, libzip and nlohmann-json. - # (tinyxml2 and spdlog are vendored via FetchContent.) + # viewer (BUILD_UI) needs: SDL2, OpenGL, libzip, nlohmann-json and spdlog. + # (tinyxml2 is vendored via FetchContent.) sudo apt-get install -y cmake ninja-build libbz2-dev \ - libsdl2-dev libgl1-mesa-dev libopengl-dev libzip-dev nlohmann-json3-dev + libsdl2-dev libgl1-mesa-dev libopengl-dev libzip-dev zipcmp zipmerge ziptool libspdlog-dev nlohmann-json3-dev - name: Build run: | # Enable the viewer in CI (BUILD_UI is off by default); both Linux diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d69d6dc..c32ef9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: sudo apt-get update # Includes the libultraship/Fast3D deps for the interactive viewer. sudo apt-get install -y cmake ninja-build libbz2-dev \ - libsdl2-dev libgl1-mesa-dev libopengl-dev libzip-dev nlohmann-json3-dev + libsdl2-dev libgl1-mesa-dev libopengl-dev libzip-dev zipcmp zipmerge ziptool libspdlog-dev nlohmann-json3-dev - name: Configure and Build Linux Binaries run: | diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index 6a21f3a..3daccd3 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -22,6 +22,8 @@ jobs: exclude: - toolchain: windows-clang-cl arch: Win32 + - toolchain: windows-clang-cl + generate: Visual Studio 17 2022 - isPR: true standalone: OFF steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index a395e5f..aa4d5b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,14 @@ include(FetchContent) set(CMAKE_POLICY_VERSION_MINIMUM 3.12) +if(MSVC) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") + foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE) + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endforeach() +endif() + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -193,16 +201,17 @@ if(ENABLE_ASAN) add_link_options(-fsanitize=address) endif() -# MSVC static runtime for all targets (must be set before add_subdirectory/FetchContent) if (MSVC) - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") + # NOMINMAX: keep windows.h from defining min/max macros that break std::min/std::max. + # _USE_MATH_DEFINES: expose M_PI and friends from <cmath>. (Covers clang-cl too.) + add_compile_definitions(NOMINMAX _USE_MATH_DEFINES) endif() # Build if (USE_STANDALONE) add_definitions(-DSTANDALONE) add_executable(${PROJECT_NAME} ${SRC_DIR}) - set(LINK_TYPE "MD") + set(LINK_TYPE "MT") else() add_library(${PROJECT_NAME} STATIC ${SRC_DIR}) set(LINK_TYPE "MT") @@ -252,6 +261,10 @@ else() if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") target_compile_options(${PROJECT_NAME} PRIVATE /bigobj) target_link_options(${PROJECT_NAME} PRIVATE /bigobj) + else() + # clang-cl treats C++11 narrowing as a hard error by default (MSVC and + # GCC only warn); mirror the -Wno-narrowing used for non-MSVC builds. + target_compile_options(${PROJECT_NAME} PRIVATE -Wno-narrowing) endif() add_definitions(-DSTORMLIB_NO_AUTO_LINK) endif() @@ -325,14 +338,17 @@ if(USE_STANDALONE) set(SPDLOG_USE_STD_FORMAT ON) endif() - FetchContent_Declare( - spdlog - GIT_REPOSITORY https://github.com/gabime/spdlog.git - GIT_TAG 79524ddd08a4ec981b7fea76afd08ee05f83755d - ) + find_package(spdlog QUIET) + if(NOT spdlog_FOUND) + FetchContent_Declare( + spdlog + GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_TAG 79524ddd08a4ec981b7fea76afd08ee05f83755d + ) - FetchContent_MakeAvailable(spdlog) - target_link_libraries(${PROJECT_NAME} PRIVATE spdlog) + FetchContent_MakeAvailable(spdlog) + endif() + target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog) if (MSVC) FetchContent_Declare( |
