Skip to content

Commit

Permalink
better cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethiy committed May 31, 2017
1 parent 2d3bfaf commit 5a6cecf
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 43 deletions.
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
cmake_minimum_required(VERSION 3.2)

project(3DSceneModel
VERSION 0.4.0
LANGUAGES CXX)
VERSION 0.4.1
LANGUAGES CXX
)

configure_file (
"${PROJECT_SOURCE_DIR}/src/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)

##
# ________________________________________________ Modules __________________________________________________
Expand All @@ -14,6 +20,7 @@ include(cmake/dependencies.cmake)
# _______________________________________________ Libraries __________________________________________________
##

include_directories("${PROJECT_SOURCE_DIR}/src/libs")
add_subdirectory(src/libs libs)

##
Expand Down
1 change: 0 additions & 1 deletion src/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
set(Proj_XY_CLI_SRC "${3DSceneModel_SOURCE_DIR}/src/cli/project_scene_xy.cpp")
add_executable(project_scene_xy ${Proj_XY_CLI_SRC} ${urban_HEADER})
target_compile_options(project_scene_xy PUBLIC -DVERSION=\"${PROJECT_VERSION}\")
target_link_libraries(project_scene_xy urban)
6 changes: 4 additions & 2 deletions src/cli/project_scene_xy.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "../libs/urban.h"
#include "arguments.h"
#include "config.h"

#include <urban.h>

#include <docopt.h>
#include "arguments.h"

#include <boost/filesystem.hpp>

Expand Down
7 changes: 7 additions & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

/** Project version*/
#define _VERSION_MAJOR @3DSceneModel_VERSION_MAJOR@
#define _VERSION_MINOR @3DSceneModel_VERSION_MINOR@
#define _VERSION_PATCH @3DSceneModel_VERSION_PATCH@

#define VERSION "@3DSceneModel_VERSION_MAJOR@.@3DSceneModel_VERSION_MINOR@.@3DSceneModel_VERSION_PATCH@"
26 changes: 13 additions & 13 deletions src/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,29 @@ set(IO_SRC
"${3DSceneModel_SOURCE_DIR}/src/libs/io/io_off.cpp"
"${3DSceneModel_SOURCE_DIR}/src/libs/io/io_gdal.cpp"
)
set(urban_HEADER "${3DSceneModel_SOURCE_DIR}/src/libs/urban.h")

# Shadow
add_library(urban_shadow ${Shadow_HEADERS} ${Shadow_SRC})
add_library(urban_shadow ${Shadow_SRC})
target_link_libraries(urban_shadow ${LIBS})

# Projections
add_library(urban_projection ${Projection_HEADER} ${Projection_SRC} ${Scene_HEADERS} ${Algorithms_HEADER})
target_link_libraries(urban_projection urban_algorithms ${LIBS})
# Scene
add_library(urban_scene ${Scene_SRC})
target_link_libraries(urban_scene urban_shadow urban_projection ${LIBS})

# Algorithms
add_library(urban_algorithms ${Algorithms_HEADER} ${Algorithms_SRC} ${Scene_HEADERS} ${Shadow_HEADERS} ${Projection_HEADER})
target_link_libraries(urban_algorithms urban_scene urban_shadow urban_projection ${LIBS})

# Scene
add_library(urban_scene ${Scene_HEADERS} ${Scene_SRC} ${Shadow_HEADERS} ${Projection_HEADER} ${Algorithms_HEADER})
target_link_libraries(urban_scene urban_shadow urban_algorithms urban_projection ${LIBS})
add_library(urban_algorithms ${Algorithms_SRC})
target_link_libraries(urban_algorithms urban_scene urban_shadow ${LIBS})

# Projections
add_library(urban_projection ${Projection_SRC})
target_link_libraries(urban_projection urban_algorithms ${LIBS})

# Input/Output
add_library(urban_io ${IO_HEADERS} ${IO_SRC} ${Shadow_HEADERS} ${Projection_HEADER} ${Line_HEADER} ${Adjacency_HEADER} ${Off_HEADER} ${Scene_HEADERS})
add_library(urban_io ${IO_SRC})
target_link_libraries(urban_io urban_shadow urban_projection ${LIBS})

# urban
set(urban_HEADER "${3DSceneModel_SOURCE_DIR}/src/libs/urban.h")
add_library(urban SHARED ${urban_HEADER})
add_library(urban SHARED)
link_directories(urban ${LIBS_DIRS})
target_link_libraries(urban urban_shadow urban_io urban_scene urban_projection urban_algorithms ${LIBS})
2 changes: 2 additions & 0 deletions src/libs/urban.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "config.h"

#include "shadow/mesh.h"

#include "io/io_off.h"
Expand Down
4 changes: 2 additions & 2 deletions src/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Santa
set(SANTA_SRC "${3DSceneModel_SOURCE_DIR}/src/samples/hello_santa.cpp")
add_executable(hello_santa ${SANTA_SRC} ${urban_HEADER})
add_executable(hello_santa ${SANTA_SRC})
target_link_libraries(hello_santa urban)

# Project Santa
set(Proj_XY_SANTA_SRC "${3DSceneModel_SOURCE_DIR}/src/samples/project_santa_xy.cpp")
add_executable(project_santa_xy ${Proj_XY_SANTA_SRC} ${urban_HEADER})
add_executable(project_santa_xy ${Proj_XY_SANTA_SRC})
target_link_libraries(project_santa_xy urban)
2 changes: 1 addition & 1 deletion src/samples/hello_santa.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../libs/urban.h"
#include <urban.h>

#ifdef CGAL_USE_GEOMVIEW
#include <CGAL/IO/Geomview_stream.h>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/project_santa_xy.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../libs/urban.h"
#include <urban.h>

#include <boost/filesystem.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file(GLOB_RECURSE TEST_SRC "${3DSceneModel_SOURCE_DIR}/src/tests/*.cpp")

add_executable(tests ${TEST_SRC} ${urban_HEADER})
add_executable(tests ${TEST_SRC})
target_link_libraries(tests Catch urban)
2 changes: 1 addition & 1 deletion src/tests/test_io_3ds.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../libs/io/io_3ds.h"
#include <io/io_3ds.h>

#include <boost/filesystem.hpp>
#include <boost/uuid/uuid.hpp>
Expand Down
6 changes: 3 additions & 3 deletions src/tests/test_io_gdal.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../libs/io/io_gdal.h"
#include "../libs/algorithms/algorithms.h"
#include "../libs/scene/brick/brick.h"
#include <io/io_gdal.h>
#include <algorithms/algorithms.h>
#include <scene/brick/brick.h>

#include <boost/filesystem.hpp>
#include <boost/uuid/uuid.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_io_off.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "../libs/io/io_off.h"
#include "../libs/io/Line/line.h"
#include <io/io_off.h>
#include <io/Line/line.h>

#include <boost/filesystem.hpp>
#include <boost/uuid/uuid.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_projection_algorithms.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "../libs/algorithms/algorithms.h"
#include "../libs/scene/brick/brick.h"
#include <algorithms/algorithms.h>
#include <scene/brick/brick.h>

#include <CGAL/Boolean_set_operations_2.h>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_projection_brick.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../libs/projection/Brick/brick_projection.h"
#include <projection/Brick/brick_projection.h>

#include <catch.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_projection_face.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../libs/projection/Face/face_projection.h"
#include <projection/Face/face_projection.h>

#include <catch.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_shadow_face.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../libs/shadow/Face/face.h"
#include <shadow/Face/face.h>

#include <catch.hpp>

Expand Down
6 changes: 3 additions & 3 deletions src/tests/test_shadow_geometry.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../libs/shadow/Point/point.h"
#include "../libs/shadow/Vector/vector.h"
#include "../libs/shadow/Bbox/bbox.h"
#include <shadow/Point/point.h>
#include <shadow/Vector/vector.h>
#include <shadow/Bbox/bbox.h>

#include <limits>
#include <cmath>
Expand Down
6 changes: 2 additions & 4 deletions src/tests/test_shadow_mesh.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "../libs/shadow/mesh.h"
#include "../libs/algorithms/shadow/shadow_algorithms.h"

#include "../libs/urban.h"
#include <shadow/mesh.h>
#include <algorithms/shadow/shadow_algorithms.h>

#ifdef CGAL_USE_GEOMVIEW
#include <CGAL/IO/Geomview_stream.h>
Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_urban_object.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "../libs/scene/brick/brick.h"
#include "../libs/io/io_off.h"
#include <scene/brick/brick.h>
#include <io/io_off.h>

#include <boost/filesystem.hpp>

Expand Down

0 comments on commit 5a6cecf

Please sign in to comment.