CMakeLists.txt 35.1 KB
Newer Older
1
# Documentation: Some useful options:
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)
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
9
# -D AIROUTER=true (default false)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
10
# -D JPSFIRE=true (default false)
11
#--------------------------------------------------------------------------
12

Mohcine Chraibi's avatar
Mohcine Chraibi committed
13
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
14
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
15
IF (POLICY CMP0054)
16
    cmake_policy(SET CMP0054 NEW)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
17
ENDIF (POLICY CMP0054)
18 19 20
IF (POLICY CMP0077)
    cmake_policy(SET CMP0077 OLD)
ENDIF (POLICY CMP0077)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
21

Mohcine Chraibi's avatar
Mohcine Chraibi committed
22
project(JPScore LANGUAGES CXX)
23

24
# Options for  jpscore
25
if(NOT AIROUTER)
26
    set(AIROUTER false)
27
else()
28
    set(AIROUTER true)
29 30
endif()

Mohcine Chraibi's avatar
Mohcine Chraibi committed
31
if(NOT JPSFIRE)
32
    set(JPSFIRE false)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
33
else()
34
    set(JPSFIRE true)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
35 36
endif()

37 38
message(STATUS "BUILD_TESTING01: " ${BUILD_TESTING})

Mohcine Chraibi's avatar
Mohcine Chraibi committed
39
set(CMAKE_COLOR_MAKEFILE ON)
40
set(JPSCORE_MAJOR_VERSION 0)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
41
set(JPSCORE_MINOR_VERSION 8)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
42
set(JPSCORE_PATCH_VERSION 4)
43
set(JPSCORE_VERSION
Mohcine Chraibi's avatar
Mohcine Chraibi committed
44
${JPSCORE_MAJOR_VERSION}.${JPSCORE_MINOR_VERSION}.${JPSCORE_PATCH_VERSION})
GrgrLmml's avatar
GrgrLmml committed
45
message(STATUS "JPSCORE_VERSION: " ${JPSCORE_VERSION})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
46
add_definitions("-DJPSCORE_VERSION=\"${JPSCORE_VERSION}\"")
47
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
Mohcine Chraibi's avatar
Mohcine Chraibi committed
48
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
49
    set(warnings "-Wall -Wextra")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
50
    # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
51
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
52
    set(warnings "/W4 /WX /EHsc")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
53
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
54 55 56
    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")
57
elseif ()
GrgrLmml's avatar
GrgrLmml committed
58 59
endif ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${warnings}")
60
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warnings}")
61

62
message(STATUS "BUILD_TESTING02: " ${BUILD_TESTING})
63

GrgrLmml's avatar
GrgrLmml committed
64
if (NOT BUILD_TESTING)
65
    set(BUILD_TESTING OFF) # test units & python tests are not generated.
GrgrLmml's avatar
GrgrLmml committed
66 67
endif (NOT BUILD_TESTING)
message(STATUS "BUILD_TESTING: " ${BUILD_TESTING})
68

GrgrLmml's avatar
GrgrLmml committed
69
if (NOT BUILD_CPPUNIT_TEST)
70
    set(BUILD_CPPUNIT_TEST OFF)
GrgrLmml's avatar
GrgrLmml committed
71 72
endif (NOT BUILD_CPPUNIT_TEST)
message(STATUS "BUILD_CPPUNIT_TEST: " ${BUILD_CPPUNIT_TEST})
73

GrgrLmml's avatar
GrgrLmml committed
74
if (NOT CMAKE_EXPORT_COMPILE_COMMANDS)
75 76
    # To generate a compilation database "compilation_commands.json" for clang_check
    set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
GrgrLmml's avatar
GrgrLmml committed
77
endif (NOT CMAKE_EXPORT_COMPILE_COMMANDS)
78

79
set(CTEST_BUILD_FLAGS "-j")
GrgrLmml's avatar
GrgrLmml committed
80 81

if (NOT CMAKE_BUILD_TYPE)
82 83
    #  set (CMAKE_BUILD_TYPE Release)
    set(CMAKE_BUILD_TYPE Debug)
