Page MenuHomePhabricator

No OneTemporary

diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt
index 35877a5d65..84b1e811b3 100644
--- a/src/crypto/CMakeLists.txt
+++ b/src/crypto/CMakeLists.txt
@@ -1,27 +1,29 @@
# Copyright (c) 2017 The Bitcoin developers
project(crypto)
set(CMAKE_CXX_STANDARD 11)
-include_directories(
- ..
- # To access the config.
- # TODO: Make compat its own lib and just import it.
- ${CMAKE_CURRENT_BINARY_DIR}/..
- ${CMAKE_CURRENT_BINARY_DIR}/../config
-)
-
# The library
add_library(crypto
aes.cpp
chacha20.cpp
hmac_sha256.cpp
hmac_sha512.cpp
ripemd160.cpp
sha1.cpp
sha256.cpp
sha512.cpp
)
+target_include_directories(crypto
+ PRIVATE
+ ..
+ PUBLIC
+ # To access the config.
+ # TODO: Make compat its own lib and just import it.
+ ${CMAKE_CURRENT_BINARY_DIR}/..
+ ${CMAKE_CURRENT_BINARY_DIR}/../config
+)
+
target_compile_definitions(crypto PUBLIC HAVE_CONFIG_H)
diff --git a/src/secp256k1/CMakeLists.txt b/src/secp256k1/CMakeLists.txt
index c4545280f5..4b076c3021 100644
--- a/src/secp256k1/CMakeLists.txt
+++ b/src/secp256k1/CMakeLists.txt
@@ -1,80 +1,81 @@
# Copyright (c) 2017 The Bitcoin developers
cmake_minimum_required(VERSION 3.1)
project(secp256k1)
option(SECP256K1_BUILD_TEST "Build secp256k1's unit tests" ON)
# TODO: change this to include when possible
-include_directories(. include)
+include_directories(.)
# The library
add_library(secp256k1 src/secp256k1.c)
+target_include_directories(secp256k1 PUBLIC include)
# We need to link in GMP
find_package(GMP)
if(GMP_INCLUDE_DIR AND GMP_LIBRARIES)
target_include_directories(secp256k1 PUBLIC ${GMP_INCLUDE_DIR})
target_link_libraries(secp256k1 ${GMP_LIBRARIES})
target_compile_definitions(secp256k1
PUBLIC
HAVE_LIBGMP
USE_NUM_GMP
USE_FIELD_INV_NUM
USE_SCALAR_INV_BUILTIN
)
else()
target_compile_definitions(secp256k1
PUBLIC
USE_NUM_NONE
USE_FIELD_INV_BUILTIN
USE_SCALAR_INV_BUILTIN
)
endif()
# We make sure __int128 is defined
include(CheckTypeSize)
check_type_size(__int128 SIZEOF___INT128)
if(SIZEOF___INT128 EQUAL 16)
target_compile_definitions(secp256k1 PUBLIC HAVE___INT128)
else()
# If we do not support __int128, we should be falling back
# on 32bits implementations for field and scalar.
endif()
# Detect if we are on a 32 or 64 bits plateform and chose
# scalar and filed implementation accordingly
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64 bits implementationr require either __int128 or asm support.
# TODO: support asm.
if(NOT SIZEOF___INT128 EQUAL 16)
message(SEND_ERROR "Compiler does not support __int128")
endif()
target_compile_definitions(secp256k1 PUBLIC USE_SCALAR_4X64)
target_compile_definitions(secp256k1 PUBLIC USE_FIELD_5X52)
else()
target_compile_definitions(secp256k1 PUBLIC USE_SCALAR_8X32)
target_compile_definitions(secp256k1 PUBLIC USE_FIELD_10X26)
endif()
if(SECP256K1_BUILD_TEST)
enable_testing()
add_executable(secp256k1_tests src/tests.c)
add_test(NAME secp256k1_tests COMMAND secp256k1_tests)
target_link_libraries(secp256k1_tests secp256k1)
target_compile_definitions(secp256k1_tests PUBLIC VERIFY)
add_executable(exhaustive_tests src/tests_exhaustive.c)
add_test(NAME exhaustive_tests COMMAND exhaustive_tests)
target_link_libraries(exhaustive_tests secp256k1)
target_compile_definitions(exhaustive_tests PUBLIC SECP256K1_BUILD)
# This should not be enabled at the same time as coverage is.
# TODO: support coverage.
target_compile_definitions(exhaustive_tests PUBLIC VERIFY)
endif(SECP256K1_BUILD_TEST)
# TODO: emult static precomputation
# TODO: ecdh module
# TODO: RECOVERY module
diff --git a/src/univalue/CMakeLists.txt b/src/univalue/CMakeLists.txt
index 6dc9573edb..001dd933cf 100644
--- a/src/univalue/CMakeLists.txt
+++ b/src/univalue/CMakeLists.txt
@@ -1,53 +1,60 @@
# Copyright (c) 2017 The Bitcoin developers
cmake_minimum_required(VERSION 3.1)
project(univalue)
option(UNIVALUE_BUILD_TESTS "Build univalue's unit tests" ON)
-include_directories(include)
-
# TODO: Version info
add_library(univalue
lib/univalue.cpp
lib/univalue_get.cpp
lib/univalue_read.cpp
lib/univalue_write.cpp
)
-target_include_directories(univalue PRIVATE lib)
+target_include_directories(univalue
+ PUBLIC
+ include
+ PRIVATE
+ lib
+)
if(UNIVALUE_BUILD_TESTS)
enable_testing()
add_executable(unitester_test test/unitester.cpp)
add_test(NAME unitester_test COMMAND unitester_tests)
target_link_libraries(unitester_test univalue)
target_compile_definitions(unitester_test
PUBLIC JSON_TEST_SRC="${PROJECT_SOURCE_DIR}/test"
)
add_executable(json_test test/test_json.cpp)
add_test(NAME json_test COMMAND json_test)
target_link_libraries(json_test univalue)
add_executable(no_nul_test test/no_nul.cpp)
add_test(NAME no_nul_test COMMAND no_nul_test)
target_link_libraries(no_nul_test univalue)
add_executable(object_test test/object.cpp)
add_test(NAME object_test COMMAND object_test)
target_link_libraries(object_test univalue)
endif(UNIVALUE_BUILD_TESTS)
# Generate lib/univalue_escapes.h
add_executable(univalue_gen gen/gen.cpp)
+target_include_directories(univalue_gen PUBLIC include)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib/univalue_escapes.h
COMMAND univalue_gen > ${CMAKE_CURRENT_BINARY_DIR}/lib/univalue_escapes.h
DEPENDS univalue_gen ${CMAKE_CURRENT_SOURCE_DIR}/lib/univalue_escapes.h
)
-add_custom_target(generate_univalue_escapes_h DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lib/univalue_escapes.h)
+add_custom_target(generate_univalue_escapes_h
+ DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/lib/univalue_escapes.h
+)

File Metadata

Mime Type
text/x-diff
Expires
Thu, Apr 17, 03:37 (8 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5508729
Default Alt Text
(5 KB)

Event Timeline