Skip to content

Commit

Permalink
Merge pull request #640 from jorisv/topic/nominmax
Browse files Browse the repository at this point in the history
Add NOMINMAX definition to avoid Windows build issue
  • Loading branch information
jorisv authored Jan 3, 2025
2 parents cf75966 + d2767b7 commit f3fe7e8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/macos-linux-windows-pixi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ jobs:
environment: all-clang-cl
cxx_options: ''
build_type: Release
- os: windows-latest
environment: default
cxx_options: ''
build_type: Debug

steps:
- uses: actions/checkout@v4
Expand All @@ -83,7 +87,12 @@ jobs:
COAL_BUILD_TYPE: ${{ matrix.build_type }}
COAL_CXX_FLAGS: ${{ matrix.cxx_options }}
run: |
pixi run -e ${{ matrix.environment }} test
pixi run -e ${{ matrix.environment }} build
- name: Test Coal [MacOS/Linux/Windows]
if: ${{ ! (contains(matrix.os, 'windows') && matrix.build_type == 'Debug') }}
run: |
pixi run -e ${{ matrix.environment }} ctest --test-dir build --output-on-failure
check:
if: always()
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Add Pixi support ([#629](https://github.com/coal-library/coal/pull/629))

### Changed
- Set NOMINMAX as a public definitions on Windows ([#640](https://github.com/coal-library/coal/pull/640))

## [3.0.0] - 2024-11-20

### Added
Expand Down
11 changes: 8 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,14 @@ if(UNIX)
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${${PROJECT_NAME}_INSTALL_RPATH}")
endif()

IF(MSVC)
target_compile_options(${PROJECT_NAME} PUBLIC "/bigobj")
ENDIF()
cxx_flags_by_compiler_frontend(
MSVC "/bigobj"
OUTPUT PUBLIC_OPTIONS
FILTER)
target_compile_options(${PROJECT_NAME} PUBLIC ${PUBLIC_OPTIONS})

cxx_flags_by_compiler_frontend(MSVC "NOMINMAX" OUTPUT PUBLIC_DEFINITIONS)
target_compile_definitions(${PROJECT_NAME} INTERFACE ${PUBLIC_DEFINITIONS})

# IDE sources and headers sorting
ADD_SOURCE_GROUP(${LIBRARY_NAME}_SOURCES)
Expand Down
5 changes: 2 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ function(add_coal_test test_name source)
Boost::filesystem
${utility_target}
)
IF(NOT WIN32)
target_compile_options(${target_name} PRIVATE "-Wno-c99-extensions")
ENDIF()
cxx_flags_by_compiler_frontend(GNU "-Wno-c99-extensions" OUTPUT PRIVATE_OPTIONS)
target_compile_options(${target_name} PRIVATE ${PRIVATE_OPTIONS})
if(COAL_HAS_QHULL)
target_compile_options(${target_name} PRIVATE -DCOAL_HAS_QHULL)
endif()
Expand Down
2 changes: 0 additions & 2 deletions test/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
#endif

#ifdef _WIN32
#define NOMINMAX // required to avoid compilation errors with Visual Studio
// 2010
#include <windows.h>
#else
#include <sys/time.h>
Expand Down

0 comments on commit f3fe7e8

Please sign in to comment.