-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
109 lines (86 loc) · 4.41 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
107
108
109
cmake_minimum_required (VERSION 2.6)
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type: Debug or Release")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release)
project (channel9)
set (channel9_VERSION_MAJOR 1)
set (channel9_VERSION_MINOR 0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(Ruby REQUIRED)
add_definitions( -D__STDC_FORMAT_MACROS )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -g")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall -Werror -frtti -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-strict-aliasing")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -stdlib=libc++")
endif()
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_definitions( -DDEBUG )
else()
add_definitions( -DNDEBUG )
endif()
option (ENABLE_VALGRIND "Enable valgrind instrumentation." OFF)
if(ENABLE_VALGRIND)
add_definitions( -DVALGRIND )
else(ENABLE_VALGRIND)
add_definitions( -DNVALGRIND )
endif(ENABLE_VALGRIND)
set (TRACE_LEVEL_GENERAL "OFF" CACHE STRING "Hard minimum trace level for general trace info (SPAM, DEBUG, INFO, WARN, ERROR, CRIT, OFF)")
set_property(CACHE TRACE_LEVEL_GENERAL PROPERTY STRINGS SPAM DEBUG INFO WARN ERROR CRIT OFF)
set (TRACE_LEVEL_VM "OFF" CACHE STRING "Hard minimum trace level for general trace info (SPAM, DEBUG, INFO, WARN, ERROR, CRIT, OFF)")
set_property(CACHE TRACE_LEVEL_VM PROPERTY STRINGS SPAM DEBUG INFO WARN ERROR CRIT OFF)
set (TRACE_LEVEL_GC "OFF" CACHE STRING "Hard minimum trace level for general trace info (SPAM, DEBUG, INFO, WARN, ERROR, CRIT, OFF)")
set_property(CACHE TRACE_LEVEL_GC PROPERTY STRINGS SPAM DEBUG INFO WARN ERROR CRIT OFF)
set (TRACE_LEVEL_ALLOC "OFF" CACHE STRING "Hard minimum trace level for general trace info (SPAM, DEBUG, INFO, WARN, ERROR, CRIT, OFF)")
set_property(CACHE TRACE_LEVEL_ALLOC PROPERTY STRINGS SPAM DEBUG INFO WARN ERROR CRIT OFF)
add_definitions(
-DHARD_TRACE_LEVEL_GENERAL=VAL_TRACE_${TRACE_LEVEL_GENERAL}
-DHARD_TRACE_LEVEL_VM=VAL_TRACE_${TRACE_LEVEL_VM}
-DHARD_TRACE_LEVEL_GC=VAL_TRACE_${TRACE_LEVEL_GC}
-DHARD_TRACE_LEVEL_ALLOC=VAL_TRACE_${TRACE_LEVEL_ALLOC}
)
if (DEFINED ENV{DEFAULT_COLLECTOR})
set (DEFAULT_COLLECTOR $ENV{DEFAULT_COLLECTOR})
message("Setting default collector to $ENV{DEFAULT_COLLECTOR}")
else()
set (DEFAULT_COLLECTOR "Markcompact")
message("Defaulting to mark compact collector.")
endif()
set (COLLECTOR ${DEFAULT_COLLECTOR} CACHE STRING "Which collector to use for long-lived objects. (Markcompact or Semispace)")
set_property(CACHE COLLECTOR PROPERTY STRINGS Markcompact Semispace)
add_definitions( -DCOLLECTOR_CLASS=${COLLECTOR} )
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
include_directories(include)
add_custom_target(bundle-install
COMMAND ${RUBY_EXECUTABLE} -rubygems -C${CMAKE_SOURCE_DIR} -S bundle install
DEPENDS ${CMAKE_SOURCE_DIR}/Gemfile ${CMAKE_SOURCE_DIR}/Gemfile.lock
)
add_subdirectory(src/libc9)
add_subdirectory(src/jsoncpp)
add_subdirectory(src/c9)
function(copy_script_files SRC DST COMMON_PATH TARGET_PREFIX) # extra args are script names.
foreach(FILE ${ARGN})
add_custom_command(
OUTPUT ${DST}/${COMMON_PATH}/${FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${SRC}/${COMMON_PATH}/${FILE} ${DST}/${COMMON_PATH}/${FILE}
DEPENDS ${SRC}/${COMMON_PATH}/${FILE}
)
add_custom_target(${TARGET_PREFIX}-${FILE} ALL DEPENDS ${DST}/${COMMON_PATH}/${FILE})
endforeach()
endfunction()
function(add_c9_alias NAME)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/bin/c9.${NAME}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${PROJECT_BINARY_DIR}/bin/c9 ${PROJECT_BINARY_DIR}/bin/c9.${NAME}
DEPENDS ${PROJECT_BINARY_DIR}/bin/c9
)
add_custom_target(c9.${NAME} ALL DEPENDS ${PROJECT_BINARY_DIR}/bin/c9.${NAME})
endfunction()
file(GLOB environments "environments/*")
foreach(environment ${environments})
add_subdirectory(${environment})
endforeach()