Skip to content

Commit a50c8a0

Browse files
fix macOS building with AppleClang; and pre-commit autoupdate (#210)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](pre-commit/pre-commit-hooks@v5.0.0...v6.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.12.5 → v0.12.10](astral-sh/ruff-pre-commit@v0.12.5...v0.12.10) * macos-runner: install libomp * macos test * test apple building * test apple building * test apple building * test apple building * test apple building * test apple building * test apple building * test apple building * test apple building * remove unused variables in test * fix clang error * revert ruff version * update CHANGELOG --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Richard Preen <rpreen@gmail.com>
1 parent d8353dc commit a50c8a0

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

.github/workflows/macOS_build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ jobs:
3434
with:
3535
submodules: true
3636

37+
- name: Install OpenMP
38+
run: |
39+
brew install libomp
40+
OPENMP_PREFIX=$(brew --prefix)/opt/libomp
41+
echo "OpenMP_ROOT=$OPENMP_PREFIX" >> $GITHUB_ENV
42+
echo "LDFLAGS=$LDFLAGS -L$OPENMP_PREFIX/lib" >> $GITHUB_ENV
43+
3744
- name: Configure
38-
env:
39-
CC: gcc-12
40-
CXX: g++-12
4145
working-directory: build
4246
run: cmake ..
4347
-DCMAKE_BUILD_TYPE=Release

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Changes:
77
* Fix Python `json_read` crashing when the new population is empty ([#205](https://github.com/xcsf-dev/xcsf/pull/205))
88
* Reduce `max_trials` in Python tests for speed ([#206](https://github.com/xcsf-dev/xcsf/pull/206))
99
* Update Python packaging: move `setup.cfg` metadata to `pyproject.toml` ([#207](https://github.com/xcsf-dev/xcsf/pull/207))
10+
* Fix macOS building with AppleClang ([#210](https://github.com/xcsf-dev/xcsf/pull/210))
1011

1112
## Version 1.4.7 (Aug 19, 2024)
1213

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ if(NOT MSVC)
5353
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe")
5454
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat")
5555
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-align")
56-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlogical-op")
5756
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations")
5857
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes")
5958
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wnested-externs")
@@ -76,9 +75,11 @@ if(NOT MSVC)
7675
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
7776
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized")
7877
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wuninitialized")
78+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlong-long")
7979
else()
8080
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmaybe-uninitialized")
8181
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmaybe-uninitialized")
82+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlogical-op")
8283
endif()
8384
else()
8485
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")

test/cl_test.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @file cl_test.cpp
1818
* @author Richard Preen <rpreen@gmail.com>
1919
* @copyright The Authors.
20-
* @date 2023--2024.
20+
* @date 2023--2025.
2121
* @brief Classifier tests.
2222
*/
2323

@@ -36,11 +36,6 @@ extern "C" {
3636
#include <string.h>
3737
}
3838

39-
const double x[5] = { 0.8455260670, 0.7566081103, 0.3125093674, 0.3449376898,
40-
0.3677518467 };
41-
42-
const double y[1] = { 0.9 };
43-
4439
TEST_CASE("CL")
4540
{
4641
/* Test initialisation */

xcsf/pybind_wrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ class XCS
841841
// map None types
842842
if (params.contains("random_state")) {
843843
py::object rs = params["random_state"];
844-
if (py::isinstance<py::int_>(rs) && py::int_(rs) < 0) {
844+
if (py::isinstance<py::int_>(rs) && rs.cast<long long>() < 0) {
845845
params["random_state"] = py::none();
846846
}
847847
}

0 commit comments

Comments
 (0)