-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
136 lines (116 loc) · 5.16 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
cmake_minimum_required(VERSION 3.2.2)
project(ml_util)
set (ML_UTIL_VERSION_MAJOR 0)
set (ML_UTIL_VERSION_MINOR 2)
set (ML_UTIL_VERSION_PATCH 0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -lstdc++ -lpthread -ldl")
set(CTEST_ENVIRONMENT "LC_ALL=C")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/build")
if (APPLE)
add_definitions(-DGTEST_USE_OWN_TR1_TUPLE)
add_definitions(-D__GLIBCXX__)
endif (APPLE)
if (CMAKE_VERSION VERSION_LESS 3.2)
set(UPDATE_DISCONNECTED_IF_AVAILABLE "")
else()
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
endif()
include(CTest)
# manages deps
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 curl
# GIT_REPOSITORY https://github.com/curl/curl.git
# GIT_TAG master
# ${UPDATE_DISCONNECTED_IF_AVAILABLE})
# runtime deps
#add_subdirectory(${curl_SOURCE_DIR})
#include_directories(${curl_SOURCE_DIR}/include)
include_directories(${rapidjson_SOURCE_DIR}/include)
include_directories(${gnuplot-cpp_SOURCE_DIR})
include_directories(${loguru_SOURCE_DIR})
# setup 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 curl)
add_test( runTests build/runAllTests )
add_executable(runHistTests test/unit_test_history.cpp)
target_link_libraries(runHistTests gtest gmock_main pthread curl)
add_test( runHistTests build/runHistTests )
# build executables
add_executable(ml-hist src/mlhistory/main.cpp)
add_executable(ml-xq src/mlxq/main.cpp)
add_executable(ml-js src/mljs/main.cpp)
add_executable(ml-load src/mlload/main.cpp)
add_executable(ml-status src/mlstatus/main.cpp)
add_executable(ml-log src/mllog/main.cpp)
add_executable(ml-config src/mlconfigure/main.cpp)
add_executable(ml-browse src/mlbrowse/main.cpp)
# link curl
target_link_libraries(ml-hist curl)
target_link_libraries(ml-js curl)
target_link_libraries(ml-xq curl)
target_link_libraries(ml-load curl)
target_link_libraries(ml-status curl)
target_link_libraries(ml-config curl)
target_link_libraries(ml-log curl)
target_link_libraries(ml-browse curl)
# 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(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION . COMPONENT applications)
install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION . COMPONENT applications)
install(FILES ${CMAKE_SOURCE_DIR}/VERSION DESTINATION . COMPONENT applications)
install(FILES ${CMAKE_SOURCE_DIR}/etc/.ml-utils DESTINATION . COMPONENT applications)
install(FILES ${CMAKE_SOURCE_DIR}/etc/.ml-utils DESTINATION etc COMPONENT applications)
install(FILES ${CMAKE_SOURCE_DIR}/etc/basic.gnuplot DESTINATION etc COMPONENT applications)
install(FILES ${CMAKE_SOURCE_DIR}/etc/text.gnuplot DESTINATION etc COMPONENT applications)
#install(TARGETS ml-config RUNTIME DESTINATION bin COMPONENT applications)
install(TARGETS ml-hist RUNTIME DESTINATION bin COMPONENT applications)
install(TARGETS ml-status RUNTIME DESTINATION bin COMPONENT applications)
install(TARGETS ml-xq RUNTIME DESTINATION bin COMPONENT applications)
install(TARGETS ml-js RUNTIME DESTINATION bin COMPONENT applications)
install(TARGETS ml-log RUNTIME DESTINATION bin COMPONENT applications)
install(TARGETS ml-load RUNTIME DESTINATION bin COMPONENT applications)
install(TARGETS ml-config RUNTIME DESTINATION bin COMPONENT applications)
install(TARGETS ml-browse RUNTIME DESTINATION bin COMPONENT applications)
# cpack defs
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL applications)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MarkLogic commandline utilities")
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)