forked from simdjson/simdjson
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
120 lines (105 loc) · 3.47 KB
/
CMakeLists.txt
File metadata and controls
120 lines (105 loc) · 3.47 KB
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
if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") # icc / icpc
# prevent shared libraries from depending on Intel provided libraries
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel")
endif()
include(GNUInstallDirs)
# we default on a shared library.
if(SIMDJSON_BUILD_STATIC)
set(SIMDJSON_LIB_TYPE STATIC)
MESSAGE( STATUS "Building a static library." )
else()
MESSAGE( STATUS "Building a dynamic library (default)." )
set(SIMDJSON_LIB_TYPE SHARED)
endif()
MESSAGE( STATUS "SIMDJSON_LIB_TYPE: " ${SIMDJSON_LIB_TYPE})
# Bring in include files
include(../include/CMakeLists.txt)
set(SIMDJSON_SRC_DIR $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
set(SIMDJSON_SRC
jsonioutil.cpp
jsonminifier.cpp
jsonparser.cpp
jsonstream.cpp
stage1_find_marks.cpp
stage2_build_tape.cpp
parsedjson.cpp
parsedjsoniterator.cpp
simdjson.cpp
)
# Load headers and sources
set(SIMDJSON_SRC_HEADERS
jsoncharutils.h
simdprune_tables.h
arm64/bitmask.h
arm64/simd.h
arm64/bitmanipulation.h
arm64/intrinsics.h
arm64/stage1_find_marks.h
arm64/stage2_build_tape.h
arm64/stringparsing.h
arm64/numberparsing.h
generic/stage1_find_marks.h
generic/stage2_build_tape.h
generic/stage2_streaming_build_tape.h
generic/stringparsing.h
generic/numberparsing.h
generic/utf8_fastvalidate_algorithm.h
generic/utf8_lookup_algorithm.h
generic/utf8_lookup2_algorithm.h
generic/utf8_range_algorithm.h
generic/utf8_zwegner_algorithm.h
haswell/bitmask.h
haswell/bitmanipulation.h
haswell/intrinsics.h
haswell/simd.h
haswell/stage1_find_marks.h
haswell/stage2_build_tape.h
haswell/stringparsing.h
westmere/bitmanipulation.h
westmere/intrinsics.h
westmere/bitmask.h
westmere/simd.h
westmere/stage1_find_marks.h
westmere/stage2_build_tape.h
westmere/stringparsing.h
westmere/numberparsing.h
)
add_library(${SIMDJSON_LIB_NAME} ${SIMDJSON_LIB_TYPE} ${SIMDJSON_SRC} ${SIMDJSON_INCLUDE} ${SIMDJSON_SRC_HEADERS})
target_include_directories(${SIMDJSON_LIB_NAME}
PUBLIC
$<BUILD_INTERFACE:${SIMDJSON_SRC_DIR}>
$<BUILD_INTERFACE:${SIMDJSON_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
install(TARGETS ${SIMDJSON_LIB_NAME}
EXPORT ${SIMDJSON_LIB_NAME}-config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(EXPORT ${SIMDJSON_LIB_NAME}-config
FILE ${SIMDJSON_LIB_NAME}-config.cmake
NAMESPACE ${SIMDJSON_LIB_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${SIMDJSON_LIB_NAME}
)
if(NOT MSVC)
## We output the library at the root of the current directory where cmake is invoked
## This is handy but Visual Studio will happily ignore us
set_target_properties(${SIMDJSON_LIB_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
VERSION ${SIMDJSON_LIB_VERSION}
SOVERSION ${SIMDJSON_LIB_SOVERSION})
MESSAGE( STATUS "Library output directory (does not apply to Visual Studio): " ${CMAKE_BINARY_DIR})
endif()
if(MSVC AND (SIMDJSON_LIB_TYPE STREQUAL "SHARED"))
if (CMAKE_VERSION VERSION_LESS 3.4)
MESSAGE( STATUS "To build a Windows DLL using Visual Studio, you may need cmake 3.4 or better." )
endif()
MESSAGE( STATUS "Building a Windows DLL using Visual Studio, exporting all symbols automatically." )
set_target_properties(${SIMDJSON_LIB_NAME}
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
endif()
if(SIMDJSON_ENABLE_THREADS)
find_package(Threads REQUIRED)
target_link_libraries( ${SIMDJSON_LIB_NAME} Threads::Threads)
endif()