ca67fd5aec2d3d9ca4f23fa277d07fada3cd4367
[6bed4] / CMakeLists.txt
1 project (6bed4 C)
2 cmake_minimum_required (VERSION 2.6)
3 set (VERSION "0.0.1")
4 cmake_policy(SET CMP0053 NEW)
5
6 add_definitions (-DLINUX)
7
8 add_executable (6bed4client "src/6bed4peer.c")
9 add_executable (6bed4server "src/6bed4router.c")
10
11 install (PROGRAMS
12         ${CMAKE_BINARY_DIR}/6bed4client
13         ${CMAKE_BINARY_DIR}/6bed4server
14         DESTINATION sbin)
15 install (FILES
16         ${CMAKE_SOURCE_DIR}/doc/man/6bed4server.man
17         ${CMAKE_SOURCE_DIR}/doc/man/6bed4client.man
18         DESTINATION ${SHARE_INSTALL_PREFIX}/man/man8)
19
20
21 #
22 # Setup a number of parameters.  Until we get 6bed4 standardised,
23 # these are preliminary values that MUST NOT be assumed static.
24 #
25 # This is why CMake will present a warning, but it will still
26 # go ahead with the values.  They can be changed at will using
27 # any tool that interacts with the CMakeCache.txt file or that
28 # overrides the settings at build time.
29 #
30 # Please beware that the values contain the information in a
31 # number of different forms.  In a perfect world, we would
32 # derive values from one another.  In a portable world, for
33 # now at least, we resort to letting you maintain consistency.
34 #
35
36 if (NOT ND_OPT_DESTINATION_LINKADDR)
37         message ("Stealing an experimental Neighbor Discovery Option Type 253 for Destination Link-Layer Address -- please configure your local override")
38         set (ND_OPT_DESTINATION_LINKADDR 253
39                 CACHE STRING "Neighbor Discovery Option Type for Destination Link-Layer Address; Configure an unused value until this is standardised"
40         )
41 else ()
42         message (WARNING
43                 "Using experimental Neighbour Discovery Option Type ${ND_OPT_DESTINATION_LINKADDR}")
44 endif ()
45
46 if (NOT UDP_PORT_6BED4)
47         message ("Stealing an experimental UDP port number 25790 or 0x64be -- please configure your local override")
48         set (UDP_PORT_6BED4 25790
49                 CACHE STRING "Decimal UDP Port to use in this 6bed4 setup; Must be consistent with other settings that mention it in different forms; Configure an unused value until this is standardised"
50         )
51         set (SERVER_6BED4_PORT_TXT "\"25790\""
52                 CACHE STRING "Decimal string representation of the UDP Port to use; Must be consistent with UDP_PORT_6BED4"
53         )
54         set (SERVER_6BED4_PORT_BINSTR "\"\\xbe\\x64\""
55                 CACHE STRING "Binary string representation of the UDP Port to use; Unsigned 16 bits in network byte order; Must be consistent with UDP_PORT_6BED4"
56         )
57 else ()
58         message (WARNING
59                 "Using experimental UDP port number ${UDP_PORT_6BED4}")
60 endif ()
61
62 if (NOT SERVER_6BED4_IPV4_TXT)
63         message ("Stealing an expermental 6bed4 server IP address 145.136.0.1 -- please configure your local override")
64         set (SERVER_6BED4_IPV4_TXT "\"145.136.0.1\""
65                 CACHE STRING "String representation of decimal IP address of the 6bed4 server to use; Must be consistent with other settings that mention it in different forms"
66         )
67         set (SERVER_6BED4_IPV4_INT32 252183167
68                 CACHE STRING "Unsinged 32-bit integer form of the IP address of the 6bed4 server; Higher bits are for coarser routing; Must be consistent with SERVER_6BED4_IPV4_TXT"
69         )
70         set (SERVER_6BED4_IPV4_INT0 145
71                 CACHE STRING "Decimal form of the byte 1/4 of the IP address of the 6bed4 server; Must be consistent with SERVER_6BED4_IPV4_TXT"
72         )
73         set (SERVER_6BED4_IPV4_INT1 136
74                 CACHE STRING "Decimal form of the byte 2/4 of the IP address of the 6bed4 server; Must be consistent with SERVER_6BED4_IPV4_TXT"
75         )
76         set (SERVER_6BED4_IPV4_INT2 0
77                 CACHE STRING "Decimal form of the byte 3/4 of the IP address of the 6bed4 server; Must be consistent with SERVER_6BED4_IPV4_TXT"
78         )
79         set (SERVER_6BED4_IPV4_INT3 1
80                 CACHE STRING "Decimal form of the byte 4/4 of the IP address of the 6bed4 server; Must be consistent with SERVER_6BED4_IPV4_TXT"
81         )
82         set (SERVER_6BED4_IPV4_BINSTR "\"\\x91\\x88\\x00\\x01\""
83                 CACHE STRING "Binary string representation of the IP address of the 6bed4 server; Must be consistent with SERVER_6BED4_IPV4_TXT"
84         )
85 else ()
86         message (WARNING
87                 "Using experimental server IP address ${SERVER_6BED4_IPV4_TXT}")
88 endif ()
89
90 set (SERVER_6BED4_IPV4_PORT_TXT "\"145.136.0.1:25790\""
91         CACHE STRING "Textual representation of the 6bed4 server IPv4 address and port number; Must be consistent with SERVER_6BED4_IPV4_TXT and UDP_PORT_6BED4"
92 )
93 set (SERVER_6BED4_PORT_IPV4_ADDRSTR "\"\\xbe\\x64\\x91\\x88\\x00\\x01\""
94         CACHE STRING "Binary string representation of the 6bed4 server port number followed by the IPv4 address; Must be the concatenation of SERVER_6BED4_PORT_BINSTR and SERVER_6BED4_IPV4_BINSTR"
95 )
96 set (SERVER_6BED4_PORT_IPV4_MACSTR "\"\\xbc\\x64\\x91\\x88\\x00\\x01\""
97         CACHE STRING "Binary string representation of the 6bed4 server port number and IPv4 address as a MAC address; Must be equal to SERVER_6BED4_PORT_IPV4_ADDRSTR except for an applied XOR with 0x02 on the first byte"
98 )
99
100 set (LOCAL_OVERRIDES_PORT0 yes)
101
102 set (INTERFACE_NAME_6BED4 "6bed4")
103
104
105 configure_file (
106         ${CMAKE_SOURCE_DIR}/src/nonstd.h.in
107         ${CMAKE_BINARY_DIR}/src/nonstd.h
108         IMMEDIATE @ONLY
109 )
110
111 include_directories (${CMAKE_BINARY_DIR}/src)
112
113
114 #
115 # Packaging
116 #
117 include (CPack)