-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·49 lines (35 loc) · 1.97 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
cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR)
include(FindPkgConfig)
project (wavedcc)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(ignoreMe "${USE_PIGPIOD_IF}")
option(USE_PIGPIOD_IF "Enables GPIO interface through the pigpiod daemon" ON)
option(USE_PIGPIO "Enables direct GPIO interface, requires root" OFF)
find_package(Threads REQUIRED)
find_package(pigpio REQUIRED)
add_library(dccpacket OBJECT dccpacket.cpp)
add_library(dccengine OBJECT dccengine.cpp)
add_library(DatagramSocket OBJECT DatagramSocket.cpp)
add_executable(wavedcc wavedcc.cpp)
add_executable(wavedccd wavedccd.cpp)
add_executable(dcclog dcclog.cpp)
target_link_libraries(dcclog DatagramSocket)
if (USEPIGPIOD_IF)
set(CMAKE_CXX_FLAGS "-DUSE_PIGPIOD_IF")
target_include_directories(wavedcc SYSTEM PUBLIC ${PIGPIO_INCLUDE_DIR})
target_link_libraries(wavedcc dccengine dccpacket DatagramSocket Threads::Threads ${pigpiod_if2_LIBRARY})
target_include_directories(wavedccd SYSTEM PUBLIC ${PIGPIO_INCLUDE_DIR})
target_link_libraries(wavedccd dccengine dccpacket DatagramSocket Threads::Threads ${pigpiod_if2_LIBRARY})
elseif (USE_PIGPIO)
target_include_directories(wavedcc PRIVATE ${pigpio_INCLUDE_DIR} )
target_link_libraries(wavedcc dccengine dccpacket DatagramSocket Threads::Threads ${pigpio_LIBRARY})
target_include_directories(wavedccd PRIVATE ${pigpio_INCLUDE_DIRS} )
target_link_libraries(wavedccd dccengine dccpacket DatagramSocket Threads::Threads ${pigpio_LIBRARY})
else() #default is to use the pigpiod interface... (USE_PIGPIOD_IF still works)
set(CMAKE_CXX_FLAGS "-DUSE_PIGPIOD_IF")
target_include_directories(wavedcc SYSTEM PUBLIC ${PIGPIO_INCLUDE_DIR})
target_link_libraries(wavedcc dccengine dccpacket DatagramSocket Threads::Threads ${pigpiod_if2_LIBRARY})
target_include_directories(wavedccd SYSTEM PUBLIC ${PIGPIO_INCLUDE_DIR})
target_link_libraries(wavedccd dccengine dccpacket DatagramSocket Threads::Threads ${pigpiod_if2_LIBRARY})
endif()