GrgrLmml's avatar
GrgrLmml committed
84 85
endif (NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
86
if(NOT USE_DUAL_ABI)
87
    set (USE_DUAL_ABI FALSE)
88
endif()
89
#------------------ set important directories --------------------
90 91 92 93 94 95 96
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
97
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib/${CMAKE_BUILD_TYPE})
98
set(CMAKE_TEST_DIR ${CMAKE_SOURCE_DIR}/Utest)
99 100
message(STATUS "BUILD_TESTING03: " ${BUILD_TESTING})

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

129
find_package(Git QUIET) # no need for this msg. It comes from cmake.findgit()
Mohcine Chraibi's avatar
Mohcine Chraibi committed
130 131 132 133
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)
134 135 136 137 138 139 140 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
    # 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)
else()
    message(STATUS "Not in a git repo")
  endif()
166 167

# string(REGEX REPLACE "\#" "" GIT_COMMIT_SUBJECT ${GIT_COMMIT_SUBJECT})
168

169
# even if not in a git repository we need to define these
Mohcine Chraibi's avatar
Mohcine Chraibi committed
170 171 172 173 174
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}\"")

Mohcine Chraibi's avatar
Mohcine Chraibi committed
175 176
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
GrgrLmml's avatar
GrgrLmml committed
177
if (DOXYGEN_FOUND)
178 179 180 181 182
    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/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
183
endif (DOXYGEN_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
184
#http://stackoverflow.com/questions/1487752/how-do-i-instruct-cmake-to-look-for-libraries-installed-by-macports
GrgrLmml's avatar
GrgrLmml committed
185
if (APPLE)
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
    # 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
210
endif (APPLE)
211 212


213

214
if (Boost_NO_SYSTEM_PATHS)
215 216 217 218 219
    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})
220
endif (Boost_NO_SYSTEM_PATHS)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
221 222 223
# 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")
224

Mohcine Chraibi's avatar
Mohcine Chraibi committed
225

226
# find the correct OpenMP flag
Mohcine Chraibi's avatar
Mohcine Chraibi committed
227
FIND_PACKAGE(OpenMP)
GrgrLmml's avatar
GrgrLmml committed
228
if (OPENMP_FOUND)
229 230 231
    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
232
else (OPENMP_FOUND)
233 234 235 236 237 238
    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
239
endif (OPENMP_FOUND)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
240

Ulrich Kemloh's avatar
Ulrich Kemloh committed
241
#statically link all gcc stuffs
242 243
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
244

Erik Andresen's avatar
Erik Andresen committed
245
#boost
246 247 248 249
if(MSVC)
   find_package(Boost COMPONENTS  QUIET)
else()
   find_package(Boost COMPONENTS  REQUIRED)
Erik Andresen's avatar
Erik Andresen committed
250

251 252 253
endif()

message(STATUS "BUILD_TESTING0: " ${BUILD_TESTING})
254
if(AIROUTER)
255 256
    #CGAL
    find_package(CGAL REQUIRED) # for AI router
257
endif()
Erik Andresen's avatar
Erik Andresen committed
258

259
# test all cpp-files in Utest
GrgrLmml's avatar
GrgrLmml committed
260
if (BUILD_TESTING OR BUILD_CPPUNIT_TEST)
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
        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
280 281 282
endif (BUILD_TESTING OR BUILD_CPPUNIT_TEST)

if (BUILD_TESTING)
283
    file(GLOB_RECURSE test_py_files "${CMAKE_TEST_DIR}/*runtest_*.py")
GrgrLmml's avatar
GrgrLmml committed
284
endif (BUILD_TESTING)
285

286
# add sources and headers
GrgrLmml's avatar
GrgrLmml committed
287
set(source_files
Mohcine Chraibi's avatar
Mohcine Chraibi committed
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
Simulation.cpp
general/ArgumentParser.cpp
IO/progress_bar.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
304
geometry/WaitingArea.cpp
Mohcine Chraibi's avatar
Mohcine Chraibi committed
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

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

347 348
#floorfield
routing/ff_router_trips/ffRouterTrips.cpp
349 350
routing/ff_router_trips/FloorfieldViaFMTrips.cpp
routing/ff_router_trips/UnivFFviaFMTrips.cpp
351 352

        #global_shortest
Mohcine Chraibi's avatar
Mohcine Chraibi committed
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
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

391

Mohcine Chraibi's avatar
Mohcine Chraibi committed
392 393 394
events/EventManager.cpp
events/Event.cpp

395 396 397
geometry/Trips.cpp
routing/trips_router/TripsRouter.cpp

Mohcine Chraibi's avatar
Mohcine Chraibi committed
398
forms/jpscore.rc
399
math/KrauszModel.cpp geometry/GoalManager.cpp geometry/GoalManager.h)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
400

