-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
90 lines (66 loc) · 2.22 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
cmake_minimum_required(VERSION 3.13)
project(llserver_ecui_houbolt)
find_package(Threads REQUIRED)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
include_directories(include include/can_houbolt)
file(GLOB_RECURSE sources main.cpp src/*.cpp src/*.c include/*.h)
if(NO_PYTHON)
MESSAGE(STATUS "Python features are not used")
add_compile_definitions(NO_PYTHON)
list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/src/drivers/PythonController.cpp)
else()
include_directories(/usr/include/python3.8)
endif()
add_executable(${PROJECT_NAME} ${sources})
option(TEST "test with simple CAN Driver simulation" OFF)
if(TEST)
add_compile_definitions(TEST_LLSERVER)
endif()
if(NO_CANLIB)
MESSAGE(STATUS "Kvaser CanLib is not used")
add_compile_definitions(NO_CANLIB)
endif()
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
if(LINUX)
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads -lstdc++fs -latomic)
if(NOT NO_CANLIB)
target_link_libraries(${PROJECT_NAME} PRIVATE -lcanlib)
endif()
if(NOT NO_PYTHON)
target_link_libraries(${PROJECT_NAME} PRIVATE -lpython3.8)
endif()
else()
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
endif()
##----WITH BOOST
# cmake_minimum_required(VERSION 3.13)
# project(llserver_ecui_houbolt)
# find_package(Threads REQUIRED)
# set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# #if(NOT TARGET spdlog)
# # # Stand-alone build
# # find_package(spdlog REQUIRED)
# #endif()
# include_directories(include)
# file(GLOB sources ./*.cpp src/*.cpp include/*.h)
# set(Boost_USE_STATIC_LIBS OFF)
# set(Boost_USE_MULTITHREADED ON)
# set(Boost_USE_STATIC_RUNTIME OFF)
# find_package(Boost 1.45.0 COMPONENTS system)
# if(Boost_FOUND)
# add_executable(${PROJECT_NAME} ${sources})
# #spdlog_enable_warnings(${PROJECT_NAME})
# if(UNIX AND NOT APPLE)
# set(LINUX TRUE)
# endif()
# if(LINUX)
# target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads -lstdc++fs Boost::system)#spdlog::spdlog)
# else()
# target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads Boost::system)#spdlog::spdlog)
# endif()
# endif()