From f7e5af7390e37a5c4047f02cc3995d9ef791daa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jason=20Mar=C3=A9chal?= <45510813+JasonMarechal25@users.noreply.github.com> Date: Fri, 20 Sep 2024 00:24:56 +0200 Subject: [PATCH] Fix or-tools integration (#2402) Update to properly handle new [or-tools-rte repository](https://github.com/rte-france/or-tools-rte) --- ortools_tag | 2 +- src/CMakeLists.txt | 25 ++++++++++++++----------- src/solver/simulation/CMakeLists.txt | 7 ++++--- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ortools_tag b/ortools_tag index ef2956ed2d..88446ca998 100644 --- a/ortools_tag +++ b/ortools_tag @@ -1 +1 @@ -v9.10-rte1.0 \ No newline at end of file +v9.10-rte1.2 \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6631922410..43358fa472 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -207,8 +207,8 @@ find_package(sirius_solver REQUIRED) find_package(ortools) if(NOT ortools_FOUND OR BUILD_ORTOOLS) message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") - FetchContent_Declare(ortools - GIT_REPOSITORY "https://github.com/rte-france/or-tools-rte" + FetchContent_Declare(ortools-rte + GIT_REPOSITORY "https://github.com/rte-france/or-tools-rte.git" GIT_TAG ${ORTOOLS_TAG} GIT_SHALLOW TRUE ) @@ -226,8 +226,11 @@ message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") # In mode optimization error analysis, we call Sirius through or-tools # So we need to activate Sirius in or-tools configuration (OFF by default) set(USE_SIRIUS "ON" CACHE INTERNAL "") + set(ortools_REPO "https://github.com/google/or-tools.git") + string(REGEX MATCH "^[^-]+" OFFICIAL_TAG ${ORTOOLS_TAG}) + set(ortools_REF ${OFFICIAL_TAG}) - FetchContent_MakeAvailable(ortools) + FetchContent_MakeAvailable(ortools-rte) endif() find_package(minizip-ng QUIET) @@ -243,7 +246,7 @@ else () endif () #wxWidget not needed for all library find is done in ui CMakeLists.txt -if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) +if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) #Add cmake directory to CMAKE_MODULE_PATH to use specific FindwxWidgets package needed for vcpkg list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wxWidgets") endif() @@ -294,7 +297,7 @@ OMESSAGE("") - + # Informations for NSIS if(WIN32 OR WIN64) if(MSVC) @@ -310,7 +313,7 @@ if(WIN32 OR WIN64) set(COMPILER_MARK "m") set(COMPILER_INCLUDE "mingw") endif(MSVC) - + set(CPACK_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR}/distrib/win32 ${CPACK_MODULE_PATH}) # Configure file with custom definitions for NSIS. @@ -318,17 +321,17 @@ if(WIN32 OR WIN64) ${PROJECT_SOURCE_DIR}/distrib/win32/version.cmake ${CMAKE_CURRENT_BINARY_DIR}/distrib/win32/version.nsh ) - + configure_file( ${PROJECT_SOURCE_DIR}/distrib/win32/build.template.cmake ${CMAKE_CURRENT_BINARY_DIR}/distrib/win32/build.nsh ) - + configure_file( ${PROJECT_SOURCE_DIR}/distrib/win32/make-zip-from-installer.cmake ${CMAKE_CURRENT_BINARY_DIR}/distrib/win32/make-zip-from-installer.bat ) - + SET(ANTARES_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) # Define system libraries so NSIS can package these files @@ -349,7 +352,7 @@ if(WIN32 OR WIN64) ${CMAKE_CURRENT_BINARY_DIR}/distrib/win32/NSIS.template.in @ONLY ) - + #Define cpack install script to checkout examples configure_file( ${PROJECT_SOURCE_DIR}/distrib/CMakeLists.txt.in @@ -368,7 +371,7 @@ else() if(CMAKE_SYSTEM_NAME MATCHES "Linux") get_linux_lsb_release_information() message(STATUS "Linux ${LSB_RELEASE_ID_SHORT} ${LSB_RELEASE_VERSION_SHORT} ${LSB_RELEASE_CODENAME_SHORT}") - set(CPACK_SYSTEM_NAME "${LSB_RELEASE_ID_SHORT}-${LSB_RELEASE_VERSION_SHORT}") + set(CPACK_SYSTEM_NAME "${LSB_RELEASE_ID_SHORT}-${LSB_RELEASE_VERSION_SHORT}") endif() #For now only test deb, need to define several CPACK variable diff --git a/src/solver/simulation/CMakeLists.txt b/src/solver/simulation/CMakeLists.txt index b54d722e17..8ba67f0e73 100644 --- a/src/solver/simulation/CMakeLists.txt +++ b/src/solver/simulation/CMakeLists.txt @@ -27,7 +27,7 @@ set(SRC_SIMULATION include/antares/solver/simulation/solver.hxx include/antares/solver/simulation/solver.data.h solver.data.cpp - include/antares/solver/simulation/simulation-run.h + include/antares/solver/simulation/simulation-run.h simulation-run.cpp include/antares/solver/simulation/common-eco-adq.h common-eco-adq.cpp @@ -45,8 +45,8 @@ set(SRC_SIMULATION adequacy_patch_runtime_data.cpp include/antares/solver/simulation/ITimeSeriesNumbersWriter.h TimeSeriesNumbersWriter.cpp - include/antares/solver/simulation/BindingConstraintsTimeSeriesNumbersWriter.h - include/antares/solver/simulation/ISimulationObserver.h + include/antares/solver/simulation/BindingConstraintsTimeSeriesNumbersWriter.h + include/antares/solver/simulation/ISimulationObserver.h ) source_group("simulation" FILES ${SRC_SIMULATION}) @@ -54,6 +54,7 @@ source_group("simulation" FILES ${SRC_SIMULATION}) # --- Library VARIABLES --- # add_library(antares-solver-simulation) +add_library(Antares::antares-solver-simulation ALIAS antares-solver-simulation) target_sources(antares-solver-simulation PRIVATE ${SRC_SIMULATION})