CMakeLists.txt 2.13 KB
Newer Older
Timothee Habra's avatar
Timothee Habra committed
1
2
3
4
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

5
cmake_minimum_required(VERSION 2.8.7)
Timothee Habra's avatar
Timothee Habra committed
6
7
8

project(MBsysC_realtime)

9
10
11
12
13
14
15
# project configuration
set( CMAKE_C_FLAGS_RELEASE   "-O3" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3" )

# release of debug
release_debug()

Timothee Habra's avatar
Timothee Habra committed
16
17
18
# list source files to compile
init_src()
increment_src(./realtime)
Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
19
increment_src(./void)
Timothee Habra's avatar
Timothee Habra committed
20
21
22
23

# Get SDL lib and add plot functions to src
if (FLAG_PLOT)

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
24
25
26
27
    # Find SDL
    sdl_lib(mbs_realtime)
    set(SDL2_LIBRARIES ${SDL2_LIBRARIES} PARENT_SCOPE)
    set(SDL2TTF_LIBRARIES ${SDL2TTF_LIBRARIES} PARENT_SCOPE)
Timothee Habra's avatar
Timothee Habra committed
28

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
29
    increment_src(./sdl)
Timothee Habra's avatar
Timothee Habra committed
30

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
31
32
    # configure a header file to pass some of the CMake settings to the source code
    set(SDL_FILES ${CMAKE_CURRENT_SOURCE_DIR}/sdl/SDL_files)
Timothee Habra's avatar
Timothee Habra committed
33

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
34
35
36
37
38
39
    configure_file (
        "./sdl/conf/cmake_sdl_config.h.in"
        "${PROJECT_BINARY_DIR}/conf/cmake_sdl_config.h"
    )
    include_directories ("${PROJECT_BINARY_DIR}/conf")
endif ()
Timothee Habra's avatar
Timothee Habra committed
40
41
42
43

# Get java lib and add java functions to src
if (FLAG_VISU)

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
44
45
46
47
    # find java and java 3d
    java_lib(mbs_realtime)
    set(JNI_LIBRARIES ${JNI_LIBRARIES} PARENT_SCOPE)
    set (J3D_PATH ${J3D_PATH} PARENT_SCOPE)
Timothee Habra's avatar
Timothee Habra committed
48

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
49
50
    include_directories("./java")
    increment_src(./java)
Timothee Habra's avatar
Timothee Habra committed
51

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
52
    set(JAR_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../mbsyspad/MBsysPad.jar)
Timothee Habra's avatar
Timothee Habra committed
53

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
54
55
56
57
58
59
    configure_file (
        "./java/conf/cmake_java_config.h.in"
        "${PROJECT_BINARY_DIR}/conf/cmake_java_config.h"
    )
    include_directories ("${PROJECT_BINARY_DIR}/conf")
endif ()
Timothee Habra's avatar
Timothee Habra committed
60
61
62
63
64
65
66

# list include directories (to find headers)
init_include()
set(INCLUDE_DIR ${INCLUDE_DIR} "./realtime" PARENT_SCOPE)

add_library(MBsysC_realtime ${SOURCE_FILES} ${INCLUDE_DIR})

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
67
68
# SDL external library: linkage
if (FLAG_PLOT)
Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
69
    target_link_libraries (MBsysC_realtime ${SDL2_LIBRARIES} ${SDL2TTF_LIBRARIES})
Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
70
71
72
73
endif ( )

# Java external library: linkage
if (FLAG_VISU)
Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
74
    target_link_libraries (MBsysC_realtime ${JNI_LIBRARIES})
Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
75
76
endif ( )

Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
77
# include directories
Timothee Habra's avatar
Timothee Habra committed
78
79
include_directories("./")
include_directories("./sdl" "./sdl/auto_plot")
80
include_directories("./realtime")
Nicolas Van der Noot's avatar
Nicolas Van der Noot committed
81
82
include_directories("../mbs_struct")
include_directories("../mbs_utilities")