-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
44 lines (32 loc) · 1.55 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.2)
message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
project(simgrid-platform-inspector)
# Disable annoying warnings
add_definitions("-DBOOST_ALLOW_DEPRECATED_HEADERS")
add_definitions("-Wall -Wno-unused-variable -Wno-unused-private-field")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
# Find SimGrid, and Boost
find_package(SimGrid REQUIRED)
find_package(Boost REQUIRED)
find_package(Boost COMPONENTS program_options REQUIRED)
# include directories
include_directories(/usr/local/include/ /opt/local/include/ ${SimGrid_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
# Executable
add_executable(simgrid_platform_inspector src/main.cpp)
target_link_libraries(simgrid_platform_inspector
${SimGrid_LIBRARY}
${Boost_LIBRARIES}
)
# Custom target for the .so file
add_custom_target(shared_object_file ALL
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/sample_platform.so)
# Custom command for the .so file
add_custom_command(
OUTPUT sample_platform.so
COMMAND g++ -fPIC --std=c++17 -Wno-deprecated-builtins -I${SimGrid_INCLUDE_DIR} -I${Boost_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/sample_platform.cpp -c -o ${CMAKE_CURRENT_BINARY_DIR}/sample_platform.o
COMMAND g++ -fPIC -shared -fPIC ${CMAKE_CURRENT_BINARY_DIR}/sample_platform.o -o sample_platform.so ${SimGrid_LIBRARY}
DEPENDS ${CMAKE_SOURCE_DIR}/src/sample_platform.cpp
)
install(TARGETS simgrid_platform_inspector DESTINATION bin)