Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 117 lines (96 sloc) 3.415 kb
9aa22fe Offered permission to copy under gplv3 license.
cjdelisle authored
1 # You may redistribute this program and/or modify it under the terms of
2 # the GNU General Public License as published by the Free Software Foundation,
3 # either version 3 of the License, or (at your option) any later version.
4 #
5 # This program is distributed in the hope that it will be useful,
6 # but WITHOUT ANY WARRANTY; without even the implied warranty of
7 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 # GNU General Public License for more details.
9 #
10 # You should have received a copy of the GNU General Public License
11 # along with this program. If not, see <http://www.gnu.org/licenses/>.
d475c9c First commit for cjdns.
cjdelisle authored
12 project(cjdns C)
13 cmake_minimum_required(VERSION 2.4)
14
15 if(CMAKE_BINARY_DIR STREQUAL ${CMAKE_SOURCE_DIR})
e419a1e Massive changeset. It builds and tests pass, that's about all I can be s...
cjdelisle authored
16 message( FATAL_ERROR "type: mkdir build ; cd build ; cmake .. ; make" )
d475c9c First commit for cjdns.
cjdelisle authored
17 endif(CMAKE_BINARY_DIR STREQUAL ${CMAKE_SOURCE_DIR})
18
19 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
20 ${CMAKE_SOURCE_DIR}/cmake/modules)
21
e419a1e Massive changeset. It builds and tests pass, that's about all I can be s...
cjdelisle authored
22 # validation
def16b2 warnings about unused results.
Caleb James DeLisle authored
23 add_definitions(-Wall -Wextra -std=c99 -Werror -pedantic)
24
e393817 more platform independent way of applying -Wno-unused-result
Caleb James DeLisle authored
25 # This breaks logging since loggers are passed to functions
26 # and only used if the log level is high.
27 add_definitions(-Wno-unused-parameter)
02de592 hardening
cjdelisle authored
28
e393817 more platform independent way of applying -Wno-unused-result
Caleb James DeLisle authored
29 include(CheckCCompilerFlag)
30 # There are a number of places in Admin where read() and write() are used
31 # and they fail silently if anything goes wrong so the result is unused.
416d458 derp
Caleb James DeLisle authored
32 check_c_compiler_flag(-Wno-unused-result HAS_NO_UNUSED_RESULT)
e393817 more platform independent way of applying -Wno-unused-result
Caleb James DeLisle authored
33 if(HAS_NO_UNUSED_RESULT)
34 add_definitions(-Wno-unused-result)
35 endif()
013919c @ianlevesque Functional on OS X. Passes all tests. Requires libevent and nacl to be...
ianlevesque authored
36
e419a1e Massive changeset. It builds and tests pass, that's about all I can be s...
cjdelisle authored
37 # hardening
38 add_definitions(
39 -fPIE
d086bcb Worked around bug in gcc patch and fixed test
cjdelisle authored
40
41 # Broken GCC patch makes -fstack-protector-all not work
42 # workaround is to give -fno-stack-protector first.
43 # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722
44 -fno-stack-protector
e419a1e Massive changeset. It builds and tests pass, that's about all I can be s...
cjdelisle authored
45 -fstack-protector-all
d086bcb Worked around bug in gcc patch and fixed test
cjdelisle authored
46
e419a1e Massive changeset. It builds and tests pass, that's about all I can be s...
cjdelisle authored
47 -Wstack-protector
48 )
49
30fe61d Trying to fix the build for apple.
Caleb James DeLisle authored
50 # allow position independent executable to be turned off with NO_PIE cmake ..
51 if("$ENV{NO_PIE}" STREQUAL "")
52 message("Building with position independent executable.")
53 set(PIE "-pie")
54 else()
55 message("Building with position dependent executable (ASLR security disabled).")
56 set(PIE "")
57 endif()
8f0924d Fixed static linking bug on amd64 and allowed for disabling pie from com...
Caleb James DeLisle authored
58
30fe61d Trying to fix the build for apple.
Caleb James DeLisle authored
59 if(NOT DEFINED APPLE)
8f0924d Fixed static linking bug on amd64 and allowed for disabling pie from com...
Caleb James DeLisle authored
60 set(CMAKE_EXE_LINKER_FLAGS "${PIE} -Wl,-z,relro,-z,now,-z,noexecstack")
30fe61d Trying to fix the build for apple.
Caleb James DeLisle authored
61 else()
62 # apple seems to set noexecstack by defualt and not support relro.
63 set(CMAKE_EXE_LINKER_FLAGS "${PIE}")
64 endif()
02de592 hardening
cjdelisle authored
65
e419a1e Massive changeset. It builds and tests pass, that's about all I can be s...
cjdelisle authored
66 # debugging
67 add_definitions(-g)
68
55fb7a7 Added KEYS logging level and made logging level choosable at build time.
cjdelisle authored
69 if(NOT $ENV{Log_LEVEL} STREQUAL "")
d136ce5 Handle lower case log levels.
Caleb James DeLisle authored
70 string(TOUPPER $ENV{Log_LEVEL} LEVEL)
71 message("Log_LEVEL = ${LEVEL}")
cdf6130 improved logging and fixed bug in label splicer
cjdelisle authored
72 if ($ENV{Log_LEVEL} STREQUAL "KEYS")
dc3585f fixed logging
cjdelisle authored
73 message("\n\nEXPECT TO SEE PRIVATE KEYS PRINTED IN YOUR LOGS!\n\n")
cdf6130 improved logging and fixed bug in label splicer
cjdelisle authored
74 endif ($ENV{Log_LEVEL} STREQUAL "KEYS")
d136ce5 Handle lower case log levels.
Caleb James DeLisle authored
75 add_definitions("-D Log_${LEVEL}")
46b26de Default to Log_LEVEL=DEBUG
cjdelisle authored
76 else()
77 add_definitions("-D Log_DEBUG")
78 endif()
55fb7a7 Added KEYS logging level and made logging level choosable at build time.
cjdelisle authored
79
c42258f Try to fix error which happens on some machines
cjdelisle authored
80 add_definitions(-O3 -funroll-loops)
a96c403 Continued work on router module.
cjdelisle authored
81
d475c9c First commit for cjdns.
cjdelisle authored
82 include_directories(${CMAKE_SOURCE_DIR})
83
8d96d7e Shifted stuff around and removed unused code.
cjdelisle authored
84 find_package(Libevent2 REQUIRED)
85 include_directories(${LIBEVENT2_INCLUDE_DIRS})
86
87 find_package(NACL REQUIRED)
88 include_directories(${NACL_INCLUDE_DIRS})
89
970cabf Added administration interface
cjdelisle authored
90 add_subdirectory(admin)
2f8cb1d Refactoring and finished rewriting libbenc
cjdelisle authored
91 add_subdirectory(benc)
d475c9c First commit for cjdns.
cjdelisle authored
92 add_subdirectory(crypto)
93 add_subdirectory(dht)
970cabf Added administration interface
cjdelisle authored
94 add_subdirectory(interface)
95 add_subdirectory(io)
96 add_subdirectory(memory)
7c7005c Added rolling average utility.
cjdelisle authored
97 add_subdirectory(util)
1706066 Added switch core
cjdelisle authored
98 add_subdirectory(switch)
970cabf Added administration interface
cjdelisle authored
99
d475c9c First commit for cjdns.
cjdelisle authored
100
6ac4ca5 Got SwitchConnectorModule into a compilable state and removed some old s...
cjdelisle authored
101 add_executable(cjdroute cjdroute.c)
102 target_link_libraries(cjdroute
103 crypto
104 interface
105 switch
106 dht
107 dhtcore
2f8cb1d Refactoring and finished rewriting libbenc
cjdelisle authored
108 cjdbenc
109 cjdbenc_JsonBencSerializer
17da216 Renamed libMemAllocator libcjdmemory
cjdelisle authored
110 cjdmemory
970cabf Added administration interface
cjdelisle authored
111 cjdadmin
c3a908e debugging and bugfixes
cjdelisle authored
112 ${LIBEVENT2_LIBRARIES}
6ac4ca5 Got SwitchConnectorModule into a compilable state and removed some old s...
cjdelisle authored
113 )
6baa018 Changed RouterModule to handle new address types, added Address.h, began...
cjdelisle authored
114
d475c9c First commit for cjdns.
cjdelisle authored
115 # Everything must be tested.
116 enable_testing()
Something went wrong with that request. Please try again.