Commit a105b5a1 authored by Mike Kremer's avatar Mike Kremer

First check-in

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@2 66977474-1d4b-4f09-8fe9-267525286df2
parent 3555e88d
This diff is collapsed.
################################################################################
# Custom settings for compiler flags and similar
################################################################################
if (UNIX)
set ( ADDITIONAL_CXX_DEBUG_FLAGS )
set ( ADDITIONAL_CXX_RELEASE_FLAGS )
set ( ADDITIONAL_CXX_RELWITHDEBINFO_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_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_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_DEBUG_FLAGS "-ftemplate-depth-100" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-ftemplate-depth-100" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-ftemplate-depth-100" )
ENDIF()
################################################################################
# OS Defines
################################################################################
if (APPLE)
add_definitions( -DARCH_DARWIN )
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( NOT CMAKE_SYSTEM MATCHES "SunOS*")
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-W" "-Wall" "-Wno-unused" )
ENDIF()
if (APPLE)
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-Wno-non-virtual-dtor" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-Wno-non-virtual-dtor" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-Wno-non-virtual-dtor" )
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_DEBUG_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "${flag}" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ")
endif()
endforeach()
# Add the release flags
foreach( flag ${ADDITIONAL_CXX_RELEASE_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELEASE MATCHES "${flag}" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ")
endif()
endforeach()
# Add the release with debug info flags
foreach( flag ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "${flag}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ")
endif()
endforeach()
# Add the debug flags
foreach( flag ${ADDITIONAL_C_DEBUG_FLAGS} )
if( NOT CMAKE_C_FLAGS_DEBUG MATCHES "${flag}" )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ")
endif()
endforeach()
# Add the release flags
foreach( flag ${ADDITIONAL_C_RELEASE_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELEASE MATCHES "${flag}" )
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ")
endif()
endforeach()
# Add the release with debug info flags
foreach( flag ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "${flag}" )
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*" )
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
FIND_PACKAGE(Doxygen)
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)
\ No newline at end of file
# 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")
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 ()
# - Try to find GLEW
# Once done this will define
#
# GLEW_FOUND - system has GLEW
# GLEW_INCLUDE_DIR - the GLEW include directory
# GLEW_LIBRARY_DIR - where the libraries are
# GLEW_LIBRARY - Link these to use GLEW
#
IF (GLEW_INCLUDE_DIR)
# Already in cache, be silent
SET(GLEW_FIND_QUIETLY TRUE)
ENDIF (GLEW_INCLUDE_DIR)
if( WIN32 )
if( MSVC80 )
set( COMPILER_PATH "C:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC" )
endif( MSVC80 )
if( MSVC71 )
set( COMPILER_PATH "C:/Program\ Files/Microsoft\ Visual\ Studio\ .NET\ 2003/Vc7" )
endif( MSVC71 )
FIND_PATH( GLEW_INCLUDE_DIR gl/glew.h gl/wglew.h
PATHS "c:/glew/include" "c:/libs/glew/include" ${COMPILER_PATH}/PlatformSDK/Include )
SET( GLEW_NAMES glew32 )
FIND_LIBRARY( GLEW_LIBRARY
NAMES ${GLEW_NAMES}
PATHS "c:/glew/lib" "c:/libs/glew/lib" ${COMPILER_PATH}/PlatformSDK/Lib )
else( WIN32 )
FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h GL/wglew.h
PATHS /usr/local/include /usr/include )
SET( GLEW_NAMES glew GLEW )
FIND_LIBRARY( GLEW_LIBRARY
NAMES ${GLEW_NAMES}
PATHS /usr/lib /usr/local/lib )
endif( WIN32 )
GET_FILENAME_COMPONENT( GLEW_LIBRARY_DIR ${GLEW_LIBRARY} PATH )
IF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
SET(GLEW_FOUND TRUE)
ELSE (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
SET( GLEW_FOUND FALSE )
SET( GLEW_LIBRARY_DIR )
ENDIF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
# - try to find glut library and include files
# GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
# GLUT_LIBRARIES, the libraries to link against
# GLUT_FOUND, If false, do not try to use GLUT.
# Also defined, but not for general use are:
# GLUT_glut_LIBRARY = the full path to the glut library.
# GLUT_Xmu_LIBRARY = the full path to the Xmu library.
# GLUT_Xi_LIBRARY = the full path to the Xi Library.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
IF (WIN32)
FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h
PATHS ${GLUT_ROOT_PATH}/include
"C:/libs/glut-3.7/include" )
FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut32 glut
PATHS
${OPENGL_LIBRARY_DIR}
${GLUT_ROOT_PATH}/Release
"C:/libs/glut-3.7/lib"
)
ELSE (WIN32)
IF (APPLE)
# These values for Apple could probably do with improvement.
FIND_PATH( GLUT_INCLUDE_DIR glut.h
/System/Library/Frameworks/GLUT.framework/Versions/A/Headers
${OPENGL_LIBRARY_DIR}
)
SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX")
SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
ELSE (APPLE)
FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
/usr/include/GL
/usr/openwin/share/include
/usr/openwin/include
/opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglut
)
FIND_LIBRARY( GLUT_glut_LIBRARY glut
/usr/openwin/lib
)
FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
/usr/openwin/lib
)
FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
/usr/openwin/lib
)
ENDIF (APPLE)
ENDIF (WIN32)
SET( GLUT_FOUND "NO" )
IF(GLUT_INCLUDE_DIR)
IF(GLUT_glut_LIBRARY)
SET( GLUT_LIBRARIES
${GLUT_glut_LIBRARY}
${GLUT_cocoa_LIBRARY}
)
SET( GLUT_FOUND "YES" )
#The following deprecated settings are for backwards compatibility with CMake1.4
SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
ENDIF(GLUT_glut_LIBRARY)
ENDIF(GLUT_INCLUDE_DIR)
MARK_AS_ADVANCED(
GLUT_INCLUDE_DIR
GLUT_glut_LIBRARY
GLUT_Xmu_LIBRARY
GLUT_Xi_LIBRARY
)
# - Finds OpenMP support
# This module can be used to detect OpenMP support in a compiler.
# If the compiler supports OpenMP, the flags required to compile with
# openmp support are set.
#
# The following variables are set:
# OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support
# OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support
# OPENMP_FOUND - true if openmp is detected
#
# Supported compilers can be found at http://openmp.org/wp/openmp-compilers/
# Copyright 2008, 2009 <André Rigland Brodtkorb> Andre.Brodtkorb@ifi.uio.no
#
# Redistribution AND use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(FindPackageHandleStandardArgs)
set(OpenMP_C_FLAG_CANDIDATES
#Gnu
"-fopenmp"
#Microsoft Visual Studio
"/openmp"
#Intel windows
"-Qopenmp"
#Intel
"-openmp"
#Empty, if compiler automatically accepts openmp
" "
#Sun
"-xopenmp"
#HP
"+Oopenmp"
#IBM XL C/c++
"-qsmp"
#Portland Group
"-mp"
)
set(OpenMP_CXX_FLAG_CANDIDATES ${OpenMP_C_FLAG_CANDIDATES})
# sample openmp source code to test
set(OpenMP_C_TEST_SOURCE
"
#include <omp.h>
int main() {
#ifdef _OPENMP
return 0;
#else
breaks_on_purpose
#endif
}
")
# use the same source for CXX as C for now
set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE})
# if these are set then do not try to find them again,
# by avoiding any try_compiles for the flags
if(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS)
set(OpenMP_C_FLAG_CANDIDATES)
set(OpenMP_CXX_FLAG_CANDIDATES)
endif(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS)
# check c compiler
foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
set(OpenMP_C_FLAG_DETECTED)
message(STATUS "Try OpenMP C flag = [${FLAG}]")
check_c_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_C_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(OpenMP_C_FLAG_DETECTED)
set(OpenMP_C_FLAGS_INTERNAL "${FLAG}")
break()
endif(OpenMP_C_FLAG_DETECTED)
endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
# check cxx compiler
foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
set(OpenMP_CXX_FLAG_DETECTED)
message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
check_cxx_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_CXX_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(OpenMP_CXX_FLAG_DETECTED)
set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}")
break()
endif(OpenMP_CXX_FLAG_DETECTED)
endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}"
CACHE STRING "C compiler flags for OpenMP parallization")
set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}"
CACHE STRING "C++ compiler flags for OpenMP parallization")
# handle the standard arguments for find_package
find_package_handle_standard_args(OpenMP DEFAULT_MSG
OpenMP_C_FLAGS OpenMP_CXX_FLAGS )
mark_as_advanced(
OpenMP_C_FLAGS
OpenMP_CXX_FLAGS
)
# option to disable inclusion of qmake build system into source package
option (
DISABLE_QMAKE_BUILD
"Disable inclusion of qmake build system into source package"
OFF
)
# set name
set (CPACK_PACKAGE_NAME "OpenMesh")
set (CPACK_PACKAGE_VENDOR "ACG")
# set version
set (CPACK_PACKAGE_VERSION_MAJOR "${OPENMESH_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${OPENMESH_VERSION_MINOR}")
set (CPACK_PACKAGE_VERSION_PATCH "${OPENMESH_VERSION_PATCH}")
set (CPACK_PACKAGE_VERSION "${OPENMESH_VERSION}")
# addition package info
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenMesh")
#set (CPACK_PACKAGE_EXECUTABLES "DecimaterGui;SubdividerGui;QtViewer" "OpenMesh Decimater;OpenMesh Subdivider;OpenMesh Mesh Viewer")
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set (CPACK_SOURCE_STRIP_FILES "")
# set (CPACK_STRIP_FILES "bin/OpenFlipper")
# source package generation
set (CPACK_SOURCE_GENERATOR "TGZ;TBZ2;ZIP")
# ignored files in source package
set (CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.git")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.svn")
list (APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_BINARY_DIR}")
list (APPEND CPACK_SOURCE_IGNORE_FILES "Makefile")
list (APPEND CPACK_SOURCE_IGNORE_FILES "Makefile\\\\..*")
list (APPEND CPACK_SOURCE_IGNORE_FILES "\\\\.moc\\\\.cpp$")
list (APPEND CPACK_SOURCE_IGNORE_FILES "CMakeCache.txt")
list (APPEND CPACK_SOURCE_IGNORE_FILES "CMakeFiles")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/.*_(32|64)_Debug/")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/.*_(32|64)_Release/")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/MacOS")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/WIN")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/tmp/")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/.*\\\\.kdevelop")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/.*\\\\.kdevses")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/ACG/lib/")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/ACG/include/")
if (DISABLE_QMAKE_BUILD)
list (APPEND CPACK_SOURCE_IGNORE_FILES "/.*\\\\.pro")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/qmake/")
list (APPEND CPACK_SOURCE_IGNORE_FILES "\\\\.qmake\\\\.cache")
endif ()
# filter out all disabled plugins
# file (
# GLOB _plugins_in
# RELATIVE "${CMAKE_SOURCE_DIR}"
# "${CMAKE_SOURCE_DIR}/Plugin-*"
# )
#foreach (_plugin ${_plugins_in})
# string (REPLACE "Plugin-" "" _plugin_name ${_plugin})
# string (TOUPPER ${_plugin_name} _PLUGIN)
# if (NOT EXISTS ${CMAKE_SOURCE_DIR}/${_plugin}/CMakeLists.txt AND DISABLE_QMAKE_BUILD)
# list (APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_SOURCE_DIR}/${_plugin}")
# elseif (DISABLE_PLUGIN_${_PLUGIN})
# list (APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_SOURCE_DIR}/${_plugin}")
# endif ()
#endforeach ()
if (WIN32)
# window NSIS installer
set (CPACK_GENERATOR "NSIS")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set (CPACK_NSIS_DISPLAY_NAME "OpenMesh v${CPACK_PACKAGE_VERSION}")
# set (CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}\\\\OpenFlipper\\\\Icons\\\\OpenFlipper_Icon_128x128x32.ico")
# we need a real uninstaller icon here and we have to define both to make the installer icon work
# set (CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}\\\\OpenFlipper\\\\Icons\\\\OpenFlipper_Icon_128x128x32.ico")
# set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\OpenFlipper\\\\Icons\\\\installer.bmp")
set (CPACK_NSIS_HELP_LINK "http:\\\\www.openmesh.org")
set (CPACK_NSIS_URL_INFO_ABOUT "http:\\\\www.openmesh.org")
# TODO: fillme
# set (CPACK_NSIS_CONTACT "")
# Copy all shared Qt files to build binary dir
if ( NOT Q_WS_MAC)
if (DEFINED QT_QMAKE_EXECUTABLE)
SET (QTLIBLIST QtCore QtGui)
IF (MSVC)
set(TYPE "d")
FOREACH(qtlib ${QTLIBLIST})
IF (WIN32)
GET_FILENAME_COMPONENT(QT_DLL_PATH_tmp ${QT_QMAKE_EXECUTABLE} PATH)
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug)
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release)
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/MinSizeRel)
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/RelWithDebInfo)
INSTALL(FILES ${QT_DLL_PATH_tmp}/${qtlib}${type}d4.dll
DESTINATION ./
CONFIGURATIONS Debug
COMPONENT Applications)
INSTALL(FILES ${QT_DLL_PATH_tmp}/${qtlib}4.dll
DESTINATION ./
CONFIGURATIONS Release
COMPONENT Applications)
ENDIF (WIN32)
ENDFOREACH(qtlib)
endif()
endif(DEFINED QT_QMAKE_EXECUTABLE)
endif()
# copy the glut library if it exists on windows
IF ( WIN32)
if (EXISTS ${CMAKE_BINARY_DIR}/Build/glut32.dll)
install(FILES ${CMAKE_BINARY_DIR}/Build/glut32.dll
DESTINATION ./
COMPONENT Applications
)
endif()
endif()
# copy the documentation if it exists
IF ( WIN32 )
if (EXISTS ${CMAKE_BINARY_DIR}/Build/Doc)
install(DIRECTORY ${CMAKE_BINARY_DIR}/Build/Doc
DESTINATION ./
COMPONENT Applications
)
endif()
endif()
# append dll's to installed package
#if (EXISTS ${CMAKE_SOURCE_DIR}/WIN)
#file (GLOB _files "${CMAKE_SOURCE_DIR}/WIN/DLLs/DLLs 32 debug/*.dll")
#install(FILES ${_files}
#DESTINATION ${ACG_PROJECT_BINDIR}
#CONFIGURATIONS Debug
#)
#file (GLOB _files "${CMAKE_SOURCE_DIR}/WIN/DLLs/DLLs 32 release/*.dll")
#install (FILES ${_files}
# DESTINATION ${ACG_PROJECT_BINDIR}
# CONFIGURATIONS Release
#)
#install (FILES "${CMAKE_SOURCE_DIR}/WIN/DLLs/Redistributables/Visual Studio 2008/vcredist_x86.exe"
# DESTINATION ${ACG_PROJECT_BINDIR}
#)
#set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\vcredist_x86.exe\\\" /q:a'")
#endif ()
#elseif (APPLE)
# apple Drag'n'Drop installer package
#set (CPACK_GENERATOR "DragNDrop;TGZ")
#set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/OpenFlipper/Icons/OpenFlipper_Icon.icns")
endif ()
# has to be last
if (WIN32)
set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP "true")
# include (InstallRequiredSystemLibraries)
install (PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${ACG_PROJECT_BINDIR})