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 3.0.2)
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 no)
32 # export build setup for development environment
33 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
35 set(ENGRID_MAJOR_VERSION 2)
36 set(ENGRID_MINOR_VERSION 0)
37 set(ENGRID_PATCH_VERSION 0)
38 set(ENGRID_VERSION ${ENGRID_MAJOR_VERSION}.${ENGRID_MINOR_VERSION}.${ENGRID_PATCH_VERSION})
42 ${CMAKE_CURRENT_SOURCE_DIR}
44 OUTPUT_VARIABLE GIT_SHA1)
45 string(REGEX MATCH "-g.*$" GIT_SHA1 ${GIT_SHA1})
46 string(REGEX REPLACE "[-g]" "" GIT_SHA1 ${GIT_SHA1} )
47 add_definitions( -DGIT_SHA1="${GIT_SHA1}" )
51 ${CMAKE_CURRENT_SOURCE_DIR}
52 ARGS "symbolic-ref --short HEAD"
53 OUTPUT_VARIABLE GIT_BRANCH)
54 add_definitions( -DGIT_BRANCH="${GIT_BRANCH}" )
56 if(NOT CMAKE_BUILD_TYPE)
57 set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
58 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
62 FIND_PACKAGE(VTK REQUIRED NO_MODULE PATHS $ENV{HOME}/local $ENV{HOME}/local_new/lib/VTK HINTS ENV LD_LIBRARY_PATH)
64 FIND_PACKAGE(VTK COMPONENTS
83 if("${VTK_VERSION}" VERSION_LESS 6.0)
84 message("The VTK version installed on the current system is too old. EnGrid requires VTK 6.0 or higher.")
87 #if("${VTK_VERSION}" VERSION_LESS 6.1)
89 if(NOT INITIAL_CONFIG)
90 set(INITIAL_CONFIG "..." CACHE INTERNAL "hidden flag...")
91 set(CMAKE_INSTALL_PREFIX $ENV{HOME}/local CACHE STRING "Install path prefix, prepended onto install directories." FORCE)
94 # include(${VTK_USE_FILE})
95 # include_directories(${VTK_INCLUDE_DIRS})
97 FIND_PACKAGE(CGAL REQUIRED)
98 include(${CGAL_USE_FILE})
99 #include_directories(${VTK_INCLUDE_DIRS})
102 find_package(Qt5 COMPONENTS Core Gui Widgets Network Xml REQUIRED)
103 INCLUDE_DIRECTORIES(${Qt5Core_INCLUDE_DIRS})
104 INCLUDE_DIRECTORIES(${Qt5Gui_INCLUDE_DIRS})
105 INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
106 INCLUDE_DIRECTORIES(${Qt5Network_INCLUDE_DIRS})
107 INCLUDE_DIRECTORIES(${Qt5Xml_INCLUDE_DIRS})
109 # set include directory, add src directories
110 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tetgen)
111 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libengrid)
112 include_directories(${CMAKE_CURRENT_BINARY_DIR}/libengrid)
113 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
114 include_directories(${CMAKE_CURRENT_BINARY_DIR})
116 option(PROFILING "add -g for profiling even in RELEASE configuration?" OFF)
118 #if (CMAKE_BUILD_TYPE MATCHES Release)
119 if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
120 add_definitions(-DNDEBUG)
121 add_definitions(-DQT_NO_DEBUG)
122 remove_definitions(-DQT_DEBUG)
124 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
127 add_definitions(-DQT_DEBUG)
130 add_subdirectory(tetgen)
131 add_subdirectory(libengrid)
133 add_executable(engrid main.cpp)
135 target_link_libraries(engrid libengrid)
136 target_link_libraries(engrid tet)
137 target_link_libraries(engrid Qt5::Core)
138 target_link_libraries(engrid Qt5::Gui)
139 target_link_libraries(engrid Qt5::Widgets)
140 target_link_libraries(engrid Qt5::Network)
141 target_link_libraries(engrid Qt5::Xml)
142 target_link_libraries(engrid ${VTK_LIBRARIES})
144 install(TARGETS engrid DESTINATION bin)
148 PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ
152 add_dependencies(engrid tetgen libengrid)