aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2018-07-16 19:26:36 -0400
committerDeterminant <tederminant@gmail.com>2018-07-16 19:26:36 -0400
commit02e347dae1a01172dbcc2efe054014c015d96507 (patch)
tree4b49650ba8d5dac0ab689cdc59867da3127f2bb7 /CMakeLists.txt
parenta7cfb274d651e858ab06eff5b28a6f77e0178cf1 (diff)
...
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt33
1 files changed, 21 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5246c6..d032ae0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,12 +30,25 @@ add_dependencies(secp256k1 libsecp256k1)
include_directories(include)
add_library(hotstuff
- src/entity.cpp
- src/core.cpp
+ OBJECT
+ src/util.cpp
src/client.cpp
src/crypto.cpp
- src/util.cpp)
-target_link_libraries(hotstuff salticidae secp256k1 crypto)
+ src/entity.cpp
+ src/consensus.cpp
+ src/hotstuff.cpp
+ )
+
+option(BUILD_SHARED "build shared library." OFF)
+if(BUILD_SHARED)
+ set_property(TARGET hotstuff PROPERTY POSITION_INDEPENDENT_CODE 1)
+ add_library(hotstuff_shared SHARED $<TARGET_OBJECTS:hotstuff>)
+ set_target_properties(hotstuff_shared PROPERTIES OUTPUT_NAME "hotstuff")
+ target_link_libraries(hotstuff_shared salticidae_static secp256k1 crypto)
+endif()
+add_library(hotstuff_static STATIC $<TARGET_OBJECTS:hotstuff>)
+set_target_properties(hotstuff_static PROPERTIES OUTPUT_NAME "hotstuff")
+target_link_libraries(hotstuff_static salticidae_static secp256k1 crypto)
add_subdirectory(test)
@@ -54,16 +67,16 @@ endif()
# add executables
add_executable(hotstuff-app
- src/hotstuff.cpp)
-target_link_libraries(hotstuff-app hotstuff)
+ src/hotstuff_app.cpp)
+target_link_libraries(hotstuff-app hotstuff_static)
add_executable(hotstuff-client
src/hotstuff_client.cpp)
-target_link_libraries(hotstuff-client hotstuff)
+target_link_libraries(hotstuff-client hotstuff_static)
add_executable(hotstuff-keygen
src/hotstuff_keygen.cpp)
-target_link_libraries(hotstuff-keygen hotstuff)
+target_link_libraries(hotstuff-keygen hotstuff_static)
find_package(Doxygen)
if (DOXYGEN_FOUND)
@@ -80,7 +93,3 @@ macro(remove_cxx_flag flag)
endmacro()
remove_cxx_flag("-DNDEBUG")
-#message(${CMAKE_CXX_FLAGS_RELEASE})
-#remove_cxx_flag("-O3")
-#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
-#message(${CMAKE_CXX_FLAGS_RELEASE})