CMakeLists.txt 31.8 KB
Newer Older
1
# Documentation: Some useful options:
Mohcine Chraibi's avatar
Mohcine Chraibi committed
2 3 4
# -DCMAKE_CXX_COMPILER:STRING=clang++   -DCMAKE_C_COMPILER:STRING=clang .
# -DCMAKE_BUILD_TYPE:STRING=Debug (default Release)
# -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON (default OFF)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
5
# -DBUILD_TESTING=ON (default OFF) for python tests
Mohcine Chraibi's avatar
Mohcine Chraibi committed
6
# -DBUILD_CPPUNIT_TEST=ON (default OFF) for unit tests
Mohcine Chraibi's avatar
Mohcine Chraibi committed
7
# -DUSE_DUAL_ABI=ON (default OFF)  https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
8
# -D Boost_NO_SYSTEM_PATHS=true (default false) -D BOOST_ROOT=PATH_where_to_find_boost
Mohcine Chraibi's avatar
Mohcine Chraibi committed
9
# -D AIROUTER=true (default false)
10
#--------------------------------------------------------------------------
11

Mohcine Chraibi's avatar
Mohcine Chraibi committed
12
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
13
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
14 15 16
IF (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
ENDIF (POLICY CMP0054)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
17

18
project(JPScore)
19

20 21 22 23 24 25
if(NOT AIROUTER)
set(AIROUTER false)
else()
set(AIROUTER true)
endif()

Mohcine Chraibi's avatar
Mohcine Chraibi committed
26
set(CMAKE_COLOR_MAKEFILE ON)
27
set(JPSCORE_MAJOR_VERSION 0)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
28
set(JPSCORE_MINOR_VERSION 8)
29
set(JPSCORE_PATCH_VERSION 3)
30
set(JPSCORE_VERSION
Mohcine Chraibi's avatar
Mohcine Chraibi committed
31
${JPSCORE_MAJOR_VERSION}.${JPSCORE_MINOR_VERSION}.${JPSCORE_PATCH_VERSION})
GrgrLmml's avatar
GrgrLmml committed
32
message(STATUS "JPSCORE_VERSION: " ${JPSCORE_VERSION})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
33
add_definitions("-DJPSCORE_VERSION=\"${JPSCORE_VERSION}\"")
34
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
Mohcine Chraibi's avatar
Mohcine Chraibi committed
35 36 37 38 39 40 41 42 43
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(warnings "-Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(warnings "/W4 /WX /EHsc")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
message(STATUS "Compiling with Intel settings")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -w")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -w -tcheck")
44
elseif ()
GrgrLmml's avatar
GrgrLmml committed
45 46
endif ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${warnings}")
47
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warnings}")
48

GrgrLmml's avatar
GrgrLmml committed
49
if (NOT BUILD_TESTING)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
50
set(BUILD_TESTING OFF) # test units & python tests are not generated.
GrgrLmml's avatar
GrgrLmml committed
51 52
endif (NOT BUILD_TESTING)
message(STATUS "BUILD_TESTING: " ${BUILD_TESTING})
53

GrgrLmml's avatar
GrgrLmml committed
54
if (NOT BUILD_CPPUNIT_TEST)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
55
set(BUILD_CPPUNIT_TEST OFF)
GrgrLmml's avatar
GrgrLmml committed
56 57
endif (NOT BUILD_CPPUNIT_TEST)
message(STATUS "BUILD_CPPUNIT_TEST: " ${BUILD_CPPUNIT_TEST})
58

GrgrLmml's avatar
GrgrLmml committed
59
if (NOT CMAKE_EXPORT_COMPILE_COMMANDS)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
60 61
# To generate a compilation database "compilation_commands.json" for clang_check
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
GrgrLmml's avatar
GrgrLmml committed
62
endif (NOT CMAKE_EXPORT_COMPILE_COMMANDS)
63 64

# Get number of processors. Mac is not supported
GrgrLmml's avatar
GrgrLmml committed
65
if (NOT DEFINED PROCESSOR_COUNT)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79
# Unknown:
set(PROCESSOR_COUNT 0)

# Linux:
set(cpuinfo_file "/proc/cpuinfo")
if (EXISTS "${cpuinfo_file}")
file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
list(LENGTH procs PROCESSOR_COUNT)
endif (EXISTS "${cpuinfo_file}")

# Windows:
if (WIN32)
set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
endif (WIN32)
GrgrLmml's avatar
GrgrLmml committed
80 81 82
endif (NOT DEFINED PROCESSOR_COUNT)

if (PROCESSOR_COUNT)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
83 84 85
message( STATUS "PROCESSOR_COUNT: " ${PROCESSOR_COUNT})
#  set(CTEST_BUILD_FLAGS "-j${PROCESSOR_COUNT}")
message(STATUS "PROCESSOR_COUNT: 1")
86

Mohcine Chraibi's avatar
Mohcine Chraibi committed
87
set(CTEST_BUILD_FLAGS "-j0")
GrgrLmml's avatar
GrgrLmml committed
88 89 90
endif (PROCESSOR_COUNT)

