-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
153 lines (125 loc) · 6.5 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
cmake_minimum_required(VERSION 3.17)
#**************************************************************************************************
# General cMake settings
#**************************************************************************************************
project(Stryke)
#**************************************************************************************************
# Find Package ************************************************************************************
# Orc Dependency
find_package(protobuf CONFIG REQUIRED)
find_package (ZLIB REQUIRED)
find_package(Snappy CONFIG REQUIRED)
find_library(LZ4_LIBRARY NAMES lz4 liblz4 REQUIRED)
find_library(ZSTD_LIBRARY NAMES zstd REQUIRED)
find_library(ORC_LIBRARY NAMES orc liborc REQUIRED)
find_package(Catch2 CONFIG REQUIRED)
# get_cmake_property(_variableNames VARIABLES)
# list (SORT _variableNames)
# foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
# endforeach()
option(BUILD_PYTHON_BINDING "Build the unit tests" OFF)
set(CUSTOM_BINDING ${CMAKE_CURRENT_SOURCE_DIR}/python/custom_binding_example.cpp CACHE STRING "Build binding in the specified cpp")
if(BUILD_PYTHON_BINDING)
# Pybind11
# Pybind11 also set PYTHON_INCLUDE_DIRS and PYTHON_LIBRARIES
find_package(pybind11 CONFIG REQUIRED)
include_directories(${pybind11_INCLUDE_DIR})
MESSAGE( " *** PYTHON_INCLUDE_DIRS : " ${PYTHON_INCLUDE_DIRS} )
MESSAGE( " *** PYTHON_LIBRARIES : " ${PYTHON_LIBRARIES} )
include_directories(${PYTHON_INCLUDE_DIRS})
endif()
#**************************************************************************************************
# Include *****************************************************************************************
include_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/python)
#**************************************************************************************************
# Set variable ************************************************************************************
SET(SOURCES
)
set(examples
core_writer
csv_writer
csv_sequential
csv_performance
dispatch
dispatch_duplicate
dispatch_folder
merge_file
performance
reader_basic_type
reader_rainbow
sequential
sequential_duplicate
thread
writer_rainbow
)
#**************************************************************************************************
# Set compiler ************************************************************************************^
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
#**************************************************************************************************
# Linker ******************************************************************************************
#**************************************************************************************************
# Build Example
#**************************************************************************************************
option(BUILD_EXAMPLES "Build stryke example" OFF)
if(BUILD_EXAMPLES)
foreach (example ${examples})
add_executable("stryke_${example}" ${CMAKE_CURRENT_SOURCE_DIR}/example/cpp/${example}.cpp)
target_compile_options("stryke_${example}" PRIVATE -O3)
target_link_libraries("stryke_${example}" PRIVATE -lstdc++fs ${ORC_LIBRARY} Snappy::snappy ZLIB::ZLIB protobuf::libprotoc protobuf::libprotobuf ${LZ4_LIBRARY} ${ZSTD_LIBRARY})
endforeach(example)
endif()
#**************************************************************************************************
# Build Tests
#**************************************************************************************************
option(BUILD_UNIT_TESTS "Build the unit tests" OFF)
if(BUILD_UNIT_TESTS)
enable_testing()
SET(TEST_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-template-type.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-template-batch.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-template-lock.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-template-folder-creation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-template-col-name.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-dispatch-folder-encoding.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-dispatch-split.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-dispatch-col-name.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-sequential-closing.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-sequential-col-name.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-dispatch-duplicate-timestampnumber.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-dispatch-duplicate-col-name.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-sequential-duplicate-datenumber.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-sequential-duplicate-timestampnumber.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-sequential-duplicate-col-name.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-thread.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-thread-writer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp/unit-thread-folder-encoding.cpp
)
add_executable(unit-test ${TEST_SOURCES} ${SOURCES} ${TEST_HEADERS})
target_link_libraries(unit-test PRIVATE -lstdc++fs ${ORC_LIBRARY} Snappy::snappy ZLIB::ZLIB protobuf::libprotoc protobuf::libprotobuf ${LZ4_LIBRARY} ${ZSTD_LIBRARY})
add_test(NAME "unit_test_default"
COMMAND unit-test
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif()
#**************************************************************************************************
# Build Python Binding
#**************************************************************************************************
if(BUILD_PYTHON_BINDING)
add_library(stryke SHARED ${CMAKE_CURRENT_SOURCE_DIR}/python/stryke_binding.cpp ${CUSTOM_BINDING})
target_link_libraries(stryke PRIVATE -lstdc++fs ${ORC_LIBRARY} Snappy::snappy ZLIB::ZLIB protobuf::libprotoc protobuf::libprotobuf ${LZ4_LIBRARY} ${ZSTD_LIBRARY} ${PYTHON_LIBRARIES})
set_target_properties(stryke PROPERTIES PREFIX "")
install(TARGETS stryke DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/python/stryke)
endif()
#**************************************************************************************************
# Documentation generation
#**************************************************************************************************
add_custom_target(
docs
COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/docs/config_file
)