Handle vendor libraries better in cmake
This commit is contained in:
parent
cbd1a24a05
commit
59474b10b6
@ -5,7 +5,5 @@ include(utils.cmake)
|
||||
require_gcc_version(4.8)
|
||||
|
||||
add_subdirectory(vendor)
|
||||
include_directories(vendor)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(test)
|
||||
|
2
README
2
README
@ -1,2 +1,4 @@
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug
|
||||
cmake .. -DBUILD_TESTING=off
|
||||
cmake .. -DBUILD_TESTING=on
|
@ -44,7 +44,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE curl)
|
||||
|
||||
# TODO From Crypto++ 5.7 on, it should support cmake with find_package().
|
||||
find_library(CryptoPP cryptopp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${CryptoPP} scrypt)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${CryptoPP} scrypt spdlog)
|
||||
|
||||
target_add_boost(${PROJECT_NAME} filesystem system thread)
|
||||
target_enable_style_warnings(${PROJECT_NAME})
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "../../macros.h"
|
||||
#include "../../random/Random.h"
|
||||
extern "C" {
|
||||
#include <scrypt-1.2.0/lib/crypto/crypto_scrypt.h>
|
||||
#include <scrypt/lib/crypto/crypto_scrypt.h>
|
||||
}
|
||||
#include <stdexcept>
|
||||
#include "DerivedKey.h"
|
||||
|
@ -14,7 +14,7 @@ add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
||||
#endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC _FILE_OFFSET_BITS=64)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE cpp-utils)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC cpp-utils)
|
||||
|
||||
target_add_boost(${PROJECT_NAME} filesystem system thread chrono)
|
||||
target_enable_style_warnings(${PROJECT_NAME})
|
||||
|
@ -1,8 +1,8 @@
|
||||
enable_testing()
|
||||
include_directories(SYSTEM ${gtest_INCLUDE_DIRS}/include SYSTEM ${gmock_INCLUDE_DIRS}/include)
|
||||
link_libraries(gtest gmock gmock_main)
|
||||
include(CTest)
|
||||
|
||||
include_directories(../src)
|
||||
if (BUILD_TESTING)
|
||||
include_directories(../src)
|
||||
|
||||
add_subdirectory(cpp-utils)
|
||||
add_subdirectory(fspp)
|
||||
add_subdirectory(cpp-utils)
|
||||
add_subdirectory(fspp)
|
||||
endif(BUILD_TESTING)
|
||||
|
@ -50,7 +50,7 @@ set(SOURCES
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} cpp-utils)
|
||||
target_link_libraries(${PROJECT_NAME} googletest cpp-utils)
|
||||
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
|
||||
target_enable_style_warnings(${PROJECT_NAME})
|
||||
|
@ -103,7 +103,7 @@ set(SOURCES
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} fspp)
|
||||
target_link_libraries(${PROJECT_NAME} googletest fspp)
|
||||
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
|
||||
target_enable_style_warnings(${PROJECT_NAME})
|
||||
|
43
vendor/CMakeLists.txt
vendored
43
vendor/CMakeLists.txt
vendored
@ -1,40 +1,3 @@
|
||||
include(ExternalProject)
|
||||
|
||||
add_subdirectory(gtest-1.7.0)
|
||||
|
||||
project (scrypt C)
|
||||
# This builds the original scrypt source using configure & make. We don't use their build result,
|
||||
# but we use the config.h it creates somewhere on the way (see target_compile_options below).
|
||||
ExternalProject_Add(scrypt_original
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/configure --prefix=${CMAKE_BINARY_DIR}/vendor/
|
||||
PREFIX ${CMAKE_BINARY_DIR}/vendor/
|
||||
BUILD_COMMAND ${MAKE})
|
||||
# This creates the cpusupport_config.h file we need (see target_compile_options below).
|
||||
execute_process(
|
||||
COMMAND /bin/sh ${CMAKE_CURRENT_LIST_DIR}/scrypt-1.2.0/libcperciva/cpusupport/Build/cpusupport.sh
|
||||
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/cpusupport_config.h
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
add_library(${PROJECT_NAME} STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/lib/crypto/crypto_scrypt.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/lib/crypto/crypto_scrypt_smix.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/lib/crypto/crypto_scrypt_smix_sse2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/libcperciva/util/warnp.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/libcperciva/util/insecure_memzero.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/libcperciva/alg/sha256.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/libcperciva/cpusupport/cpusupport_x86_aesni.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/libcperciva/cpusupport/cpusupport_x86_sse2.c
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/libcperciva/cpusupport
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/libcperciva/alg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/libcperciva/util
|
||||
)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
-DCONFIG_H_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/src/scrypt_original-build/config.h\"
|
||||
-DCPUSUPPORT_CONFIG_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/cpusupport_config.h\"
|
||||
)
|
||||
add_dependencies(${PROJECT_NAME} scrypt_original)
|
||||
|
||||
add_subdirectory(googletest)
|
||||
add_subdirectory(scrypt)
|
||||
add_subdirectory(spdlog)
|
||||
|
2
vendor/README
vendored
2
vendor/README
vendored
@ -1,4 +1,4 @@
|
||||
This directory contains external projects, taken from the following locations:
|
||||
scrypt: http://www.tarsnap.com/scrypt.html
|
||||
gtest: https://github.com/google/googletest
|
||||
googletest: https://github.com/google/googletest
|
||||
spdlog: https://github.com/gabime/spdlog/commit/0c7beb2e36008598cf80d0e8eb8635ac403febb9 (commit 0c7beb2e36008598cf80d0e8eb8635ac403febb9)
|
||||
|
6
vendor/googletest/CMakeLists.txt
vendored
Normal file
6
vendor/googletest/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
add_subdirectory(gtest-1.7.0)
|
||||
|
||||
project (googletest)
|
||||
add_library(${PROJECT_NAME} dummy.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} gtest gmock gmock_main)
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE ${gtest_INCLUDE_DIRS}/include SYSTEM ${gmock_INCLUDE_DIRS}/include)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user