2019-11-15 00:23:43 +00:00
|
|
|
cmake_minimum_required (VERSION 3.7)
|
|
|
|
project(controller)
|
|
|
|
|
|
|
|
add_executable(controller main.c)
|
|
|
|
|
|
|
|
option(WIRING_PI_DEBUG "Use WiringPi Debugging Tool" OFF)
|
|
|
|
|
2020-04-13 22:50:55 +00:00
|
|
|
SET(CMAKE_C_FLAGS "-Wall -Wextra -lwiringPi -lwiringPiDev -luuid -llmdb -g")
|
2019-11-15 00:23:43 +00:00
|
|
|
|
2020-02-08 12:50:54 +00:00
|
|
|
string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
|
|
|
|
add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}")
|
|
|
|
|
2019-11-15 00:23:43 +00:00
|
|
|
if(WIRING_PI_DEBUG)
|
2020-02-09 23:58:17 +00:00
|
|
|
message("Using wiringPi debug calls")
|
2019-11-15 00:23:43 +00:00
|
|
|
add_compile_definitions("WIRING_PI_DEBUG")
|
|
|
|
endif(WIRING_PI_DEBUG)
|
|
|
|
|
2020-04-17 23:24:36 +00:00
|
|
|
aux_source_directory(vendor VENDOR_SRC) # vendor first to put their warnings on top
|
2019-11-15 00:23:43 +00:00
|
|
|
aux_source_directory(. SRC_DIR)
|
2020-04-13 22:50:55 +00:00
|
|
|
aux_source_directory(models MODELS_SRC)
|
|
|
|
aux_source_directory(helpers HELPERS_SRC)
|
|
|
|
aux_source_directory(handlers HANDLERS_SRC)
|
|
|
|
aux_source_directory(drivers DRIVERS_SRC)
|
2020-04-17 23:24:36 +00:00
|
|
|
aux_source_directory(runners RUNNERS_SRC)
|
2019-11-15 00:23:43 +00:00
|
|
|
|
2020-04-16 23:38:25 +00:00
|
|
|
configure_file("controller.ini" "controller.ini" COPYONLY)
|
|
|
|
|
2020-04-17 23:24:36 +00:00
|
|
|
target_sources(controller PRIVATE ${VENDOR_SRC} ${SRC_DIR} ${MODELS_SRC} ${HELPERS_SRC} ${HANDLERS_SRC} ${DRIVERS_SRC} ${RUNNERS_SRC})
|
2020-01-07 01:23:16 +00:00
|
|
|
target_include_directories(controller PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
2020-04-17 23:24:36 +00:00
|
|
|
target_include_directories(controller PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor)
|
2020-02-08 12:50:54 +00:00
|
|
|
|
|
|
|
add_custom_target(run
|
2020-04-17 23:24:36 +00:00
|
|
|
COMMAND ./controller start
|
2020-04-13 22:50:55 +00:00
|
|
|
DEPENDS controller
|
|
|
|
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
|
|
|
|
)
|
|
|
|
add_custom_target(debug
|
2020-04-17 23:24:36 +00:00
|
|
|
COMMAND valgrind ./controller start
|
2020-04-13 22:50:55 +00:00
|
|
|
DEPENDS controller
|
|
|
|
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
|
|
|
|
)
|
|
|
|
add_custom_target(debug-full
|
2020-04-17 23:24:36 +00:00
|
|
|
COMMAND valgrind --leak-check=full --show-leak-kinds=all ./controller start
|
2020-02-08 12:50:54 +00:00
|
|
|
DEPENDS controller
|
|
|
|
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
|
|
|
|
)
|
2020-02-09 23:58:17 +00:00
|
|
|
add_custom_target(docs
|
|
|
|
COMMAND doxygen
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|