Skip to content

Commit

Permalink
Add build options for oRatio executable and API; update subproject re…
Browse files Browse the repository at this point in the history
…ferences
  • Loading branch information
riccardodebenedictis committed Nov 11, 2024
1 parent 86aa253 commit 756b6ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ enable_testing()
set(JSON_INCLUDE_UTILS OFF CACHE BOOL "Enable JSON Utils" FORCE)
set(BUILD_LISTENERS ON CACHE BOOL "Builds oRatio listeners" FORCE)

add_subdirectory(extern/riddle)
add_subdirectory(extern/semitone)
option(CHECK_INCONSISTENCIES "Check inconsistencies at each step" OFF)
option(ENABLE_API "oRatio API" OFF)
option(BUILD_EXECUTABLE "Build oRatio executable" ON)
if(BUILD_EXECUTABLE)
set(ENABLE_API ON CACHE BOOL "oRatio API" FORCE)
endif()

set(TEMPORAL_NETWORK_TYPES LRA DL)
set(TEMPORAL_NETWORK_TYPE LRA CACHE STRING "Temporal network type")
Expand All @@ -29,9 +33,8 @@ if(${HEURISTIC_TYPE_INDEX} EQUAL -1)
endif()
message(STATUS "Heuristic type: ${HEURISTIC_TYPE}")

option(CHECK_INCONSISTENCIES "Check inconsistencies at each step" OFF)
option(ENABLE_API "oRatio API" OFF)
option(BUILD_EXECUTABLE "Build oRatio executable" ON)
add_subdirectory(extern/riddle)
add_subdirectory(extern/semitone)

add_library(oRatioLib src/solver.cpp src/graph.cpp src/flaw.cpp src/resolver.cpp src/smart_type.cpp src/flaws/atom_flaw.cpp src/flaws/bool_flaw.cpp src/flaws/disj_flaw.cpp src/flaws/disjunction_flaw.cpp src/flaws/enum_flaw.cpp src/types/agent.cpp src/types/state_variable.cpp src/types/consumable_resource.cpp src/types/reusable_resource.cpp $<$<BOOL:${ENABLE_API}>:${CMAKE_CURRENT_SOURCE_DIR}/src/solver_api.cpp>)
add_dependencies(oRatioLib RiDDLe SeMiTONE)
Expand Down Expand Up @@ -74,7 +77,6 @@ endif()

message(STATUS "Build oRatio executable: ${BUILD_EXECUTABLE}")
if(BUILD_EXECUTABLE)
set(ENABLE_API ON CACHE BOOL "oRatio API" FORCE)
add_executable(oRatio src/main.cpp src/solver_api.cpp)
add_dependencies(oRatio oRatioLib)
target_link_libraries(oRatio PRIVATE oRatioLib)
Expand Down
2 changes: 1 addition & 1 deletion extern/semitone
Submodule semitone updated 1 files
+9 −7 CMakeLists.txt
5 changes: 4 additions & 1 deletion src/types/reusable_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ namespace ratio

for (const auto &[rr, atms] : rr_instances)
{
json::json tl{{"id", get_id(*rr)}, {"type", REUSABLE_RESOURCE_TYPE_NAME}, {"name", get_solver().guess_name(*rr)}};
json::json tl{{"id", get_id(*rr)}, {"type", REUSABLE_RESOURCE_TYPE_NAME}};
#ifdef COMPUTE_NAMES
tl["name"] = get_solver().guess_name(*rr);
#endif

const auto c_capacity = get_solver().arithmetic_value(*std::static_pointer_cast<riddle::arith_item>(rr->get(REUSABLE_RESOURCE_CAPACITY_NAME)));
tl[REUSABLE_RESOURCE_CAPACITY_NAME] = to_json(c_capacity);
Expand Down

0 comments on commit 756b6ae

Please sign in to comment.