-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
78 lines (59 loc) · 2.53 KB
/
Copy pathCMakeLists.txt
File metadata and controls
78 lines (59 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cmake_minimum_required(VERSION 3.18)
project(DEMEProjects)
#=============================================================================
# CMake configuration file for DEME-only projects
#=============================================================================
message("\n building DEME-only projects")
#--------------------------------------------------------------
# List of all executables
#--------------------------------------------------------------
set(TESTS
WheelSimulator
)
#--------------------------------------------------------------
# Find required packages
#--------------------------------------------------------------
# Find CUDA for DEME
find_package(CUDAToolkit REQUIRED)
# Find DEME library
set(DEME_DIR "~/moonranger_mobility/DEM-Engine/build/DEME") # Set the DEME directory here if needed
list(APPEND CMAKE_PREFIX_PATH "${DEME_DIR}")
find_package(DEME REQUIRED)
# If DEME was not found, terminate the configuration
if(NOT DEME_FOUND)
message(FATAL_ERROR "Could not find DEM-Engine library. Please check the DEME install directory.")
return()
endif()
#--------------------------------------------------------------
# Include paths and libraries
#--------------------------------------------------------------
# Add DEME headers and source directory
include_directories(
${DEME_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
)
#--------------------------------------------------------------
# Set C++ standard and other flags
#--------------------------------------------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
#--------------------------------------------------------------
# Loop over all demo programs and build them
#--------------------------------------------------------------
MESSAGE(STATUS "Building DEME-only programs...")
foreach(PROGRAM ${TESTS})
message(STATUS "...adding ${PROGRAM}")
# Only add main.cpp and WheelSimulator.cpp to the WheelSimulator executable
if (${PROGRAM} STREQUAL "WheelSimulator")
ADD_EXECUTABLE(${PROGRAM} "main.cpp" "WheelSimulator.cpp" "Utils.cpp") # Include main.cpp here
else()
ADD_EXECUTABLE(${PROGRAM} "${PROGRAM}.cpp")
endif()
source_group("" FILES "${PROGRAM}.cpp")
# Add DEME library to each executable
target_link_libraries(${PROGRAM} PRIVATE DEME::simulator_multi_gpu)
# Define DEME data directory (if needed)
target_compile_definitions(${PROGRAM} PUBLIC "DEME_DATA_DIR=\"${DEME_DATA_DIRS}\"")
endforeach()