...
 
Commits (46)
......@@ -11,3 +11,4 @@ cppcheck.log
*.gcda
*.gcno
.DS_Store
Version X (?/?/?)
Version 2.1 (2019/09/09)
- Modern target-based CMake 3 build system
- !!!Break compatiblity with C++98, require C++11 as mininum!!!
- Renamed *T.cc into *T_impl.hh to avoid ugly problems ith several IDEs
- Fix bug in halfface reordering
......@@ -19,6 +20,8 @@ Version X (?/?/?)
- Fix bug in edge split of tetrahedral meshes
- Ensure that halfface iterators start with a boundary halffaces when cells are deleted
- Added new iterators (VertexIHalfEdgeIter, VertexEdgeIter, VertexHalfFaceIter, EdgeHalfFaceIter, EdgeFaceIter, EdgeCellIter)
- Added `hidden` flag to StatusAttrib for visualisation purposes
- Added InterfaceAttrib to denote interior interfaces
......
......@@ -45,9 +45,13 @@ ECHO "LIBPATH : %LIBPATH%"
ECHO "==============================================================="
ECHO "==============================================================="
set GTEST_PREFIX=%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%
set GTEST_INCLUDE_DIR=%GTEST_PREFIX%\include
set GTEST_LIBRARY=%GTEST_PREFIX%\lib\gtest.lib
set GTEST_MAIN_LIBRARY=%GTEST_PREFIX%\lib\gtest_main.lib
"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release %CMAKE_CONFIGURATION% ..
"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_LIBRARY="%GTEST_LIBRARY%" -DGTEST_INCLUDE_DIR="%GTEST_INCLUDE_DIR%" -DGTEST_MAIN_LIBRARY="%GTEST_MAIN_LIBRARY%" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release %CMAKE_CONFIGURATION% ..
%VS_PATH% /Build "Release" OpenVolumeMesh.sln /Project "ALL_BUILD"
......@@ -57,7 +61,7 @@ cd ..
cd src\Unittests\TestFiles
..\..\..\build-release\src\Unittests\Release\unittests.exe
..\..\..\build-release\Unittests\Release\unittests.exe
cd ..\..\..\
......@@ -68,7 +72,10 @@ mkdir build-debug
cd build-debug
"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Debug %CMAKE_CONFIGURATION% ..
set GTEST_LIBRARY=%GTEST_PREFIX%\lib\gtestd.lib
set GTEST_MAIN_LIBRARY=%GTEST_PREFIX%\lib\gtest_maind.lib
"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_LIBRARY="%GTEST_LIBRARY%" -DGTEST_INCLUDE_DIR="%GTEST_INCLUDE_DIR%" -DGTEST_MAIN_LIBRARY="%GTEST_MAIN_LIBRARY%" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Debug %CMAKE_CONFIGURATION% ..
%VS_PATH% /Build "Debug" OpenVolumeMesh.sln /Project "ALL_BUILD"
......@@ -78,7 +85,7 @@ cd ..
cd src\Unittests\TestFiles
..\..\..\build-debug\src\Unittests\Debug\unittests.exe
..\..\..\build-debug\Unittests\Debug\unittests.exe
IF %errorlevel% NEQ 0 exit /b %errorlevel%
......@@ -10,6 +10,12 @@ NC='\033[0m'
OUTPUT='\033[0;32m'
WARNING='\033[0;93m'
BUILDPATH="build-cppcheck"
mkdir -p "${BUILDPATH}"
cd "${BUILDPATH}"
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
cd ..
echo -e "${OUTPUT}"
echo "=============================================================================="
echo "Running cppcheck"
......@@ -20,7 +26,17 @@ echo -e "${NC}"
echo "Please Wait ..."
# Run cppcheck and output into file
cppcheck --enable=all . -I src -i Doc/ --force --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -UBMPOSTFIX -DOPENVOLUMEMESHDLLEXPORT="" 2>&1 | tee cppcheck.log
# we do not enable 'style' and 'unusedFunction' (the latter gives false positive
# for the public library interface)
cppcheck \
--project=${BUILDPATH}/compile_commands.json \
--force \
--enable=warning,performance,portability,information,missingInclude \
--suppress=missingIncludeSystem \
--suppress=unmatchedSuppression \
--inline-suppr \
--quiet \
2>&1 | tee cppcheck.log
COUNT=$(wc -l < cppcheck.log )
......@@ -30,7 +46,7 @@ echo "CPPCHECK Summary"
echo "=============================================================================="
echo -e "${NC}"
if [ $COUNT -gt 5 ]; then
if [ $COUNT -gt 3 ]; then
echo -e ${WARNING}
echo "Total CPPCHECK error Count is $COUNT, which is too High! CPPCHECK Run failed";
echo -e "${NC}"
......
......@@ -37,7 +37,7 @@ fi
cd build-release-$BUILDPATH
cmake -DCMAKE_BUILD_TYPE=Release -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
cmake -DCMAKE_BUILD_TYPE=Release -DSTL_DEBUG=ON $OPTIONS ../
#build it
make
......@@ -68,7 +68,7 @@ fi
cd build-debug-$BUILDPATH
cmake -DCMAKE_BUILD_TYPE=Debug -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
cmake -DCMAKE_BUILD_TYPE=Debug -DSTL_DEBUG=ON $OPTIONS ../
#build the unit tests
make unittests
......
......@@ -10,6 +10,10 @@ export PATH
OPTIONS=""
OPTIONS="${OPTIONS} -DGTEST_LIBRARY=${HOME}/sw/gtest-1.7.0/lib/libgtest.a"
OPTIONS="${OPTIONS} -DGTEST_INCLUDE_DIR=${HOME}/sw/gtest-1.7.0/include/"
OPTIONS="${OPTIONS} -DGTEST_MAIN_LIBRARY=${HOME}/sw/gtest-1.7.0/lib/libgtest_main.a"
if [ "$LANGUAGE" == "C++98" ]; then
echo "Building with C++98";
elif [ "$LANGUAGE" == "C++11" ]; then
......@@ -28,7 +32,7 @@ fi
cd build-release
cmake -DCMAKE_BUILD_TYPE=Release -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
cmake -DCMAKE_BUILD_TYPE=Release $OPTIONS ../
#build it
make
......@@ -58,7 +62,7 @@ fi
cd build-debug
cmake -DCMAKE_BUILD_TYPE=Debug -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
cmake -DCMAKE_BUILD_TYPE=Debug $OPTIONS ../
#build it
make
......
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
cmake_policy(VERSION 3.12.0)
if("${PROJECT_NAME}" STREQUAL "")
message("Setting project name to OpenVolumeMesh")
project (OpenVolumeMesh)
set(CMAKE_MACOSX_RPATH 1)
project (OpenVolumeMesh
VERSION 2.1.0
LANGUAGES CXX
HOMEPAGE_URL https://openvolumemesh.org/
)
endif()
# add our macro directory to cmake search path
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set (CMAKE_DEBUG_POSTFIX "d")
#list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Enable bigobj on MSVC Windows debug mode
if ( MSVC )
add_compile_options("$<IF:$<CXX_COMPILER_ID:MSVC>,$<$<CONFIG:DEBUG>:/bigobj>,>")
if( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} )
set(OVM_STANDALONE_BUILD TRUE)
else()
set(OVM_STANDALONE_BUILD FALSE)
endif()
if (WIN32)
add_definitions( -D_USE_MATH_DEFINES -DNOMINMAX )
endif ()
# include our cmake files
include (ACGCommon)
acg_get_version ()
include (ACGOutput)
set(OVM_ENABLE_APPLICATIONS ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh applications")
set(OVM_ENABLE_UNITTESTS ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh unit tests")
set(OVM_ENABLE_EXAMPLES ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh examples")
set(OVM_BUILD_DOCUMENTATION ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh documentation")
set(OVM_CXX_VERSION 11 CACHE STRING "C++ version to use")
set_property(CACHE OVM_CXX_VERSION PROPERTY STRINGS 11 14 17 20)
if (OVM_STANDALONE_BUILD)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/lib")
set(OVM_TARGET_PREFIX "")
enable_testing()
option(STL_DEBUG "Enable STL debug checks. Warning: This must be consistent across the whole build! Not compatible with the libc++ shipped with Apple XCode as of 2019." OFF)
if (STL_DEBUG)
# We do not know which STL will be used, defining both is the easist way.
# https://libcxx.llvm.org/docs/UsingLibcxx.html#libc-configuration-macros
# https://libcxx.llvm.org/docs/DesignDocs/DebugMode.html#using-debug-mode
add_definitions(-D_LIBCPP_DEBUG=1)
# https://gcc.gnu.org/onlinedocs/libstdc%2B%2B/manual/debug_mode_using.html
add_definitions(-D_GLIBXX_DEBUG=1)
add_definitions(-D_GLIBXX_DEBUG_PEDANTIC=1)
endif()
else()
# OVM_TARGET_PREFIX is prepended to targets with generic names,
# i.e., "doc", "unittests"
set(OVM_TARGET_PREFIX "OVM_")
endif()
# ========================================================================
# Call the subdirectories with the projects
# ========================================================================
set (CMAKE_DEBUG_POSTFIX "d")
add_subdirectory (src)
# Only add examples and doc to build target if OpenVolumeMesh
# is not built as external library only
if(${PROJECT_NAME} MATCHES "OpenVolumeMesh")
add_subdirectory (examples)
add_subdirectory (documentation)
if (OVM_ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()
if (OVM_BUILD_DOCUMENTATION)
add_subdirectory(documentation)
endif()
# ========================================================================
# Bundle generation (Targets exist, now configure them)
# ========================================================================
#export(PACKAGE OpenVolumeMesh)
# display results
acg_print_configure_header (OPENVOLUMEMESH "OpenVolumeMesh")
#list(REMOVE_AT CMAKE_MODULE_PATH -1)
VERSION=2.0.0
MAJOR=2
MINOR=0
PATCH=0
ID=OPENVOLUMEMESH
This diff is collapsed.
################################################################################
# Custom settings for compiler flags and similar
################################################################################
if (UNIX)
set ( ADDITIONAL_CXX_FLAGS )
set ( ADDITIONAL_CXX_DEBUG_FLAGS )
set ( ADDITIONAL_CXX_RELEASE_FLAGS )
set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS )
set ( ADDITIONAL_C_FLAGS )
set ( ADDITIONAL_C_DEBUG_FLAGS )
set ( ADDITIONAL_C_RELEASE_FLAGS )
set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS )
################################################################################
# Defaults
################################################################################
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_CXX_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_FLAGS "-DINCLUDE_TEMPLATES" )
# Increase the template depth as this might be exceeded from time to time
IF( NOT CMAKE_SYSTEM MATCHES "SunOS*")
list(APPEND ADDITIONAL_CXX_FLAGS "-ftemplate-depth-100" )
ENDIF()
################################################################################
# Build/Release Defines
################################################################################
IF( NOT CMAKE_SYSTEM MATCHES "SunOS*")
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-DDEBUG" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DNDEBUG" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DDEBUG" )
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-DDEBUG" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-DNDEBUG" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-DDEBUG" )
ENDIF()
################################################################################
# Warnings
################################################################################
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
list(APPEND ADDITIONAL_CXX_FLAGS "-Weverything")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat-pedantic")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-padded")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-old-style-cast")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-documentation-unknown-command")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-unreachable-code-return")
# enable later:
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-sign-conversion")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-deprecated")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-weak-vtables")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wall")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wextra")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wpedantic")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wshadow")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wpointer-arith")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wcast-qual")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wconversion")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wtype-limits")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wsign-compare")
endif()
################################################################################
# STL Vector checks
################################################################################
# Pre initialize stl vector check variable
if ( NOT STL_VECTOR_CHECKS )
set ( STL_VECTOR_CHECKS false CACHE BOOL "Include full stl vector checks in debug mode (This option is only used in debug Mode!)" )
endif ( NOT STL_VECTOR_CHECKS )
# Add a flag to check stl vectors in debugging mode
if ( STL_VECTOR_CHECKS AND NOT CMAKE_SYSTEM MATCHES "SunOS*" )
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-D_GLIBCXX_DEBUG" )
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-D_GLIBCXX_DEBUG_PEDANTIC")
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-D_GLIBCXX_DEBUG" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-D_GLIBCXX_DEBUG_PEDANTIC")
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-D_GLIBCXX_DEBUG" )
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-D_GLIBCXX_DEBUG_PEDANTIC")
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-D_GLIBCXX_DEBUG" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-D_GLIBCXX_DEBUG_PEDANTIC")
endif()
################################################################################
# Process the additional flags:
################################################################################
# Add the debug flags
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_DEBUG_FLAGS} )
list (FIND ${CMAKE_CXX_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ")
endif()
endforeach()
# Add the release flags
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELEASE_FLAGS} )
list (FIND ${CMAKE_CXX_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ")
endif()
endforeach()
# Add the release with debug info flags
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
list (FIND ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ")
endif()
endforeach()
# Add the debug flags
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_DEBUG_FLAGS} )
list (FIND ${CMAKE_C_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ")
endif()
endforeach()
# Add the release flags
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELEASE_FLAGS} )
list (FIND ${CMAKE_C_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ")
endif()
endforeach()
# Add the release with debug info flags
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
list (FIND ${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ")
endif()
endforeach()
#TODO : Test and remove it?!
IF( CMAKE_SYSTEM MATCHES "SunOS*")
set (CMAKE_CFLAGS_RELEASE "-xO3")
set (CMAKE_CXX_FLAGS_RELEASE "-xO3")
endif ( CMAKE_SYSTEM MATCHES "SunOS*" )
################################################################################
# C++ 11 support
################################################################################
# On apple, if we have c++ 11 support, we enable it automatically here
# if (APPLE)
#
# include(CheckCXXCompilerFlag)
# CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
# CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
#
# if(COMPILER_SUPPORTS_CXX11)
# set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11")
# set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11")
# set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11")
# elseif(COMPILER_SUPPORTS_CXX0X)
# set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++0x")
# set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} -std=c++0x")
# set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_DEBUG} -std=c++0x")
# else()
# message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Falling back to non C++11 mode. If you encounter errors, please use a different C++ compiler.")
# endif()
#
# endif()
endif ()
# -helper macro to add a "doc" target with CMake build system.
# and configure doxy.config.in to doxy.config
#
# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
# Creates .chm windows help file if MS HTML help workshop
# (available from http://msdn.microsoft.com/workshop/author/htmlhelp)
# is installed with its DLLs in PATH.
#
#
# Please note, that the tools, e.g.:
# doxygen, dot, latex, dvips, makeindex, gswin32, etc.
# must be in path.
#
# Note about Visual Studio Projects:
# MSVS hast its own path environment which may differ from the shell.
# See "Menu Tools/Options/Projects/VC++ Directories" in VS 7.1
#
# author Jan Woetzel 2004-2006
# www.mip.informatik.uni-kiel.de/~jw
if ( NOT DOXYGEN_FOUND)
FIND_PACKAGE(Doxygen)
endif()
IF (DOXYGEN_FOUND)
# click+jump in Emacs and Visual Studio (for doxy.config) (jw)
IF (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
SET(DOXY_WARN_FORMAT "\"$file($line) : $text \"")
ELSE (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
SET(DOXY_WARN_FORMAT "\"$file:$line: $text \"")
ENDIF (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
# we need latex for doxygen because of the formulas
FIND_PACKAGE(LATEX)
IF (NOT LATEX_COMPILER)
MESSAGE(STATUS "latex command LATEX_COMPILER not found but usually required. You will probably get warnings and user inetraction on doxy run.")
ENDIF (NOT LATEX_COMPILER)
IF (NOT MAKEINDEX_COMPILER)
MESSAGE(STATUS "makeindex command MAKEINDEX_COMPILER not found but usually required.")
ENDIF (NOT MAKEINDEX_COMPILER)
IF (NOT DVIPS_CONVERTER)
MESSAGE(STATUS "dvips command DVIPS_CONVERTER not found but usually required.")
ENDIF (NOT DVIPS_CONVERTER)
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
MESSAGE(STATUS "configured ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in --> ${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in
${CMAKE_CURRENT_BINARY_DIR}/doxy.config
@ONLY )
# use (configured) doxy.config from (out of place) BUILD tree:
SET(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
# use static hand-edited doxy.config from SOURCE tree:
SET(DOXY_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
MESSAGE(STATUS "WARNING: using existing ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config instead of configuring from doxy.config.in file.")
ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
IF (EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
# using template doxy.config.in
MESSAGE(STATUS "configured ${CMAKE_CMAKE_MODULE_PATH}/doxy.config.in --> ${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
CONFIGURE_FILE(${CMAKE_MODULE_PATH}/doxy.config.in
${CMAKE_CURRENT_BINARY_DIR}/doxy.config
@ONLY )
SET(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
ELSE (EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
# failed completely...
MESSAGE(SEND_ERROR "Please create ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in (or doxy.config as fallback)")
ENDIF(EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG})
# create a windows help .chm file using hhc.exe
# HTMLHelp DLL must be in path!
# fallback: use hhw.exe interactively
IF (WIN32)
FIND_PACKAGE(HTMLHelp)
IF (HTML_HELP_COMPILER)
SET (TMP "${CMAKE_CURRENT_BINARY_DIR}\\Doc\\html\\index.hhp")
STRING(REGEX REPLACE "[/]" "\\\\" HHP_FILE ${TMP} )
# MESSAGE(SEND_ERROR "DBG HHP_FILE=${HHP_FILE}")
ADD_CUSTOM_TARGET(winhelp ${HTML_HELP_COMPILER} ${HHP_FILE})
ADD_DEPENDENCIES (winhelp doc)
IF (NOT TARGET_DOC_SKIP_INSTALL)
# install windows help?
# determine useful name for output file
# should be project and version unique to allow installing
# multiple projects into one global directory
IF (EXISTS "${PROJECT_BINARY_DIR}/Doc/html/index.chm")
IF (PROJECT_NAME)
SET(OUT "${PROJECT_NAME}")
ELSE (PROJECT_NAME)
SET(OUT "Documentation") # default
ENDIF(PROJECT_NAME)
IF (${PROJECT_NAME}_VERSION_MAJOR)
SET(OUT "${OUT}-${${PROJECT_NAME}_VERSION_MAJOR}")
IF (${PROJECT_NAME}_VERSION_MINOR)
SET(OUT "${OUT}.${${PROJECT_NAME}_VERSION_MINOR}")
IF (${PROJECT_NAME}_VERSION_PATCH)
SET(OUT "${OUT}.${${PROJECT_NAME}_VERSION_PATCH}")
ENDIF(${PROJECT_NAME}_VERSION_PATCH)
ENDIF(${PROJECT_NAME}_VERSION_MINOR)
ENDIF(${PROJECT_NAME}_VERSION_MAJOR)
# keep suffix
SET(OUT "${OUT}.chm")
#MESSAGE("DBG ${PROJECT_BINARY_DIR}/Doc/html/index.chm \n${OUT}")
# create target used by install and package commands
INSTALL(FILES "${PROJECT_BINARY_DIR}/Doc/html/index.chm"
DESTINATION "doc"
RENAME "${OUT}"
)
ENDIF(EXISTS "${PROJECT_BINARY_DIR}/Doc/html/index.chm")
ENDIF(NOT TARGET_DOC_SKIP_INSTALL)
ENDIF(HTML_HELP_COMPILER)
# MESSAGE(SEND_ERROR "HTML_HELP_COMPILER=${HTML_HELP_COMPILER}")
ENDIF (WIN32)
ENDIF(DOXYGEN_FOUND)
# fill string with spaces
macro (acg_format_string str length return)
string (LENGTH "${str}" _str_len)
math (EXPR _add_chr "${length} - ${_str_len}")
set (${return} "${str}")
while (_add_chr GREATER 0)
set (${return} "${${return}} ")
math (EXPR _add_chr "${_add_chr} - 1")
endwhile ()
endmacro ()
# print message with color escape sequences if CMAKE_COLOR_MAKEFILE is set
string (ASCII 27 _escape)
function (acg_color_message _str)
if (CMAKE_COLOR_MAKEFILE AND NOT WIN32)
message (${_str})
else ()
string (REGEX REPLACE "${_escape}.[0123456789;]*m" "" __str ${_str})
message (${__str})
endif ()
endfunction ()
# info header
function (acg_print_configure_header _id _name)
acg_format_string ("${_name}" 40 _project)
acg_format_string ("${${_id}_VERSION}" 40 _version)
acg_color_message ("\n${_escape}[40;37m************************************************************${_escape}[0m")
acg_color_message ("${_escape}[40;37m* ${_escape}[1;31mACG ${_escape}[0;40;34mBuildsystem${_escape}[0m${_escape}[40;37m *${_escape}[0m")
acg_color_message ("${_escape}[40;37m* *${_escape}[0m")
acg_color_message ("${_escape}[40;37m* Package : ${_escape}[32m${_project} ${_escape}[37m *${_escape}[0m")
acg_color_message ("${_escape}[40;37m* Version : ${_escape}[32m${_version} ${_escape}[37m *${_escape}[0m")
if ( NOT WIN32 )
# Just artistic. remove 2 spaces for release to make it look nicer ;-)
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
acg_color_message ("${_escape}[40;37m* Type : ${_escape}[32m${CMAKE_BUILD_TYPE} ${_escape}[37m *${_escape}[0m")
else()
acg_color_message ("${_escape}[40;37m* Type : ${_escape}[32m${CMAKE_BUILD_TYPE} ${_escape}[37m *${_escape}[0m")
endif()
endif()
acg_color_message ("${_escape}[40;37m************************************************************${_escape}[0m")
endfunction ()
# info line
function (acg_print_configure_footer)
acg_color_message ("${_escape}[40;37m************************************************************${_escape}[0m\n")
endfunction ()
# Locate and configure the Google Test libraries.
#
# Defines the following variable:
#
# GTEST_FOUND - Found the Google Test libraries
# GTEST_INCLUDE_DIRS - The directories needed on the include paths
# GTEST_LIBRARIES - The libraries to link to test executables
# GTEST_MAIN_LIBRARIES - The libraries to link for automatic main() provision
#
# Copyright 2008 Chandler Carruth
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
if(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES)
set(GTEST_FOUND true)
else(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES)
set(GTEST_PREFIX "" CACHE PATH "Installation prefix for Google Test")
if(GTEST_PREFIX)
find_path(_GTEST_INCLUDE_DIR "gtest/gtest.h"
PATHS "${GTEST_PREFIX}/include"
NO_DEFAULT_PATH)
find_library(_GTEST_LIBRARY gtest
PATHS "${GTEST_PREFIX}/lib"
NO_DEFAULT_PATH)
find_library(_GTEST_MAIN_LIBRARY gtest_main
PATHS "${GTEST_PREFIX}/lib"
NO_DEFAULT_PATH)
if ( _GTEST_LIBRARY )
get_filename_component(_GTEST_LIBRARY_DIR ${_GTEST_LIBRARY} PATH CACHE )
endif()
else(GTEST_PREFIX)
find_path(_GTEST_INCLUDE_DIR "gtest/gtest.h"
PATHS
~/sw/gtest-1.8.0/include
~/sw/gtest-1.7.0/include
~/sw/gtest/include
/ACG/acgdev/gcc-x86_64/gtest/include
/opt/local/include
/usr/local/include
/usr/include
"C:/libs/win32/gtest/include"
NO_DEFAULT_PATH )
find_library(_GTEST_LIBRARY gtest
PATHS
~/sw/gtest-1.8.0/lib
~/sw/gtest-1.7.0/lib
~/sw/gtest/lib
/ACG/acgdev/gcc-x86_64/gtest/lib
/opt/local/lib
/usr/local/lib
/usr/include
"C:/libs/win32/gtest/lib"
NO_DEFAULT_PATH )
find_library(_GTEST_MAIN_LIBRARY gtest_main
PATHS
~/sw/gtest-1.8.0/lib
~/sw/gtest-1.7.0/lib
~/sw/gtest/lib
/ACG/acgdev/gcc-x86_64/gtest/lib
/opt/local/lib
/usr/local/lib
/usr/include
"C:/libs/win32/gtest/lib"
NO_DEFAULT_PATH )
if ( _GTEST_LIBRARY )
get_filename_component(_GTEST_LIBRARY_DIR ${_GTEST_LIBRARY} PATH CACHE )
endif()
endif(GTEST_PREFIX)
if(_GTEST_INCLUDE_DIR AND _GTEST_LIBRARY AND _GTEST_MAIN_LIBRARY)
set(GTEST_FOUND true)
set(GTEST_INCLUDE_DIRS ${_GTEST_INCLUDE_DIR} CACHE PATH
"Include directories for Google Test framework")
if ( NOT WIN32 )
set(GTEST_LIBRARIES ${_GTEST_LIBRARY} CACHE FILEPATH
"Libraries to link for Google Test framework")
set(GTEST_MAIN_LIBRARIES ${_GTEST_MAIN_LIBRARY} CACHE FILEPATH
"Libraries to link for Google Test automatic main() definition")
set(GTEST_MAIN_LIBRARY ${_GTEST_MAIN_LIBRARY} CACHE FILEPATH
"Libraries to link for Google Test automatic main() definition")
else()
set(GTEST_LIBRARIES "optimized;gtest;debug;gtestd" CACHE FILEPATH
"Libraries to link for Google Test framework")
set(GTEST_MAIN_LIBRARIES "optimized;gtest_main;debug;gtest_maind" CACHE FILEPATH
"Libraries to link for Google Test automatic main() definition")
set(GTEST_MAIN_LIBRARY "optimized;gtest_main;debug;gtest_maind" CACHE FILEPATH
"Libraries to link for Google Test automatic main() definition")
endif()
# Macro required to use google test with vs2012
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
add_definitions(-D_VARIADIC_MAX=10)
endif()
set(GTEST_LIBRARY ${_GTEST_LIBRARY} CACHE FILEPATH
"GTest Libraries")
set(GTEST_LIBRARY_DIR ${_GTEST_LIBRARY_DIR} CACHE FILEPATH
"Library dir containing Google Test libraries")
mark_as_advanced(GTEST_INCLUDE_DIRS GTEST_LIBRARIES GTEST_MAIN_LIBRARIES GTEST_LIBRARY_DIR )
if(NOT GoogleTest_FIND_QUIETLY)
message(STATUS "Found Google Test: ${GTEST_LIBRARIES}")
endif(NOT GoogleTest_FIND_QUIETLY)
else(_GTEST_INCLUDE_DIR AND _GTEST_LIBRARY AND _GTEST_MAIN_LIBRARY)
if(GoogleTest_FIND_REQUIRED)
message(FATAL_ERROR "Could not find the Google Test framework")
endif(GoogleTest_FIND_REQUIRED)
endif(_GTEST_INCLUDE_DIR AND _GTEST_LIBRARY AND _GTEST_MAIN_LIBRARY)
endif(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES)
include (ACGDoxygen)
IF (DOXYGEN_FOUND)
if (TARGET doc)
acg_copy_after_build (doc "${CMAKE_CURRENT_SOURCE_DIR}/html" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html")
endif ()
# Add a documentation install target
add_custom_target(doc-install COMMENT "Installing Documentation" VERBATIM )
# Build Documentation before installing it
add_dependencies(doc-install doc)
if (TARGET doc-install)
acg_copy_after_build (doc-install "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html" "${CMAKE_INSTALL_PREFIX}/${ACG_PROJECT_DATADIR}/doc/html")
endif()
ENDIF(DOXYGEN_FOUND)
\ No newline at end of file
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_PROJECT_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/html/logo_vci.png")
set(DOXYGEN_IMAGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/images")
set(DOXYGEN_WARN_IF_UNDOCUMENTED "FALSE")
set(DOXYGEN_CITE_BIB_FILES "${CMAKE_CURRENT_SOURCE_DIR}/references.bib")
set(DOXYGEN_STRIP_FROM_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../src")
set(DOXYGEN_STRIP_FROM_INC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../src")
set(DOXYGEN_FILE_PATTERNS "*.cc" "*.hh" "*.docu")
set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/examples")
set(DOXYGEN_EXAMPLE_PATTERNS "*.cc" "*.hh" "*.txt" ".ovm")
set(DOXYGEN_ENABLED_SECTIONS "OPENVOLUMEMESH_INTERNAL_DOC")
set(DOXYGEN_GENERATE_TREEVIEW "YES")
set(DOXYGEN_USE_MATHJAX "YES")
#set(DOXYGEN_EXTRA_PACKAGS "amsmath" "amsfonts" "amssymb" "biblatex")
set(DOXYGEN_EXCLUDE # "${CMAKE_BINARY_DIR}"
# "${CMAKE_CURRENT_SOURCE_DIR}/../examples"
"${CMAKE_CURRENT_SOURCE_DIR}/../src/Unittests"
)
if (${ACG_PROJECT_DATADIR})
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc")
else()
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/share/doc/OpenVolumeMesh")
endif()
doxygen_add_docs("${OVM_TARGET_PREFIX}doc"
"${CMAKE_CURRENT_SOURCE_DIR}/"
"${CMAKE_CURRENT_SOURCE_DIR}/../src"
)
endif()
# Set project variable such that OpenVolumeMesh does not
# build its unit tests and stuff
project(Examples)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
cmake_policy(VERSION 3.12.0)
project(OpenVolumeMeshExamples)
# Add OpenVolumeMesh's source path to include path for compiler
include_directories(../src)
if (NOT TARGET OpenVolumeMesh::OpenVolumeMesh)
find_package(OpenVolumeMesh REQUIRED)
endif()
# Add target for first example
add_executable(simple_mesh EXCLUDE_FROM_ALL simple_mesh/simple_mesh.cc)
if(NOT WIN32)
# Link against OpenVolumeMesh
target_link_libraries(simple_mesh OpenVolumeMesh)
# Set output directory to ${BINARY_DIR}/Examples
set_target_properties(simple_mesh PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Examples)
else()
# Link against OpenVolumeMesh
target_link_libraries(simple_mesh OpenVolumeMesh)
endif()
add_executable(simple_mesh simple_mesh/simple_mesh.cc)
target_link_libraries(simple_mesh OpenVolumeMesh::OpenVolumeMesh)
set_target_properties (simple_mesh PROPERTIES
CXX_STANDARD ${OVM_CXX_VERSION}
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
#[[=
if(WIN32)
# copy exe file to "Build" directory
# Visual studio will create this file in a subdirectory so we can't use
......@@ -31,4 +27,6 @@ if(WIN32)
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/simple_mesh.exe
${CMAKE_BINARY_DIR}/Examples/simple_mesh.exe)
else()
endif()
=]]
include (ACGCommon)
set(OVM_ENABLE_DEPRECATED_APIS ON CACHE BOOL "Support deprecated OpenVolumeMesh APIs")
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/Config/DeprecationConfig.hh.in"
"${CMAKE_CURRENT_BINARY_DIR}/Config/DeprecationConfig.hh"
)
include_directories (
..
${CMAKE_CURRENT_SOURCE_DIR}
)
# source code directories
set (directories
.
OpenVolumeMesh/Attribs
OpenVolumeMesh/Core
OpenVolumeMesh/Config
OpenVolumeMesh/FileManager
OpenVolumeMesh/Geometry
OpenVolumeMesh/Mesh
)
# collect all header and source files
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
# Disable Library installation when not building OpenVolumeMesh on its own but as part of another project!
if ( NOT ${PROJECT_NAME} MATCHES "OpenVolumeMesh")
set(ACG_NO_LIBRARY_INSTALL true)
endif()
if (WIN32)
# OpenVolumeMesh has no dll exports so we have to build a static library on windows
acg_add_library (OpenVolumeMesh STATIC ${sources} ${headers})
else ()
acg_add_library (OpenVolumeMesh SHAREDANDSTATIC ${sources} ${headers})
set_target_properties (OpenVolumeMesh PROPERTIES VERSION ${OPENVOLUMEMESH_VERSION_MAJOR}.${OPENVOLUMEMESH_VERSION_MINOR}
SOVERSION ${OPENVOLUMEMESH_VERSION_MAJOR}.${OPENVOLUMEMESH_VERSION_MINOR} )
endif ()
foreach(TARGET_NAME OpenVolumeMesh OpenVolumeMeshStatic)
if (TARGET ${TARGET_NAME})
target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/Config/")
endif()
endforeach(TARGET_NAME)
# Only install if the project name matches OpenVolumeMesh.
if (NOT APPLE AND ${PROJECT_NAME} MATCHES "OpenVolumeMesh")
# Install Header Files)
install(DIRECTORY .
DESTINATION include
FILES_MATCHING
PATTERN "*.hh"
PATTERN "Unittests" EXCLUDE
PATTERN "FileConverter" EXCLUDE
PATTERN "CVS" EXCLUDE
PATTERN ".svn" EXCLUDE
PATTERN "tmp" EXCLUDE
PATTERN "Templates" EXCLUDE
PATTERN "Debian*" EXCLUDE)
endif ()
# install config files
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/Config/DeprecationConfig.hh
DESTINATION include/OpenVolumeMesh/Config )
# Only build unittests and file converter
# if not built as external library
if(${PROJECT_NAME} MATCHES "OpenVolumeMesh")
# Add unittests target
add_subdirectory(Unittests)
add_subdirectory(FileConverter)
endif()
SET(SOURCE_FILES
OpenVolumeMesh/Attribs/InterfaceAttrib.cc
OpenVolumeMesh/Attribs/OpenVolumeMeshStatus.cc
OpenVolumeMesh/Attribs/StatusAttrib.cc
OpenVolumeMesh/Geometry/Vector.cc
OpenVolumeMesh/FileManager/FileManager.cc
OpenVolumeMesh/Core/PropertyDefines.cc
OpenVolumeMesh/Core/OpenVolumeMeshHandle.cc
OpenVolumeMesh/Core/ResourceManager.cc
OpenVolumeMesh/Core/BaseEntities.cc
OpenVolumeMesh/Core/BaseProperty.cc
OpenVolumeMesh/Core/TopologyKernel.cc
OpenVolumeMesh/Core/Serializers.cc
OpenVolumeMesh/Core/Iterators.cc
OpenVolumeMesh/Core/OpenVolumeMeshBaseProperty.cc
OpenVolumeMesh/Mesh/TetrahedralMeshIterators.cc
OpenVolumeMesh/Mesh/HexahedralMeshIterators.cc
OpenVolumeMesh/Mesh/TetrahedralMeshTopologyKernel.cc
OpenVolumeMesh/Mesh/HexahedralMeshTopologyKernel.cc
)
set(OVM_ENABLE_DEPRECATED_APIS ON CACHE BOOL "Support deprecated OpenVolumeMesh APIs")
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/OpenVolumeMesh/Config/DeprecationConfig.hh.in"
"${CMAKE_CURRENT_BINARY_DIR}/OpenVolumeMesh/Config/DeprecationConfig.hh"
)
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/OpenVolumeMesh/Config/Version.hh.in"
"${CMAKE_CURRENT_BINARY_DIR}/OpenVolumeMesh/Config/Version.hh"
)
# If we are in a subdirectory of another project that has a ACGCommon module
# (e.g. OpenFlipper), we will use acg_add_library; otherwise behave "normally".
include(ACGCommon OPTIONAL RESULT_VARIABLE IN_ACG_BUILD)
if(IN_ACG_BUILD)
message("OVM is being built as part of an ACG project, using acg_add_library!")
if (WIN32)
acg_add_library(OpenVolumeMesh STATIC ${SOURCE_FILES})
else()
acg_add_library(OpenVolumeMesh SHARED ${SOURCE_FILES})
endif()
else(IN_ACG_BUILD)
if (WIN32)
# Windows .dll build is not supported yet.
# TODO: turn this on once we have OVM_EXPORT macros in all required places,
# cf CXX_VISIBILITY_PRESET:
add_library(OpenVolumeMesh STATIC ${SOURCE_FILES})
else()
option(BUILD_SHARED_LIBS "Build shared library (*.dll, *.so, *.dylib) instead of static library (*.a, *.lib)" ON)
add_library(OpenVolumeMesh ${SOURCE_FILES})
endif()
endif(IN_ACG_BUILD)
add_library(OpenVolumeMesh::OpenVolumeMesh ALIAS OpenVolumeMesh)
include(GenerateExportHeader)
generate_export_header(OpenVolumeMesh
BASE_NAME OVM
EXPORT_FILE_NAME "OpenVolumeMesh/Config/Export.hh"
DEPRECATED_MACRO_NAME "CMAKE_OVM_DEPRECATED"
NO_DEPRECATED_MACRO_NAME "CMAKE_OVM_NO_DEPRECATED"
)
set_target_properties (OpenVolumeMesh PROPERTIES
VERSION ${OpenVolumeMesh_VERSION_MAJOR}.${OpenVolumeMesh_VERSION_MINOR}
SOVERSION ${OpenVolumeMesh_VERSION_MAJOR}.${OpenVolumeMesh_VERSION_MINOR}
CXX_STANDARD ${OVM_CXX_VERSION}
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
POSITION_INDEPENDENT_CODE ON
# TODO: turn this on once we have OVM_EXPORT macros in all required places:
#CXX_VISIBILITY_PRESET hidden
)
target_compile_options(OpenVolumeMesh PUBLIC
"$<$<CXX_COMPILER_ID:MSVC>:/bigobj>"
"$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>" # Enable updated __cplusplus macro
PRIVATE
"$<$<CXX_COMPILER_ID:GNU>:-Wall>"
"$<$<CXX_COMPILER_ID:Clang>:-Wall;-Wno-c++98-compat;-Wno-c++98-compat-pedantic;-Wno-weak-vtables;-Wno-padded;-Wno-sign-conversion;-Wno-missing-prototypes>"
"$<$<CXX_COMPILER_ID:MSVC>:/W1>"
# disable MSVC inline warnings that are enabled with /Ob2, which is in the default cmake release cxxflags:
"$<$<CXX_COMPILER_ID:MSVC>:/wd4710>"
"$<$<CXX_COMPILER_ID:MSVC>:/wd4711>"
)
target_compile_definitions(OpenVolumeMesh PUBLIC "INCLUDE_TEMPLATES")
target_include_directories(OpenVolumeMesh
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/OpenVolumeMesh)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/OpenVolumeMeshConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/OpenVolumeMeshConfig.cmake"
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
)
write_basic_package_version_file(
OpenVolumeMeshConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMinorVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/OpenVolumeMeshConfigVersion.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/OpenVolumeMeshConfig.cmake"
DESTINATION ${INSTALL_CONFIGDIR})
install(DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/OpenVolumeMesh/Config"
DESTINATION include/OpenVolumeMesh)
# Install Header Files
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OpenVolumeMesh
DESTINATION include
FILES_MATCHING PATTERN "*.hh"
)
install(TARGETS OpenVolumeMesh
EXPORT OpenVolumeMeshTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(EXPORT OpenVolumeMeshTargets
FILE OpenVolumeMeshTargets.cmake
NAMESPACE OpenVolumeMesh::
DESTINATION ${INSTALL_CONFIGDIR}
)
export(EXPORT OpenVolumeMeshTargets
NAMESPACE OpenVolumeMesh::)
#export(PACKAGE OpenVolumeMesh)
if (OVM_ENABLE_APPLICATIONS)
add_subdirectory(FileConverter)
endif()
if (OVM_ENABLE_UNITTESTS)
add_subdirectory(Unittests)
endif()
include (ACGCommon)
include_directories (
..
${CMAKE_CURRENT_SOURCE_DIR}
)
find_package(Boost 1.43.0)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
# Add target for first example
add_executable(file_converter EXCLUDE_FROM_ALL ovm_converter.cc)
add_dependencies(file_converter OpenVolumeMesh)
if(NOT WIN32)
# Link against all necessary libraries
target_link_libraries(file_converter OpenVolumeMesh)
# Set output directory to ${BINARY_DIR}/FileConverter
set_target_properties(file_converter PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/FileConverter)
else()
# Link against all necessary libraries
target_link_libraries(file_converter OpenVolumeMesh)
endif()
add_executable(file_converter ovm_converter.cc)
set_target_properties (file_converter PROPERTIES
CXX_STANDARD ${OVM_CXX_VERSION}
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_link_libraries(file_converter OpenVolumeMesh::OpenVolumeMesh Boost::boost)
else()
message(STATUS "Boost not found. Disabling file_converter.")
endif()
#include "InterfaceAttrib.hh"
#include "../Core/TopologyKernel.hh"
namespace OpenVolumeMesh {
InterfaceAttrib::InterfaceAttrib(TopologyKernel &_kernel)
: kernel_(_kernel),
v_interface_(&_kernel, "interface", false),
e_interface_(&_kernel, "interface", false),
f_interface_(&_kernel, "interface", false)
{
_kernel.set_persistent(v_interface_, true);
_kernel.set_persistent(e_interface_, true);
_kernel.set_persistent(f_interface_, true);
}
}
#pragma once
/*===========================================================================*\
* *
* OpenVolumeMesh *
......@@ -32,35 +33,72 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* $LastChangedBy$ *
* *
\*===========================================================================*/
#include "../Core/OpenVolumeMeshProperty.hh"
#include "../Core/OpenVolumeMeshHandle.hh"
#include "../Core/PropertyDefines.hh"
#include "OpenVolumeMesh/Config/Export.hh"
#include "../Core/TopologyKernel.hh"
namespace OpenVolumeMesh {
class TopologyKernel;
/**
* @brief InterfaceAttrib stores if an entity is part of an interface,
* e.g. an material boundary inside the volume.
*/
class OVM_EXPORT InterfaceAttrib {
using boolref = std::vector<bool>::reference;
public:
explicit InterfaceAttrib(TopologyKernel& _kernel);
~InterfaceAttrib() = default;
bool operator[](const VertexHandle& _h) const {
return v_interface_[_h];
}
boolref operator[](const VertexHandle& _h) {
return v_interface_[_h];
}
bool operator[](const EdgeHandle& _h) const {
return e_interface_[_h];
}
boolref operator[](const EdgeHandle& _h) {
return e_interface_[_h];
}
bool operator[](const HalfEdgeHandle& _h) const {
return e_interface_[kernel_.edge_handle(_h)];
}
boolref operator[](const HalfEdgeHandle& _h) {
return e_interface_[kernel_.edge_handle(_h)];
}
bool operator[](const FaceHandle& _h) const {
return f_interface_[_h];
}
boolref operator[](const FaceHandle& _h) {
return f_interface_[_h];
}
bool operator[](const HalfFaceHandle& _h) const {
return f_interface_[kernel_.face_handle(_h)];
}
boolref operator[](const HalfFaceHandle& _h) {
return f_interface_[kernel_.face_handle(_h)];
}
TopologyKernel& kernel_;
VertexPropertyT<bool> v_interface_;
EdgePropertyT<bool> e_interface_;
FacePropertyT<bool> f_interface_;
};
#ifndef DEFINES_HH_
#define DEFINES_HH_
#ifndef OVMDLLEXPORT
#ifdef WIN32
#ifdef OVMDLL
#ifdef BUILDOVM
#define OVMDLLEXPORT __declspec(dllexport)
#define OVMDLLEXPORTONLY __declspec(dllexport)
#else
#define OVMDLLEXPORT __declspec(dllimport)
#define OVMDLLEXPORTONLY
#endif
#else
#define OVMDLLEXPORT
#define OVMDLLEXPORTONLY
#endif
#else
#define OVMDLLEXPORT
#define OVMDLLEXPORTONLY
#endif
#endif
#endif /* DEFINES_HH_ */
} // Namespace OpenVolumeMesh
......@@ -36,6 +36,7 @@
#define STATUS_HH_
#include <iosfwd>
#include "OpenVolumeMesh/Config/Export.hh"
namespace OpenVolumeMesh {
......@@ -44,7 +45,7 @@ namespace OpenVolumeMesh {
* \brief Stores statuses like selected, tagged, deleted, hidden.
*/
class OpenVolumeMeshStatus {
class OVM_EXPORT OpenVolumeMeshStatus {
public:
OpenVolumeMeshStatus() = default;
......
......@@ -44,6 +44,7 @@
#include <iostream>
#endif
#include "../Core/TopologyKernel.hh"
#include "StatusAttrib.hh"
namespace OpenVolumeMesh {
......
......@@ -45,16 +45,18 @@
#include <cassert>
#include "../Core/OpenVolumeMeshProperty.hh"
#include "../Core/OpenVolumeMeshHandle.hh"
#include "OpenVolumeMeshStatus.hh"
#include "../Core/PropertyDefines.hh"
#include "OpenVolumeMesh/Config/Export.hh"
namespace OpenVolumeMesh {
// Forward declaration
class TopologyKernel;
class StatusAttrib {
class OVM_EXPORT StatusAttrib {
public:
explicit StatusAttrib(TopologyKernel& _kernel);
~StatusAttrib();
......
#pragma once
#define OPENVOLUMEMESH_VERSION "@OpenVolumeMesh_VERSION@"
#define OPENVOLUMEMESH_VERSION_MAJOR @OpenVolumeMesh_VERSION_MAJOR@
#define OPENVOLUMEMESH_VERSION_MINOR @OpenVolumeMesh_VERSION_MINOR@
#define OPENVOLUMEMESH_VERSION_PATCH @OpenVolumeMesh_VERSION_PATCH@
#define OPENVOLUMEMESH_CXX_VERSION @OVM_CXX_VERSION@
......@@ -45,11 +45,12 @@
#include <vector>
#include "OpenVolumeMesh/Config/Export.hh"
#include "OpenVolumeMeshHandle.hh"
namespace OpenVolumeMesh {
class OpenVolumeMeshEdge {
class OVM_EXPORT OpenVolumeMeshEdge {
friend class TopologyKernel;
public:
OpenVolumeMeshEdge(const VertexHandle& _fromVertex,
......@@ -84,7 +85,7 @@ std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshEdge& _edge);
//***************************************************************************
class OpenVolumeMeshFace {
class OVM_EXPORT OpenVolumeMeshFace {
friend class TopologyKernel;
public:
explicit OpenVolumeMeshFace(const std::vector<HalfEdgeHandle>& _halfedges) :
......@@ -115,7 +116,7 @@ std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshFace& _face);
//***************************************************************************
class OpenVolumeMeshCell {
class OVM_EXPORT OpenVolumeMeshCell {
friend class TopologyKernel;
public:
explicit OpenVolumeMeshCell(const std::vector<HalfFaceHandle>& _halffaces) :
......
......@@ -38,21 +38,29 @@
#include <string>
#include "OpenVolumeMeshHandle.hh"
#include "OpenVolumeMesh/Config/Export.hh"
namespace OpenVolumeMesh {
class ResourceManager;
class BaseProperty {
class OVM_EXPORT BaseProperty {
public:
friend class ResourceManager;
explicit BaseProperty(ResourceManager* _resMan) : resMan_(_resMan) {}
BaseProperty(BaseProperty&& _other) = default;
BaseProperty(const BaseProperty& _other) = default;
BaseProperty& operator=(const BaseProperty& _cpy) = delete;
BaseProperty(BaseProperty&& _other) {
resMan_ = _other.resMan_;
_other.resMan_ = nullptr;
}
BaseProperty& operator=(BaseProperty&& _other) {
resMan_ = _other.resMan_;
_other.resMan_ = nullptr;
return *this;
}
virtual ~BaseProperty();
......
#pragma once
#include "OpenVolumeMesh/Config/Export.hh"
#include <type_traits>
namespace OpenVolumeMesh {
namespace Entity {
struct Vertex {};
struct Edge {};
struct HalfEdge {};
struct Face {};
struct HalfFace {};
struct Cell {};
struct Mesh {};
struct OVM_EXPORT Vertex { Vertex() = delete;};
struct OVM_EXPORT Edge {};
struct OVM_EXPORT HalfEdge {};
struct OVM_EXPORT Face {};
struct OVM_EXPORT HalfFace {};
struct OVM_EXPORT Cell {};
struct OVM_EXPORT Mesh {};
}
template<typename T>
struct is_entity : std::false_type {};
template<> struct is_entity<Entity::Vertex> : std::true_type {};
template<> struct is_entity<Entity::Edge> : std::true_type {};
template<> struct is_entity<Entity::HalfEdge> : std::true_type {};
template<> struct is_entity<Entity::Face> : std::true_type {};
template<> struct is_entity<Entity::HalfFace> : std::true_type {};
template<> struct is_entity<Entity::Cell> : std::true_type {};
template<> struct is_entity<Entity::Mesh> : std::true_type {};
template<> struct OVM_EXPORT is_entity<Entity::Vertex> : std::true_type {};
template<> struct OVM_EXPORT is_entity<Entity::Edge> : std::true_type {};
template<> struct OVM_EXPORT is_entity<Entity::HalfEdge> : std::true_type {};
template<> struct OVM_EXPORT is_entity<Entity::Face> : std::true_type {};
template<> struct OVM_EXPORT is_entity<Entity::HalfFace> : std::true_type {};
template<> struct OVM_EXPORT is_entity<Entity::Cell> : std::true_type {};
template<> struct OVM_EXPORT is_entity<Entity::Mesh> : std::true_type {};
} // namespace OpenVolumeMesh
......@@ -80,12 +80,12 @@ public:
assert(_vh.idx() < (int)vertices_.size());
vertices_[_vh.idx()] = _p;
vertices_[_vh.uidx()] = _p;
}
/// Get point _vh's coordinates
const VecT& vertex(const VertexHandle& _vh) const {
return vertices_[_vh.idx()];
return vertices_[_vh.uidx()];
}
VertexIter delete_vertex(const VertexHandle& _h) override {
......@@ -130,7 +130,7 @@ public:
if (_h1 == _h2)
return;
std::swap(vertices_[_h1.idx()], vertices_[_h2.idx()]);
std::swap(vertices_[_h1.uidx()], vertices_[_h2.uidx()]);
TopologyKernelT::swap_vertex_indices(_h1, _h2);
}
......