-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (83 loc) · 3.46 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
91
92
93
94
95
96
97
98
99
100
101
102
103
cmake_minimum_required(VERSION 3.2.2)
project(sdss_asteroid_detect)
set (ML_UTIL_VERSION_MAJOR 0)
set (ML_UTIL_VERSION_MINOR 1)
set (ML_UTIL_VERSION_PATCH 0)
set(CMAKE_CXX_STANDARD 14)
include(CTest)
include(DownloadProject.cmake)
download_project(PROJ googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
download_project(PROJ rapidjson
GIT_REPOSITORY https://github.com/miloyip/rapidjson.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
download_project(PROJ gnuplot-cpp
GIT_REPOSITORY https://github.com/orbitcowboy/gnuplot-cpp.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
download_project(PROJ loguru
GIT_REPOSITORY https://github.com/emilk/loguru.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
download_project(PROJ OpenCV
GIT_REPOSITORY https://github.com/opencv/opencv.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
download_project(PROJ curl
GIT_REPOSITORY https://github.com/curl/curl.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
#include_directories(${curl_SOURCE_DIR}/include)
include_directories(${rapidjson_SOURCE_DIR}/include)
include_directories(${gnuplot-cpp_SOURCE_DIR})
include_directories(${loguru_SOURCE_DIR})
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
find_package( curl REQUIRED )
include_directories( ${curl_INCLUDE_DIRS} )
# setup gtest testing
enable_testing()
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
if(NOT DISABLE_TESTS)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
endif()
# tests
add_executable(runAllTests test/unit_test_main.cpp)
target_link_libraries(runAllTests gtest gmock_main pthread ${OpenCV_LIBS} ${curl_LIBS})
add_test( runTests build/runAllTests )
# build command line utilities
set(NAIVE_DETECT_SOURCE_FILES src/naive_detect/main.cpp)
add_executable(naive_detect ${NAIVE_DETECT_SOURCE_FILES})
target_link_libraries(naive_detect ${OpenCV_LIBS} ${curl_LIBS})
set(VIDEO_DETECT_SOURCE_FILES src/example_video_test.cpp)
add_executable(video_test ${VIDEO_DETECT_SOURCE_FILES})
target_link_libraries(video_test ${OpenCV_LIBS} ${curl_LIBS})
# define what to include in release
install(TARGETS ${INS_TARGETS}
RUNTIME DESTINATION bin COMPONENT applications
LIBRARY DESTINATION lib COMPONENT libraries
ARCHIVE DESTINATION lib COMPONENT libraries
)
install(TARGETS naive_detect RUNTIME DESTINATION bin COMPONENT applications)
# cpack defs
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL applications)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "sdss asteroid detect")
set(CPACK_PACKAGE_VENDOR "James Fuller")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION_MAJOR "${ML_UTIL_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${ML_UTIL_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${ML_UTIL_VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
set(CPACK_SOURCE_GENERATOR "RPM")
include(CPack)