/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
26 by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works.
1
cmake_minimum_required (VERSION 2.8)
2
project(SuperSimpleTypeSystem)
3
121.1.1 by Gustav Hartvigsson
* added CMake rules for libgc in CMakeLists.txt and a findGC file.
4
# Set so it finds the cmake directory.
5
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
6
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
7
option (DEBUG "Enable debug flags and macros in project." ON)
130.1.6 by Gustav Hartvigsson
* Added more tests
8
option (S_USE_GC "Enable/disable the LibGC garbage colletor." ON)
30 by Gustav Hartvigsson
* Made the code compile using CMake.
9
87 by Gustav Hartvigsson
I have no idea why this is not working...0_o...
10
find_package (Threads REQUIRED)
139 by Gustav Hartvigsson
* Started work on the ring buffer, still untested and may contain
11
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
12
if (S_USE_GC)
121.1.1 by Gustav Hartvigsson
* added CMake rules for libgc in CMakeLists.txt and a findGC file.
13
  find_package (GC REQUIRED)
14
endif ()
87 by Gustav Hartvigsson
I have no idea why this is not working...0_o...
15
88 by Gustav Hartvigsson
* Made the SMutex code compile.
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
91 by Gustav Hartvigsson
* Moved Version Number to config.h.in
27
set (SSTS_V_MAJOR 0)
28
set (SSTS_V_MINOR 0)
29
set (SSTS_V_PATCH 1)
88 by Gustav Hartvigsson
* Made the SMutex code compile.
30
31
58 by Gustav Hartvigsson
* Added preliminary CMake commands for Windows.
32
if (WIN32)
33
  if (MINGW)
34
    message ("Compiling on Windows is undested.")
35
    # THIS IS UNTESTED.
36
    # On Wine (and, presumably ReactOS) (Using MingW) we need to pass -gdwarf-2
37
    # to ba able to get traceback information. This is not ideal.
38
    # On Windows we need to use cv2pdb (https://github.com/rainers/cv2pdb) to
39
    # provide debug information.
40
    # This can not be tested using cross-compile methods with MingW and Wine.
87 by Gustav Hartvigsson
I have no idea why this is not working...0_o...
41
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -mthreads -Wall -gdwarf-2 -pthread")
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
42
109.1.1 by Gustav Hartvigsson
* SMap seems to be broken... Or could it be SObject's Callback stuff? Or SLinkedList?
43
    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c11 -mthreads -Wall -g -O0")
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
44
118 by Gustav Hartvigsson
* Added embedded copyright information in the library.
45
    set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c11 -mthreads -Wall")
58 by Gustav Hartvigsson
* Added preliminary CMake commands for Windows.
46
  elseif (MSVC)
59 by Gustav Hartvigsson
* Moved print_backtrace() to utils.h
47
    message ("MSVC is not supported, Yet. Patches welcome!")
58 by Gustav Hartvigsson
* Added preliminary CMake commands for Windows.
48
  endif ()
49
else ()
88 by Gustav Hartvigsson
* Made the SMutex code compile.
50
  add_definitions(-D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE)
58 by Gustav Hartvigsson
* Added preliminary CMake commands for Windows.
51
  # We need -rdynamic to get the traceback information on *nix.
52
  # This may not work on all non-windows targets. FIXME.
109.1.6 by Gustav Hartvigsson
* fixed SLinkedList for the time being.
53
  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -std=c11  -Wall -rdynamic -g -fstack-protector-strong")
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
54
89 by Gustav Hartvigsson
* Started working on Threads
55
  set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pthread -std=c11 -Wall -g -rdynamic -fstack-protector-strong")
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
56
89 by Gustav Hartvigsson
* Started working on Threads
57
  set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -pthread -std=c11 -Wall -rdynamic -fstack-protector-strong")
58 by Gustav Hartvigsson
* Added preliminary CMake commands for Windows.
58
endif ()
32 by Gustav Hartvigsson
* Added some compile options to the root CMakeLists.txt
59
55 by Gustav Hartvigsson
* Added doxygen thingy to the CMake file
60
# add a target to generate API documentation with Doxygen
61
find_package(Doxygen)
62
if(DOXYGEN_FOUND)
63
  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
64
  add_custom_target(doc
65
    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
66
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
67
    COMMENT "Generating API documentation with Doxygen" VERBATIM
68
  )
69
endif(DOXYGEN_FOUND)
70
96 by Gustav Hartvigsson
* Added skeleton for cxx binding. This is not a priotity, and never will be.
71
add_subdirectory (libssts)
72
include_directories (${CMAKE_SOURCE_DIR}/libssts/)
34 by Gustav Hartvigsson
* Finnished test suite
73
add_subdirectory (tests)
74
39 by Gustav Hartvigsson
* Added "check" target for testing.
75
add_library (ssts SHARED ${SSTS_SRC})
138 by Gustav Hartvigsson
* Fixed s_base_16_enc
76
target_link_libraries (ssts PUBLIC ${CMAKE_THREAD_LIBS_INIT})
88 by Gustav Hartvigsson
* Made the SMutex code compile.
77
message (${CMAKE_THREAD_LIBS_INIT})
87 by Gustav Hartvigsson
I have no idea why this is not working...0_o...
78
118 by Gustav Hartvigsson
* Added embedded copyright information in the library.
79
set_target_properties (ssts PROPERTIES COMPILE_DEFINITIONS "SSTS_BUILDING=1")
39 by Gustav Hartvigsson
* Added "check" target for testing.
80
121.1.1 by Gustav Hartvigsson
* added CMake rules for libgc in CMakeLists.txt and a findGC file.
81
# If we found the GC...
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
82
if (S_USE_GC)
121.1.1 by Gustav Hartvigsson
* added CMake rules for libgc in CMakeLists.txt and a findGC file.
83
  if (BOEHM_GC_FOUND)
84
    target_include_directories (ssts PUBLIC ${BOEHM_GC_INCLUDE_DIR})
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
85
    target_link_libraries (ssts PUBLIC ${BOEHM_GC_LIBRARIES})
121.1.1 by Gustav Hartvigsson
* added CMake rules for libgc in CMakeLists.txt and a findGC file.
86
  endif ()
87
endif ()
88
39 by Gustav Hartvigsson
* Added "check" target for testing.
89
enable_testing()
86 by Gustav Hartvigsson
* added external .h files for dealing with stuff that may or may not be avalible on scertain platforms.
90
add_test (test tests/ssts_test )
130.1.6 by Gustav Hartvigsson
* Added more tests
91
add_test (test_ml_b_libc tests/ssts_main_loop_basic_libc )
92
add_test (test_ml_b_gc tests/ssts_main_loop_basic_gc )
93
add_test (test_ml_b_m_n_s tests/ssts_main_loop_basic_mark_and_sweep )
39 by Gustav Hartvigsson
* Added "check" target for testing.
94
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --extra-verbose)
95
96