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
|
cmake_minimum_required (VERSION 2.8)
project(SuperSimpleTypeSystem)
# Set so it finds the cmake directory.
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
option (DEBUG "Enable debug flags and macros in project." ON)
option (S_USE_GC "Enable/disable the LibGC garbage colletor." ON)
find_package (Threads REQUIRED)
if (S_USE_GC)
find_package (GC REQUIRED)
endif ()
if (CMAKE_USE_WIN32_THREADS_INIT)
set (HAVE_MTHREAD ON)
set (HAVE_PTHREAD OFF)
elseif (CMAKE_USE_PTHREADS_INIT)
set (HAVE_PTHREAD ON)
set (HAVE_MTHREAD OFF)
else ()
set (HAVE_PTHREAD OFF)
set (HAVE_MTHREAD OFF)
endif ()
set (SSTS_V_MAJOR 0)
set (SSTS_V_MINOR 0)
set (SSTS_V_PATCH 1)
if (WIN32)
if (MINGW)
message ("Compiling on Windows is undested.")
# THIS IS UNTESTED.
# On Wine (and, presumably ReactOS) (Using MingW) we need to pass -gdwarf-2
# to ba able to get traceback information. This is not ideal.
# On Windows we need to use cv2pdb (https://github.com/rainers/cv2pdb) to
# provide debug information.
# This can not be tested using cross-compile methods with MingW and Wine.
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -mthreads -Wall -gdwarf-2 -pthread")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c11 -mthreads -Wall -g -O0")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c11 -mthreads -Wall")
elseif (MSVC)
message ("MSVC is not supported, Yet. Patches welcome!")
endif ()
else ()
add_definitions(-D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE)
# We need -rdynamic to get the traceback information on *nix.
# This may not work on all non-windows targets. FIXME.
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -std=c11 -Wall -rdynamic -g -fstack-protector-strong")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pthread -std=c11 -Wall -g -rdynamic -fstack-protector-strong")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -pthread -std=c11 -Wall -rdynamic -fstack-protector-strong")
endif ()
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
add_subdirectory (libssts)
include_directories (${CMAKE_SOURCE_DIR}/libssts/)
add_subdirectory (tests)
add_library (ssts SHARED ${SSTS_SRC})
target_link_libraries (ssts PUBLIC ${CMAKE_THREAD_LIBS_INIT} m)
message (${CMAKE_THREAD_LIBS_INIT})
set_target_properties (ssts PROPERTIES COMPILE_DEFINITIONS "SSTS_BUILDING=1")
# If we found the GC...
if (S_USE_GC)
if (BOEHM_GC_FOUND)
target_include_directories (ssts PUBLIC ${BOEHM_GC_INCLUDE_DIR})
target_link_libraries (ssts PUBLIC ${BOEHM_GC_LIBRARIES})
endif ()
endif ()
enable_testing()
add_test (test tests/ssts_test )
add_test (ssts_main_loop_basic_libc tests/ssts_main_loop_basic_libc )
add_test (ssts_main_loop_basic_gc tests/ssts_main_loop_basic_gc )
add_test (ssts_main_loop_basic_mark_and_sweep tests/ssts_main_loop_basic_mark_and_sweep )
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --extra-verbose)
|