Mohcine Chraibi's avatar
Mohcine Chraibi committed
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
set(THIRD_PARTY_SRC
  tinyxml/tinystr.cpp
  tinyxml/tinyxml.cpp
  tinyxml/tinyxmlerror.cpp
  tinyxml/tinyxmlparser.cpp

  poly2tri/common/shapes.cpp
  poly2tri/sweep/sweep_context.cpp
  poly2tri/sweep/advancing_front.cpp
  poly2tri/sweep/sweep.cpp
  poly2tri/sweep/cdt.cpp

  visiLibity/source_code/visilibity.cpp
  )
set(THIRD_PARTY_HDR
  tinyxml/tinyxml.h
  tinyxml/tinystr.h

  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

  visiLibity/source_code/visilibity.hpp
  )

Mohcine Chraibi's avatar
Mohcine Chraibi committed
430
set(JPSFIRE_SRC
Mohcine Chraibi's avatar
Mohcine Chraibi committed
431 432 433 434 435 436 437
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
438
)
Erik Andresen's avatar
Erik Andresen committed
439
set(header_files
440

Mohcine Chraibi's avatar
Mohcine Chraibi committed
441 442 443 444 445 446 447 448 449
#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

450 451 452 453
#floorfield
routing/ff_router_trips/ffRouterTrips.h
routing/ff_router_trips/RectGrid.h
routing/ff_router_trips/Trial.h
454 455
routing/ff_router_trips/FloorfieldViaFMTrips.h
routing/ff_router_trips/UnivFFviaFMTrips.h
456

Mohcine Chraibi's avatar
Mohcine Chraibi committed
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 529 530 531 532
#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

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


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
533
geometry/WaitingArea.h
Mohcine Chraibi's avatar
Mohcine Chraibi committed
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552

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

events/EventManager.h
events/Event.h
553 554 555 556 557

        geometry/Trips.h
        routing/trips_router/TripsRouter.h

        )
Mohcine Chraibi's avatar
Mohcine Chraibi committed
558

Mohcine Chraibi's avatar
Mohcine Chraibi committed
559
set(JPSFIRE_HDR
Mohcine Chraibi's avatar
Mohcine Chraibi committed
560 561 562 563 564 565 566
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
567

568
)
569
SET(AIROUTER_SRC
Mohcine Chraibi's avatar
Mohcine Chraibi committed
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
#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
585 586

#AI router trips
Mohcine Chraibi's avatar
Mohcine Chraibi committed
587 588 589 590 591 592 593 594 595 596 597 598 599 600
#routing/ai_router_trips/AIRouterTrips.cpp
#routing/ai_router_trips/BrainStorage.cpp
#routing/ai_router_trips/cognitiveMap/associations.cpp
#routing/ai_router_trips/cognitiveMap/connection.cpp
#routing/ai_router_trips/cognitiveMap/cognitivemap.cpp
#routing/ai_router_trips/cognitiveMap/landmark.cpp
#routing/ai_router_trips/cognitiveMap/region.cpp
#routing/ai_router_trips/cognitiveMap/landmarknetwork.cpp
#routing/ai_router_trips/cognitiveMap/internnavigationnetwork.cpp
#routing/ai_router_trips/perception/visualsystem.cpp
#routing/ai_router_trips/perception/visibleenvironment.cpp
#routing/ai_router_trips/perception/cgalgeometry.cpp
#routing/ai_router_trips/perception/sign.cpp
#routing/ai_router_trips/Cortex.cpp
601
)
602

