added script to execute engrid
[engrid-github.git] / src / CMakeLists.txt
blobb183a6445fa112f0ce453718be6dc94bb1f33c15
1 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 # +                                                                      +
3 # + This file is part of enGrid.                                         +
4 # +                                                                      +
5 # + Copyright 2008-2014 enGits GmbH                                      +
6 # +                                                                      +
7 # + enGrid is free software: you can redistribute it and/or modify       +
8 # + it under the terms of the GNU General Public License as published by +
9 # + the Free Software Foundation, either version 3 of the License, or    +
10 # + (at your option) any later version.                                  +
11 # +                                                                      +
12 # + enGrid is distributed in the hope that it will be useful,            +
13 # + but WITHOUT ANY WARRANTY; without even the implied warranty of       +
14 # + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        +
15 # + GNU General Public License for more details.                         +
16 # +                                                                      +
17 # + You should have received a copy of the GNU General Public License    +
18 # + along with enGrid. If not, see <http://www.gnu.org/licenses/>.       +
19 # +                                                                      +
20 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 cmake_minimum_required(VERSION 2.8)
25 # limit configuration types (must be done before project() statement)
26 set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited config" FORCE)
28 project(ENGRID)
30 set(CMAKE_VERBOSE_MAKEFILE off)
32 set(ENGRID_MAJOR_VERSION 2)
33 set(ENGRID_MINOR_VERSION 0)
34 set(ENGRID_PATCH_VERSION 0)
35 set(ENGRID_VERSION ${ENGRID_MAJOR_VERSION}.${ENGRID_MINOR_VERSION}.${ENGRID_PATCH_VERSION})
37 exec_program(
38     "git"
39     ${CMAKE_CURRENT_SOURCE_DIR}
40     ARGS "describe"
41     OUTPUT_VARIABLE GIT_SHA1)
42 string(REGEX MATCH "-g.*$" GIT_SHA1 ${GIT_SHA1})
43 string(REGEX REPLACE "[-g]" "" GIT_SHA1 ${GIT_SHA1} )
44 add_definitions( -DGIT_SHA1="${GIT_SHA1}" )
46 exec_program(
47     "git"
48     ${CMAKE_CURRENT_SOURCE_DIR}
49     ARGS "symbolic-ref --short HEAD"
50     OUTPUT_VARIABLE GIT_BRANCH)
51 add_definitions( -DGIT_BRANCH="${GIT_BRANCH}" )
53 FIND_PACKAGE(VTK REQUIRED)
54 include(${VTK_USE_FILE})
55 include_directories(${VTK_INCLUDE_DIRS})
57 FIND_PACKAGE(CGAL REQUIRED)
58 include(${CGAL_USE_FILE})
59 #include_directories(${VTK_INCLUDE_DIRS})
61 # Qt4
62 find_package(Qt4 COMPONENTS QtCore REQUIRED)
63 find_package(Qt4 COMPONENTS QtGui REQUIRED)
64 find_package(Qt4 COMPONENTS QtXml REQUIRED)
66 #include(${QT_USE_FILE})
67 include_directories(${QT_QTCORE_INCLUDE_DIR})
68 include_directories(${QT_QTGUI_INCLUDE_DIR})
69 include_directories(${QT_QTXML_INCLUDE_DIR})
71 # set include directory, add src directories
72 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tetgen)
73 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libengrid)
74 include_directories(${CMAKE_CURRENT_BINARY_DIR}/libengrid)
75 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
77 option(PROFILING "add -g for profiling even in RELEASE configuration?" OFF)
79 if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
80   add_definitions(-DNDEBUG)
81   add_definitions(-DQT_NO_DEBUG)
82   remove_definitions(-DQT_DEBUG)
83   if (PROFILING)
84     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
85   endif()
86 else()
87   add_definitions(-DQT_DEBUG)
88 endif()
90 add_subdirectory(tetgen)
91 add_subdirectory(libengrid)
93 add_executable(engrid main.cpp)
95 target_link_libraries(engrid libengrid)
96 target_link_libraries(engrid tet)
97 target_link_libraries(engrid ${QT_LIBRARIES})
98 target_link_libraries(engrid ${VTK_LIBRARIES})
99 target_link_libraries(engrid Qt4::QtCore)
100 target_link_libraries(engrid Qt4::QtGui)
101 target_link_libraries(engrid Qt4::QtXml)
103 install(TARGETS engrid DESTINATION bin)
104 install(FILES engrid.bash DESTINATION bin)
106 add_dependencies(engrid tetgen libengrid)