From 0093c4451451cd119ce3dac25847cfe2fdd91bf0 Mon Sep 17 00:00:00 2001 From: Philipp Basler Date: Tue, 24 May 2022 21:34:28 +0200 Subject: [PATCH 1/4] Fixed the cmake compile options to not override parent project --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e5a4084..6f84df9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,13 @@ if (NOT DEFINED CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type") endif () -set(CMAKE_CXX_FLAGS "-Wall -Wextra") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") +add_compile_options( + -Wall + -Wextra + "$<$:-O3>" + "$<$:-g>" + ) + list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) From 0715293c701f1854efd399aeae9b1113c247cff3 Mon Sep 17 00:00:00 2001 From: Philipp Basler <28863303+phbasler@users.noreply.github.com> Date: Thu, 5 Dec 2024 07:05:52 +0100 Subject: [PATCH 2/4] Set target specific flags --- CMakeLists.txt | 7 +------ src/CMakeLists.txt | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f84df9f..d28f4cc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,12 +9,7 @@ if (NOT DEFINED CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type") endif () -add_compile_options( - -Wall - -Wextra - "$<$:-O3>" - "$<$:-g>" - ) + list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7dd6c9ab..d6f8c4f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,6 +52,12 @@ else () add_library (cmaes STATIC ${LIBCMAES_SOURCES}) endif () + +target_compile_options(cmaes + PRIVATE + $<$>:-Wall -Wextra> + $<$:/W4> ) + target_include_directories ( cmaes PUBLIC $ $ From dd1fc976ddd0565e03bcdf559caeb237fdb38e63 Mon Sep 17 00:00:00 2001 From: Philipp Basler <28863303+phbasler@users.noreply.github.com> Date: Thu, 5 Dec 2024 07:16:25 +0100 Subject: [PATCH 3/4] Add workflows for ubuntu and mac --- .github/workflows/test-mac.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/test-mac.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test-mac.yml b/.github/workflows/test-mac.yml new file mode 100644 index 00000000..58969b77 --- /dev/null +++ b/.github/workflows/test-mac.yml @@ -0,0 +1,32 @@ +name: Mac unit tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + +jobs: + mac-tests: + runs-on: macos-latest + if: "!contains(github.event.head_commit.message, 'skip-ci')" + + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - name : installPackages + run : brew install eigen boost boost-python3 libomp gflags + - name : install python packages + run: pip3 install numpy setuptools --break-system-packages + - name: Get number of CPU cores + uses: SimenB/github-actions-cpu-cores@v1 + id: cpu-cores + - name: cmake + run: mkdir build && cd build && cmake .. -DLIBCMAES_BUILD_PYTHON=On -DLIBCMAES_BUILD_TESTS=On -DLIBCMAES_USE_OPENMP=On + - name: compile + run: cd build && cmake --build . -j${{ steps.cpu-cores.outputs.count }} + - name: Run ctest + run: cd build && ctest -j${{ steps.cpu-cores.outputs.count }} --output-on-failure + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..57019d40 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Ubuntu unit tests + +on: + push: + branches: [ master] + pull_request: + branches: [ master, develop ] + workflow_dispatch: + + +jobs: + ubuntu-tests-fullSetup: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'skip-ci')" + + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - name : installPackages + run : sudo apt-get update && sudo apt-get install --no-install-recommends --yes libeigen3-dev libboost-all-dev libgflags-dev + - name : install python packages + run: pip3 install numpy + - name: Get number of CPU cores + uses: SimenB/github-actions-cpu-cores@v1 + id: cpu-cores + - name: cmake + run: mkdir build && cd build && cmake .. -DLIBCMAES_BUILD_PYTHON=On -DLIBCMAES_BUILD_TESTS=On -DLIBCMAES_USE_OPENMP=On + - name: compile + run: cd build && cmake --build . -j${{ steps.cpu-cores.outputs.count }} + - name: Run ctest + run: cd build && ctest -j${{ steps.cpu-cores.outputs.count }} --output-on-failure + + From 0f32362490760cc050c36ad8a692981e21a4643c Mon Sep 17 00:00:00 2001 From: Philipp Basler <28863303+phbasler@users.noreply.github.com> Date: Thu, 5 Dec 2024 07:30:49 +0100 Subject: [PATCH 4/4] Remove test workflows. They need the other PR --- .github/workflows/test-mac.yml | 32 -------------------------------- .github/workflows/test.yml | 34 ---------------------------------- 2 files changed, 66 deletions(-) delete mode 100644 .github/workflows/test-mac.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test-mac.yml b/.github/workflows/test-mac.yml deleted file mode 100644 index 58969b77..00000000 --- a/.github/workflows/test-mac.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Mac unit tests - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - workflow_dispatch: - -jobs: - mac-tests: - runs-on: macos-latest - if: "!contains(github.event.head_commit.message, 'skip-ci')" - - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - name : installPackages - run : brew install eigen boost boost-python3 libomp gflags - - name : install python packages - run: pip3 install numpy setuptools --break-system-packages - - name: Get number of CPU cores - uses: SimenB/github-actions-cpu-cores@v1 - id: cpu-cores - - name: cmake - run: mkdir build && cd build && cmake .. -DLIBCMAES_BUILD_PYTHON=On -DLIBCMAES_BUILD_TESTS=On -DLIBCMAES_USE_OPENMP=On - - name: compile - run: cd build && cmake --build . -j${{ steps.cpu-cores.outputs.count }} - - name: Run ctest - run: cd build && ctest -j${{ steps.cpu-cores.outputs.count }} --output-on-failure - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 57019d40..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Ubuntu unit tests - -on: - push: - branches: [ master] - pull_request: - branches: [ master, develop ] - workflow_dispatch: - - -jobs: - ubuntu-tests-fullSetup: - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, 'skip-ci')" - - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - name : installPackages - run : sudo apt-get update && sudo apt-get install --no-install-recommends --yes libeigen3-dev libboost-all-dev libgflags-dev - - name : install python packages - run: pip3 install numpy - - name: Get number of CPU cores - uses: SimenB/github-actions-cpu-cores@v1 - id: cpu-cores - - name: cmake - run: mkdir build && cd build && cmake .. -DLIBCMAES_BUILD_PYTHON=On -DLIBCMAES_BUILD_TESTS=On -DLIBCMAES_USE_OPENMP=On - - name: compile - run: cd build && cmake --build . -j${{ steps.cpu-cores.outputs.count }} - - name: Run ctest - run: cd build && ctest -j${{ steps.cpu-cores.outputs.count }} --output-on-failure - -