@@ -16,9 +16,11 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
1616include (AppendCompilerFlags)
1717
1818
19- project (FastPFor CXX C)
19+ project (FastPFOR CXX C)
2020set (PROJECT_URL "https://github.com/lemire/FastPFOR" )
2121set (PROJECT_DESCRIPTION "The FastPFOR C++ library: Fast integer compression" )
22+ # Need to bump this when we release a new version.
23+ set (PROJECT_VERSION "0.1.9" )
2224
2325include (DetectCPUFeatures)
2426#
@@ -106,17 +108,16 @@ MESSAGE( STATUS "CMAKE_C_FLAGS_RELEASE: " ${CMAKE_C_FLAGS_RELEASE} )
106108
107109# library target
108110include_directories (headers)
109- add_library (FastPFor STATIC src/bitpacking.cpp
110- src/bitpacking.cpp
111- src/bitpackingaligned.cpp
112- src/bitpackingunaligned.cpp
113- src/horizontalbitpacking.cpp
114- src/simdunalignedbitpacking.cpp
115- src/simdbitpacking.cpp
116- src/varintdecode.c
117- src/streamvbyte.c
118- ${HEADERS}
119- )
111+ add_library (FastPFOR STATIC
112+ src/bitpacking.cpp
113+ src/bitpackingaligned.cpp
114+ src/bitpackingunaligned.cpp
115+ src/horizontalbitpacking.cpp
116+ src/simdunalignedbitpacking.cpp
117+ src/simdbitpacking.cpp
118+ src/varintdecode.c
119+ src/streamvbyte.c)
120+ set_target_properties (FastPFOR PROPERTIES POSITION_INDEPENDENT_CODE TRUE )
120121
121122
122123# other executables
@@ -125,11 +126,11 @@ add_executable(partitionbylength src/partitionbylength.cpp)
125126add_executable (csv2maropu src/csv2maropu.cpp)
126127
127128add_executable (entropy src/entropy.cpp)
128- target_link_libraries (entropy FastPFor )
129+ target_link_libraries (entropy FastPFOR )
129130
130131if ( SUPPORT_SSE42 )
131132 add_executable (benchbitpacking src/benchbitpacking.cpp)
132- target_link_libraries (benchbitpacking FastPFor )
133+ target_link_libraries (benchbitpacking FastPFOR )
133134endif ()
134135
135136find_package (snappy)
@@ -142,11 +143,11 @@ else()
142143 include_directories (${snappy_INCLUDE_DIRS} )
143144 add_executable (codecssnappy src/codecs.cpp)
144145 set_target_properties (codecssnappy PROPERTIES DEFINE_SYMBOL USESNAPPY)
145- target_link_libraries (codecssnappy FastPFor ${snappy_LIBRARIES} )
146+ target_link_libraries (codecssnappy FastPFOR ${snappy_LIBRARIES} )
146147
147148 add_executable (inmemorybenchmarksnappy src/inmemorybenchmark.cpp)
148149 set_target_properties (inmemorybenchmarksnappy PROPERTIES DEFINE_SYMBOL USESNAPPY)
149- target_link_libraries (inmemorybenchmarksnappy FastPFor ${snappy_LIBRARIES} )
150+ target_link_libraries (inmemorybenchmarksnappy FastPFOR ${snappy_LIBRARIES} )
150151endif ()
151152
152153# Download and unpack googletest at configure time
@@ -184,25 +185,57 @@ if(CMAKE_VERSION VERSION_LESS 2.8.11)
184185endif ()
185186
186187add_executable (codecs src/codecs.cpp)
187- target_link_libraries (codecs FastPFor )
188+ target_link_libraries (codecs FastPFOR )
188189
189190add_executable (example example.cpp)
190- target_link_libraries (example FastPFor )
191+ target_link_libraries (example FastPFOR )
191192
192193add_executable (inmemorybenchmark src/inmemorybenchmark.cpp)
193- target_link_libraries (inmemorybenchmark FastPFor )
194+ target_link_libraries (inmemorybenchmark FastPFOR )
194195
195196add_executable (unit src/unit.cpp)
196- target_link_libraries (unit FastPFor )
197+ target_link_libraries (unit FastPFOR )
197198add_custom_target (check unit DEPENDS unit)
198199
199200
200- add_executable (FastPFor_unittest
201+ add_executable (FastPFOR_unittest
201202 unittest/test_composite.cpp
202203 unittest/test_driver.cpp
203204 unittest/test_fastpfor.cpp
204205 unittest/test_variablebyte.cpp)
205- target_link_libraries (FastPFor_unittest gtest FastPFor )
206+ target_link_libraries (FastPFOR_unittest gtest FastPFOR )
206207enable_testing ()
207208add_test ("unit" unit)
208- add_test ("FastPFor_unittest" FastPFor_unittest)
209+ add_test ("FastPFOR_unittest" FastPFOR_unittest)
210+
211+
212+ include (GNUInstallDirs)
213+ install (TARGETS FastPFOR
214+ EXPORT FastPFORExport
215+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} "
216+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR} "
217+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} "
218+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} " )
219+ set (PACKAGE_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR} /cmake/FastPFOR" )
220+ install (EXPORT FastPFORExport
221+ FILE "FastPFORTargets.cmake"
222+ DESTINATION "${PACKAGE_CMAKE_INSTALL_DIR} "
223+ NAMESPACE "FastPFOR::" )
224+ install (DIRECTORY "headers/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} /fastpfor" )
225+ install (FILES AUTHORS LICENSE README.md
226+ DESTINATION "${CMAKE_INSTALL_DOCDIR} " )
227+ if (NOT CMAKE_VERSION VERSION_LESS 3.0.0)
228+ include (CMakePackageConfigHelpers)
229+ configure_package_config_file("FastPFORConfig.cmake.in"
230+ "${CMAKE_CURRENT_BINARY_DIR} /FastPFORConfig.cmake"
231+ INSTALL_DESTINATION "${PACKAGE_CMAKE_INSTALL_DIR} " )
232+ write_basic_package_version_file("FastPFORConfigVersion.cmake"
233+ COMPATIBILITY SameMajorVersion)
234+ install (FILES
235+ "${CMAKE_CURRENT_BINARY_DIR} /FastPFORConfig.cmake"
236+ "${CMAKE_CURRENT_BINARY_DIR} /FastPFORConfigVersion.cmake"
237+ DESTINATION "${PACKAGE_CMAKE_INSTALL_DIR} " )
238+ endif ()
239+ configure_file ("fastpfor.pc.in" "${CMAKE_CURRENT_BINARY_DIR} /fastpfor.pc" @ONLY)
240+ install (FILES "${CMAKE_CURRENT_BINARY_DIR} /fastpfor.pc"
241+ DESTINATION "${CMAKE_INSTALL_LIBDIR} /pkgconfig" )
0 commit comments