2011-10-26 07:01:04 +00:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2010-12-07 12:28:53 +00:00
|
|
|
|
2012-01-18 09:07:27 +00:00
|
|
|
# Only set project name if OpenMesh is built as stand-alone library
|
|
|
|
|
if("${PROJECT_NAME}" STREQUAL "")
|
|
|
|
|
project (OpenMesh)
|
|
|
|
|
endif()
|
2010-12-07 12:28:53 +00:00
|
|
|
|
|
|
|
|
# add our macro directory to cmake search path
|
2012-01-18 09:07:27 +00:00
|
|
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
2011-08-31 09:21:17 +00:00
|
|
|
set (CMAKE_DEBUG_POSTFIX "d")
|
2010-12-07 12:28:53 +00:00
|
|
|
|
|
|
|
|
# include our cmake files
|
|
|
|
|
include (ACGCommon)
|
|
|
|
|
|
|
|
|
|
acg_get_version ()
|
|
|
|
|
|
2012-01-18 09:07:27 +00:00
|
|
|
|
|
|
|
|
# Disable package building when built as an external library
|
|
|
|
|
if(${PROJECT_NAME} MATCHES "OpenMesh")
|
|
|
|
|
include(OpenMeshPackage)
|
|
|
|
|
endif()
|
|
|
|
|
|
2010-12-07 12:28:53 +00:00
|
|
|
include (ACGOutput)
|
|
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
|
add_definitions(
|
|
|
|
|
-D_USE_MATH_DEFINES -DNOMINMAX
|
|
|
|
|
)
|
|
|
|
|
endif ()
|
|
|
|
|
|
2012-09-23 13:53:10 +00:00
|
|
|
|
|
|
|
|
# ========================================================================
|
|
|
|
|
# Windows build style control
|
|
|
|
|
# ========================================================================
|
|
|
|
|
|
|
|
|
|
if ( WIN32 )
|
|
|
|
|
if ( NOT DEFINED OPENMESH_BUILD_SHARED )
|
2012-09-24 14:12:15 +00:00
|
|
|
set( OPENMESH_BUILD_SHARED false CACHE BOOL "Build as shared library(DLL)?" )
|
2012-09-23 13:53:10 +00:00
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2011-03-09 09:52:57 +00:00
|
|
|
# ========================================================================
|
|
|
|
|
# Add bundle targets here
|
|
|
|
|
# ========================================================================
|
2011-10-11 06:37:38 +00:00
|
|
|
if ( NOT DEFINED BUILD_APPS )
|
|
|
|
|
set( BUILD_APPS true CACHE BOOL "Enable or disable building of apps" )
|
|
|
|
|
endif()
|
|
|
|
|
|
2012-01-18 10:35:09 +00:00
|
|
|
# Only call fixbundle, when we are building OpenMesh standalone
|
|
|
|
|
if(${PROJECT_NAME} MATCHES "OpenMesh")
|
|
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
|
if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" AND BUILD_APPS )
|
|
|
|
|
add_custom_target (fixbundle ALL
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.win.cmake" )
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if (APPLE)
|
2011-10-11 06:37:38 +00:00
|
|
|
add_custom_target (fixbundle ALL
|
2012-01-18 10:35:09 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.cmake"
|
|
|
|
|
)
|
2011-10-11 06:37:38 +00:00
|
|
|
endif()
|
2011-03-09 09:52:57 +00:00
|
|
|
|
2012-01-18 10:35:09 +00:00
|
|
|
endif() # project OpenMesh
|
2011-03-09 09:52:57 +00:00
|
|
|
|
|
|
|
|
# ========================================================================
|
|
|
|
|
# Call the subdirectories with there projects
|
|
|
|
|
# ========================================================================
|
|
|
|
|
|
2010-12-07 12:28:53 +00:00
|
|
|
add_subdirectory (src/OpenMesh/Core)
|
|
|
|
|
add_subdirectory (src/OpenMesh/Tools)
|
|
|
|
|
add_subdirectory (src/OpenMesh/Apps)
|
2012-01-18 09:48:05 +00:00
|
|
|
|
|
|
|
|
# Do not build unit tests when build as external library
|
2013-02-20 12:19:25 +00:00
|
|
|
#if(${PROJECT_NAME} MATCHES "OpenMesh")
|
2012-01-18 09:48:05 +00:00
|
|
|
add_subdirectory (src/Unittests)
|
2013-02-20 12:19:25 +00:00
|
|
|
#endif()
|
2012-01-18 09:48:05 +00:00
|
|
|
|
2010-12-07 12:28:53 +00:00
|
|
|
add_subdirectory (Doc)
|
|
|
|
|
|
|
|
|
|
# ========================================================================
|
2011-03-09 09:52:57 +00:00
|
|
|
# Bundle generation (Targets exist, now configure them)
|
2010-12-07 12:28:53 +00:00
|
|
|
# ========================================================================
|
|
|
|
|
|
2012-01-18 10:35:09 +00:00
|
|
|
# Only call fixbundle, when we are building OpenMesh standalone
|
|
|
|
|
if(${PROJECT_NAME} MATCHES "OpenMesh")
|
2010-12-07 12:28:53 +00:00
|
|
|
|
2012-01-18 10:35:09 +00:00
|
|
|
if (WIN32 AND BUILD_APPS )
|
|
|
|
|
# prepare bundle generation cmake file and add a build target for it
|
|
|
|
|
configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.win.in"
|
|
|
|
|
"${CMAKE_BINARY_DIR}/fixbundle.win.cmake" @ONLY IMMEDIATE)
|
2010-12-07 12:28:53 +00:00
|
|
|
|
2012-01-18 10:35:09 +00:00
|
|
|
if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
|
|
|
|
|
# let bundle generation depend on all targets
|
|
|
|
|
add_dependencies (fixbundle QtViewer DecimaterGui)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
endif()
|
2011-03-09 09:52:57 +00:00
|
|
|
|
2010-12-07 12:28:53 +00:00
|
|
|
|
2012-01-18 10:35:09 +00:00
|
|
|
if (APPLE)
|
|
|
|
|
# prepare bundle generation cmake file and add a build target for it
|
|
|
|
|
configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.in"
|
|
|
|
|
"${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE)
|
2010-12-07 14:00:28 +00:00
|
|
|
|
2012-01-18 10:35:09 +00:00
|
|
|
# let bundle generation depend on all targets
|
|
|
|
|
add_dependencies (fixbundle DecimaterGui ProgViewer QtViewer SubdividerGui)
|
|
|
|
|
|
|
|
|
|
# Required for Snow leopard, and the latest qt. Then the resources have to be copied
|
|
|
|
|
if ( EXISTS "/opt/local/libexec/qt4-mac/lib/QtGui.framework/Versions/4/Resources/qt_menu.nib" )
|
|
|
|
|
add_custom_command(TARGET OpenMesh POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "/opt/local/libexec/qt4-mac/lib/QtGui.framework/Versions/4/Resources/qt_menu.nib" "${CMAKE_BINARY_DIR}/Build/Libraries/qt_menu.nib"
|
|
|
|
|
)
|
|
|
|
|
endif ()
|
2010-12-07 14:00:28 +00:00
|
|
|
|
2012-01-18 10:35:09 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
endif()
|
2010-12-07 12:28:53 +00:00
|
|
|
|
|
|
|
|
# ========================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# display results
|
|
|
|
|
acg_print_configure_header (OPENMESH "OpenMesh")
|