Skip to content

Commit

Permalink
added cmake script
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Jan 12, 2024
1 parent c077e92 commit a7e0fbd
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ configure_ccache()
# Dependency Handling
##############################################################

# set(CMAKE_FIND_DEBUG_MODE ON)

set(DEPENDENCY_NAMES_LIST benchmark boost googletest)
configure_dependencies("${DEPENDENCY_NAMES_LIST}")

Expand Down
8 changes: 5 additions & 3 deletions tests/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ project(integration_example VERSION "0.0.1" LANGUAGES C CXX)
list(APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/cmake"
)
# include("configure_dependencies")
include("configure_dependencies")


##############################################################
# Dependency Handling
##############################################################

# Add lokis dependencies
# configure_dependencies()
# set(CMAKE_FIND_DEBUG_MODE ON)

set(DEPENDENCY_NAMES_LIST loki)
configure_dependencies("${DEPENDENCY_NAMES_LIST}")


##############################################################
Expand Down
29 changes: 29 additions & 0 deletions tests/integration/cmake/configure_dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
macro(configure_dependencies list_of_dependencies)
# We installed the dependencies into the subdirectories under the install prefix.
# Hence must append them to the single cmake_prefix_path.
message("Configure dependencies of Loki:")
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
list(LENGTH CMAKE_PREFIX_PATH PREFIX_PATH_COUNT)
if(PREFIX_PATH_COUNT GREATER 1)
message(FATAL_ERROR "Only one prefix path is allowed. Found multiple paths in CMAKE_PREFIX_PATH. Please add dependencies to the CMake Superbuild.")
endif()

# Assuming there's only one path in CMAKE_PREFIX_PATH, get that path
list(GET CMAKE_PREFIX_PATH 0 SINGLE_CMAKE_PREFIX_PATH)

# Clear MODIFIED_CMAKE_PREFIX_PATH before appending
set(MODIFIED_CMAKE_PREFIX_PATH "")

# Iterate over list of names and append each to SINGLE_CMAKE_PREFIX_PATH
foreach(DEPENDENCY_NAME ${list_of_dependencies})
list(APPEND MODIFIED_CMAKE_PREFIX_PATH "${SINGLE_CMAKE_PREFIX_PATH}/${DEPENDENCY_NAME}")
endforeach()

# message(${MODIFIED_CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${MODIFIED_CMAKE_PREFIX_PATH})
message(STATUS "MODIFIED_CMAKE_PREFIX_PATH:")
foreach(CMAKE_PREFIX_PATH_ARG ${CMAKE_PREFIX_PATH})
message(STATUS "-- ${CMAKE_PREFIX_PATH_ARG}")
endforeach()
# set(CMAKE_FIND_DEBUG_MODE ON)
endmacro()
15 changes: 3 additions & 12 deletions tests/integration/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

// Test loki include
#include <loki/domain/parser.hpp>
#include <loki/problem/parser.hpp>

#include <iostream>
// Test boost include
#include <boost/container/small_vector.hpp>


int main() {
// Parse the domain
auto domain_parser = loki::DomainParser("data/gripper/domain.pddl");
const auto domain = domain_parser.get_domain();
std::cout << *domain << std::endl;

// Parse the problem
const auto problem_parser = loki::ProblemParser("data/gripper/p-2-0.pddl", domain_parser);
const auto problem = problem_parser.get_problem();
std::cout << *problem << std::endl;

return 0;
}

0 comments on commit a7e0fbd

Please sign in to comment.