603
SET(AIROUTER_HDR
Mohcine Chraibi's avatar
Mohcine Chraibi committed
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
#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
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634

#AI router trips
routing/ai_router_trips/AIRouterTrips.h
routing/ai_router_trips/BrainStorage.h
routing/ai_router_trips/cognitiveMap/associations.h
routing/ai_router_trips/cognitiveMap/connection.cpp
routing/ai_router_trips/cognitiveMap/cognitivemap.h
routing/ai_router_trips/cognitiveMap/landmark.h
routing/ai_router_trips/cognitiveMap/region.h
routing/ai_router_trips/cognitiveMap/landmarknetwork.h
routing/ai_router_trips/cognitiveMap/internnavigationnetwork.h
routing/ai_router_trips/perception/visualsystem.h
routing/ai_router_trips/perception/visibleenvironment.h
routing/ai_router_trips/perception/cgalgeometry.h
routing/ai_router_trips/perception/sign.h
routing/ai_router_trips/Cortex.h
635 636 637 638
)

message(STATUS "AIROUTER: ${AIROUTER}")
if(CGAL_FOUND AND AIROUTER)
639 640 641 642
    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")
643 644
endif()

Mohcine Chraibi's avatar
Mohcine Chraibi committed
645
if(JPSFIRE)
646 647 648 649
    SET(source_files ${source_files} ${JPSFIRE_SRC})
    SET(header_files ${header_files} ${JPSFIRE_HDR})
    message(STATUS "USE JPSFIRE")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJPSFIRE")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
650
endif()
Mohcine Chraibi's avatar
Mohcine Chraibi committed
651

Mohcine Chraibi's avatar
Mohcine Chraibi committed
652
message(STATUS "JPSFIRE: ${JPSFIRE}")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
653
# ----- add here 3th party
Mohcine Chraibi's avatar
Mohcine Chraibi committed
654 655 656 657 658 659
if(JPSFIRE)
    find_package(ZLIB REQUIRED)
    include_directories(${ZLIB_INCLUDE_DIRS})
    add_library(cnpy STATIC "cnpy/cnpy.cpp")
    target_link_libraries(cnpy ${ZLIB_LIBRARIES})
endif()
660

Mohcine Chraibi's avatar
Mohcine Chraibi committed
661 662 663 664 665 666 667 668 669 670 671
# todo make this system
add_library(thirdParty STATIC ${THIRD_PARTY_SRC})

add_library(core STATIC ${source_files})
# c++17 ----
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(TARGET core PROPERTY CXX_STANDARD 17)
set_property(TARGET core PROPERTY CXX_STANDARD_REQUIRED ON)
if(CMAKE_COMPILER_IS_GNUCXX)
  target_link_libraries(core thirdParty stdc++fs) # link to lib filesystem
else()
672 673
  target_link_libraries(core thirdParty)
  #message(WARNING "I don't know how to link filesystem with ${CMAKE_CXX_COMPILER_ID}")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
674 675 676
endif()


Mohcine Chraibi's avatar
Mohcine Chraibi committed
677
#add_library ( core SHARED ${source_files} )
Mohcine Chraibi's avatar
Mohcine Chraibi committed
678
add_executable(jpscore main.cpp ${CMAKE_SOURCE_DIR}/forms/JPScore.ico)
GrgrLmml's avatar
GrgrLmml committed
679
if (Boost_FOUND)
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700
    set(Boost_USE_STATIC_LIBS ON)
    set(Boost_USE_STATIC_RUNTIME ON)
    add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})

    if(WIN32)
        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})
    endif()
    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})

    if(JPSFIRE)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
701
        target_link_libraries(core cnpy)
702
    else()
Mohcine Chraibi's avatar
Mohcine Chraibi committed
703
        target_link_libraries(core)
704
    endif()
Mohcine Chraibi's avatar
Mohcine Chraibi committed
705
else()
706
    message(WARNING did not find BOOST)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
707
endif()
708 709

if (GMP_FOUND)
710 711 712 713
    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})
714 715 716
endif()

if (MPFR_FOUND)
717 718 719 720 721
    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})
722 723 724 725
endif()


if (CGAL_FOUND)
726 727 728 729 730 731 732 733 734 735
    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})
736 737 738
endif()


GrgrLmml's avatar
GrgrLmml committed
739
target_link_libraries(jpscore core)
740

GrgrLmml's avatar
GrgrLmml committed
741
if (WIN32)
742
    target_link_libraries(jpscore core wsock32)
