2020-05-05 09:42:02 +00:00
|
|
|
cmake_minimum_required (VERSION 3.7)
|
2019-09-01 17:34:50 +00:00
|
|
|
project(core)
|
2019-07-12 19:05:56 +00:00
|
|
|
|
2020-05-05 09:42:02 +00:00
|
|
|
add_executable(core main.c)
|
2019-07-12 19:05:56 +00:00
|
|
|
|
2020-05-24 23:10:37 +00:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wpedantic -Werror -Wall -Wextra -luuid -lsqlite3 -g -fprofile-arcs -ftest-coverage")
|
2019-07-12 19:05:56 +00:00
|
|
|
|
2020-05-05 09:42:02 +00:00
|
|
|
string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
|
|
|
|
add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}")
|
2019-09-01 17:34:50 +00:00
|
|
|
|
2020-05-05 09:42:02 +00:00
|
|
|
add_definitions("-DMG_ENABLE_EXTRA_ERRORS_DESC")
|
2019-09-08 17:54:38 +00:00
|
|
|
|
2020-05-05 09:42:02 +00:00
|
|
|
aux_source_directory(vendor VENDOR_SRC) # vendor first to put their warnings on top
|
|
|
|
aux_source_directory(. SRC_DIR)
|
|
|
|
aux_source_directory(models MODELS_SRC)
|
|
|
|
aux_source_directory(helpers HELPERS_SRC)
|
|
|
|
aux_source_directory(handlers HANDLERS_SRC)
|
2020-05-10 20:37:55 +00:00
|
|
|
aux_source_directory(endpoints ENDPOINTS_SRC)
|
2019-09-01 17:34:50 +00:00
|
|
|
|
2020-05-05 09:42:02 +00:00
|
|
|
configure_file("core.ini" "core.ini" COPYONLY)
|
2019-09-01 17:34:50 +00:00
|
|
|
|
2020-05-10 20:37:55 +00:00
|
|
|
target_sources(core PRIVATE ${VENDOR_SRC} ${SRC_DIR} ${HANDLERS_SRC} ${HELPERS_SRC} ${MODELS_SRC} ${ENDPOINTS_SRC})
|
2020-05-05 09:42:02 +00:00
|
|
|
target_include_directories(core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
target_include_directories(core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor)
|
2019-07-12 19:05:56 +00:00
|
|
|
|
2020-02-23 00:12:39 +00:00
|
|
|
|
2020-02-23 19:06:14 +00:00
|
|
|
add_custom_target(migrations
|
|
|
|
COMMAND ./compile_migrations.sh
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
|
2020-02-23 00:12:39 +00:00
|
|
|
add_custom_target(run
|
2020-05-05 09:42:02 +00:00
|
|
|
COMMAND ./core start
|
2020-02-23 00:12:39 +00:00
|
|
|
DEPENDS core
|
|
|
|
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
|
|
|
|
)
|
2020-04-23 15:00:12 +00:00
|
|
|
add_custom_target(debug
|
2020-05-05 09:42:02 +00:00
|
|
|
COMMAND valgrind ./core start
|
2020-04-23 15:00:12 +00:00
|
|
|
DEPENDS core
|
|
|
|
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
|
|
|
|
)
|
|
|
|
add_custom_target(debug-full
|
2020-05-05 09:42:02 +00:00
|
|
|
COMMAND valgrind --leak-check=full --show-leak-kinds=all ./core start
|
2020-04-23 15:00:12 +00:00
|
|
|
DEPENDS core
|
|
|
|
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
|
|
|
|
)
|
2020-05-05 09:42:02 +00:00
|
|
|
add_custom_target(docs
|
|
|
|
COMMAND doxygen
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
2020-02-23 19:06:14 +00:00
|
|
|
|
|
|
|
add_custom_target(test
|
2020-05-10 20:37:55 +00:00
|
|
|
COMMAND ./run_tests.sh ${CMAKE_BINARY_DIR}/core "dev"
|
2020-02-23 19:06:14 +00:00
|
|
|
DEPENDS core
|
2020-05-05 20:29:04 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
|
|
|
)
|
2020-05-24 23:10:37 +00:00
|
|
|
add_custom_target(coverage
|
|
|
|
COMMAND gcovr -s --root ${CMAKE_SOURCE_DIR} -e ${CMAKE_SOURCE_DIR}/vendor --html-details ${CMAKE_BINARY_DIR}/coverage.html --html-title "Emgauwa Core Coverage" ${CMAKE_BINARY_DIR}/CMakeFiles/core.dir
|
|
|
|
DEPENDS test
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-02-23 19:06:14 +00:00
|
|
|
)
|