|
1 | 1 | cmake_minimum_required(VERSION 2.8)
|
2 | 2 |
|
3 |
| -project(GSAP) |
4 |
| - |
5 |
| -set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin/) |
6 |
| -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
7 |
| -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
8 |
| -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
9 |
| -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) |
10 |
| -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) |
11 |
| -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) |
12 |
| -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}) |
13 |
| -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}) |
14 |
| -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}) |
15 |
| - |
16 |
| -# Build option for enabling compiler and linker flags for gathering coverage data |
17 |
| -# In command line, set option this way: |
18 |
| -# cmake -DCoverage=ON <build folder> |
| 3 | +# Build option for enabling compiler and linker flags for gathering coverage data |
| 4 | +# In command line, set option this way: |
| 5 | +# cmake -DCoverage=ON <build folder> |
19 | 6 | option(Coverage "Coverage" OFF)
|
20 | 7 |
|
21 |
| -if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") |
22 |
| - # -g: Produce debugging information |
23 |
| - # -O3: Optimize as much as possible while remaning standards compliant |
24 |
| - # -O0: Disable optimizations |
25 |
| - # -std: Determine the language standard. |
26 |
| - # -Wall: Enables all the warnings about constructions that some users consider questionable |
27 |
| - # -Wcast-qual: Warn whenever a pointer is cast so as to remove a type qualifier from the target type |
28 |
| - # -Werror: Make all warnings into errors |
29 |
| - # -Weffc++: Warn about violations of some guidelines from Scott Meyers' Effective C++ (Note 2016-07-13: Currently removed because it warns about some things that are perfectly safe) |
30 |
| - # -Wextra: Enables some extra warning flags that are not enabled by -Wall |
31 |
| - # -Wfloat-equal: Warn if floating-point values are used in equality comparisons. |
32 |
| - # -Wformat: Check calls to printf and scanf, etc. |
33 |
| - # -Winline: Warn if a function that is declared as inline cannot be inlined |
34 |
| - # -Wold-style-cast: Warn on C-style casts |
35 |
| - # -Wpedantic: Issue all the warnings demanded by strict ISO C and ISO C++ |
36 |
| - # -Wshadow: Warn whenever a local variable or type declaration shadows another variable, parameter, type, or class member |
37 |
| - # -Wsign-conversion: Warn for implicit conversions that may change the sign of an integer value |
38 |
| - # -Wswitch-default: Warn whenever a switch statement does not have a default case. |
39 |
| - # -Wno-unknown-pragmas: (2016-07-13) Temporarily added to disable warnings about #pragma unused |
40 |
| - set(CMAKE_CXX_FLAGS "-std=c++11 -pthread") |
41 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstrict-aliasing") |
42 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wcast-qual -Wextra -Wfloat-equal") |
43 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wold-style-cast -Wpedantic -Wshadow") |
44 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion -Wswitch-default -Wno-unknown-pragmas") |
45 |
| - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Winline") |
46 |
| - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Werror") |
47 |
| -elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") |
48 |
| - # -g: Produce debugging information |
49 |
| - # -O3: Optimize as much as possible while remaning standards compliant |
50 |
| - # -Og: Enable optimizations that don't interfere with debugging |
51 |
| - # -std: Determine the language standard. |
52 |
| - # -Wall: Enables all the warnings about constructions that some users consider questionable |
53 |
| - # -Wcast-qual: Warn whenever a pointer is cast so as to remove a type qualifier from the target type |
54 |
| - # -Werror: Make all warnings into errors |
55 |
| - # -Weffc++: Warn about violations of some guidelines from Scott Meyers' Effective C++ (Note 2016-07-13: Currently removed because it warns about some things that are perfectly safe) |
56 |
| - # -Wextra: Enables some extra warning flags that are not enabled by -Wall |
57 |
| - # -Wfloat-equal: Warn if floating-point values are used in equality comparisons. |
58 |
| - # -Wformat: Check calls to printf and scanf, etc. |
59 |
| - # -Winline: Warn if a function that is declared as inline cannot be inlined |
60 |
| - # -Wold-style-cast: Warn on C-style casts |
61 |
| - # -Wpedantic: Issue all the warnings demanded by strict ISO C and ISO C++ |
62 |
| - # -Wshadow: Warn whenever a local variable or type declaration shadows another variable, parameter, type, or class member |
63 |
| - # -Wsign-conversion: Warn for implicit conversions that may change the sign of an integer value |
64 |
| - # -Wswitch-default: Warn whenever a switch statement does not have a default case. |
65 |
| - # -Wno-unknown-pragmas: (2016-07-13) Temporarily added to disable warnings about #pragma unused |
66 |
| - set(CMAKE_CXX_FLAGS "-std=c++11 -pthread") |
67 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstrict-aliasing") |
68 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wcast-qual -Wextra -Wfloat-equal") |
69 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wold-style-cast -Wpedantic -Wshadow") |
70 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion -Wswitch-default -Wno-unknown-pragmas") |
71 |
| - |
72 |
| -if(Coverage) |
73 |
| - # If coverage option enabled, set compiler and linker flags to gather coverage data |
74 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") |
75 |
| - set(CMAKE_EXE_LINKER_FLAGS "-lgcov") |
76 |
| -endif() |
77 |
| - |
78 |
| - set(CMAKE_CXX_FLAGS_DEBUG "-g -Og -Winline") |
79 |
| - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Werror") |
80 |
| -elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") |
81 |
| - # /EHsc: Specifies the model of exception handling. |
82 |
| - # /GL: Enables whole program optimization. |
83 |
| - # /Gm: Enables minimal rebuild. |
84 |
| - # /GS: Buffers security check. |
85 |
| - # /MD: Creates a multithreaded DLL using MSVCRT.lib. |
86 |
| - # /MDd: Creates a debug multithreaded DLL using MSVCRTD.lib. |
87 |
| - # /O2: Creates fast code. |
88 |
| - # /Od: Disables optimization. |
89 |
| - # /Oi: Generates intrinsic functions. |
90 |
| - # /RTC1: Enables run-time error checking. |
91 |
| - # /sdl: Enables additional (Windows-specific) security features and warnings. |
92 |
| - # /W4: Sets which warning level to output. |
93 |
| - # /wd: Disable warning |
94 |
| - # /Zi: Generates complete debugging information. |
95 |
| - set(CMAKE_CXX_FLAGS "/EHsc /GS /sdl- /W4 /wd\"4996\" /Zi") |
96 |
| - set(CMAKE_CXX_FLAGS_DEBUG "/Gm /MDd /Od /RTC1") |
97 |
| - set(CMAKE_CXX_FLAGS_RELEASE "/GL /Gm- /MD /O2 /Oi") |
98 |
| -else() |
99 |
| - message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} is not recognized.") |
100 |
| -endif() |
101 |
| - |
102 | 8 | # Check command line to see if OpenMP is to be used.
|
103 | 9 | option(UseOpenMP "UseOpenMP" FALSE)
|
104 | 10 |
|
105 | 11 | # Build with OpenMP if desired, and package can be found.
|
106 | 12 | if (UseOpenMP)
|
107 |
| - message(STATUS "Attempting to find OpenMP package...") |
108 |
| - find_package(OpenMP) |
109 |
| - if (OPENMP_FOUND) |
110 |
| - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") |
| 13 | + message(STATUS "Attempting to find OpenMP package...") |
| 14 | + find_package(OpenMP) |
| 15 | + if (OPENMP_FOUND) |
| 16 | + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") |
111 | 17 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
112 |
| - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") |
113 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D USING_OPENMP") |
114 |
| - message(STATUS "Added OpenMP to buildsystem") |
115 |
| - else() |
116 |
| - message(FATAL_ERROR "Command line asked for OpenMP, but package couldn't be found!") |
117 |
| - endif() |
| 18 | + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") |
| 19 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D USING_OPENMP") |
| 20 | + message(STATUS "Added OpenMP to buildsystem") |
| 21 | + else() |
| 22 | + message(FATAL_ERROR "Command line asked for OpenMP, but package couldn't be found!") |
| 23 | + endif() |
118 | 24 | endif()
|
119 | 25 |
|
120 |
| -#Libraries |
121 |
| -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/support/) |
122 |
| -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/framework/) |
123 |
| -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Test/) |
124 |
| -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/example/) |
| 26 | +set(HEADERS |
| 27 | + inc/BenchmarkTimer.h |
| 28 | + inc/CompositeSavePointProvider.h |
| 29 | + inc/ConfigMap.h |
| 30 | + inc/Contracts.h |
| 31 | + inc/DataPoint.h |
| 32 | + inc/DataPoints.h |
| 33 | + inc/DataStore.h |
| 34 | + inc/Datum.h |
| 35 | + inc/DynamicArray.h |
| 36 | + inc/AsyncPrognoser.h |
| 37 | + inc/AsyncPrognoserBuilder.h |
| 38 | + inc/Exceptions.h |
| 39 | + inc/Factory.h |
| 40 | + inc/GaussianVariable.h |
| 41 | + inc/ISavePointProvider.h |
| 42 | + inc/Loading/ConstLoadEstimator.h |
| 43 | + inc/Loading/LoadEstimator.h |
| 44 | + inc/Loading/LoadEstimatorFactory.h |
| 45 | + inc/Loading/MovingAverageLoadEstimator.h |
| 46 | + inc/Matrix.h |
| 47 | + inc/Messages/IMessageProcessor.h |
| 48 | + inc/Messages/IMessagePublisher.h |
| 49 | + inc/Messages/Message.h |
| 50 | + inc/Messages/MessageBus.h |
| 51 | + inc/Messages/MessageClock.h |
| 52 | + inc/Messages/MessageId.h |
| 53 | + inc/Messages/MessageWatcher.h |
| 54 | + inc/Messages/ProgEventMessage.h |
| 55 | + inc/Messages/UDataMessage.h |
| 56 | + inc/Messages/WaypointMessage.h |
| 57 | + inc/ModelBasedAsyncPrognoserBuilder.h |
| 58 | + inc/ModelBasedPrognoser.h |
| 59 | + inc/Models/BatteryModel.h |
| 60 | + inc/Models/SystemModel.h |
| 61 | + inc/Models/SystemModelFactory.h |
| 62 | + inc/Models/PrognosticsModel.h |
| 63 | + inc/Models/PrognosticsModelFactory.h |
| 64 | + inc/Observers/AsyncObserver.h |
| 65 | + inc/Observers/Observer.h |
| 66 | + inc/Observers/ObserverFactory.h |
| 67 | + inc/Observers/ParticleFilter.h |
| 68 | + inc/Observers/UnscentedKalmanFilter.h |
| 69 | + inc/Predictors/AsyncPredictor.h |
| 70 | + inc/Predictors/MonteCarloPredictor.h |
| 71 | + inc/Predictors/Predictor.h |
| 72 | + inc/Predictors/PredictorFactory.h |
| 73 | + inc/PContainer.h |
| 74 | + inc/Point3D.h |
| 75 | + inc/ProgEvent.h |
| 76 | + inc/Prognoser.h |
| 77 | + inc/PrognoserFactory.h |
| 78 | + inc/Singleton.h |
| 79 | + inc/StatisticalTools.h |
| 80 | + inc/StringUtils.h |
| 81 | + inc/Trajectory/AsyncTrajectoryService.h |
| 82 | + inc/Trajectory/ITrajectoryCorrelator.h |
| 83 | + inc/Trajectory/TrajectoryService.h |
| 84 | + inc/ThreadSafeLog.h |
| 85 | + inc/UData.h |
| 86 | + inc/UDataInterfaces.h |
| 87 | +) |
| 88 | + |
| 89 | +set(SRCS |
| 90 | + src/ConfigMap.cpp |
| 91 | + src/DataPoint.cpp |
| 92 | + src/DataPoints.cpp |
| 93 | + src/AsyncPrognoserBuilder.cpp |
| 94 | + src/GaussianVariable.cpp |
| 95 | + src/Loading/ConstLoadEstimator.cpp |
| 96 | + src/Loading/GaussianLoadEstimator.cpp |
| 97 | + src/Loading/MovingAverageLoadEstimator.cpp |
| 98 | + src/Matrix.cpp |
| 99 | + src/Messages/EmptyMessage.cpp |
| 100 | + src/Messages/Message.cpp |
| 101 | + src/Messages/MessageBus.cpp |
| 102 | + src/Messages/MessageId.cpp |
| 103 | + src/Messages/WaypointMessage.cpp |
| 104 | + src/ModelBasedAsyncPrognoserBuilder.cpp |
| 105 | + src/ModelBasedPrognoser.cpp |
| 106 | + src/Models/BatteryModel.cpp |
| 107 | + src/Observers/AsyncObserver.cpp |
| 108 | + src/Observers/ParticleFilter.cpp |
| 109 | + src/Observers/UnscentedKalmanFilter.cpp |
| 110 | + src/PContainer.cpp |
| 111 | + src/Predictors/AsyncPredictor.cpp |
| 112 | + src/Predictors/MonteCarloPredictor.cpp |
| 113 | + src/StatisticalTools.cpp |
| 114 | + src/ThreadSafeLog.cpp |
| 115 | + src/Trajectory/AsyncTrajectoryService.cpp |
| 116 | + src/Trajectory/TrajectoryService.cpp |
| 117 | + src/UData.cpp |
| 118 | + src/UDataInterfaces.cpp |
| 119 | +) |
| 120 | + |
| 121 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc/) |
| 122 | +add_library(gsap ${HEADERS} ${SRCS}) |
0 commit comments