-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
54,840 additions
and
3,382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
############################################################################## | ||
# Geogram/Vorpaline root CMakeList | ||
############################################################################## | ||
|
||
# CMake 2.8.11 is required for 2 reasons: | ||
# - it is the first version that fully supports the specification of Visual | ||
# Studio toolsets (v110_xp). | ||
# - it is the version that supports the command string(TIMESTAMP ...) | ||
cmake_minimum_required(VERSION 2.8.11) | ||
|
||
# Note: geogram.cmake defines GEOGRAM_WITH_VORPALINE | ||
# that we could have used instead, | ||
# but geogram.cmake needs to be included after the project() | ||
# command, since project() resets CFLAGS and CXXFLAGS. | ||
|
||
if("$ENV{GEOGRAM_WITH_VORPALINE}" STREQUAL "") | ||
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/vorpalib) | ||
project(Vorpaline) | ||
else() | ||
project(Geogram) | ||
endif() | ||
elseif ("$ENV{GEOGRAM_WITH_VORPALINE}" STREQUAL ON) | ||
project(Vorpaline) | ||
else() | ||
project(Geogram) | ||
endif() | ||
|
||
# Optional modules | ||
# (can be overriden in CMakeOptions.txt) | ||
|
||
# Set GEOGRAM_SUB_BUILD if Geogram sources included in buildtree, then | ||
# VORPALINE_PLATFORM can be set directly in parent CMakeLists.txt | ||
if(NOT GEOGRAM_SUB_BUILD) | ||
option(GEOGRAM_WITH_GRAPHICS "Viewers and geogram_gfx library" OFF) | ||
option(GEOGRAM_WITH_LEGACY_NUMERICS "Legacy numerical libraries" OFF) | ||
option(GEOGRAM_WITH_HLBFGS "Non-linear solver (Yang Liu's HLBFGS)" OFF) | ||
option(GEOGRAM_WITH_TETGEN "Tetrahedral mesher (Hang Si's TetGen)" OFF) | ||
option(GEOGRAM_WITH_TRIANGLE "Triangle mesher (Jonathan Shewchuk's triangle)" OFF) | ||
option(GEOGRAM_WITH_EXPLORAGRAM "Experimental code (hexahedral meshing pipeline and optimal transport)" OFF) | ||
option(GEOGRAM_WITH_LUA "Built-in LUA interpreter" ON) | ||
option(GEOGRAM_LIB_ONLY "Libraries only (no example programs/no viewer)" OFF) | ||
option(GEOGRAM_WITH_FPG "Predicate generator (Sylvain Pion's FPG)" OFF) | ||
option(GEOGRAM_USE_SYSTEM_GLFW3 "Use the version of GLFW3 installed in the system if found" OFF) | ||
set(VORPALINE_PLATFORM "" CACHE STRING "") | ||
endif() | ||
|
||
include(cmake/geogram.cmake) | ||
|
||
set(VORPALINE_VERSION_MAJOR 1) | ||
set(VORPALINE_VERSION_MINOR 7) | ||
set(VORPALINE_VERSION_PATCH 5) | ||
set(VORPALINE_VERSION ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH}) | ||
|
||
set(VORPALINE_INCLUDE_SUBPATH geogram${VORPALINE_VERSION_MAJOR}) | ||
|
||
# Determine the current Build-OS (Build-platform without the compiler info) | ||
string(REGEX REPLACE "-[^-]+$" "" VORPALINE_OS ${VORPALINE_PLATFORM}) | ||
|
||
# Determine the current build date | ||
string(TIMESTAMP VORPALINE_BUILD_DATE "%Y-%m-%d %H:%M:%S") | ||
string(TIMESTAMP YEAR "%Y") | ||
|
||
# Determine the current build number | ||
# This is set by Jenkins in environment variable BUILD_NUMBER | ||
set(VORPALINE_BUILD_NUMBER $ENV{BUILD_NUMBER}) | ||
|
||
|
||
############################################################################## | ||
# Get SVN revision info | ||
|
||
if(GEOGRAM_WITH_VORPALINE) | ||
find_package(Subversion QUIET) | ||
if(NOT SUBVERSION_FOUND) | ||
message(WARNING "Subversion executable not found - cannot determine current revision") | ||
else() | ||
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Vorpaline) | ||
message(STATUS "Vorpaline revision is ${Vorpaline_WC_REVISION}") | ||
set(VORPALINE_SVN_REVISION ${Vorpaline_WC_REVISION}) | ||
endif() | ||
endif() | ||
|
||
############################################################################## | ||
# RPATH (where executables find the .so / DLLs) | ||
# - Enables RPATH support for MACOSX | ||
# - Makes RPATH of dynamic libraries and executable point to the directory | ||
# where libraries are installed. | ||
|
||
if(VORPALINE_BUILD_DYNAMIC) | ||
set(CMAKE_MACOSX_RPATH 1) | ||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
endif() | ||
|
||
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") | ||
|
||
# uninstall target | ||
# Needs to be created before add_subdirectory() because GLFw has | ||
# also an uninstall target that will be inhibited if there is | ||
# already one (Geogram's one needs to be first) | ||
|
||
configure_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" | ||
IMMEDIATE @ONLY) | ||
|
||
add_custom_target(uninstall | ||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) | ||
|
||
############################################################################## | ||
# Geogram/Vorpaline sources | ||
|
||
add_subdirectory(src/lib/geogram) | ||
if(GEOGRAM_WITH_VORPALINE) | ||
add_subdirectory(src/lib/vorpalib) | ||
endif() | ||
|
||
add_subdirectory(src/lib/third_party) | ||
|
||
if(GEOGRAM_WITH_GRAPHICS) | ||
add_subdirectory(src/lib/geogram_gfx) | ||
endif() | ||
|
||
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/exploragram) | ||
if(GEOGRAM_WITH_EXPLORAGRAM) | ||
add_subdirectory(src/lib/exploragram) | ||
endif() | ||
endif() | ||
|
||
if(NOT GEOGRAM_LIB_ONLY) | ||
add_subdirectory(src/bin) | ||
add_subdirectory(src/tests) | ||
add_subdirectory(src/examples) | ||
add_subdirectory(tests) | ||
endif() | ||
|
||
add_subdirectory(doc) | ||
|
||
############################################################################## | ||
# Cleanup from previous builds | ||
|
||
file(REMOVE ${CMAKE_BINARY_DIR}/doc/LICENSE.txt) | ||
|
||
|
||
############################################################################## | ||
# Geogram installation | ||
|
||
|
||
# FindGeogram.cmake | ||
|
||
install(FILES cmake/FindGeogram.cmake DESTINATION lib/cmake/modules COMPONENT devkit) | ||
|
||
# Configure CPack | ||
|
||
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) | ||
set(CPACK_SYSTEM_NAME ${VORPALINE_OS}) | ||
set(CPACK_PACKAGE_VENDOR "INRIA - ALICE") | ||
|
||
|
||
if(${GEOGRAM_WITH_VORPALINE}) | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A flexible mesh generator") | ||
else() | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "fast, simple and easy-to-use primitives for geometric programming") | ||
endif() | ||
|
||
set(CPACK_PACKAGE_VERSION_MAJOR ${VORPALINE_VERSION_MAJOR}) | ||
set(CPACK_PACKAGE_VERSION_MINOR ${VORPALINE_VERSION_MINOR}) | ||
set(CPACK_PACKAGE_VERSION_PATCH ${VORPALINE_VERSION_PATCH}) | ||
set(CPACK_PACKAGE_VERSION ${VORPALINE_VERSION}) | ||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}) | ||
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY true) | ||
|
||
if(CPACK_GENERATOR STREQUAL "DEB") | ||
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) | ||
set(CPACK_PACKAGE_CONTACT [email protected]) | ||
# set(CPACK_PACKAGE_DEPENDS "libglfw3 (>= 3.2-1), libc6 (>= 2.22-11), libstdc++ (>= 6.1.1-4)") | ||
# TODO: use objdump -p | grep NEEDED to automate... | ||
# or GET_PROPERTY(result GLOBAL ENABLED_FEATURES) (successful FIND_PACKAGE()) | ||
endif() | ||
|
||
if(NOT DEFINED CPACK_GENERATOR) | ||
if(WIN32) | ||
set(CPACK_GENERATOR ZIP) | ||
else() | ||
set(CPACK_GENERATOR TGZ) | ||
endif() | ||
endif() | ||
|
||
# Enable component-based packaging for archive generators (TGZ, ZIP) | ||
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) | ||
|
||
set(CPACK_COMPONENTS_ALL runtime devkit devkit-full doc-devkit doc-devkit-full) | ||
set(CPACK_COMPONENTS_GROUPING "IGNORE") | ||
|
||
set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "Vorpaline Application") | ||
set(CPACK_COMPONENT_RUNTIME_GROUP "Runtime") | ||
|
||
set(CPACK_COMPONENT_DEVKIT_DISPLAY_NAME "Vorpaline Developer Kit") | ||
set(CPACK_COMPONENT_DEVKIT_GROUP "Development") | ||
|
||
set(CPACK_COMPONENT_DEVKIT-FULL_DISPLAY_NAME "Vorpaline Full Developer Kit") | ||
set(CPACK_COMPONENT_DEVKIT-FULL_GROUP "Development") | ||
|
||
set(CPACK_COMPONENT_DOC-DEVKIT_DISPLAY_NAME "Vorpaline API Developer Kit Documentation") | ||
set(CPACK_COMPONENT_DOC-DEVKIT_GROUP "Documentation") | ||
|
||
set(CPACK_COMPONENT_DOC-DEVKIT-FULL_DISPLAY_NAME "Vorpaline Full Developer Kit Documentation") | ||
set(CPACK_COMPONENT_DOC-DEVKIT-FULL_GROUP "Documentation") | ||
|
||
set(CPACK_COMPONENT_DOC-DEVKIT-INTERNAL_DISPLAY_NAME "Vorpaline Internal Developer Kit Documentation") | ||
set(CPACK_COMPONENT_DOC-DEVKIT-INTERNAL_GROUP "Documentation") | ||
|
||
# Copy the helper script to build individual packages to the binary directory | ||
configure_file( | ||
tools/make_package.pl.in | ||
make_package.pl | ||
@ONLY | ||
) | ||
|
||
# This must always be last! | ||
include(CPack) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
#------------------------------------------------------------------- | ||
# Flags common to all Linux based platforms with GNU compiler | ||
#------------------------------------------------------------------- | ||
|
||
include(${GEOGRAM_SOURCE_DIR}/cmake/platforms/Linux.cmake) | ||
|
||
# Warning flags | ||
set(NORMAL_WARNINGS -Wall -Wextra) | ||
set(FULL_WARNINGS | ||
${NORMAL_WARNINGS} | ||
-pedantic | ||
-Wno-long-long | ||
-Wconversion | ||
) | ||
|
||
# Determine gcc version and activate additional warnings available in latest versions | ||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | ||
|
||
if (GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3) | ||
set(FULL_WARNINGS ${FULL_WARNINGS} -Wsign-conversion) | ||
endif() | ||
|
||
if (GCC_VERSION VERSION_GREATER 4.6 OR GCC_VERSION VERSION_EQUAL 4.6) | ||
set(FULL_WARNINGS ${FULL_WARNINGS} -Wdouble-promotion) | ||
endif() | ||
|
||
|
||
# Compile with full warnings by default | ||
add_definitions(${FULL_WARNINGS}) | ||
|
||
# Warn about missing virtual destructor (C++ only) | ||
add_flags(CMAKE_CXX_FLAGS -Wnon-virtual-dtor) | ||
|
||
# Add static and dynamic bounds checks (optimization required) | ||
if (GCC_VERSION VERSION_GREATER 4.0) | ||
add_flags(CMAKE_CXX_FLAGS_RELEASE -D_FORTIFY_SOURCE=2) | ||
add_flags(CMAKE_C_FLAGS_RELEASE -D_FORTIFY_SOURCE=2) | ||
endif() | ||
|
||
# Enable setting FPU rounding mode (needed by FPG) and | ||
# disable automatic generation of FMAs (would break exact | ||
# predicates) | ||
add_flags(CMAKE_CXX_FLAGS -frounding-math -ffp-contract=off) | ||
add_flags(CMAKE_C_FLAGS -frounding-math -ffp-contract=off) | ||
|
||
# Activate AVX2 instruction set | ||
#add_flags(CMAKE_CXX_FLAGS -mavx2) | ||
#add_flags(CMAKE_C_FLAGS -mavx2) | ||
|
||
# Activate 64 bit indices everywhere | ||
add_flags(CMAKE_CXX_FLAGS -DGARGANTUA) | ||
add_flags(CMAKE_C_FLAGS -DGARGANTUA) | ||
|
||
|
||
# Activate c++ 2011 | ||
add_flags(CMAKE_CXX_FLAGS -std=c++11) | ||
|
||
# Enable glibc parallel mode | ||
#add_flags(CMAKE_CXX_FLAGS -D_GLIBCXX_PARALLEL) | ||
|
||
# Generate debug information even in release mode | ||
#add_flags(CMAKE_CXX_FLAGS_RELEASE -g) | ||
#add_flags(CMAKE_C_FLAGS_RELEASE -g) | ||
|
||
# Additional debug flags | ||
# deactivated for now: I added bound checking in VOR::vector<>. | ||
#add_flags(CMAKE_CXX_FLAGS_DEBUG -D_GLIBCXX_DEBUG) | ||
|
||
|
||
# Compile and link with OpenMP | ||
if (GCC_VERSION VERSION_GREATER 4.0) | ||
add_flags(CMAKE_CXX_FLAGS -fopenmp) | ||
add_flags(CMAKE_C_FLAGS -fopenmp) | ||
endif() | ||
|
||
# Alaways generate position independant code | ||
# (to allow linking geogram/vorlalib with DLLs) | ||
add_flags(CMAKE_CXX_FLAGS -fPIC) | ||
add_flags(CMAKE_C_FLAGS -fPIC) | ||
|
||
# Hide symbols that are not explicitly exported | ||
add_flags(CMAKE_CXX_FLAGS -fvisibility=hidden) | ||
add_flags(CMAKE_C_FLAGS -fvisibility=hidden) | ||
|
||
# Profiler compilation flags | ||
if(VORPALINE_WITH_GPROF) | ||
message(STATUS "Building for code profiling") | ||
add_flags(CMAKE_CXX_FLAGS -pg -DPROFILER) | ||
add_flags(CMAKE_C_FLAGS -pg -DPROFILER) | ||
endif() | ||
|
||
|
||
# Code coverage compilation flags | ||
if(VORPALINE_WITH_GCOV) | ||
message(STATUS "Building for coverage analysis") | ||
add_flags(CMAKE_CXX_FLAGS --coverage) | ||
add_flags(CMAKE_C_FLAGS --coverage) | ||
endif() | ||
|
||
|
||
# Compilation flags for Google's AddressSanitizer | ||
# These flags can only be specified for dynamic builds | ||
if(VORPALINE_WITH_ASAN) | ||
if(VORPALINE_BUILD_DYNAMIC) | ||
message(STATUS "Building with AddressSanitizer (debug only)") | ||
add_flags(CMAKE_CXX_FLAGS_DEBUG -fsanitize=address -fno-omit-frame-pointer) | ||
add_flags(CMAKE_C_FLAGS_DEBUG -fsanitize=address -fno-omit-frame-pointer) | ||
else() | ||
message(WARNING "AddressSanitizer can be used with dynamic builds only") | ||
set(VORPALINE_WITH_ASAN false) | ||
endif() | ||
endif() | ||
if(NOT VORPALINE_WITH_ASAN) | ||
# Use native GCC stack smash Protection and buffer overflow detection (debug only) | ||
add_flags(CMAKE_CXX_FLAGS_DEBUG -fstack-protector-all) | ||
add_flags(CMAKE_C_FLAGS_DEBUG -fstack-protector-all) | ||
endif() | ||
|
||
|
||
# Compilation flags for Google's ThreadSanitizer | ||
# Does not work for the moment: cannot figure out how to link with library libtsan | ||
if(VORPALINE_WITH_TSAN) | ||
message(STATUS "Building with ThreadSanitizer (debug only)") | ||
message(FATAL_ERROR "ThreadSanitizer is not available: cannot figure out how to link with library libtsan") | ||
add_flags(CMAKE_CXX_FLAGS_DEBUG -fsanitize=thread) | ||
add_flags(CMAKE_C_FLAGS_DEBUG -fsanitize=thread) | ||
if(NOT VORPALINE_BUILD_DYNAMIC) | ||
add_flags(CMAKE_EXE_LINKER_FLAGS -static-libtsan) | ||
endif() | ||
endif() | ||
|
||
|
||
# Reset the warning level for third parties | ||
function(vor_reset_warning_level) | ||
remove_definitions(${FULL_WARNINGS}) | ||
add_definitions(${NORMAL_WARNINGS}) | ||
endfunction() | ||
|
||
macro(vor_add_executable) | ||
if(NOT VORPALINE_BUILD_DYNAMIC) | ||
# Create a statically linked executable | ||
# Link with static libraries | ||
add_flags(CMAKE_CXX_FLAGS -static-libstdc++ -static-libgcc -static) | ||
add_flags(CMAKE_C_FLAGS -static-libgcc -static) | ||
endif() | ||
|
||
add_executable(${ARGN}) | ||
|
||
if(NOT VORPALINE_BUILD_DYNAMIC AND DEFINED VORPALINE_WITH_DDT) | ||
# Static builds running with Allinea's DDT must be linked with a | ||
# special malloc library which replaces the malloc primitives of | ||
# the Glibc (We must allow multiple definitions) | ||
add_flags(CMAKE_EXE_LINKER_FLAGS -Wl,--allow-multiple-definition) | ||
|
||
if(VORPALINE_ARCH_64) | ||
link_directories(${VORPALINE_WITH_DDT}/lib/64) | ||
else() | ||
link_directories(${VORPALINE_WITH_DDT}/lib/32) | ||
endif() | ||
target_link_libraries(${ARGV0} dmallocthcxx) | ||
endif() | ||
|
||
if(UNIX) | ||
target_link_libraries(${ARGV0} m pthread) | ||
endif() | ||
endmacro() | ||
|
Oops, something went wrong.