-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
86 lines (67 loc) · 1.65 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
cmake_minimum_required(VERSION 2.8)
project(circ C)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "debug build" FORCE)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(PrettyCompilerColors)
add_subdirectory(log)
add_subdirectory(libirc)
set(CIRC_SOURCES
src/config/config.h
src/config/config.c
src/core_hooks.c
src/scheme/scheme.h
src/scheme/scmapi.c
src/scheme/scheme.c
src/circ.c
)
set(CIRC_SOURCES_EXTRA
thirdparty/cJSON/cJSON.h
thirdparty/cJSON/cJSON.c
)
add_executable(circ ${CIRC_SOURCES} ${CIRC_SOURCES_EXTRA})
find_library(LIBEV_LIBS NAMES ev REQUIRED)
find_library(LIBGNUTLS_LIBS NAMES gnutls REQUIRED)
find_library(LIBSQLITE3_LIBS NAMES sqlite3 REQUIRED)
find_package(GLIB COMPONENTS gobject REQUIRED)
# get and build chibi
if(NOT IS_DIRECTORY ${CMAKE_BINARY_DIR}/chibi-scheme)
execute_process(
COMMAND git clone https://github.com/ashinn/chibi-scheme
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif()
include(ProcessorCount)
ProcessorCount(num_cpus)
execute_process(
COMMAND make -j${num_cpus}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/chibi-scheme
)
find_library(LIBCHIBI_LIBS
NAMES chibi-scheme
PATHS ${CMAKE_BINARY_DIR}/chibi-scheme
REQUIRED
)
include(build_stubs)
target_include_directories(circ
PRIVATE src
PRIVATE thirdparty
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${CMAKE_BINARY_DIR}/chibi-scheme/include
)
target_link_libraries(circ
irc
log
${LIBEV_LIBS}
${LIBGNUTLS_LIBS}
${LIBSQLITE3_LIBS}
${GLIB_GOBJECT_LIBRARIES}
${GLIB_LIBRARIES}
${LIBCHIBI_LIBS}
)
include(ClangFormat)
clangformat_setup(
${LOG_SOURCES}
${IRC_SOURCES}
${CIRC_SOURCES}
)
add_dependencies(circ clangformat build_stubs)