forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
110 lines (90 loc) · 3.39 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
cmake_minimum_required(VERSION 3.5.1)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
message(STATUS "ccache enabled (${CCACHE_PROGRAM})")
endif()
PROJECT(iroha C CXX)
SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
SET(CMAKE_CXX_FLAGS "-std=c++1y -Wall")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -O0")
SET(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
SET(CMAKE_INSTALL_RPATH "../lib")
if(COVERAGE)
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
set(CMAKE_CXX_FLAGS "--coverage ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "--coverage ${CMAKE_C_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "--coverage ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "--coverage ${CMAKE_EXE_LINKER_FLAGS}")
set(REPORT_DIR ${CMAKE_BINARY_DIR}/reports)
file(MAKE_DIRECTORY ${REPORT_DIR})
include(cmake/analysis.cmake)
endif()
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
option(BENCHMARKING "Build benchmarks" OFF)
option(TESTING "Build tests" ON )
option(COVERAGE "Enable coverage" OFF)
option(FUZZING "Build fuzzing binaries" OFF)
option(PACKAGE_ZIP "Create ZIP package" OFF)
option(PACKAGE_TGZ "Create TGZ package" OFF)
option(PACKAGE_RPM "Create RPM package" OFF)
option(PACKAGE_DEB "Create DEB package" OFF)
option(ENABLE_LIBS_PACKAGING "Enable libs packaging" ON)
option(SWIG_PYTHON "Generate Swig Python bindings" OFF)
option(SWIG_JAVA "Generate Swig Java bindings" OFF)
option(SWIG_CSHARP "Generate Swig C# bindings" OFF)
if (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug)
endif()
if(PACKAGE_TGZ OR PACKAGE_ZIP OR PACKAGE_RPM OR PACKAGE_DEB)
message(STATUS "Packaging enabled: forcing non-packaging options to OFF")
set(BENCHMARKING OFF)
set(TESTING OFF)
set(COVERAGE OFF)
set(FUZZING OFF)
set(SWIG_PYTHON OFF)
set(SWIG_JAVA OFF)
endif()
message(STATUS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
message(STATUS "-DTESTING=${TESTING}")
message(STATUS "-DBENCHMARKING=${BENCHMARKING}")
message(STATUS "-DFUZZING=${FUZZING}")
message(STATUS "-DCOVERAGE=${COVERAGE}")
message(STATUS "-DPACKAGE_ZIP=${PACKAGE_ZIP}")
message(STATUS "-DPACKAGE_TGZ=${PACKAGE_TGZ}")
message(STATUS "-DPACKAGE_RPM=${PACKAGE_RPM}")
message(STATUS "-DPACKAGE_DEB=${PACKAGE_DEB}")
message(STATUS "-DENABLE_LIBS_PACKAGING=${ENABLE_LIBS_PACKAGING}")
message(STATUS "-DSWIG_PYTHON=${SWIG_PYTHON}")
message(STATUS "-DSWIG_JAVA=${SWIG_JAVA}")
message(STATUS "-DSWIG_CSHARP=${SWIG_CSHARP}")
SET(IROHA_SCHEMA_DIR "${PROJECT_SOURCE_DIR}/schema")
include_directories(
${PROJECT_SOURCE_DIR}/irohad
${PROJECT_SOURCE_DIR}/shared_model
${PROJECT_SOURCE_DIR}/libs
${IROHA_SCHEMA_DIR}
)
include(FeatureSummary)
include(cmake/functions.cmake)
include(cmake/dependencies.cmake)
if(PACKAGE_TGZ OR PACKAGE_ZIP OR PACKAGE_RPM OR PACKAGE_DEB)
include(cmake/release.cmake)
endif()
add_subdirectory(schema)
add_subdirectory(libs)
add_subdirectory(irohad)
add_subdirectory(iroha-cli)
add_subdirectory(shared_model)
if(TESTING)
enable_testing()
add_subdirectory(test)
endif()
if (FUZZING)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_subdirectory(fuzz)
else()
message(Fuzzing with compilers other than clang does not supported yet)
endif()
endif()