|
| 1 | +############################################################################## |
| 2 | +# Geogram/Vorpaline root CMakeList |
| 3 | +############################################################################## |
| 4 | + |
| 5 | +# CMake 2.8.11 is required for 2 reasons: |
| 6 | +# - it is the first version that fully supports the specification of Visual |
| 7 | +# Studio toolsets (v110_xp). |
| 8 | +# - it is the version that supports the command string(TIMESTAMP ...) |
| 9 | +cmake_minimum_required(VERSION 2.8.11) |
| 10 | + |
| 11 | +# Note: geogram.cmake defines GEOGRAM_WITH_VORPALINE |
| 12 | +# that we could have used instead, |
| 13 | +# but geogram.cmake needs to be included after the project() |
| 14 | +# command, since project() resets CFLAGS and CXXFLAGS. |
| 15 | + |
| 16 | +if("$ENV{GEOGRAM_WITH_VORPALINE}" STREQUAL "") |
| 17 | + if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/vorpalib) |
| 18 | + project(Vorpaline) |
| 19 | + else() |
| 20 | + project(Geogram) |
| 21 | + endif() |
| 22 | +elseif ("$ENV{GEOGRAM_WITH_VORPALINE}" STREQUAL ON) |
| 23 | + project(Vorpaline) |
| 24 | +else() |
| 25 | + project(Geogram) |
| 26 | +endif() |
| 27 | + |
| 28 | +# Optional modules |
| 29 | +# (can be overriden in CMakeOptions.txt) |
| 30 | + |
| 31 | +# Set GEOGRAM_SUB_BUILD if Geogram sources included in buildtree, then |
| 32 | +# VORPALINE_PLATFORM can be set directly in parent CMakeLists.txt |
| 33 | +if(NOT GEOGRAM_SUB_BUILD) |
| 34 | + option(GEOGRAM_WITH_GRAPHICS "Viewers and geogram_gfx library" OFF) |
| 35 | + option(GEOGRAM_WITH_LEGACY_NUMERICS "Legacy numerical libraries" OFF) |
| 36 | + option(GEOGRAM_WITH_HLBFGS "Non-linear solver (Yang Liu's HLBFGS)" OFF) |
| 37 | + option(GEOGRAM_WITH_TETGEN "Tetrahedral mesher (Hang Si's TetGen)" OFF) |
| 38 | + option(GEOGRAM_WITH_TRIANGLE "Triangle mesher (Jonathan Shewchuk's triangle)" OFF) |
| 39 | + option(GEOGRAM_WITH_EXPLORAGRAM "Experimental code (hexahedral meshing pipeline and optimal transport)" OFF) |
| 40 | + option(GEOGRAM_WITH_LUA "Built-in LUA interpreter" ON) |
| 41 | + option(GEOGRAM_LIB_ONLY "Libraries only (no example programs/no viewer)" OFF) |
| 42 | + option(GEOGRAM_WITH_FPG "Predicate generator (Sylvain Pion's FPG)" OFF) |
| 43 | + option(GEOGRAM_USE_SYSTEM_GLFW3 "Use the version of GLFW3 installed in the system if found" OFF) |
| 44 | + set(VORPALINE_PLATFORM "" CACHE STRING "") |
| 45 | +endif() |
| 46 | + |
| 47 | +include(cmake/geogram.cmake) |
| 48 | + |
| 49 | +set(VORPALINE_VERSION_MAJOR 1) |
| 50 | +set(VORPALINE_VERSION_MINOR 7) |
| 51 | +set(VORPALINE_VERSION_PATCH 5) |
| 52 | +set(VORPALINE_VERSION ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH}) |
| 53 | + |
| 54 | +set(VORPALINE_INCLUDE_SUBPATH geogram${VORPALINE_VERSION_MAJOR}) |
| 55 | + |
| 56 | +# Determine the current Build-OS (Build-platform without the compiler info) |
| 57 | +string(REGEX REPLACE "-[^-]+$" "" VORPALINE_OS ${VORPALINE_PLATFORM}) |
| 58 | + |
| 59 | +# Determine the current build date |
| 60 | +string(TIMESTAMP VORPALINE_BUILD_DATE "%Y-%m-%d %H:%M:%S") |
| 61 | +string(TIMESTAMP YEAR "%Y") |
| 62 | + |
| 63 | +# Determine the current build number |
| 64 | +# This is set by Jenkins in environment variable BUILD_NUMBER |
| 65 | +set(VORPALINE_BUILD_NUMBER $ENV{BUILD_NUMBER}) |
| 66 | + |
| 67 | + |
| 68 | +############################################################################## |
| 69 | +# Get SVN revision info |
| 70 | + |
| 71 | +if(GEOGRAM_WITH_VORPALINE) |
| 72 | + find_package(Subversion QUIET) |
| 73 | + if(NOT SUBVERSION_FOUND) |
| 74 | + message(WARNING "Subversion executable not found - cannot determine current revision") |
| 75 | + else() |
| 76 | + Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Vorpaline) |
| 77 | + message(STATUS "Vorpaline revision is ${Vorpaline_WC_REVISION}") |
| 78 | + set(VORPALINE_SVN_REVISION ${Vorpaline_WC_REVISION}) |
| 79 | + endif() |
| 80 | +endif() |
| 81 | + |
| 82 | +############################################################################## |
| 83 | +# RPATH (where executables find the .so / DLLs) |
| 84 | +# - Enables RPATH support for MACOSX |
| 85 | +# - Makes RPATH of dynamic libraries and executable point to the directory |
| 86 | +# where libraries are installed. |
| 87 | + |
| 88 | +if(VORPALINE_BUILD_DYNAMIC) |
| 89 | + set(CMAKE_MACOSX_RPATH 1) |
| 90 | + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") |
| 91 | +endif() |
| 92 | + |
| 93 | +set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") |
| 94 | + |
| 95 | +# uninstall target |
| 96 | +# Needs to be created before add_subdirectory() because GLFw has |
| 97 | +# also an uninstall target that will be inhibited if there is |
| 98 | +# already one (Geogram's one needs to be first) |
| 99 | + |
| 100 | +configure_file( |
| 101 | + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" |
| 102 | + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" |
| 103 | + IMMEDIATE @ONLY) |
| 104 | + |
| 105 | +add_custom_target(uninstall |
| 106 | + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) |
| 107 | + |
| 108 | +############################################################################## |
| 109 | +# Geogram/Vorpaline sources |
| 110 | + |
| 111 | +add_subdirectory(src/lib/geogram) |
| 112 | +if(GEOGRAM_WITH_VORPALINE) |
| 113 | + add_subdirectory(src/lib/vorpalib) |
| 114 | +endif() |
| 115 | + |
| 116 | +add_subdirectory(src/lib/third_party) |
| 117 | + |
| 118 | +if(GEOGRAM_WITH_GRAPHICS) |
| 119 | + add_subdirectory(src/lib/geogram_gfx) |
| 120 | +endif() |
| 121 | + |
| 122 | +if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/exploragram) |
| 123 | + if(GEOGRAM_WITH_EXPLORAGRAM) |
| 124 | + add_subdirectory(src/lib/exploragram) |
| 125 | + endif() |
| 126 | +endif() |
| 127 | + |
| 128 | +if(NOT GEOGRAM_LIB_ONLY) |
| 129 | + add_subdirectory(src/bin) |
| 130 | + add_subdirectory(src/tests) |
| 131 | + add_subdirectory(src/examples) |
| 132 | + add_subdirectory(tests) |
| 133 | +endif() |
| 134 | + |
| 135 | +add_subdirectory(doc) |
| 136 | + |
| 137 | +############################################################################## |
| 138 | +# Cleanup from previous builds |
| 139 | + |
| 140 | +file(REMOVE ${CMAKE_BINARY_DIR}/doc/LICENSE.txt) |
| 141 | + |
| 142 | + |
| 143 | +############################################################################## |
| 144 | +# Geogram installation |
| 145 | + |
| 146 | + |
| 147 | +# FindGeogram.cmake |
| 148 | + |
| 149 | +install(FILES cmake/FindGeogram.cmake DESTINATION lib/cmake/modules COMPONENT devkit) |
| 150 | + |
| 151 | +# Configure CPack |
| 152 | + |
| 153 | +set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) |
| 154 | +set(CPACK_SYSTEM_NAME ${VORPALINE_OS}) |
| 155 | +set(CPACK_PACKAGE_VENDOR "INRIA - ALICE") |
| 156 | + |
| 157 | + |
| 158 | +if(${GEOGRAM_WITH_VORPALINE}) |
| 159 | + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A flexible mesh generator") |
| 160 | +else() |
| 161 | + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "fast, simple and easy-to-use primitives for geometric programming") |
| 162 | +endif() |
| 163 | + |
| 164 | +set(CPACK_PACKAGE_VERSION_MAJOR ${VORPALINE_VERSION_MAJOR}) |
| 165 | +set(CPACK_PACKAGE_VERSION_MINOR ${VORPALINE_VERSION_MINOR}) |
| 166 | +set(CPACK_PACKAGE_VERSION_PATCH ${VORPALINE_VERSION_PATCH}) |
| 167 | +set(CPACK_PACKAGE_VERSION ${VORPALINE_VERSION}) |
| 168 | +set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}) |
| 169 | +set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY true) |
| 170 | + |
| 171 | +if(CPACK_GENERATOR STREQUAL "DEB") |
| 172 | + set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) |
| 173 | + set(CPACK_PACKAGE_CONTACT Bruno.Levy@inria.fr) |
| 174 | +# set(CPACK_PACKAGE_DEPENDS "libglfw3 (>= 3.2-1), libc6 (>= 2.22-11), libstdc++ (>= 6.1.1-4)") |
| 175 | +# TODO: use objdump -p | grep NEEDED to automate... |
| 176 | +# or GET_PROPERTY(result GLOBAL ENABLED_FEATURES) (successful FIND_PACKAGE()) |
| 177 | +endif() |
| 178 | + |
| 179 | +if(NOT DEFINED CPACK_GENERATOR) |
| 180 | + if(WIN32) |
| 181 | + set(CPACK_GENERATOR ZIP) |
| 182 | + else() |
| 183 | + set(CPACK_GENERATOR TGZ) |
| 184 | + endif() |
| 185 | +endif() |
| 186 | + |
| 187 | +# Enable component-based packaging for archive generators (TGZ, ZIP) |
| 188 | +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) |
| 189 | + |
| 190 | +set(CPACK_COMPONENTS_ALL runtime devkit devkit-full doc-devkit doc-devkit-full) |
| 191 | +set(CPACK_COMPONENTS_GROUPING "IGNORE") |
| 192 | + |
| 193 | +set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "Vorpaline Application") |
| 194 | +set(CPACK_COMPONENT_RUNTIME_GROUP "Runtime") |
| 195 | + |
| 196 | +set(CPACK_COMPONENT_DEVKIT_DISPLAY_NAME "Vorpaline Developer Kit") |
| 197 | +set(CPACK_COMPONENT_DEVKIT_GROUP "Development") |
| 198 | + |
| 199 | +set(CPACK_COMPONENT_DEVKIT-FULL_DISPLAY_NAME "Vorpaline Full Developer Kit") |
| 200 | +set(CPACK_COMPONENT_DEVKIT-FULL_GROUP "Development") |
| 201 | + |
| 202 | +set(CPACK_COMPONENT_DOC-DEVKIT_DISPLAY_NAME "Vorpaline API Developer Kit Documentation") |
| 203 | +set(CPACK_COMPONENT_DOC-DEVKIT_GROUP "Documentation") |
| 204 | + |
| 205 | +set(CPACK_COMPONENT_DOC-DEVKIT-FULL_DISPLAY_NAME "Vorpaline Full Developer Kit Documentation") |
| 206 | +set(CPACK_COMPONENT_DOC-DEVKIT-FULL_GROUP "Documentation") |
| 207 | + |
| 208 | +set(CPACK_COMPONENT_DOC-DEVKIT-INTERNAL_DISPLAY_NAME "Vorpaline Internal Developer Kit Documentation") |
| 209 | +set(CPACK_COMPONENT_DOC-DEVKIT-INTERNAL_GROUP "Documentation") |
| 210 | + |
| 211 | +# Copy the helper script to build individual packages to the binary directory |
| 212 | +configure_file( |
| 213 | + tools/make_package.pl.in |
| 214 | + make_package.pl |
| 215 | + @ONLY |
| 216 | +) |
| 217 | + |
| 218 | +# This must always be last! |
| 219 | +include(CPack) |
| 220 | + |
0 commit comments