1
- if (${CMAKE_C_COMPILER_ID} MATCHES "Intel" ) # icc / icpc
2
- # prevent shared libraries from depending on Intel provided libraries
3
- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel" )
4
- endif ()
5
-
6
1
include (GNUInstallDirs)
7
2
8
- # we default on a shared library.
9
3
if (SIMDJSON_BUILD_STATIC)
10
- set (SIMDJSON_LIB_TYPE STATIC )
11
4
MESSAGE ( STATUS "Building a static library." )
5
+ add_library (simdjson STATIC "" )
12
6
else ()
13
- MESSAGE ( STATUS "Building a dynamic library (default) ." )
14
- set (SIMDJSON_LIB_TYPE SHARED)
7
+ MESSAGE ( STATUS "Building a dynamic library." )
8
+ add_library (simdjson SHARED "" )
15
9
endif ()
16
10
17
- MESSAGE ( STATUS "SIMDJSON_LIB_TYPE: " ${SIMDJSON_LIB_TYPE} )
18
-
19
- # Bring in include files
20
- include (../include /CMakeLists.txt)
11
+ target_sources (simdjson PRIVATE simdjson.cpp)
12
+ target_include_directories (simdjson PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /include >)
13
+ target_include_directories (simdjson PRIVATE .)
21
14
22
- set (SIMDJSON_SRC_DIR $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /src>)
23
-
24
- set (SIMDJSON_SRC
25
- simdjson.cpp
26
- )
27
-
28
- # Load headers and sources
29
- set (SIMDJSON_SRC_HEADERS
30
- error.cpp
31
- implementation.cpp
32
- isadetection.h
33
- simdprune_tables.h
34
- stage1_find_marks.cpp
35
- stage2_build_tape.cpp
36
- arm64/bitmanipulation.h
37
- arm64/bitmask.h
38
- arm64/implementation.h
39
- arm64/intrinsics.h
40
- arm64/numberparsing.h
41
- arm64/simd.h
42
- arm64/stage1_find_marks.h
43
- arm64/stage2_build_tape.h
44
- arm64/stringparsing.h
45
- fallback/implementation.h
46
- fallback/stage1_find_marks.h
47
- fallback/stage2_build_tape.h
48
- generic/atomparsing.h
49
- generic/json_scanner.h
50
- generic/json_string_scanner.h
51
- generic/json_structural_indexer.h
52
- generic/numberparsing.h
53
- generic/stage2_build_tape.h
54
- generic/stage2_streaming_build_tape.h
55
- generic/stringparsing.h
56
- generic/utf8_fastvalidate_algorithm.h
57
- generic/utf8_lookup_algorithm.h
58
- generic/utf8_lookup2_algorithm.h
59
- generic/utf8_range_algorithm.h
60
- generic/utf8_zwegner_algorithm.h
61
- haswell/bitmanipulation.h
62
- haswell/bitmask.h
63
- haswell/implementation.h
64
- haswell/intrinsics.h
65
- haswell/numberparsing.h
66
- haswell/simd.h
67
- haswell/stage1_find_marks.h
68
- haswell/stage2_build_tape.h
69
- haswell/stringparsing.h
70
- document_parser_callbacks.h
71
- westmere/bitmanipulation.h
72
- westmere/bitmask.h
73
- westmere/implementation.h
74
- westmere/intrinsics.h
75
- westmere/numberparsing.h
76
- westmere/simd.h
77
- westmere/stage1_find_marks.h
78
- westmere/stage2_build_tape.h
79
- westmere/stringparsing.h
80
- )
81
- set_source_files_properties (${SIMDJSON_SRC_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE )
15
+ if (${CMAKE_C_COMPILER_ID} MATCHES "Intel" ) # icc / icpc
16
+ # prevent shared libraries from depending on Intel provided libraries
17
+ target_link_options (simdjson PUBLIC "-static-intel" )
18
+ endif ()
82
19
83
- add_library (${SIMDJSON_LIB_NAME} ${SIMDJSON_LIB_TYPE} ${SIMDJSON_SRC} ${SIMDJSON_INCLUDE} ${SIMDJSON_SRC_HEADERS} )
20
+ if (SIMDJSON_ENABLE_THREADS)
21
+ find_package (Threads REQUIRED)
22
+ target_link_libraries (simdjson PRIVATE Threads::Threads)
23
+ endif ()
84
24
85
- target_include_directories (${SIMDJSON_LIB_NAME}
86
- PUBLIC
87
- $<BUILD_INTERFACE:${SIMDJSON_SRC_DIR} >
88
- $<BUILD_INTERFACE:${SIMDJSON_INCLUDE_DIR} >
89
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
90
- )
25
+ # Installation
91
26
92
- install (TARGETS ${SIMDJSON_LIB_NAME}
93
- EXPORT ${SIMDJSON_LIB_NAME} -config
27
+ install (TARGETS simdjson
28
+ EXPORT simdjson -config
94
29
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
95
30
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
96
31
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
97
32
)
98
33
99
- install (EXPORT ${SIMDJSON_LIB_NAME} -config
100
- FILE ${SIMDJSON_LIB_NAME} -config.cmake
101
- NAMESPACE ${SIMDJSON_LIB_NAME} ::
102
- DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/${SIMDJSON_LIB_NAME}
34
+ install (EXPORT simdjson -config
35
+ FILE simdjson -config.cmake
36
+ NAMESPACE simdjson ::
37
+ DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/simdjson
103
38
)
104
39
105
40
if (NOT MSVC )
106
41
## We output the library at the root of the current directory where cmake is invoked
107
42
## This is handy but Visual Studio will happily ignore us
108
- set_target_properties (${SIMDJSON_LIB_NAME} PROPERTIES
109
- LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
110
- VERSION ${SIMDJSON_LIB_VERSION}
111
- SOVERSION ${SIMDJSON_LIB_SOVERSION} )
43
+ set_target_properties (simdjson PROPERTIES
44
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} )
112
45
MESSAGE ( STATUS "Library output directory (does not apply to Visual Studio): " ${CMAKE_BINARY_DIR} )
113
46
endif ()
114
47
@@ -121,12 +54,7 @@ if(MSVC AND (SIMDJSON_LIB_TYPE STREQUAL "SHARED"))
121
54
MESSAGE ( STATUS "To build a Windows DLL using Visual Studio, you may need cmake 3.4 or better." )
122
55
endif ()
123
56
MESSAGE ( STATUS "Building a Windows DLL using Visual Studio, exporting all symbols automatically." )
124
- set_target_properties (${SIMDJSON_LIB_NAME}
57
+ set_target_properties (simdjson
125
58
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
126
59
endif ()
127
60
128
- if (SIMDJSON_ENABLE_THREADS)
129
- find_package (Threads REQUIRED)
130
- target_link_libraries ( ${SIMDJSON_LIB_NAME} Threads::Threads)
131
- endif ()
132
-
0 commit comments