if (NOT CMAKE_BUILD_TYPE)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
91 92
#  set (CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE Debug)
GrgrLmml's avatar
GrgrLmml committed
93 94
endif (NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
95
if(NOT USE_DUAL_ABI)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
96
set (USE_DUAL_ABI FALSE)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
97
endif()
98
#------------------ set important directories --------------------
Mohcine Chraibi's avatar
Mohcine Chraibi committed
99 100 101 102 103 104 105
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
endif()

if(NOT EXECUTABLE_OUTPUT_PATH)
  set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
endif()
GrgrLmml's avatar
GrgrLmml committed
106
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib/${CMAKE_BUILD_TYPE})
107
set(CMAKE_TEST_DIR ${CMAKE_SOURCE_DIR}/Utest)
108
# Debug messages
GrgrLmml's avatar
GrgrLmml committed
109 110
message(STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR})
message(STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
111
message(STATUS "CMAKE_TEST_DIR: " ${CMAKE_TEST_DIR})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
112 113
message(STATUS "RUN TIME " ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
message(STATUS "EXECUTABE" ${EXECUTABLE_OUTPUT_PATH})
114 115 116
# ========================== build platform ==========================
message(STATUS "")
message(STATUS "Platform: ")
GrgrLmml's avatar
GrgrLmml committed
117 118
message(STATUS "    Host: " ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
if (CMAKE_CROSSCOMPILING)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
119
message(STATUS "    Target: " ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
GrgrLmml's avatar
GrgrLmml committed
120 121 122
endif ()
message(STATUS "    CMake: " ${CMAKE_VERSION})
message(STATUS "    CMake generator: " ${CMAKE_GENERATOR})
123
message(STATUS "    CMake build tool: " ${CMAKE_BUILD_TOOL})
GrgrLmml's avatar
GrgrLmml committed
124
if (MSVC)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
125 126
message(STATUS "    MSVC: " ${MSVC_VERSION})
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ZLIB_WINAPI)
GrgrLmml's avatar
GrgrLmml committed
127 128
endif ()
if (CMAKE_GENERATOR MATCHES Xcode)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
129
message(STATUS "    Xcode: " ${XCODE_VERSION})
GrgrLmml's avatar
GrgrLmml committed
130 131
endif ()
if (NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
132
message(STATUS "    Configuration: " ${CMAKE_BUILD_TYPE})
GrgrLmml's avatar
GrgrLmml committed
133
endif ()
134 135
message(STATUS "")

136 137 138 139
# message( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
# message( STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY: " ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} )
# message( STATUS "EXECUTABLE_OUTPUT_PATH: " ${EXECUTABLE_OUTPUT_PATH} )
# message( STATUS "CMAKE_VERBOSE_MAKEFILE: " ${CMAKE_VERBOSE_MAKEFILE} )
Mohcine Chraibi's avatar
Mohcine Chraibi committed
140

Mohcine Chraibi's avatar
Mohcine Chraibi committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
find_package(Git REQUIRED) # no need for this msg. It comes from cmake.findgit()
find_program(GIT_SCM git DOC "Git version control")
mark_as_advanced(GIT_SCM)
find_file(GITDIR NAMES .git PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)
if (GIT_SCM AND GITDIR)
# the commit's SHA1, and whether the building workspace was dirty or not
# describe --match=NeVeRmAtCh --always --tags --abbrev=40 --dirty
execute_process(COMMAND
"${GIT_EXECUTABLE}" --no-pager describe --tags --always --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

# branch
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# the date of the commit
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%ad --date=local
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

# the subject of the commit
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%s
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_SUBJECT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)



add_definitions("-DGIT_COMMIT_HASH=\"${GIT_SHA1}\"")
add_definitions("-DGIT_COMMIT_DATE=\"${GIT_DATE}\"")
add_definitions("-DGIT_COMMIT_SUBJECT=\"${GIT_COMMIT_SUBJECT}\"")
add_definitions("-DGIT_BRANCH=\"${GIT_BRANCH}\"")
else()
message(STATUS "Not in a git repo")
endif()


Mohcine Chraibi's avatar
Mohcine Chraibi committed
187 188
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
GrgrLmml's avatar
GrgrLmml committed
189
if (DOXYGEN_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
190 191 192 193 194 195
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_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
GrgrLmml's avatar
GrgrLmml committed
196
endif (DOXYGEN_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
197
#http://stackoverflow.com/questions/1487752/how-do-i-instruct-cmake-to-look-for-libraries-installed-by-macports
GrgrLmml's avatar
GrgrLmml committed
198
if (APPLE)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
# Detect if the "port" command is valid on this system; if so, return full path
execute_process(COMMAND which port RESULT_VARIABLE DETECT_MACPORTS OUTPUT_VARIABLE MACPORTS_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if (${DETECT_MACPORTS} EQUAL 0)
# "/opt/local/bin/port" doesn't have libs, so we get the parent directory
get_filename_component(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY)
# "/opt/local/bin" doesn't have libs, so we get the parent directory
get_filename_component(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY)
# "/opt/local" is where MacPorts lives, add `/lib` suffix and link
link_directories(${MACPORTS_PREFIX}/lib)
message(STATUS "Macports detected: ${MACPORTS_PREFIX}/lib")
# SET(CMAKE_SYSTEM_NAME Darwin)
# # Add MacPorts
# INCLUDE_DIRECTORIES(/opt/local/include)

# LINK_DIRECTORIES(/opt/local/lib)

else ()
# Recommendation, also add a "brew --prefix" custom command to detect a homebrew build environment
execute_process(COMMAND brew --prefix RESULT_VARIABLE DETECT_BREW OUTPUT_VARIABLE BREW_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if (${DETECT_BREW} EQUAL 0)
link_directories(${BREW_PREFIX}/lib)
message(STATUS "Brew detected: ${BREW_PREFIX}")
endif ()
endif ()
GrgrLmml's avatar
GrgrLmml committed
223 224 225


endif (APPLE)
226 227


228

229
if (Boost_NO_SYSTEM_PATHS)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
230 231 232 233 234
set(Boost_NO_SYSTEM_PATHS ON)
set(BOOST_INCLUDE_DIRS "${BOOST_ROOT}/include")
set(BOOST_LIBRARY_DIRS "${BOOST_ROOT}/stage/lib")
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${BOOST_ROOT})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${BOOST_LIBRARY_DIRS})
235
endif (Boost_NO_SYSTEM_PATHS)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
236 237 238
# in case boost is a non-default location
# SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:/win32libs/boost")
# SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:/win32libs/boost/lib")
239
#find_package(Boost REQUIRED)
240

Mohcine Chraibi's avatar
Mohcine Chraibi committed
241

242
# find the correct OpenMP flag
Mohcine Chraibi's avatar
Mohcine Chraibi committed
243
FIND_PACKAGE(OpenMP)
GrgrLmml's avatar
GrgrLmml committed
244
if (OPENMP_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
245 246 247
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
GrgrLmml's avatar
GrgrLmml committed
248
else (OPENMP_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
249 250 251 252 253 254
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
# somehow find_package(openmp) does not work properly with clang
else (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Disabling OpenMP support")
endif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
GrgrLmml's avatar
GrgrLmml committed
255
endif (OPENMP_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
256

Ulrich Kemloh's avatar
Ulrich Kemloh committed
257
#statically link all gcc stuffs
258 259
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
260

Erik Andresen's avatar
Erik Andresen committed
261
#boost
Mohcine Chraibi's avatar
Mohcine Chraibi committed
262
find_package(Boost COMPONENTS timer chrono system filesystem unit_test_framework REQUIRED)
Erik Andresen's avatar
Erik Andresen committed
263

264
if(AIROUTER)
265
#CGAL
266 267
find_package(CGAL REQUIRED) # for AI router
endif()
Erik Andresen's avatar
Erik Andresen committed
268

269
# test all cpp-files in Utest
GrgrLmml's avatar
GrgrLmml committed
270 271
if (BUILD_TESTING OR BUILD_CPPUNIT_TEST)

Mohcine Chraibi's avatar
Mohcine Chraibi committed
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
find_package(Boost COMPONENTS timer chrono system filesystem unit_test_framework REQUIRED)
IF (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
IF (USE_DUAL_ABI)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_USE_CXX11_ABI=0")
ENDIF(USE_DUAL_ABI)
set(CMAKE_EXE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake_modules/")
INCLUDE(CodeCoverage)
set(ENABLE_COVERAGE ON)
SETUP_TARGET_FOR_COVERAGE(
cov  # Name for custom target.
ctest         # Name of the test driver executable that runs the tests.
# NOTE! This should always have a ZERO as exit code
# otherwise the coverage generation will not complete.
coverage            # Name of output directory.
)

endif (CMAKE_COMPILER_IS_GNUCXX)
file(GLOB_RECURSE test_files "${CMAKE_TEST_DIR}/*.cpp")
#  file(GLOB test_py_files "${CMAKE_TEST_DIR}/*/runtest*.py")
GrgrLmml's avatar
GrgrLmml committed
293 294 295
endif (BUILD_TESTING OR BUILD_CPPUNIT_TEST)

if (BUILD_TESTING)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
296
file(GLOB_RECURSE test_py_files "${CMAKE_TEST_DIR}/*runtest_*.py")
GrgrLmml's avatar
GrgrLmml committed
297
endif (BUILD_TESTING)
298

299
# add sources and headers
GrgrLmml's avatar
GrgrLmml committed
300
set(source_files
Mohcine Chraibi's avatar
Mohcine Chraibi committed
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
Simulation.cpp
general/ArgumentParser.cpp
IO/progress_bar.cpp
tinyxml/tinystr.cpp
tinyxml/tinyxml.cpp
tinyxml/tinyxmlerror.cpp
tinyxml/tinyxmlparser.cpp

geometry/Building.cpp
geometry/Line.cpp
geometry/Point.cpp
geometry/Transition.cpp
geometry/Hline.cpp
geometry/Obstacle.cpp
geometry/SubRoom.cpp
geometry/Crossing.cpp
geometry/NavLine.cpp
geometry/Room.cpp
geometry/Wall.cpp
geometry/Goal.cpp

IO/GeoFileParser.cpp
IO/IniFileParser.cpp
IO/IODispatcher.cpp
IO/OutputHandler.cpp
IO/PedDistributionParser.cpp
IO/TraVisToClient.cpp

math/ForceModel.cpp
math/Mathematics.cpp
math/ODESolver.cpp
math/GCFMModel.cpp
math/GompertzModel.cpp
math/GradientModel.cpp
math/VelocityModel.cpp
math/OperationalModel.cpp


mpi/LCGrid.cpp

pedestrian/Ellipse.cpp
pedestrian/PedDistributor.cpp
pedestrian/Pedestrian.cpp
pedestrian/AgentsParameters.cpp
pedestrian/Knowledge.cpp
pedestrian/AgentsQueue.cpp
pedestrian/AgentsSource.cpp
pedestrian/Pedestrian.cpp
pedestrian/AgentsSourcesManager.cpp
pedestrian/StartDistribution.cpp


#voronoi/VoronoiDiagramGenerator.cpp
voronoi-boost/VoronoiPositionGenerator.cpp

#floorfield
routing/ff_router/ffRouter.cpp
#routing/ff_router/LocalFloorfieldViaFM.cpp
routing/ff_router/FloorfieldViaFM.cpp
#routing/ff_router/FFKit.cpp
routing/ff_router/UnivFFviaFM.cpp

#global_shortest
routing/global_shortest/AccessPoint.cpp
routing/global_shortest/GlobalRouter.cpp
routing/global_shortest/DTriangulation.cpp

#general
routing/DirectionStrategy.cpp
routing/Router.cpp
routing/RoutingEngine.cpp


#quickest
routing/quickest/QuickestPathRouter.cpp

#Smoke router
routing/smoke_router/SmokeRouter.cpp
routing/smoke_router/GraphNetwork.cpp
routing/smoke_router/NavigationGraph.cpp
routing/smoke_router/BrainStorage.cpp
routing/smoke_router/navigation_graph/GraphEdge.cpp
routing/smoke_router/navigation_graph/GraphVertex.cpp
routing/smoke_router/sensor/RoomToFloorSensor.cpp
routing/smoke_router/sensor/SensorManager.cpp
routing/smoke_router/sensor/AbstractSensor.cpp
routing/smoke_router/sensor/DiscoverDoorsSensor.cpp
routing/smoke_router/sensor/JamSensor.cpp
routing/smoke_router/sensor/LastDestinationsSensor.cpp
routing/smoke_router/sensor/locater.cpp
routing/smoke_router/cognitiveMap/associations.cpp
routing/smoke_router/cognitiveMap/connection.cpp
routing/smoke_router/cognitiveMap/cognitivemap.cpp
routing/smoke_router/cognitiveMap/landmark.cpp
routing/smoke_router/cognitiveMap/region.cpp
routing/smoke_router/cognitiveMap/youareherepointer.cpp
routing/smoke_router/cognitiveMap/cogmapoutputhandler.cpp
routing/smoke_router/cognitiveMap/landmarknetwork.cpp
routing/smoke_router/Brain.cpp
routing/smoke_router/cognitiveMap/internnavigationnetwork.cpp
visiLibity/source_code/visilibity.cpp

poly2tri/common/shapes.cpp
poly2tri/sweep/sweep_context.cpp
poly2tri/sweep/advancing_front.cpp
poly2tri/sweep/sweep.cpp
poly2tri/sweep/cdt.cpp
events/EventManager.cpp
events/Event.cpp

JPSfire/generic/FDSMesh.cpp
JPSfire/generic/Knot.cpp
JPSfire/generic/FDSMeshStorage.cpp
JPSfire/A_smoke_sensor/SmokeSensor.cpp
JPSfire/B_walking_speed/WalkingSpeed.cpp
JPSfire/C_toxicity_analysis/ToxicityAnalysis.cpp
JPSfire/C_toxicity_analysis/ToxicityOutputhandler.cpp
Mohcine Chraibi's avatar
Mohcine Chraibi committed
418
forms/jpscore.rc
Mohcine Chraibi's avatar
Mohcine Chraibi committed
419
math/KrauszModel.cpp)
GrgrLmml's avatar
GrgrLmml committed
420

Erik Andresen's avatar
Erik Andresen committed
421
set(header_files
422

Mohcine Chraibi's avatar
Mohcine Chraibi committed
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
#floorfield
routing/ff_router/ffRouter.h
routing/ff_router/RectGrid.h
routing/ff_router/Trial.h
#routing/ff_router/LocalFloorfieldViaFM.h
routing/ff_router/FloorfieldViaFM.h
#routing/ff_router/FFKit.h
routing/ff_router/UnivFFviaFM.h

#general
routing/DirectionStrategy.h
routing/DummyRouter.h
routing/GlobalRouter.h
routing/QuickestPathRouter.h
routing/SafestPathRouter.h
routing/Router.h
routing/RoutingEngine.h

#global_shortest
routing/global_shortest/GlobalRouter.h
routing/global_shortest/AccessPoint.h
routing/global_shortest/DTriangulation.h

#quickest
routing/quickest/QuickestPathRouter.h

#Smoke router
routing/smoke_router/SmokeRouter.h
routing/smoke_router/GraphNetwork.h
routing/smoke_router/NavigationGraph.h
routing/smoke_router/BrainStorage.h
routing/smoke_router/navigation_graph/GraphEdge.h
routing/smoke_router/navigation_graph/GraphVertex.h
routing/smoke_router/sensor/AbstractSensor.h
routing/smoke_router/sensor/RoomToFloorSensor.h
routing/smoke_router/sensor/SensorManager.h
routing/smoke_router/sensor/DiscoverDoorsSensor.h
routing/smoke_router/sensor/JamSensor.h
routing/smoke_router/sensor/LastDestinationsSensor.h
routing/smoke_router/sensor/locater.h
routing/smoke_router/cognitiveMap/associations.h
routing/smoke_router/cognitiveMap/connection.cpp
routing/smoke_router/cognitiveMap/cognitivemap.h
routing/smoke_router/cognitiveMap/landmark.h
routing/smoke_router/cognitiveMap/region.h
routing/smoke_router/cognitiveMap/youareherepointer.h
routing/smoke_router/cognitiveMap/cogmapoutputhandler.h
routing/smoke_router/cognitiveMap/landmarknetwork.h
routing/smoke_router/Brain.h
routing/smoke_router/cognitiveMap/internnavigationnetwork.h
visiLibity/source_code/visilibity.hpp

pedestrian/Pedestrian.h
pedestrian/PedDistributor.h
pedestrian/Ellipse.h
pedestrian/AgentsParameters.h
pedestrian/Knowledge.h
pedestrian/AgentsQueue.h
pedestrian/AgentsSource.h
pedestrian/Pedestrian.h
pedestrian/AgentsSourcesManager.h
pedestrian/StartDistribution.h
#voronoi/VoronoiDiagramGenerator.h

voronoi-boost/VoronoiPositionGenerator.h

mpi/LCGrid.h

tinyxml/tinyxml.h
tinyxml/tinystr.h

general/ArgumentParser.h
general/Configuration.h
general/Macros.h
general/randomnumbergenerator.h

geometry/Crossing.h
geometry/NavLine.h
geometry/Room.h
geometry/Building.h
geometry/Wall.h
geometry/Line.h
geometry/Point.h
geometry/Transition.h
geometry/Hline.h
geometry/Obstacle.h
geometry/SubRoom.h
geometry/Goal.h

IO/GeoFileParser.h
IO/IniFileParser.h
IO/IODispatcher.h
IO/OutputHandler.h
IO/PedDistributionParser.h
IO/TraVisToClient.h

math/ForceModel.h
math/Mathematics.h
math/ODESolver.h
math/GCFMModel.h
math/GompertzModel.h
math/GradientModel.h
math/VelocityModel.h
math/OperationalModel.h


Mohcine Chraibi's avatar
Mohcine Chraibi committed
529

Mohcine Chraibi's avatar
Mohcine Chraibi committed
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
poly2tri/poly2tri.h
poly2tri/common/shapes.h
poly2tri/sweep/cdt.h
poly2tri/common/utils.h
poly2tri/sweep/sweep_context.h
poly2tri/sweep/advancing_front.h
poly2tri/sweep/sweep.h
events/EventManager.h
events/Event.h

JPSfire/generic/FDSMesh.h
JPSfire/generic/Knot.h
JPSfire/generic/FDSMeshStorage.h
JPSfire/A_smoke_sensor/SmokeSensor.h
JPSfire/B_walking_speed/WalkingSpeed.h
JPSfire/C_toxicity_analysis/ToxicityAnalysis.h
JPSfire/C_toxicity_analysis/ToxicityOutputhandler.h
)
GrgrLmml's avatar
GrgrLmml committed
548

549
SET(AIROUTER_SRC
Mohcine Chraibi's avatar
Mohcine Chraibi committed
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
#AI router
routing/ai_router/AIRouter.cpp
routing/ai_router/BrainStorage.cpp
routing/ai_router/cognitiveMap/associations.cpp
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/cognitivemap.cpp
routing/ai_router/cognitiveMap/landmark.cpp
routing/ai_router/cognitiveMap/region.cpp
routing/ai_router/cognitiveMap/landmarknetwork.cpp
routing/ai_router/cognitiveMap/internnavigationnetwork.cpp
routing/ai_router/perception/visualsystem.cpp
routing/ai_router/perception/visibleenvironment.cpp
routing/ai_router/perception/cgalgeometry.cpp
routing/ai_router/perception/sign.cpp
routing/ai_router/Cortex.cpp
565 566
)
SET(AIROUTER_HDR
Mohcine Chraibi's avatar
Mohcine Chraibi committed
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
#AI router
routing/ai_router/AIRouter.h
routing/ai_router/BrainStorage.h
routing/ai_router/cognitiveMap/associations.h
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/cognitivemap.h
routing/ai_router/cognitiveMap/landmark.h
routing/ai_router/cognitiveMap/region.h
routing/ai_router/cognitiveMap/landmarknetwork.h
routing/ai_router/cognitiveMap/internnavigationnetwork.h
routing/ai_router/perception/visualsystem.h
routing/ai_router/perception/visibleenvironment.h
routing/ai_router/perception/cgalgeometry.h
routing/ai_router/perception/sign.h
routing/ai_router/Cortex.h
582 583 584 585
)

message(STATUS "AIROUTER: ${AIROUTER}")
if(CGAL_FOUND AND AIROUTER)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
586 587 588 589
SET(source_files ${source_files} ${AIROUTER_SRC})
SET(header_files ${header_files} ${AIROUTER_HDR})
message(STATUS "USE AI ROUTER")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DAIROUTER")
590 591
endif()

GrgrLmml's avatar
GrgrLmml committed
592
add_library(core STATIC ${source_files})
593

594 595
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIRS})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
596

597
add_library(cnpy STATIC "cnpy/cnpy.cpp")
598
target_link_libraries(cnpy ${ZLIB_LIBRARIES})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
599

600

Mohcine Chraibi's avatar
Mohcine Chraibi committed
601
#add_library ( core SHARED ${source_files} )
Mohcine Chraibi's avatar
Mohcine Chraibi committed
602

603
#Target
Arne Graf's avatar
Arne Graf committed
604 605 606
#add_executable(
#  jpscore Utest/Fastmarchtest.h
#)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
607 608
add_executable(jpscore main.cpp ${CMAKE_SOURCE_DIR}/forms/JPScore.ico)

Arne Graf's avatar
Arne Graf committed
609

GrgrLmml's avatar
GrgrLmml committed
610
if (Boost_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
611
set(Boost_USE_STATIC_LIBS ON)
612
set(Boost_USE_STATIC_RUNTIME ON)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
613 614 615
 add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})

if(WIN32)
616 617 618 619 620 621
add_definitions( -DBOOST_ALL_NO_LIB )

  # force all boost libraries to dynamic link (we already disabled
  # autolinking, so I don't know why we need this, but we do!)
  add_definitions( -DBOOST_ALL_DYN_LINK )
# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
622
endif()
Mohcine Chraibi's avatar
Mohcine Chraibi committed
623 624 625 626 627 628 629 630 631
message(STATUS "BOOST FOUND: " ${Boost_LIB_VERSION})
message(STATUS "Boost_LIBRARY_DIRS: " ${Boost_LIBRARY_DIRS})
message(STATUS "Boost_INCLUDE_DIR: " ${Boost_INCLUDE_DIR})
message(STATUS "Boost_LIB_VERSION: " ${Boost_LIB_VERSION})
message(STATUS "Boost_libraries: " ${Boost_LIBRARIES})
link_directories(${Boost_LIBRARY_DIRS})

# suppress warnings in boost libraries with attribute SYSTEM
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
632
target_link_libraries(core ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} cnpy)
GrgrLmml's avatar
GrgrLmml committed
633
endif ()
634

Mohcine Chraibi's avatar
Mohcine Chraibi committed
635
#${Boost_LIBRARIES}
636 637

if (GMP_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
638 639 640 641
message(STATUS "GMP FOUND: " ${GMP_FOUND})
message(STATUS "GMP_LIBRARY: " ${GMP_LIBRARIES})
message(STATUS "GMP_INCLUDE_DIR: " ${GMP_INCLUDE_DIR})
include_directories(SYSTEM ${GMP_INCLUDE_DIR})
642 643 644 645

endif()

if (MPFR_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
646 647 648 649 650
message(STATUS "MPFR FOUND: " ${MPFR_FOUND})
message(STATUS "MPFR_LIBRARY: " ${MPFR_LIBRARIES})
message(STATUS "MPFR_INCLUDE_DIR: " ${MPFR_INCLUDE_DIR})
include_directories(SYSTEM ${MPFR_INCLUDE_DIR})
#target_link_libraries(jpscore ${MPFR_LIBRARIES})
651 652 653 654
endif()


if (CGAL_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
655 656 657 658 659 660 661 662 663 664
message(STATUS "CGAL FOUND: " ${CGAL_FOUND})
message(STATUS "CGAL_LIBRARY_DIRS: " ${CGAL_LIBRARIES_DIR})
message(STATUS "CGAL_INCLUDE_DIRS: " ${CGAL_INCLUDE_DIRS})
#message(STATUS "CGAL_LIB_VERSION: " ${CGAL_LIB_VERSION})
message(STATUS "CGAL_libraries: " ${CGAL_LIBRARY})
#link_directories(${CGAL_LIBRARIES_DIR})
#link_directories(${)
include_directories(SYSTEM ${CGAL_INCLUDE_DIRS})
#message(STATUS "CGAL_3rdparty" ${CGAL_3RD_PARTY_LIBRARIES})
#target_link_libraries(jpscore ${CGAL_LIBRARIES})
665 666 667 668

endif()


GrgrLmml's avatar
GrgrLmml committed
669
target_link_libraries(jpscore core)
670

GrgrLmml's avatar
GrgrLmml committed
671
if (WIN32)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
672
target_link_libraries(jpscore core wsock32)
GrgrLmml's avatar
GrgrLmml committed
673
endif (WIN32)
674

675 676
target_link_libraries(jpscore ${GMP_LIBRARIES} ${MPFR_LIBRARIES} ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES})

677

GrgrLmml's avatar
GrgrLmml committed
678
##if (JPS_AS_A_SERVICE)
GrgrLmml's avatar
GrgrLmml committed
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710
#find_package(Protobuf REQUIRED)
#set(GRPC_DIR "${CMAKE_SOURCE_DIR}/cmake_modules/")
#find_package(GRPC REQUIRED)
#file(GLOB ProtoFiles "${CMAKE_SOURCE_DIR}/hybrid/*.proto")
#PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles})
#PROTOBUF_GENERATE_GRPC_CPP(ProtoGRPCSources ProtoGRPCHeaders ${ProtoFiles})
#
#include_directories(${CMAKE_CURRENT_BINARY_DIR})
#set(hybrid_source_files
#        ${ProtoSources}
#        ${ProtoGRPCSources}
#        hybrid/JPSserver.cpp
#        hybrid/HybridSimulationManager.cpp
#        hybrid/Latches.cpp
#        hybrid/GeometryFromProtobufLoader.cpp
#        hybrid/PedDistributionFromProtobufLoader.cpp
#        hybrid/IniFromProtobufLoader.cpp
#        hybrid/IniFileWriter.cpp hybrid/SimObserver.cpp hybrid/SimObserver.h)
#
#set(hybrid_header_files
#        ${ProtoHeaders}
#        ${ProtoGRPCHeaders}
#        hybrid/JPSserver.h
#        hybrid/HybridSimulationManager.h
#        hybrid/Latches.h
#        hybrid/GeometryFromProtobufLoader.h
#        hybrid/PedDistributionFromProtobufLoader.h
#        hybrid/IniFromProtobufLoader.h
#        hybrid/IniFileWriter.h)
#add_library(hybrid STATIC ${hybrid_source_files})
#target_link_libraries(hybrid grpc++ grpc protobuf dl)
#target_link_libraries(core hybrid)
GrgrLmml's avatar
GrgrLmml committed
711
##endif (JPS_AS_A_SERVICE)
712

713 714
#----------------------------------------------------------------------
# enable as many warnings as possible
715
# set(warning_flags "-Wall -Wextra")
716
# issue all the warnings demanded by strict iso c and iso c++
717
# set(warning_flags "${warning_flags} -pedantic")
718
# treat warnings as errors
Mohcine Chraibi's avatar
Mohcine Chraibi committed
719
#set(warning_flags "${warning_flags} -Werror")
720
# definition shadows another
Mohcine Chraibi's avatar
Mohcine Chraibi committed
721
#set(warning_flags "${warning_flags} -Wshadow")
722
# do not issue warnings for system headers
723
# set(warning_flags "${warning_flags} -Wno-system-headers")
724
# overloaded virtual function has a different signature
725
# set(warning_flags "${warning_flags} -Woverloaded-virtual")
726
# make string constants const char*
727
# set(warning_flags "${warning_flags} -Wwrite-strings")
728
#----------------------------------------------------------------------
Mohcine Chraibi's avatar
Mohcine Chraibi committed
729
#---------------------------- compiler -------------------------------
730
# Initialize CXXFLAGS.
GrgrLmml's avatar
GrgrLmml committed
731
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
732 733 734
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warning_flags}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${warning_flags} -O0 -g -Wunused-variable -Wunused-parameter -Wunused-function -Wshadow -Wunused -DTRACE_LOGGING")
#    set(CMAKE_CXX_FLAGS_RELEASE        "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
GrgrLmml's avatar
GrgrLmml committed
735
endif ()
736

737
#--------------------
GrgrLmml's avatar
GrgrLmml committed
738
if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
739 740 741 742 743
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -stdlib=libc++")
GrgrLmml's avatar
GrgrLmml committed
744 745 746
endif (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

if (NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
747 748 749 750 751 752 753 754 755 756 757
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)

if (COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif (COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else ()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif ()
GrgrLmml's avatar
GrgrLmml committed
758
endif ()
759

760

Mohcine Chraibi's avatar
Mohcine Chraibi committed
761
if (MSVC)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
762
message(STATUS "MSVC: " ${MSVC})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
763 764 765
#add_compile_options(cnpy PRIVATE "/W4" "WX-")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT /WX-")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /WX-")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
766
elseif (MSVC_IDE)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
767
message(STATUS "MSVC_IDE: " ${MSVC_IDE})
768
elseif(MSVC60)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
769
message(STATUS "MSVC60: " ${MSVC60})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
770
elseif(MSVC71)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
771
message(STATUS "MSVC71: " ${MSVC71})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
772
elseif(MSVC80)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
773
message(STATUS "MSVC80: " ${MSVC80})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
774
elseif(MSVC90)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
775
message(STATUS "MSVC90: " ${MSVC90})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
776
elseif(MSVC10)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
777
message(STATUS "MSVC10: " ${MSVC10})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
778
elseif(MSVC12)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
779
message(STATUS "MSVC12: " ${MSVC12})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
780
elseif(MSVC13)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
781
message(STATUS "MSVC13: " ${MSVC13})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
782 783
elseif(MSVC14)
message(STATUS "MSVC14: " ${MSVC14})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
784
endif()
785
#---------------------
GrgrLmml's avatar
GrgrLmml committed
786 787
message(STATUS "C++ Compiler: " ${CMAKE_CXX_COMPILER})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
788
message(STATUS "Using Clang " ${CMAKE_CXX_COMPILER_VERSION})
GrgrLmml's avatar
GrgrLmml committed
789 790
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (CMAKE_COMPILER_IS_GNUCXX)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
791
message(STATUS "Using g++ " ${CMAKE_CXX_COMPILER_VERSION})
GrgrLmml's avatar
GrgrLmml committed
792 793 794
endif (CMAKE_COMPILER_IS_GNUCXX)

if (CMAKE_BUILD_TYPE MATCHES Debug)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
795 796
set(CMAKE_CXX_LDFLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
message(STATUS "Debug flags: " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_DEBUG})
GrgrLmml's avatar
GrgrLmml committed
797
else (CMAKE_BUILD_TYPE MATCHES Debug)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
798
message(STATUS "Release flags: " ${CMAKE_CXX_FLAGS} " ,  " ${CMAKE_CXX_FLAGS_RELEASE})
GrgrLmml's avatar
GrgrLmml committed
799
endif (CMAKE_BUILD_TYPE MATCHES Debug)
800

801
# PGI ++ Flags
GrgrLmml's avatar
GrgrLmml committed
802
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
803
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --c++11 -Minform=inform")
GrgrLmml's avatar
GrgrLmml committed
804
endif ()
805 806


807
# ----------------------------- cTest ------------------------------------------
GrgrLmml's avatar
GrgrLmml committed
808
if (BUILD_TESTING OR BUILD_CPPUNIT_TEST)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826
set(counter "0")
SET(BUILD_TEST_TIMEOUT 10800 CACHE STRING "Global timeout on all tests (seconds).")
SET(DART_TESTING_TIMEOUT "${BUILD_TEST_TIMEOUT}" CACHE STRING "" FORCE)
message(STATUS "Timeout: " ${BUILD_TEST_TIMEOUT} " s")
enable_testing() # adds another build target, which is test for Makefile generators
include(CTest) # adding Dart support

# test if code compiles and runs default setting. Takes about 30 seconds

# link_directories(${Boost_LIBRARY_DIRS})
foreach (test_src ${test_files})
MATH(EXPR counter "${counter}+1")
GET_FILENAME_COMPONENT(test ${test_src} NAME_WE)
message(STATUS "Add test " ${counter} "  : " ${test})
add_executable(${test} ${test_src})
target_link_libraries(${test} core ${Boost_LIBRARIES})
add_test(NAME ${test} COMMAND ${test})
endforeach (test_src ${test_files})
GrgrLmml's avatar
GrgrLmml committed
827 828 829
endif (BUILD_TESTING OR BUILD_CPPUNIT_TEST)

if (BUILD_TESTING)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851
#  add_test (jpscore_compile ${CMAKE_CTEST_COMMAND}
#  --build-and-test "${CMAKE_SOURCE_DIR}"  "${CMAKE_SOURCE_DIR}" #"${EXECUTABLE_OUTPUT_PATH}" #"${CMAKE_BINARY_DIR}"
#  --build-generator ${CMAKE_GENERATOR}
#  --build-makeprogram ${CMAKE_MAKE_PROGRAM} -j${PROCESSOR_COUNT}
#  --build-two-config
#  --build-exe-dir ${EXECUTABLE_OUTPUT_PATH}  # todo wo soll der exe hin?: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
#  --build-project JPScore
#  --test-command jpscore --ini=${CMAKE_SOURCE_DIR}/inputfiles/Default/ini.xml
#  )
find_package(PythonInterp)
if (PYTHONINTERP_FOUND)
message(STATUS "Found Python: " ${PYTHON_EXECUTABLE})
foreach (test_src ${test_py_files})
MATH(EXPR counter "${counter}+1")
GET_FILENAME_COMPONENT(test ${test_src} NAME_WE)
message(STATUS "Add py test " ${counter} "  : " ${test})
# message (STATUS "Add python test: " ${test} " | test_src: " ${PYTHON_EXECUTABLE} " " ${test_src})
add_test(NAME ${test} COMMAND ${PYTHON_EXECUTABLE} ${test_src})
endforeach (test_src ${test_py_files})
# set (test_parameters "${CMAKE_SOURCE_DIR}")
# add_test(NAME flow  COMMAND "${CMAKE_TEST_DIR}/testflow.py" "${test_parameters}")
endif (PYTHONINTERP_FOUND)
GrgrLmml's avatar
GrgrLmml committed
852 853 854
endif (BUILD_TESTING)


Mohcine Chraibi's avatar
Mohcine Chraibi committed
855
install(TARGETS jpscore DESTINATION bin)
856
if(WIN32)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
857 858 859 860 861
set(CT_DATA_FILE_DIR "demos")
file(GLOB CT_FILES "${CMAKE_SOURCE_DIR}/${CT_DATA_FILE_DIR}/*/*")
install(FILES ${CT_FILES}
        DESTINATION ${CT_DATA_FILE_DIR}
        COMPONENT demos)
862
endif()
Mohcine Chraibi's avatar
typo  
Mohcine Chraibi committed
863
# ------------- CPACK ------------------------------
Mohcine Chraibi's avatar
Mohcine Chraibi committed
864
IF(UNIX)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
865
SET(CPACK_GENERATOR "DEB")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
866 867 868 869 870 871 872 873
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET( CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://jupedsim.org")
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS, "jpsvis, jpsreport, jpseditor")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_PACKAGE_SECTION "science")
SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
endif()
if(WIN32 AND NOT UNIX)
874 875 876 877
        message(STATUS "Package generation - Windows")
        set(CPACK_GENERATOR "NSIS")
        find_program(NSIS_PATH nsis PATH_SUFFIXES nsis)
        if(NSIS_PATH)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
878 879
        set(CPACK_GENERATOR "${CPACK_GENERATOR};NSIS")
        message(STATUS "   + NSIS                                 YES ")
880
        else(NSIS_PATH)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
881
        message(STATUS "   + NSIS                                 NO ")
882
        endif(NSIS_PATH)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
883 884

#CPACK_NSIS_URL_INFO_ABOUT
885 886 887 888 889
        set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
        include(InstallRequiredSystemLibraries)

        message(STATUS "System Dependencies: " ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
        install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
Mohcine Chraibi's avatar
Mohcine Chraibi committed
890 891
        DESTINATION sys
        COMPONENT applications)
892 893 894 895 896

        install(FILES "${Boost_INCLUDE_DIR}/../bin/boost_system-vc141-mt-x32-1_67.dll"
                      "${Boost_INCLUDE_DIR}/../bin/boost_filesystem-vc141-mt-x32-1_67.dll"
                                  "${Boost_INCLUDE_DIR}/../bin/zlib1.dll"
                DESTINATION bin
Mohcine Chraibi's avatar
Mohcine Chraibi committed
897
        COMPONENT applications)
898

Mohcine Chraibi's avatar
Mohcine Chraibi committed
899 900
#	install(PROGRAMS ${Boost_INCLUDE_DIR}/../bin/boost_filesystem-vc141-mt-x32-1_67.dll
#		DESTINATION bin
901 902 903 904 905 906 907
#        COMPONENT applications)

        #COPYINSTALL_DLLS("${Boost_INCLUDE_DIR}/../../lib" . boost_system boost_filesystem boost_thread boost_asio)

        #COPYINSTALL_DLLS("$BOOST_INCLUDE_DIRS/../../lib" . boost_system boost_filesystem)


Mohcine Chraibi's avatar
Mohcine Chraibi committed
908 909 910 911 912 913 914 915 916 917
elseif(APPLE)
set(DEFAULT_CPACK_GENERATOR "DragNDrop")
endif()

set(CPACK_COMPONENTS_ALL applications)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/LICENSE")
#set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\hw.bmp")
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/forms/jpscore.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/forms/jpscore.ico")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
918

Mohcine Chraibi's avatar
Mohcine Chraibi committed
919 920 921 922 923 924 925 926 927 928 929
#install(DIRECTORY "${PROJECT_SOURCE_DIR}/demos/" DESTINATION "demos")


set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_COMPONENTS_ALL applications demos)
set(CPACK_COMPONENT_CTDATA_GROUP "Demos")
set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "jpscore and dlls")
set(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "demo files")
set(CPACK_COMPONENT_DATA_FILES_DESCRIPTION "demo files to get started")
SET(CPACK_PACKAGE_DESCRIPTION "Simulation core of JuPedSim")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
930
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The simulation core of JuPedSim, a framework for simulation and analysis of pedestrian dynamics")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
931 932
SET(CPACK_PACKAGE_VENDOR "Forschungszentrum Juelich GmbH")
SET(CPACK_PACKAGE_NAME "JuPedSim/JPScore")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
933 934 935 936 937 938 939 940
SET(CPACK_PACKAGE_CONTACT "m.chraibi@fz-juelich.de")
SET(CPACK_PACKAGE_VERSION_MAJOR "${JPSCORE_MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${JPSCORE_MINOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_PATCH "${JPSCORE_PATCH_VERSION}")
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${JPSCORE_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${JPSCORE_VERSION}")

INCLUDE(CPack)