1 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 # + This file is part of enGrid. +
5 # + Copyright 2008-2014 enGits GmbH +
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. +
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. +
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/>. +
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)
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})
39 ${CMAKE_CURRENT_SOURCE_DIR}
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}" )
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})
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)
84 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
87 add_definitions(-DQT_DEBUG)
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)