2 # Copyright (c) 2016 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to deal
6 # in the Software without restriction, including without limitation the rights
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 # copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 cmake_minimum_required(VERSION 2.8.12.2)
31 -D_POSIX_C_SOURCE=200112L
40 -fno-omit-frame-pointer
41 $<$<C_COMPILER_ID:gcc>:-fno-inline-small-functions>
42 $<$<C_COMPILER_ID:gcc>:-fno-inline-functions-called-once>
45 set(CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
47 include(cmake/config.cmake)
48 include(cmake/mapfile.cmake)
49 include(cmake/test.cmake)
50 include(cmake/paths.cmake)
52 # handle missing libumem
55 set(UMEM_INCLUDE_DIR fakeumem/include)
56 set(UMEM_EXTRA_SOURCE fakeumem/fakeumem.c)
58 set(UMEM_EXTRA_SOURCE)
69 # include the current source dir but only for: #include "foo.h"
71 -iquote ${CMAKE_CURRENT_SOURCE_DIR}
74 BISON_TARGET(sexpr sexpr.y ${CMAKE_CURRENT_BINARY_DIR}/sexpr.tab.c
75 COMPILE_FLAGS "-p sexpr_reader_")
76 FLEX_TARGET(sexpr sexpr.l ${CMAKE_CURRENT_BINARY_DIR}/sexpr.lex.c
77 COMPILE_FLAGS "-P sexpr_reader_")
78 ADD_FLEX_BISON_DEPENDENCY(sexpr sexpr)
80 add_library(jeffpc SHARED
89 ${FLEX_sexpr_OUTPUTS} ${BISON_sexpr_OUTPUTS}
98 target_link_libraries(jeffpc
104 target_apply_mapfile(jeffpc mapfile-vers)
106 install(TARGETS jeffpc DESTINATION ${CMAKE_INSTALL_LIBDIR}
107 PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
108 install(FILES include/jeffpc/atomic.h
109 include/jeffpc/error.h
110 include/jeffpc/hexdump.h
113 include/jeffpc/jeffpc.h
114 include/jeffpc/padding.h
115 include/jeffpc/rand.h
116 include/jeffpc/refcnt.h
117 include/jeffpc/sexpr.h
118 include/jeffpc/sock.h
120 include/jeffpc/synch.h
121 include/jeffpc/thread.h
122 include/jeffpc/time.h
123 include/jeffpc/types.h
124 include/jeffpc/uuid.h
126 ${CMAKE_CURRENT_BINARY_DIR}/include/jeffpc/config.h
127 DESTINATION include/jeffpc
128 PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
131 # Test related executables
134 build_test_bin(sexpr_parser)
135 build_test_bin_and_run(array)
136 build_test_bin_and_run(atomic-single-thread)
137 build_test_bin_and_run(bswap)
138 build_test_bin_and_run(hexdump)
139 build_test_bin_and_run(padding)
140 build_test_bin_and_run(sexpr_eval)
142 add_subdirectory(tests)