GrgrLmml's avatar
GrgrLmml committed
743
endif (WIN32)
744

745 746 747
if(CGAL_FOUND AND GMP_FOUND AND MPFR_FOUND)
    target_link_libraries(jpscore ${GMP_LIBRARIES} ${MPFR_LIBRARIES} ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES})
endif()
748

GrgrLmml's avatar
GrgrLmml committed
749
##if (JPS_AS_A_SERVICE)
GrgrLmml's avatar
GrgrLmml committed
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781
#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
782
##endif (JPS_AS_A_SERVICE)
783

784 785
#----------------------------------------------------------------------
# enable as many warnings as possible
786
set(warning_flags "-Wall -Wextra")
787
# issue all the warnings demanded by strict iso c and iso c++
788
# set(warning_flags "${warning_flags} -pedantic")
789
# treat warnings as errors
Mohcine Chraibi's avatar
Mohcine Chraibi committed
790
#set(warning_flags "${warning_flags} -Werror")
791
# definition shadows another
Mohcine Chraibi's avatar
Mohcine Chraibi committed
792
#set(warning_flags "${warning_flags} -Wshadow")
793
# do not issue warnings for system headers
794
# set(warning_flags "${warning_flags} -Wno-system-headers")
795
# overloaded virtual function has a different signature
796
# set(warning_flags "${warning_flags} -Woverloaded-virtual")
797
# make string constants const char*
798
# set(warning_flags "${warning_flags} -Wwrite-strings")
799
#----------------------------------------------------------------------
Mohcine Chraibi's avatar
Mohcine Chraibi committed
800
#---------------------------- compiler -------------------------------
801
# Initialize CXXFLAGS.
GrgrLmml's avatar
GrgrLmml committed
802
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
803
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warning_flags}")
tobias schroedter's avatar
tobias schroedter committed
804
    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${warning_flags} -Wunused-variable -Wunused-parameter -Wunused-function -Wshadow -Wunused -DTRACE_LOGGING")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
805
#    set(CMAKE_CXX_FLAGS_RELEASE        "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
GrgrLmml's avatar
GrgrLmml committed
806
endif ()
807

808
#--------------------
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 827 828
# if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
#     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++")
# endif (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

# #if (NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
# 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 ()
Mohcine Chraibi's avatar
Mohcine Chraibi committed
829
#endif ()
830

831

Mohcine Chraibi's avatar
Mohcine Chraibi committed
832
if (MSVC)
833 834 835 836
    message(STATUS "MSVC: " ${MSVC})
    #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
837
elseif (MSVC_IDE)
838
    message(STATUS "MSVC_IDE: " ${MSVC_IDE})
839
elseif(MSVC60)
840
    message(STATUS "MSVC60: " ${MSVC60})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
841
elseif(MSVC71)
842
    message(STATUS "MSVC71: " ${MSVC71})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
843
elseif(MSVC80)
844
    message(STATUS "MSVC80: " ${MSVC80})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
845
elseif(MSVC90)
846
    message(STATUS "MSVC90: " ${MSVC90})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
847
elseif(MSVC10)
848
    message(STATUS "MSVC10: " ${MSVC10})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
849
elseif(MSVC12)
850
    message(STATUS "MSVC12: " ${MSVC12})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
851
elseif(MSVC13)
852
    message(STATUS "MSVC13: " ${MSVC13})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
853
elseif(MSVC14)
854
    message(STATUS "MSVC14: " ${MSVC14})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
855
endif()
856
#---------------------
GrgrLmml's avatar
GrgrLmml committed
857 858
message(STATUS "C++ Compiler: " ${CMAKE_CXX_COMPILER})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
859
    message(STATUS "Using Clang " ${CMAKE_CXX_COMPILER_VERSION})
GrgrLmml's avatar
GrgrLmml committed
860 861
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (CMAKE_COMPILER_IS_GNUCXX)
862
    message(STATUS "Using g++ " ${CMAKE_CXX_COMPILER_VERSION})
GrgrLmml's avatar
GrgrLmml committed
863 864 865
endif (CMAKE_COMPILER_IS_GNUCXX)

if (CMAKE_BUILD_TYPE MATCHES Debug)
866 867
    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
