-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
73 lines (54 loc) · 1.95 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
# PiPid CMake config
cmake_minimum_required(VERSION 3.1.0)
project(pipid-lib CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
###########################################################
option(UNIT_TEST "Build unit tests" OFF)
option(BUILD_TOOLS "Build tools" OFF)
###########################################################
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5Charts)
include_directories(include)
set(pipid_src
src/pid_controller.cpp
src/gui.cpp
src/encoder_counter.cpp
src/motor_driver.cpp
src/pid_controller.cpp
src/delegate_logger.cpp
src/sine.cpp
# AUTOMOC does not process headers automatically, add them manually
include/gui.h
include/delegate_logger.h
)
add_library(pipid STATIC ${pipid_src})
target_link_libraries(pipid Qt5::Core Qt5::Widgets Qt5::Charts wiringPi)
###########################################################
if(UNIT_TEST)
# Gui test
add_executable(gui_test test/gui_test.cpp)
target_link_libraries(gui_test pipid pthread)
# Incremental encoder class test
add_executable(incremental_encoder
test/incremental_encoder.cpp
src/encoder_counter.cpp)
target_compile_definitions(incremental_encoder PUBLIC PRINT_ENCODER)
target_link_libraries(incremental_encoder wiringPi)
# PWM unit test (motor driver)
add_executable(pwm_driver
test/pwm_driver.cpp
src/motor_driver.cpp)
target_link_libraries(pwm_driver wiringPi)
# Basic PID test w/ encoder & motor driver
add_executable(simple_pid
test/simple_pid.cpp)
target_link_libraries(simple_pid -lpthread wiringPi pipid)
# First order system step response simu w/ gui
add_executable(first_order_simu test/first_order_simu.cpp)
target_link_libraries(first_order_simu pipid pthread)
endif()
if(BUILD_TOOLS)
endif()