Commit 6fd4a1a0 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Add cmake option to compile AIrouter

cmake  -DAIROUTER=true

if you want to use AIRouter.
(CGAL should be installed)
parent 311f63fa
Pipeline #9454 failed with stages
in 9 minutes and 51 seconds
......@@ -6,6 +6,7 @@
# -DBUILD_CPPUNIT_TEST=ON (default OFF) for unit tests
# -DUSE_DUAL_ABI=ON (default OFF) https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
# -D Boost_NO_SYSTEM_PATHS=true (default false) -D BOOST_ROOT=PATH_where_to_find_boost
# -D AIROUTER (default true)
#--------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
......@@ -13,6 +14,12 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
project(JPScore)
if(NOT AIROUTER)
set(AIROUTER false)
else()
set(AIROUTER true)
endif()
set(CMAKE_COLOR_MAKEFILE ON)
set(JPSCORE_MAJOR_VERSION 0)
set(JPSCORE_MINOR_VERSION 8)
......@@ -63,7 +70,6 @@ if (NOT DEFINED PROCESSOR_COUNT)
list(LENGTH procs PROCESSOR_COUNT)
endif (EXISTS "${cpuinfo_file}")
# Windows:
if (WIN32)
set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
......@@ -199,7 +205,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
find_package(Boost COMPONENTS timer chrono system filesystem unit_test_framework REQUIRED)
#CGAL
find_package(CGAL REQUIRED)
find_package(CGAL QUIET) # for AI router
# test all cpp-files in Utest
......@@ -336,24 +342,6 @@ set(source_files
routing/smoke_router/cognitiveMap/internnavigationnetwork.cpp
visiLibity/source_code/visilibity.cpp
#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
poly2tri/common/shapes.cpp
poly2tri/sweep/sweep_context.cpp
poly2tri/sweep/advancing_front.cpp
......@@ -426,23 +414,6 @@ set(header_files
routing/smoke_router/cognitiveMap/internnavigationnetwork.h
visiLibity/source_code/visilibity.hpp
#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
pedestrian/Pedestrian.h
pedestrian/PedDistributor.h
pedestrian/Ellipse.h
......@@ -516,6 +487,49 @@ set(header_files
JPSfire/C_toxicity_analysis/ToxicityOutputhandler.h
)
SET(AIROUTER_SRC
#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
)
SET(AIROUTER_HDR
#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
)
message(STATUS "AIROUTER: ${AIROUTER}")
if(CGAL_FOUND AND AIROUTER)
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")
endif()
add_library(core STATIC ${source_files})
find_package(ZLIB REQUIRED)
......@@ -671,6 +685,7 @@ if (NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
endif ()
endif ()
if (MSVC)
message(STATUS "MSVC: " ${MSVC})
elseif (MSVC_IDE)
......
......@@ -1045,7 +1045,6 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
Log->Write("ERROR: \t Agent Distribution section is missing");
return false;
}
//first get list of actually used router
std::vector<int> usedRouter;
usedRouter.clear();
......@@ -1104,6 +1103,7 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
}
else if ((strategy == "AI") &&
(std::find(usedRouter.begin(), usedRouter.end(), id) != usedRouter.end()) ) {
#ifdef AIROUTER
Router *r = new AIRouter(id, ROUTING_AI);
_config->GetRoutingEngine()->AddRouter(r);
......@@ -1111,6 +1111,7 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
///Parsing additional options
if (!ParseAIOpts(e))
return false;
#endif
}
else if ((strategy == "ff_global_shortest") &&
(std::find(usedRouter.begin(), usedRouter.end(), id) != usedRouter.end()) ) {
......@@ -1252,7 +1253,7 @@ bool IniFileParser::ParseCogMapOpts(TiXmlNode* routingNode)
return true;
}
#ifdef AIROUTER
bool IniFileParser::ParseAIOpts(TiXmlNode* routingNode) {
TiXmlNode *sensorNode = routingNode->FirstChild();
......@@ -1311,7 +1312,7 @@ bool IniFileParser::ParseAIOpts(TiXmlNode* routingNode) {
return true;
}
#endif
bool IniFileParser::ParseLinkedCells(const TiXmlNode& linkedCellNode)
......
......@@ -61,9 +61,9 @@ private:
bool ParseFfRouterOps(TiXmlNode* routingNode, RoutingStrategy s);
bool ParseCogMapOpts(TiXmlNode* routingNode);
#ifdef AIROUTER
bool ParseAIOpts(TiXmlNode* routingNode);
#endif
bool ParseLinkedCells(const TiXmlNode& linkedCellNode);
bool ParseStepSize(TiXmlNode& stepNode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment