Commit fbe72562 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'FreeBSD_and_Config' into 'master'

Free bsd and config

See merge request !217
parents eaa5880c a1b35d17
Pipeline #9624 passed with stages
in 86 minutes and 13 seconds
...@@ -133,7 +133,13 @@ else() ...@@ -133,7 +133,13 @@ else()
set (OPENMESH_LIBRARY_DIR "${_OPENMESH_LIBRARY_DIR}" CACHE PATH "The directory where the OpenMesh libraries can be found.") set (OPENMESH_LIBRARY_DIR "${_OPENMESH_LIBRARY_DIR}" CACHE PATH "The directory where the OpenMesh libraries can be found.")
endif() endif()
add_subdirectory (Doc) if ( NOT DEFINED OPENMESH_DOCS )
set( OPENMESH_DOCS true CACHE BOOL "Enable or disable building of documentation" )
endif()
if (OPENMESH_DOCS)
add_subdirectory (Doc)
endif()
# ======================================================================== # ========================================================================
# Bundle generation (Targets exist, now configure them) # Bundle generation (Targets exist, now configure them)
...@@ -175,6 +181,20 @@ endif() ...@@ -175,6 +181,20 @@ endif()
# ======================================================================== # ========================================================================
# Generate openmesh.pc file
set(DEST_DIR "${CMAKE_INSTALL_PREFIX}")
set(PRIVATE_LIBS "-lOpenMeshCore -lOpenMeshTools")
configure_file("openmesh.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/openmesh.pc" @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/openmesh.pc DESTINATION libdata/pkgconfig)
# generate target file
install(EXPORT OpenMeshConfig DESTINATION share/OpenMesh/cmake)
export(TARGETS OpenMeshCore OpenMeshTools FILE OpenMeshConfig.cmake)
# display results # display results
acg_print_configure_header (OPENMESH "OpenMesh") acg_print_configure_header (OPENMESH "OpenMesh")
...@@ -14,6 +14,12 @@ ...@@ -14,6 +14,12 @@
<li>PropertyManager: add hasProperty function</li> <li>PropertyManager: add hasProperty function</li>
</ul> </ul>
<b>Build System</b>
<ul>
<li>Generate OpenMeshConfig.cmake (Thanks to Thibault Payet for the patch)</li>
<li>Support building on FreeBSD (Thanks to Thibault Payet for the patch)</li>
</ul>
</tr> </tr>
......
prefix=@DEST_DIR@
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: libOpenMesh
Description: OpenMesh library
Version: @OPENMESH_VERSION_MAJOR@.@OPENMESH_VERSION_MINOR@
Libs: -L${libdir} @PRIVATE_LIBS@
Cflags: -I${includedir}
...@@ -132,4 +132,12 @@ install(DIRECTORY IO/ ...@@ -132,4 +132,12 @@ install(DIRECTORY IO/
PATTERN "Debian*" EXCLUDE ) PATTERN "Debian*" EXCLUDE )
endif () endif ()
target_include_directories(OpenMeshCore PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>)
install(TARGETS OpenMeshCore EXPORT OpenMeshConfig
ARCHIVE DESTINATION ${ACG_PROJECT_LIBDIR}
LIBRARY DESTINATION ${ACG_PROJECT_LIBDIR}
RUNTIME DESTINATION ${ACG_PROJECT_BINDIR})
include (ACGCommon) include (ACGCommon)
include_directories ( include_directories (
../.. ../..
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
# source code directories # source code directories
set (directories set (directories
. .
Decimater Decimater
Dualizer Dualizer
Smoother Smoother
Subdivider/Adaptive/Composite Subdivider/Adaptive/Composite
Subdivider/Uniform/Composite Subdivider/Uniform/Composite
Subdivider/Uniform Subdivider/Uniform
Utils Utils
VDPM VDPM
) )
# collect all header and source files # collect all header and source files
acg_append_files (headers "*.hh" ${directories}) acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories}) acg_append_files (sources "*.cc" ${directories})
IF(WIN32 AND NOT MINGW) IF(WIN32 AND NOT MINGW)
acg_append_files (sources "*.c" ${directories}) acg_append_files (sources "*.c" ${directories})
ENDIF(WIN32 AND NOT MINGW) ENDIF(WIN32 AND NOT MINGW)
# Disable Library installation when not building OpenMesh on its own but as part of another project! # Disable Library installation when not building OpenMesh on its own but as part of another project!
if ( NOT ${PROJECT_NAME} MATCHES "OpenMesh") if ( NOT ${PROJECT_NAME} MATCHES "OpenMesh")
set(ACG_NO_LIBRARY_INSTALL true) set(ACG_NO_LIBRARY_INSTALL true)
endif() endif()
if (WIN32) if (WIN32)
if ( OPENMESH_BUILD_SHARED ) if ( OPENMESH_BUILD_SHARED )
add_definitions( -DOPENMESHDLL -DBUILDOPENMESHDLL) add_definitions( -DOPENMESHDLL -DBUILDOPENMESHDLL)
acg_add_library (OpenMeshTools SHARED ${sources} ${headers}) acg_add_library (OpenMeshTools SHARED ${sources} ${headers})
else() else()
# OpenMesh has no dll exports so we have to build a static library on windows # OpenMesh has no dll exports so we have to build a static library on windows
acg_add_library (OpenMeshTools STATIC ${sources} ${headers}) acg_add_library (OpenMeshTools STATIC ${sources} ${headers})
endif() endif()
else () else ()
acg_add_library (OpenMeshTools SHAREDANDSTATIC ${sources} ${headers}) acg_add_library (OpenMeshTools SHAREDANDSTATIC ${sources} ${headers})
set_target_properties (OpenMeshTools PROPERTIES VERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR} set_target_properties (OpenMeshTools PROPERTIES VERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR}
SOVERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR} ) SOVERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR} )
endif () endif ()
target_link_libraries (OpenMeshTools OpenMeshCore) target_link_libraries (OpenMeshTools OpenMeshCore)
IF( NOT WIN32 ) IF( NOT WIN32 )
target_link_libraries (OpenMeshToolsStatic OpenMeshCoreStatic) target_link_libraries (OpenMeshToolsStatic OpenMeshCoreStatic)
ENDIF(NOT WIN32) ENDIF(NOT WIN32)
if ( (${PROJECT_NAME} MATCHES "OpenMesh") AND BUILD_APPS ) if ( (${PROJECT_NAME} MATCHES "OpenMesh") AND BUILD_APPS )
if ( WIN32 ) if ( WIN32 )
if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" ) if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
# let bundle generation depend on target # let bundle generation depend on target
add_dependencies (fixbundle OpenMeshTools) add_dependencies (fixbundle OpenMeshTools)
endif() endif()
endif() endif()
# Add tools as dependency before fixbundle # Add tools as dependency before fixbundle
if (APPLE) if (APPLE)
# let bundle generation depend on target # let bundle generation depend on target
add_dependencies (fixbundle OpenMeshTools) add_dependencies (fixbundle OpenMeshTools)
add_dependencies (fixbundle OpenMeshToolsStatic) add_dependencies (fixbundle OpenMeshToolsStatic)
endif() endif()
endif() endif()
# Install Header Files (Apple) # Install Header Files (Apple)
if ( NOT ACG_PROJECT_MACOS_BUNDLE AND APPLE ) if ( NOT ACG_PROJECT_MACOS_BUNDLE AND APPLE )
FILE(GLOB files_install_Decimater "${CMAKE_CURRENT_SOURCE_DIR}/Decimater/*.hh" ) FILE(GLOB files_install_Decimater "${CMAKE_CURRENT_SOURCE_DIR}/Decimater/*.hh" )
FILE(GLOB files_install_Dualizer "${CMAKE_CURRENT_SOURCE_DIR}/Dualizer/*.hh" ) FILE(GLOB files_install_Dualizer "${CMAKE_CURRENT_SOURCE_DIR}/Dualizer/*.hh" )
FILE(GLOB files_install_KERNEL_OSG "${CMAKE_CURRENT_SOURCE_DIR}/Kernel_OSG/*.hh" ) FILE(GLOB files_install_KERNEL_OSG "${CMAKE_CURRENT_SOURCE_DIR}/Kernel_OSG/*.hh" )
FILE(GLOB files_install_Smoother "${CMAKE_CURRENT_SOURCE_DIR}/Smoother/*.hh" ) FILE(GLOB files_install_Smoother "${CMAKE_CURRENT_SOURCE_DIR}/Smoother/*.hh" )
FILE(GLOB files_install_Subdivider_Adaptive "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Adaptive/Composite/*.hh" ) FILE(GLOB files_install_Subdivider_Adaptive "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Adaptive/Composite/*.hh" )
FILE(GLOB files_install_Subdivider_Uniform "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/*.hh" ) FILE(GLOB files_install_Subdivider_Uniform "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/*.hh" )
FILE(GLOB files_install_Subdivider_Uniform_Composite "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/Composite/*.hh" ) FILE(GLOB files_install_Subdivider_Uniform_Composite "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/Composite/*.hh" )
FILE(GLOB files_install_Utils "${CMAKE_CURRENT_SOURCE_DIR}/Utils/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Utils/getopt.h" ) FILE(GLOB files_install_Utils "${CMAKE_CURRENT_SOURCE_DIR}/Utils/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/Utils/getopt.h" )
FILE(GLOB files_install_VDPM "${CMAKE_CURRENT_SOURCE_DIR}/VDPM/*.hh" ) FILE(GLOB files_install_VDPM "${CMAKE_CURRENT_SOURCE_DIR}/VDPM/*.hh" )
INSTALL(FILES ${files_install_Decimater} DESTINATION include/OpenMesh/Tools/Decimater ) INSTALL(FILES ${files_install_Decimater} DESTINATION include/OpenMesh/Tools/Decimater )
INSTALL(FILES ${files_install_Dualizer} DESTINATION include/OpenMesh/Tools/Dualizer ) INSTALL(FILES ${files_install_Dualizer} DESTINATION include/OpenMesh/Tools/Dualizer )
INSTALL(FILES ${files_install_KERNEL_OSG} DESTINATION include/OpenMesh/Tools/Kernel_OSG ) INSTALL(FILES ${files_install_KERNEL_OSG} DESTINATION include/OpenMesh/Tools/Kernel_OSG )
INSTALL(FILES ${files_install_Smoother} DESTINATION include/OpenMesh/Tools/Smoother ) INSTALL(FILES ${files_install_Smoother} DESTINATION include/OpenMesh/Tools/Smoother )
INSTALL(FILES ${files_install_Subdivider_Adaptive} DESTINATION include/OpenMesh/Tools/Subdivider/Adaptive/Composite ) INSTALL(FILES ${files_install_Subdivider_Adaptive} DESTINATION include/OpenMesh/Tools/Subdivider/Adaptive/Composite )
INSTALL(FILES ${files_install_Subdivider_Uniform} DESTINATION include/OpenMesh/Tools/Subdivider/Uniform ) INSTALL(FILES ${files_install_Subdivider_Uniform} DESTINATION include/OpenMesh/Tools/Subdivider/Uniform )
INSTALL(FILES ${files_install_Subdivider_Uniform_Composite} DESTINATION include/OpenMesh/Tools/Subdivider/Uniform/Composite ) INSTALL(FILES ${files_install_Subdivider_Uniform_Composite} DESTINATION include/OpenMesh/Tools/Subdivider/Uniform/Composite )
INSTALL(FILES ${files_install_Utils} DESTINATION include/OpenMesh/Tools/Utils ) INSTALL(FILES ${files_install_Utils} DESTINATION include/OpenMesh/Tools/Utils )
INSTALL(FILES ${files_install_VDPM} DESTINATION include/OpenMesh/Tools/VDPM ) INSTALL(FILES ${files_install_VDPM} DESTINATION include/OpenMesh/Tools/VDPM )
endif() endif()
# Only install if the project name matches OpenMesh. # Only install if the project name matches OpenMesh.
if (NOT APPLE AND ${PROJECT_NAME} MATCHES "OpenMesh") if (NOT APPLE AND ${PROJECT_NAME} MATCHES "OpenMesh")
# Install Header Files # Install Header Files
install(DIRECTORY . install(DIRECTORY .
DESTINATION include/OpenMesh/Tools DESTINATION include/OpenMesh/Tools
FILES_MATCHING FILES_MATCHING
PATTERN "*.hh" PATTERN "*.hh"
PATTERN "CVS" EXCLUDE PATTERN "CVS" EXCLUDE
PATTERN ".svn" EXCLUDE PATTERN ".svn" EXCLUDE
PATTERN "tmp" EXCLUDE PATTERN "tmp" EXCLUDE
PATTERN "Templates" EXCLUDE PATTERN "Templates" EXCLUDE
PATTERN "Debian*" EXCLUDE) PATTERN "Debian*" EXCLUDE)
#install the config file #install the config file
install(FILES Utils/getopt.h DESTINATION include/OpenMesh/Tools/Utils) install(FILES Utils/getopt.h DESTINATION include/OpenMesh/Tools/Utils)
endif () endif ()
target_include_directories(OpenMeshTools PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>)
install(TARGETS OpenMeshTools EXPORT OpenMeshConfig
ARCHIVE DESTINATION ${ACG_PROJECT_LIBDIR}
LIBRARY DESTINATION ${ACG_PROJECT_LIBDIR}
RUNTIME DESTINATION ${ACG_PROJECT_BINDIR})
...@@ -183,7 +183,7 @@ protected: ...@@ -183,7 +183,7 @@ protected:
}; };
// ----------------------------------------------------------- gettimeofday ---- // ----------------------------------------------------------- gettimeofday ----
#elif (defined(__GNUC__) || (defined(__INTEL_COMPILER) && !defined(WIN32))) && !defined(__MINGW32__) #elif (defined(__GNUC__) && !defined(__FreeBSD__) || (defined(__INTEL_COMPILER) && !defined(WIN32))) && !defined(__MINGW32__)
# include <sys/time.h> # include <sys/time.h>
# include <sys/resource.h> # include <sys/resource.h>
...@@ -271,7 +271,7 @@ Timer::Timer(void) : ...@@ -271,7 +271,7 @@ Timer::Timer(void) :
# else # else
impl_ = new TimerImplPosix<CLOCK_REALTIME>; impl_ = new TimerImplPosix<CLOCK_REALTIME>;
# endif # endif
#elif (defined(__GNUC__) || (defined(__INTEL_COMPILER) && !defined(WIN32)) ) && !defined(__MINGW32__) #elif (defined(__GNUC__) && !defined(__FreeBSD__) || (defined(__INTEL_COMPILER) && !defined(WIN32)) ) && !defined(__MINGW32__)
impl_ = new TimerImplGToD; impl_ = new TimerImplGToD;
#else #else
impl_ = new TimerImplStd; impl_ = new TimerImplStd;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#endif #endif
#elif defined __APPLE__ #elif defined __APPLE__ || defined(__FreeBSD__)
#include <unistd.h> #include <unistd.h>
#else #else
#include <getopt.h> #include <getopt.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment