diff --git a/.github/workflows/macOS_build.yml b/.github/workflows/macOS_build.yml index 853b44bb9..0cbaa505c 100644 --- a/.github/workflows/macOS_build.yml +++ b/.github/workflows/macOS_build.yml @@ -34,10 +34,14 @@ jobs: with: submodules: true + - name: Install OpenMP + run: | + brew install libomp + OPENMP_PREFIX=$(brew --prefix)/opt/libomp + echo "OpenMP_ROOT=$OPENMP_PREFIX" >> $GITHUB_ENV + echo "LDFLAGS=$LDFLAGS -L$OPENMP_PREFIX/lib" >> $GITHUB_ENV + - name: Configure - env: - CC: gcc-12 - CXX: g++-12 working-directory: build run: cmake .. -DCMAKE_BUILD_TYPE=Release diff --git a/CHANGELOG.md b/CHANGELOG.md index ff08de118..5a6874f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Changes: * Fix Python `json_read` crashing when the new population is empty ([#205](https://github.com/xcsf-dev/xcsf/pull/205)) * Reduce `max_trials` in Python tests for speed ([#206](https://github.com/xcsf-dev/xcsf/pull/206)) * Update Python packaging: move `setup.cfg` metadata to `pyproject.toml` ([#207](https://github.com/xcsf-dev/xcsf/pull/207)) +* Fix macOS building with AppleClang ([#210](https://github.com/xcsf-dev/xcsf/pull/210)) ## Version 1.4.7 (Aug 19, 2024) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c35cc95e..13efee0cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,6 @@ if(NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-align") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlogical-op") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wnested-externs") @@ -76,9 +75,11 @@ if(NOT MSVC) if(CMAKE_C_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wuninitialized") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlong-long") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmaybe-uninitialized") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmaybe-uninitialized") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlogical-op") endif() else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") diff --git a/test/cl_test.cpp b/test/cl_test.cpp index 595de0f1b..26e2bc4b8 100644 --- a/test/cl_test.cpp +++ b/test/cl_test.cpp @@ -17,7 +17,7 @@ * @file cl_test.cpp * @author Richard Preen * @copyright The Authors. - * @date 2023--2024. + * @date 2023--2025. * @brief Classifier tests. */ @@ -36,11 +36,6 @@ extern "C" { #include } -const double x[5] = { 0.8455260670, 0.7566081103, 0.3125093674, 0.3449376898, - 0.3677518467 }; - -const double y[1] = { 0.9 }; - TEST_CASE("CL") { /* Test initialisation */ diff --git a/xcsf/pybind_wrapper.cpp b/xcsf/pybind_wrapper.cpp index aee42bc31..6db49f9f8 100644 --- a/xcsf/pybind_wrapper.cpp +++ b/xcsf/pybind_wrapper.cpp @@ -841,7 +841,7 @@ class XCS // map None types if (params.contains("random_state")) { py::object rs = params["random_state"]; - if (py::isinstance(rs) && py::int_(rs) < 0) { + if (py::isinstance(rs) && rs.cast() < 0) { params["random_state"] = py::none(); } }