Skip to content

Commit

Permalink
cmake with local installed zstd (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
suiguoxin committed May 31, 2022
1 parent f502072 commit 223bdd3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
6 changes: 4 additions & 2 deletions AnnService/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# Licensed under the MIT License.

set(AnnService ${PROJECT_SOURCE_DIR}/AnnService)
set(Zstd ${PROJECT_SOURCE_DIR}/ThirdParty/zstd)

include_directories(${AnnService})
include_directories(${Zstd}/lib)

file(GLOB_RECURSE HDR_FILES ${AnnService}/inc/Core/*.h ${AnnService}/inc/Helper/*.h)
file(GLOB_RECURSE SRC_FILES ${AnnService}/src/Core/*.cpp ${AnnService}/src/Helper/*.cpp)
Expand Down Expand Up @@ -32,9 +34,9 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
endif()

add_library (SPTAGLib SHARED ${SRC_FILES} ${HDR_FILES})
target_link_libraries (SPTAGLib DistanceUtils zstd::libzstd_shared)
target_link_libraries (SPTAGLib DistanceUtils libzstd_shared)
add_library (SPTAGLibStatic STATIC ${SRC_FILES} ${HDR_FILES})
target_link_libraries (SPTAGLibStatic DistanceUtils zstd::libzstd_static)
target_link_libraries (SPTAGLibStatic DistanceUtils libzstd_static)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
target_compile_options(SPTAGLibStatic PRIVATE -fPIC)
endif()
Expand Down
15 changes: 3 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,11 @@ else()
message (FATAL_ERROR "Could not find Boost >= 1.67!")
endif()

find_package(zstd)
if (zstd_FOUND)
include_directories (${zstd_INCLUDE_DIR})
link_directories (${zstd_LIBRARY_DIR})
message (STATUS "Found zstd.")
message (STATUS "Include Path: ${zstd_INCLUDE_DIR}")
message (STATUS "Library Path: ${zstd_LIBRARY_DIR}")
message (STATUS "Library: ${zstd_LIBRARIES}")
else()
message (FATAL_ERROR "Could not find zstd")
endif()

option(GPU "GPU" ON)
option(LIBRARYONLY "LIBRARYONLY" OFF)

add_subdirectory (ThirdParty/zstd/build/cmake)

add_subdirectory (AnnService)
add_subdirectory (Test)
add_subdirectory (GPUSupport)
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ COPY AnnService ./AnnService/
COPY Test ./Test/
COPY Wrappers ./Wrappers/
COPY GPUSupport ./GPUSupport/

# install zstd
COPY ThirdParty ./ThirdParty/
RUN cd ThirdParty/zstd/build/cmake && rm -rf builddir && mkdir builddir && cd builddir && cmake .. && make -j$(nproc) && make install

RUN mkdir build && cd build && cmake .. && make -j$(nproc)
1 change: 1 addition & 0 deletions Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ COPY AnnService ./AnnService/
COPY Test ./Test/
COPY Wrappers ./Wrappers/
COPY GPUSupport ./GPUSupport/
COPY ThirdParty ./ThirdParty/

RUN mkdir build && cd build && cmake .. && make -j && cd ..

0 comments on commit 223bdd3

Please sign in to comment.