CMakeLists.txt 3.07 KB
Newer Older
1 2
# Crowd Simulator Engine
# Copyright (C) 2018 - Inria Rennes - Rainbow - Julien Pettre
3
#
4 5
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 3
7
# of the License, or (at your option) any later version.
8
#
9 10 11 12 13
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
14 15
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
16 17
#
# Authors: Axel Lopez Gandia, Javad Amirian, Florian Berton,
18
# Julien Legros, Lucas Pelerin, Beatriz Cabrero Daniel, Fabien Grzeskowiak, 
19
# Alicia Nic�s Miquel, Alexandre Bonneau, Wouter Van toll, Benjamin Niay.
20
#
21 22
# Contact: crowd_group@inria.fr

23

24 25
cmake_minimum_required( VERSION 2.8 )
project( CrowdSimulator )
LOPEZ GANDIA Axel's avatar
LOPEZ GANDIA Axel committed
26
set (CMAKE_CXX_STANDARD 14)
27

Javad AMIRIAN's avatar
Javad AMIRIAN committed
28
#set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
29

30 31
# === include 3rd-party code

32 33
#set(Boost_USE_STATIC_LIBS ON)
#find_package(Boost COMPONENTS system filesystem regex REQUIRED)
34
include_directories( ./include )
35
include_directories(./3rd-party/tinyxml/ ./3rd-party/nanoflann/)
36 37 38

link_directories( ./lib/${CMAKE_BUILD_TYPE} )

39 40
#link_directories(${Boost_LIBRARY_DIRS})
#include_directories( ${Boost_INCLUDE_DIRS} )
41

Javad AMIRIAN's avatar
Javad AMIRIAN committed
42
file( GLOB_RECURSE source_files src/* include/*)
43
file( GLOB_RECURSE 3rd_party 3rd-party/tinyxml/* 3rd-party/nanoflann/*)
44

45 46 47 48 49 50 51 52 53
# === use multithreading?

option(OCSR_USE_MULTITHREADING "Allow the program to use multiple parallel threads" ON)
if (OCSR_USE_MULTITHREADING)
	if (MSVC)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /openmp")
    endif (MSVC)
endif(OCSR_USE_MULTITHREADING)

54 55 56 57 58 59
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
else()
#linux compatibility compiler option
add_definitions(-fPIC)
endif()

60 61
# === Engine project: a static library that performs the simulation

62
add_library(Engine STATIC ${source_files} ${3rd_party})
63

64 65
# === Console application

66 67 68 69 70 71 72 73
IF (WIN32)
add_executable(OCSR_ConsoleApplication_windows main.cpp)
target_link_libraries(OCSR_ConsoleApplication_windows Engine)
ELSE()
add_executable(OCSR_ConsoleApplication_linux main.cpp)
target_link_libraries(OCSR_ConsoleApplication_linux Engine)
ENDIF()

74
# === Dynamic library (e.g. a DLL on Windows) to include into other programs
Javad AMIRIAN's avatar
Javad AMIRIAN committed
75

76 77 78
add_library(OCSR_Library SHARED "APIFunctions.h" "APIFunctions.cpp")
target_link_libraries(OCSR_Library Engine)

79
# === Clean up the project's directory structure
80 81 82 83 84 85 86 87 88

foreach(_source IN ITEMS ${source_files})
    get_filename_component(_source_path "${_source}" PATH)
    file(RELATIVE_PATH _source_path_rel "${CMAKE_CURRENT_SOURCE_DIR}" "${_source_path}")
	string(REPLACE "include/" "" _source_path_rel ${_source_path_rel})
	string(REPLACE "src/" "" _source_path_rel ${_source_path_rel})
    string(REPLACE "/" "\\" _group_path "${_source_path_rel}")
    source_group("${_group_path}" FILES "${_source}")
endforeach()
89
source_group("3rd-party" FILES ${3rd_party})