From 74fe3a4ff6ca3c40c35c9e77af68a613006b75dd Mon Sep 17 00:00:00 2001 From: Florian Fontan Date: Fri, 12 Apr 2024 23:57:10 +0200 Subject: [PATCH] Update cmake files --- .github/workflows/build.yml | 8 ++++---- README.md | 7 ++++--- extern/CMakeLists.txt | 2 +- scripts/run_tests.py | 4 ++-- src/knapsack/CMakeLists.txt | 1 + src/multiple_choice_subset_sum/CMakeLists.txt | 1 + src/subset_sum/CMakeLists.txt | 1 + 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 292419c..1cd0d7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,8 @@ jobs: - name: Build run: | cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - cmake --build build --parallel - cmake --install build --prefix install + cmake --build build --config Release --parallel + cmake --install build --config Release --prefix install - name: Run unit tests working-directory: build/test run: ctest --parallel @@ -48,8 +48,8 @@ jobs: - name: Build run: | cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - cmake --build build --parallel - cmake --install build --prefix install + cmake --build build --config Release --parallel + cmake --install build --config Release --prefix install - name: Run tests run: python3 -u scripts/run_tests.py test_results_ref - name: Process tests diff --git a/README.md b/README.md index 51bb217..83c9856 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,8 @@ Here are some usage examples of this library: Compile: ```shell cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -cmake --build build --parallel +cmake --build build --config Release --parallel +cmake --install build --config Release --prefix install ``` Download data: @@ -84,7 +85,7 @@ python3 scripts/download_data.py Solve: ```shell -./build/src/knapsack/KnapsackSolver_knapsack --verbosity-level 1 --algorithm dynamic-programming-primal-dual --input data/knapsack/largecoeff/knapPI_2_10000_10000000/knapPI_2_10000_10000000_50.csv --format pisinger +./install/bin/knapsacksolver_knapsack --verbosity-level 1 --algorithm dynamic-programming-primal-dual --input data/knapsack/largecoeff/knapPI_2_10000_10000000/knapPI_2_10000_10000000_50.csv --format pisinger ``` ``` ==================================== @@ -205,7 +206,7 @@ Feasible: 1 ``` ```shell -./build/src/subset_sum/KnapsackSolver_subset_sum --verbosity-level 1 --input data/subset_sum/pthree/pthree_1000_1 --algorithm dynamic-programming-bellman-word-ram-rec +./install/bin/knapsacksolver_subset_sum --verbosity-level 1 --input data/subset_sum/pthree/pthree_1000_1 --algorithm dynamic-programming-bellman-word-ram-rec ``` ``` ==================================== diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index e25b6a3..86a0f2a 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -17,6 +17,6 @@ FetchContent_MakeAvailable(Boost) FetchContent_Declare( optimizationtools GIT_REPOSITORY https://github.com/fontanf/optimizationtools.git - GIT_TAG 95bd5064ef65ea964fe00a1547c2a556cd98d588) + GIT_TAG 33a3966ece149d390ec7ce08699669b5267e64aa) #SOURCE_DIR "${PROJECT_SOURCE_DIR}/../optimizationtools/") FetchContent_MakeAvailable(optimizationtools) diff --git a/scripts/run_tests.py b/scripts/run_tests.py index 9987dd7..be2f465 100644 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -16,7 +16,7 @@ knapsack_main = os.path.join( "install", "bin", - "KnapsackSolver_knapsack_main") + "knapsacksolver_knapsack") knapsack_data = os.environ['KNAPSACK_DATA'] @@ -54,7 +54,7 @@ subset_sum_main = os.path.join( "install", "bin", - "KnapsackSolver_subset_sum_main") + "knapsacksolver_subset_sum") subset_sum_data = os.environ['SUBSET_SUM_DATA'] diff --git a/src/knapsack/CMakeLists.txt b/src/knapsack/CMakeLists.txt index c9622e0..44e71a4 100644 --- a/src/knapsack/CMakeLists.txt +++ b/src/knapsack/CMakeLists.txt @@ -23,6 +23,7 @@ target_link_libraries(KnapsackSolver_knapsack_main PUBLIC KnapsackSolver_knapsack_dynamic_programming_bellman KnapsackSolver_knapsack_dynamic_programming_primal_dual Boost::program_options) +set_target_properties(KnapsackSolver_knapsack_main PROPERTIES OUTPUT_NAME "knapsacksolver_knapsack" ) install(TARGETS KnapsackSolver_knapsack_main DESTINATION bin) add_library(KnapsackSolver_knapsack_generator) diff --git a/src/multiple_choice_subset_sum/CMakeLists.txt b/src/multiple_choice_subset_sum/CMakeLists.txt index 68c1a9f..7cd454a 100644 --- a/src/multiple_choice_subset_sum/CMakeLists.txt +++ b/src/multiple_choice_subset_sum/CMakeLists.txt @@ -18,4 +18,5 @@ target_sources(KnapsackSolver_multiple_choice_subset_sum_main PRIVATE target_link_libraries(KnapsackSolver_multiple_choice_subset_sum_main PUBLIC KnapsackSolver_multiple_choice_subset_sum_dynamic_programming_bellman Boost::program_options) +set_target_properties(KnapsackSolver_multiple_choice_subset_sum_main PROPERTIES OUTPUT_NAME "knapsacksolver_multiple_choice_subset_sum" ) install(TARGETS KnapsackSolver_multiple_choice_subset_sum_main DESTINATION bin) diff --git a/src/subset_sum/CMakeLists.txt b/src/subset_sum/CMakeLists.txt index 9f7feef..f083e6f 100644 --- a/src/subset_sum/CMakeLists.txt +++ b/src/subset_sum/CMakeLists.txt @@ -20,6 +20,7 @@ target_link_libraries(KnapsackSolver_subset_sum_main PUBLIC KnapsackSolver_subset_sum_dynamic_programming_balancing KnapsackSolver_subset_sum_dynamic_programming_primal_dual Boost::program_options) +set_target_properties(KnapsackSolver_subset_sum_main PROPERTIES OUTPUT_NAME "knapsacksolver_subset_sum" ) install(TARGETS KnapsackSolver_subset_sum_main DESTINATION bin) add_library(KnapsackSolver_subset_sum_generator)