Skip to content

Commit

Permalink
Prepared repo for combination
Browse files Browse the repository at this point in the history
added COMBINE flag around local mains
Reworked the global CMake to detect all files and libraries
added global main
  • Loading branch information
JoHeinrich committed Jun 21, 2016
1 parent 7f4fca2 commit d0f044e
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 26 deletions.
81 changes: 57 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,79 @@
cmake_minimum_required (VERSION 2.8)
project(AutoDrive)
set (OUTPUT_NAME AutoDrive)

#add_subdirectory(src/StreamDecoder/HDFDecoder)
#add_subdirectory(src/StreamDecoder/ProtobufDeserializer)
add_definitions(-std=c++11)
SET(CAF_COMPILE_FLAGS "-lcaf_io -lcaf_core")
add_definitions(${CAF_COMPILE_FLAGS})

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_subdirectory(src/ScenarioAnalysation)
add_subdirectory(src/ObjectDetection)
add_subdirectory(src/caf)
add_subdirectory(src/StreamDecoder)

#add_subdirectory(src/StreamDecoder/DecompressionExample)

#add_subdirectory(src/StreamDecoder/FrameSelector)

add_subdirectory(src/StreamDecoder)
file(GLOB_RECURSE sources0 "./src/ScenarioAnalysation/*.cpp")
file(GLOB_RECURSE headers0 "./src/ScenarioAnalysation/*.h")

file(GLOB_RECURSE sources1 "./src/ObjectDetection/*.cpp")
file(GLOB_RECURSE headers1 "./src/ObjectDetection/*.h")

file(GLOB_RECURSE sources2 "./src/StreamDecoder/*.cpp")
file(GLOB_RECURSE sourcesc2 "./src/StreamDecoder/*.cc")
file(GLOB_RECURSE headers2 "./src/StreamDecoder/*.h")

file(GLOB_RECURSE sources3 "./src/caf/*.cpp")
file(GLOB_RECURSE sourcesc3 "./src/caf/*.cc")
file(GLOB_RECURSE headers3 "./src/caf/*.h")

LIST(APPEND sources ${sources0} ${sources1} ${sources2} ${sourcesc2} ${sources3} ${sourcesc3}
#src/ObjectDetection/element.cpp
#src/ObjectDetection/frame_detection_data.cpp
#src/StreamDecoder/image.cpp
#src/StreamDecoder/image_view.cpp

)

LIST(APPEND headers ${headers0} ${headers1} ${header2} ${headers3}
#src/ObjectDetection/element.h
#src/ObjectDetection/frame_detection_data.h
#src/StreamDecoder/image.h
#src/StreamDecoder/image_view.h


)
file(GLOB_RECURSE sourcesc "./src/*.cc")
file(GLOB_RECURSE sources "./src/*.cpp")
file(GLOB_RECURSE headers "./src/*.h")

#protobuf
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})

#opencv
#find_package( OpenCV )
#if(OpenCV_FOUND)
#include_directories( ${OpenCV_INCLUDE_DIRS} )
#set(LINK_LIBS ${LINK_LIBS} ${OpenCV_LIBS})
#else(OpenCV_FOUND)
#message(SEND_ERROR "OpenCV not found")
#endif(OpenCV_FOUND)
find_package( OpenCV )
if(OpenCV_FOUND)
include_directories( ${OpenCV_INCLUDE_DIRS} )
set(LINK_LIBS ${LINK_LIBS} ${OpenCV_LIBS})
else(OpenCV_FOUND)
message(SEND_ERROR "OpenCV not found")
endif(OpenCV_FOUND)


#hdf5
#find_package (HDF5)
#if(HDF5_FOUND)
#set(LINK_LIBS ${LINK_LIBS} ${HDF5_C_STATIC_LIBRARY} ${HDF5_C_LIBRARIES})
#include_directories(${HDF5_INCLUDE_DIR})
#else(HDF5_FOUND)
#message(SEND_ERROR "HDF5 was not Found")
#endif(HDF5_FOUND)

#add_executable(${OUTPUT_NAME} ${sources} ${headers})
#target_link_libraries(${OUTPUT_NAME} ${LINK_LIBS} -lhdf5_cpp -lhdf5)
#target_link_libraries(${OUTPUT_NAME} proto ${PROTOBUF_LIBRARY})
find_package (HDF5)
if(HDF5_FOUND)
set(LINK_LIBS ${LINK_LIBS} ${HDF5_C_STATIC_LIBRARY} ${HDF5_C_LIBRARIES})
include_directories(${HDF5_INCLUDE_DIR})
else(HDF5_FOUND)
message(SEND_ERROR "HDF5 was not Found")
endif(HDF5_FOUND)

add_definitions(-D COMBINE)

add_executable(${OUTPUT_NAME} ${sources} ${headers} ${sourcesc})
target_link_libraries(${OUTPUT_NAME} ${LINK_LIBS} -lhdf5_cpp -lhdf5)
target_link_libraries(${OUTPUT_NAME} ${PROTOBUF_LIBRARY})
target_link_libraries(${OUTPUT_NAME} ${PROTOBUF_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} -lcaf_io -lcaf_core)
2 changes: 2 additions & 0 deletions src/ObjectDetection/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
// License along with this program. If not, see
// <http://www.gnu.org/licenses/>.

#ifndef COMBINE
int main(int argc, const char * argv[]) {

return 0;
}
#endif
4 changes: 3 additions & 1 deletion src/ScenarioAnalysation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

using namespace std;


#ifndef COMBINE
int main(int argc, const char* argv[]) {

if (argc > 1 ){
Expand Down Expand Up @@ -105,3 +105,5 @@ int main(int argc, const char* argv[]) {

return 0;
}

#endif
4 changes: 3 additions & 1 deletion src/StreamDecoder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

using namespace std;


#ifndef COMBINE
int main(int argc, const char* argv[]) {

if (argc > 3 || argc == 1){
Expand Down Expand Up @@ -65,3 +65,5 @@ int main(int argc, const char* argv[]) {

return 0;
}

#endif
3 changes: 3 additions & 0 deletions src/caf/protobuf_broker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void ProtoAgent::startServer (uint16_t port) {
shutdown();
}

#ifndef COMBINE
int main(int argc, char** argv) {
// Parsing arguments
message_builder{argv + 1, argv + argc}.apply({
Expand All @@ -231,3 +232,5 @@ int main(int argc, char** argv) {
}
});
}

#endif
29 changes: 29 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Projectname: amos-ss16-proj5
//
// Copyright (c) 2016 de.fau.cs.osr.amos2016.gruppe5
//
// This file is part of the AMOS Project 2016 @ FAU
// (Friedrich-Alexander University Erlangen-Nürnberg)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see
// <http://www.gnu.org/licenses/>.


/*
* This is the global main for our project
*/
int main(int argc, const char * argv[]) {
return 0;
}

0 comments on commit d0f044e

Please sign in to comment.