/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-19 15:01:09 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210119150109-h36fjv4txv3fp2wk
removed CMake stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
cmake_minimum_required (VERSION 2.8)
2
 
project(SuperSimpleTypeSystem)
3
 
 
4
 
# Set so it finds the cmake directory.
5
 
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
6
 
 
7
 
option (DEBUG "Enable debug flags and macros in project." ON)
8
 
option (S_USE_GC "Enable/disable the LibGC garbage colletor." ON)
9
 
 
10
 
find_package (Threads REQUIRED)
11
 
 
12
 
if (S_USE_GC)
13
 
  find_package (GC REQUIRED)
14
 
endif ()
15
 
 
16
 
if (CMAKE_USE_WIN32_THREADS_INIT)
17
 
  set (HAVE_MTHREAD ON)
18
 
  set (HAVE_PTHREAD OFF)
19
 
elseif (CMAKE_USE_PTHREADS_INIT)
20
 
  set (HAVE_PTHREAD ON)
21
 
  set (HAVE_MTHREAD OFF)
22
 
else ()
23
 
  set (HAVE_PTHREAD OFF)
24
 
  set (HAVE_MTHREAD OFF)
25
 
endif ()
26
 
 
27
 
set (SSTS_V_MAJOR 0)
28
 
set (SSTS_V_MINOR 0)
29
 
set (SSTS_V_PATCH 1)
30
 
 
31
 
 
32
 
 
33
 
if (WIN32)
34
 
  if (MINGW)
35
 
    message ("Compiling on Windows is undested.")
36
 
    # THIS IS UNTESTED.
37
 
    # On Wine (and, presumably ReactOS) (Using MingW) we need to pass -gdwarf-2
38
 
    # to ba able to get traceback information. This is not ideal.
39
 
    # On Windows we need to use cv2pdb (https://github.com/rainers/cv2pdb) to
40
 
    # provide debug information.
41
 
    # This can not be tested using cross-compile methods with MingW and Wine.
42
 
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -mthreads -Wall -gdwarf-2")
43
 
 
44
 
    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c11 -mthreads -Wall -g -O0")
45
 
 
46
 
    set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c11 -mthreads -Wall")
47
 
  elseif (MSVC)
48
 
    message ("MSVC is not supported, Yet. Patches welcome!")
49
 
  endif ()
50
 
else ()
51
 
  add_definitions(-D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE)
52
 
  # We need -rdynamic to get the traceback information on *nix.
53
 
  # This may not work on all non-windows targets. FIXME.
54
 
  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -std=c11  -Wall -rdynamic -g -fstack-protector-strong")
55
 
 
56
 
  set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pthread -std=c11 -Wall -g -rdynamic -fstack-protector-strong")
57
 
 
58
 
  set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -pthread -std=c11 -Wall -rdynamic -fstack-protector-strong")
59
 
endif ()
60
 
 
61
 
# add a target to generate API documentation with Doxygen
62
 
find_package(Doxygen)
63
 
if(DOXYGEN_FOUND)
64
 
  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
65
 
  add_custom_target(doc
66
 
    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
67
 
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
68
 
    COMMENT "Generating API documentation with Doxygen" VERBATIM
69
 
  )
70
 
endif(DOXYGEN_FOUND)
71
 
 
72
 
add_subdirectory (libssts)
73
 
include_directories (${CMAKE_SOURCE_DIR}/libssts/)
74
 
add_subdirectory (tests)
75
 
 
76
 
add_library (ssts SHARED ${SSTS_SRC})
77
 
target_link_libraries (ssts PUBLIC ${CMAKE_THREAD_LIBS_INIT} m)
78
 
message (${CMAKE_THREAD_LIBS_INIT})
79
 
 
80
 
set_target_properties (ssts PROPERTIES COMPILE_DEFINITIONS "SSTS_BUILDING=1")
81
 
 
82
 
# If we found the GC...
83
 
if (S_USE_GC)
84
 
  if (BOEHM_GC_FOUND)
85
 
    target_include_directories (ssts PUBLIC ${BOEHM_GC_INCLUDE_DIR})
86
 
    target_link_libraries (ssts PUBLIC ${BOEHM_GC_LIBRARIES})
87
 
  endif ()
88
 
endif ()
89
 
 
90
 
enable_testing()
91
 
add_test (test tests/ssts_test )
92
 
add_test (ssts_main_loop_basic_libc tests/ssts_main_loop_basic_libc )
93
 
add_test (ssts_main_loop_basic_gc tests/ssts_main_loop_basic_gc )
94
 
add_test (ssts_main_loop_basic_mark_and_sweep tests/ssts_main_loop_basic_mark_and_sweep )
95
 
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --extra-verbose)
96
 
 
97