868
else (CMAKE_BUILD_TYPE MATCHES Debug)
869
    message(STATUS "Release flags: " ${CMAKE_CXX_FLAGS} " ,  " ${CMAKE_CXX_FLAGS_RELEASE})
GrgrLmml's avatar
GrgrLmml committed
870
endif (CMAKE_BUILD_TYPE MATCHES Debug)
871

872
# PGI ++ Flags
Mohcine Chraibi's avatar
Mohcine Chraibi committed
873 874 875
# if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")
#     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --c++11 -Minform=inform")
# endif ()
876

877 878 879 880 881 882
if(WIN32)
  if(MSVC)
    set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT jpscore)
    message(STATUS "set start project for VS")
  endif()
endif()
883

884
# ----------------------------- cTest ------------------------------------------
GrgrLmml's avatar
GrgrLmml committed
885
if (BUILD_TESTING OR BUILD_CPPUNIT_TEST)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
886 887 888 889 890 891 892 893 894
  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
  if(BUILD_CPPUNIT_TEST)
895
    foreach (test_src ${test_files})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
896 897 898 899 900 901
      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})
902
    endforeach (test_src ${test_files})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
903 904 905 906 907 908 909 910 911 912
  endif()
  # -- new clean geometry tests
  file(GLOB_RECURSE cgeo_inifiles "${CMAKE_TEST_DIR}/test_geometry/clean_geometry/ini*.xml")
  set(ini_counter "0")
  foreach (cgeo-ini ${cgeo_inifiles})
    MATH(EXPR ini_counter "${ini_counter}+1")
    set(testName "test_clean_geometry_${ini_counter}")
    message(STATUS "Add " ${testName})
    add_test(NAME "${testName}" COMMAND jpscore "${cgeo-ini}")
  endforeach()
913 914


GrgrLmml's avatar
GrgrLmml committed
915 916 917
endif (BUILD_TESTING OR BUILD_CPPUNIT_TEST)

if (BUILD_TESTING)
918 919 920
find_package(PythonInterp)
if (PYTHONINTERP_FOUND)
message(STATUS "Found Python: " ${PYTHON_EXECUTABLE})
921 922 923 924 925 926 927 928 929 930
        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
931 932 933
endif (BUILD_TESTING)


934 935 936
install(TARGETS jpscore
        DESTINATION bin
        COMPONENT applications)
937
if(WIN32)
938 939 940 941 942
    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)
943
endif()
Mohcine Chraibi's avatar
typo  
Mohcine Chraibi committed
944
# ------------- CPACK ------------------------------
Mohcine Chraibi's avatar
Mohcine Chraibi committed
945
IF(UNIX)
946 947 948 949 950 951 952
    SET(CPACK_GENERATOR "DEB")
    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})
Mohcine Chraibi's avatar
Mohcine Chraibi committed
953 954
endif()
if(WIN32 AND NOT UNIX)
955 956 957 958
    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
959 960
        set(CPACK_GENERATOR "${CPACK_GENERATOR};NSIS")
        message(STATUS "   + NSIS                                 YES ")
961
    else(NSIS_PATH)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
962
        message(STATUS "   + NSIS                                 NO ")
963 964 965 966 967 968 969 970 971 972 973
    endif(NSIS_PATH)

    #CPACK_NSIS_URL_INFO_ABOUT
    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}
            DESTINATION sys
            COMPONENT applications)

Mohcine Chraibi's avatar
Mohcine Chraibi committed
974 975 976 977 978
    # 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
    #         COMPONENT applications)
Mohcine Chraibi's avatar
Mohcine Chraibi committed
979
elseif(APPLE)
980
    set(DEFAULT_CPACK_GENERATOR "DragNDrop")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
981 982 983 984 985 986 987 988
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
989

Mohcine Chraibi's avatar
Mohcine Chraibi committed
990 991 992 993 994 995 996 997 998 999 1000
#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
1001
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
1002
SET(CPACK_PACKAGE_VENDOR "Forschungszentrum Juelich GmbH")
1003
SET(CPACK_PACKAGE_NAME "jpscore")
Mohcine Chraibi's avatar
Mohcine Chraibi committed
1004 1005 1006 1007 1008 1009 1010 1011
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)