Commit 15a01b25 authored by schultezub's avatar schultezub

introducing TUMVis

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@160 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 52dddf10
#
# TUMVis - Yet another visualization framework
# CMake file inspired by Voreen
#
PROJECT(TUMVis)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
#
# Global Build Options
#
OPTION(TUMVIS_SHARED_LIBS "Build shared libraries?" ON )
OPTION(TUMVIS_PRECOMPILED_HEADER "Use pre-compiled headers?" ON )
OPTION(TUMVIS_DEBUG "Activate debug code?" ON )
OPTION(TUMVIS_BUILD_LIB_TGT "Build TGT Library" ON )
IF(WIN32)
OPTION(TUMVIS_COPY_EXTERNAL_DLLS "Copy external DLLs to bin directory?" ON )
OPTION(TUMVIS_INCREMENTAL_LINKING "Enable incremental linking in Visual Studio debug builds?" ON )
OPTION(TUMVIS_GENERATE_MANIFEST "Generate manifest in Visual Studio debug builds?" OFF)
ENDIF()
#
# Further Build Configurations
#
include(cmake/commonconf.cmake)
IF(TUMVIS_BUILD_LIB_TGT)
ADD_SUBDIRECTORY(ext/tgt)
ENDIF()
#
# Copy External DLLs
#
IF(WIN32)
LIST(REMOVE_DUPLICATES TUMVIS_EXTERNAL_DEBUG_DLLS)
LIST(REMOVE_DUPLICATES TUMVIS_EXTERNAL_RELEASE_DLLS)
IF(TUMVIS_COPY_EXTERNAL_DLLS)
COPY_EXTERNAL_DLLS(TUMVIS_EXTERNAL_DEBUG_DLLS TUMVIS_EXTERNAL_RELEASE_DLLS false)
ENDIF()
IF(TUMVIS_ADD_INSTALL_TARGET)
INSTALL(FILES ${TUMVIS_EXTERNAL_DEBUG_DLLS}
DESTINATION .
CONFIGURATIONS Debug
)
INSTALL(FILES ${TUMVIS_EXTERNAL_RELEASE_DLLS}
DESTINATION .
CONFIGURATIONS Release
)
ENDIF()
ENDIF()
# Try to find GLEW library and include path. Once done this will define:
# GLEW_FOUND
# GLEW_DEFINITIONS
# GLEW_INCLUDE_DIR
# GLEW_LIBRARY (containing both debug and release libraries on win32)
# win32: GLEW_LIBRARY_DEBUG, GLEW_LIBRARY_RELEASE, GLEW_DLL_DEBUG, GLEW_DLL_RELEASE, GLEW_LICENSE_FILE
IF (WIN32)
SET(GLEW_DIR "${TUMVIS_HOME}/ext/glew" CACHE PATH "If glew is not found, set this path")
# SET(GLEW_DEFINITIONS "-DGLEW_STATIC")
SET(GLEW_INCLUDE_DIR "${GLEW_DIR}/include")
# set debug and release library
IF(TUMVIS_WIN32)
SET(GLEW_LIBRARY_DEBUG "${GLEW_DIR}/lib/win32/glew32.lib")
SET(GLEW_DLL_DEBUG "${GLEW_DIR}/lib/win32/glew32.dll")
SET(GLEW_LIBRARY_RELEASE "${GLEW_DIR}/lib/win32/glew32.lib")
SET(GLEW_DLL_RELEASE "${GLEW_DIR}/lib/win32/glew32.dll")
ELSEIF(TUMVIS_WIN64)
SET(GLEW_LIBRARY_DEBUG "${GLEW_DIR}/lib/win64/glew32.lib")
SET(GLEW_DLL_DEBUG "${GLEW_DIR}/lib/win64/glew32.dll")
SET(GLEW_LIBRARY_RELEASE "${GLEW_DIR}/lib/win64/glew32.lib")
SET(GLEW_DLL_RELEASE "${GLEW_DIR}/lib/win64/glew32.dll")
ELSE()
MESSAGE(FATAL_ERROR "Neither TUMVIS_WIN32 nor TUMVIS_WIN64 defined!")
ENDIF(TUMVIS_WIN32)
IF (GLEW_LIBRARY_DEBUG AND GLEW_LIBRARY_RELEASE)
SET(GLEW_LIBRARY debug ${GLEW_LIBRARY_DEBUG} optimized ${GLEW_LIBRARY_RELEASE})
ENDIF(GLEW_LIBRARY_DEBUG AND GLEW_LIBRARY_RELEASE)
SET(GLEW_LICENSE_FILE "${GLEW_DIR}/license.txt")
ELSE (WIN32)
FIND_PATH(
GLEW_INCLUDE_DIR
NAMES GL/glew.h
PATHS ${GLEW_DIR}/include /usr/include /usr/local/include /sw/include /opt/local/include
DOC "The directory where GL/glew.h resides"
)
FIND_LIBRARY(
GLEW_LIBRARY
NAMES GLEW glew
PATHS ${GLEW_DIR}/lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /sw/lib /opt/local/lib
DOC "The GLEW library"
)
ENDIF (WIN32)
IF(GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
SET(GLEW_FOUND TRUE)
ELSE(GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
SET(GLEW_FOUND FALSE)
ENDIF(GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
UNSET(Glew_DIR)
MARK_AS_ADVANCED(GLEW_DIR Glew_DIR GLEW_INCLUDE_DIR GLEW_LIBRARY GLEW_LIBRARY_DEBUG GLEW_LIBRARY_RELEASE GLEW_DLL_DEBUG GLEW_DLL_RELEASE)
# Try to find GLUT library and include path. Once done this will define:
# GLUT_FOUND
# GLUT_DEFINITIONS
# GLUT_INCLUDE_DIR
# GLUT_LIBRARIES (containing both debug and release libraries on win32)
# win32: GLUT_DEBUG_LIBRARY, GLUT_RELEASE_LIBRARY, GLUT_DEBUG_DLLS, GLUT_RELEASE_DLLS
IF(WIN32)
SET(GLUT_DIR "${TUMVIS_HOME}/ext/glut" CACHE PATH "If glut is not found, set this path")
SET(GLUT_DEFINITIONS "-DGLUT_NO_LIB_PRAGMA")
SET(GLUT_INCLUDE_DIR "${GLUT_DIR}")
# set debug and release library
IF(TUMVIS_WIN32)
SET(GLUT_DEBUG_LIBRARY "${GLUT_DIR}/lib/win32/glut32.lib")
SET(GLUT_RELEASE_LIBRARY "${GLUT_DIR}/lib/win32/glut32.lib")
SET(GLUT_DEBUG_DLL "${GLUT_DIR}/lib/win32/glut32.dll")
SET(GLUT_RELEASE_DLL "${GLUT_DIR}/lib/win32/glut32.dll")
ELSEIF(TUMVIS_WIN64)
SET(GLUT_DEBUG_LIBRARY "${GLUT_DIR}/lib/win64/glut64.lib")
SET(GLUT_RELEASE_LIBRARY "${GLUT_DIR}/lib/win64/glut64.lib")
SET(GLUT_DEBUG_DLL "${GLUT_DIR}/lib/win64/glut64.dll")
SET(GLUT_RELEASE_DLL "${GLUT_DIR}/lib/win64/glut64.dll")
ELSE()
MESSAGE(FATAL_ERROR "Neither TUMVIS_WIN32 nor TUMVIS_WIN64 defined!")
ENDIF(TUMVIS_WIN32)
IF (GLUT_DEBUG_LIBRARY AND GLUT_RELEASE_LIBRARY)
SET(GLUT_LIBRARIES debug ${GLUT_DEBUG_LIBRARY} optimized ${GLUT_RELEASE_LIBRARY})
ENDIF()
IF(GLUT_INCLUDE_DIR AND GLUT_LIBRARIES)
SET(GLUT_FOUND TRUE)
ELSE()
SET(GLUT_FOUND FALSE)
ENDIF()
ELSE(WIN32)
FIND_PACKAGE(GLUT REQUIRED)
# we don't need the Xmu and Xi libraries, which have been added to ${GLUT_LIBRARIES} (see module)
SET(GLUT_LIBRARIES ${GLUT_glut_LIBRARY})
ENDIF(WIN32)
UNSET(GlutTUMVIS_DIR)
MARK_AS_ADVANCED(GLUT_DIR GLUT_INCLUDE_DIR GLUT_LIBRARIES GLUT_DEBUG_LIBRARY GLUT_RELEASE_LIBRARY GLUT_DEBUG_DLL GLUT_RELEASE_DLL)
# Try to find Win32 Qt DLLs to be copied to the bin directory. Once done this will define:
# QT_DLLS_FOUND
# QT_DEBUG_DLLS
# QT_RELEASE_DLLS
#
# Note: FIND_PACKAGE(Qt4 ...) has to be called before in order for ${QT_LIBRARY_DIR}
# and ${QT_BINARY_DIR} to be defined!
# DLLs are either located in Qt library or binary directory
IF(EXISTS ${QT_LIBRARY_DIR}/QtCored4.dll)
SET(DLL_DIR ${QT_LIBRARY_DIR})
ELSEIF(EXISTS ${QT_BINARY_DIR}/QtCored4.dll)
SET(DLL_DIR ${QT_BINARY_DIR})
ELSEIF(EXISTS ${QT_LIBRARY_DIR}/QtCore4.dll)
SET(DLL_DIR ${QT_LIBRARY_DIR})
ELSEIF(EXISTS ${QT_BINARY_DIR}/QtCore4.dll)
SET(DLL_DIR ${QT_BINARY_DIR})
ENDIF()
IF(DLL_DIR)
SET(QT_DLLS_FOUND TRUE)
FOREACH(component ${Qt4DLLsTUMVIS_FIND_COMPONENTS})
IF(EXISTS ${DLL_DIR}/${component}d4.dll)
LIST(APPEND QT_DEBUG_DLLS ${DLL_DIR}/${component}d4.dll)
ELSE()
MESSAGE("Failed to find Qt Debug DLL: ${component}d4.dll")
SET(QT_DLLS_FOUND FALSE)
ENDIF()
IF(EXISTS ${DLL_DIR}/${component}4.dll)
LIST(APPEND QT_RELEASE_DLLS ${DLL_DIR}/${component}4.dll)
ELSE()
MESSAGE(WARNING "Failed to find Qt Release DLL: ${component}4.dll")
SET(QT_DLLS_FOUND FALSE)
ENDIF()
ENDFOREACH()
ELSE()
SET(QT_DLLS_FOUND FALSE)
ENDIF()
UNSET(Qt4DLLsTUMVIS_DIR)
MARK_AS_ADVANCED(Qt4DLLsTUMVIS_DIR)
IF(NOT COMMONCONF_PROCESSED)
SET(TUMVIS_HOME ${CMAKE_CURRENT_SOURCE_DIR})
MESSAGE(STATUS "TUMVis Home: ${TUMVIS_HOME}")
# include macros
INCLUDE(${TUMVIS_HOME}/cmake/macros.cmake)
# detect compiler and architecture
IF(${CMAKE_GENERATOR} STREQUAL "Visual Studio 9 2008")
SET(TUMVIS_MSVC2008 TRUE)
SET(TUMVIS_WIN32 TRUE)
MESSAGE(STATUS "Visual Studio 2008 build (32 Bit)")
ELSEIF(${CMAKE_GENERATOR} STREQUAL "Visual Studio 9 2008 Win64")
SET(TUMVIS_MSVC2008 TRUE)
SET(TUMVIS_WIN64 TRUE)
MESSAGE(STATUS "Visual Studio 2008 Build (64 Bit)")
ELSEIF(${CMAKE_GENERATOR} STREQUAL "Visual Studio 10")
SET(TUMVIS_MSVC2010 TRUE)
SET(TUMVIS_WIN32 TRUE)
MESSAGE(STATUS "Visual Studio 2010 Build (32 Bit)")
ELSEIF(${CMAKE_GENERATOR} STREQUAL "Visual Studio 10 Win64")
SET(TUMVIS_MSVC2010 TRUE)
SET(TUMVIS_WIN64 TRUE)
MESSAGE(STATUS "Visual Studio 2010 Build (64 Bit)")
ELSEIF(${CMAKE_GENERATOR} STREQUAL "Visual Studio 11")
SET(TUMVIS_MSVC11 TRUE)
SET(TUMVIS_WIN32 TRUE)
MESSAGE("Visual Studio 11 Build (32 Bit) (not actively supported)")
ELSEIF(${CMAKE_GENERATOR} STREQUAL "Visual Studio 11 Win64")
SET(TUMVIS_MSVC11 TRUE)
SET(TUMVIS_WIN64 TRUE)
MESSAGE("Visual Studio 11 Build (64 Bit) (not actively supported)")
ELSEIF(${CMAKE_GENERATOR} MATCHES "NMake")
SET(TUMVIS_NMAKE TRUE)
IF(CMAKE_CL_64)
SET(TUMVIS_WIN64 TRUE)
MESSAGE(STATUS "NMake 64 Bit Build")
ELSE(CMAKE_CL_64)
SET(TUMVIS_WIN32 TRUE)
MESSAGE(STATUS "NMake 32 Bit Build")
ENDIF(CMAKE_CL_64)
ELSEIF(${CMAKE_GENERATOR} MATCHES "MinGW")
SET(TUMVIS_MINGW TRUE)
SET(TUMVIS_WIN32 TRUE)
MESSAGE("MinGW 32 Bit Build (not actively supported)")
ELSEIF(${CMAKE_GENERATOR} MATCHES "Unix")
SET(TUMVIS_UNIX TRUE)
MESSAGE(STATUS "Unix Build")
ELSE()
MESSAGE(WARNING "Unsupported or unknown generator: ${CMAKE_GENERATOR}")
ENDIF()
# set binary output path
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${TUMVIS_HOME}/bin")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${TUMVIS_HOME}/bin")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${TUMVIS_HOME}/bin")
# common include directories
LIST(APPEND TUMVIS_INCLUDE_DIRECTORIES "${TUMVIS_HOME}" "${TUMVIS_HOME}/ext")
LIST(APPEND TUMVIS_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
# platform-dependent configuration
IF(WIN32)
LIST(APPEND TUMVIS_DEFINITIONS "-DNOMINMAX" "-D_CRT_SECURE_NO_DEPRECATE")
# Disable warnings for Microsoft compiler:
# C4305: 'identifier' : truncation from 'type1' to 'type2'
# C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning
# C4290: C++ exception specification ignored except to indicate a function is
# not __declspec(nothrow)
# C4068: unknown pragma
# C4251 class needs to have dll interface (used for std classes)
# C4355: 'this' : used in base member initializer list
# occurs in processors' constructors when initializing event properties,
# but is safe there, since the 'this' pointer is only stored and not accessed.
# C4390: ';' : empty controlled statement found; is this the intent?
# occurs when OpenGL error logging macros are disabled
#LIST(APPEND TUMVIS_DEFINITIONS /wd4305 /wd4800 /wd4290 /wd4068 /wd4251 /wd4355 /wd4390)
# enable parallel builds in Visual Studio
LIST(APPEND TUMVIS_DEFINITIONS /MP)
# prevent error: number of sections exceeded object file format limit
LIST(APPEND TUMVIS_DEFINITIONS /bigobj)
# allows 32 Bit builds to use more than 2GB RAM (VC++ only)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
IF(TUMVIS_SHARED_LIBS)
# Linking against Windows DLLs requires explicit instantiation of templates
LIST(APPEND TUMVIS_DEFINITIONS "-DDLL_TEMPLATE_INST")
IF(NOT TUMVIS_GENERATE_MANIFEST)
# Do not embed manifest into binaries in debug mode (slows down incremental linking)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /MANIFEST:NO")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /MANIFEST:NO")
ENDIF()
ENDIF()
# enable/disable incremental linking in debug builds
If(TUMVIS_INCREMENTAL_LINKING)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL")
ELSE()
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO")
ENDIF()
ELSEIF(UNIX)
LIST(APPEND TUMVIS_DEFINITIONS "-DUNIX")
LIST(APPEND TUMVIS_DEFINITIONS "-D__STDC_CONSTANT_MACROS")
ENDIF(WIN32)
# tgt configuration
LIST(APPEND TUMVIS_DEFINITIONS "-DTGT_WITHOUT_DEFINES") # don't use tgt's build system
IF(WIN32)
SET(TGT_WITH_WMI TRUE) #< enable Windows Management Instrumentation for hardware detection
ENDIF()
IF(TUMVIS_DEBUG)
LIST(APPEND TUMVIS_DEFINITIONS -DTGT_DEBUG -DTUMVIS_DEBUG)
ENDIF()
# minimum Qt version
SET(TUMVIS_REQUIRED_QT_VERSION "4.6")
# detect libraries
MESSAGE(STATUS "--------------------------------------------------------------------------------")
MESSAGE(STATUS "Detecting Common Mandatory Libraries:")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${TUMVIS_HOME}/cmake")
# OpenGL
FIND_PACKAGE(OpenGL REQUIRED)
IF(OPENGL_FOUND)
MESSAGE(STATUS "* Found OpenGL")
LIST(APPEND TUMVIS_INCLUDE_DIRECTORIES ${OPENGL_INCLUDE_DIR})
LIST(APPEND TUMVIS_EXTERNAL_LIBRARIES ${OPENGL_LIBRARIES})
ELSE(OPENGL_FOUND)
MESSAGE(FATAL_ERROR "OpenGL not found!")
ENDIF(OPENGL_FOUND)
# GLEW
FIND_PACKAGE(Glew REQUIRED)
IF(GLEW_FOUND)
MESSAGE(STATUS "* Found GLEW")
LIST(APPEND TUMVIS_DEFINITIONS ${GLEW_DEFINITIONS})
LIST(APPEND TUMVIS_INCLUDE_DIRECTORIES ${GLEW_INCLUDE_DIR})
LIST(APPEND TUMVIS_EXTERNAL_LIBRARIES ${GLEW_LIBRARY})
LIST(APPEND TUMVIS_EXTERNAL_DEBUG_DLLS ${GLEW_DLL_DEBUG})
LIST(APPEND TUMVIS_EXTERNAL_RELEASE_DLLS ${GLEW_DLL_RELEASE})
LIST(APPEND TUMVIS_EXTERNAL_LICENSE_FILES ${GLEW_LICENSE_FILE})
ELSE(GLEW_FOUND)
MESSAGE(FATAL_ERROR "GLEW not found!")
ENDIF(GLEW_FOUND)
SET(COMMONCONF_PROCESSED TRUE)
ENDIF(NOT COMMONCONF_PROCESSED)
MACRO(LIST_SUBDIRECTORIES Result Directory AbsolutePath)
FILE(GLOB sub-dirs RELATIVE ${Directory} ${Directory}/*)
SET(${Result} "")
FOREACH(d ${sub-dirs})
IF(IS_DIRECTORY ${Directory}/${d})
IF(${AbsolutePath})
LIST(APPEND ${Result} ${Directory}/${d})
ELSE()
LIST(APPEND ${Result} ${d})
ENDIF()
ENDIF()
ENDFOREACH()
LIST(SORT ${Result})
ENDMACRO(LIST_SUBDIRECTORIES)
# copies the passed debug and release DLLs to bin/Debug and bin/Release, resp.
MACRO(COPY_EXTERNAL_DLLS DebugDLLs ReleaseDLLs failOnError)
MESSAGE(STATUS "Copying external DLLs")
SET(debug_dir "${VRN_HOME}/bin/Debug")
IF(NOT EXISTS ${debug_dir})
FILE(MAKE_DIRECTORY ${debug_dir})
ENDIF()
FOREACH(dllPath ${${DebugDLLs}})
IF(EXISTS ${dllPath})
GET_FILENAME_COMPONENT(dllName ${dllPath} NAME)
IF(EXISTS ${debug_dir}/${dllName})
FILE(REMOVE ${debug_dir}/${dllName})
ENDIF()
FILE(COPY ${dllPath} DESTINATION ${debug_dir})
ELSEIF(${failOnError})
MESSAGE(FATAL_ERROR "Debug DLL not found: ${dllPath}")
ELSE()
MESSAGE(WARNING "Debug DLL not found: ${dllPath}")
ENDIF()
ENDFOREACH()
SET(release_dir "${VRN_HOME}/bin/Release")
IF(NOT EXISTS ${release_dir})
FILE(MAKE_DIRECTORY ${release_dir})
ENDIF()
FOREACH(dllPath ${${ReleaseDLLs}})
IF(EXISTS ${dllPath})
GET_FILENAME_COMPONENT(dllName ${dllPath} NAME)
IF(EXISTS ${release_dir}/${dllName})
FILE(REMOVE ${release_dir}/${dllName})
ENDIF()
FILE(COPY ${dllPath} DESTINATION ${release_dir})
ELSEIF(${failOnError})
MESSAGE(FATAL_ERROR "Release DLL not found: ${dllPath}")
ELSE()
MESSAGE(WARNING "Release DLL not found: ${dllPath}")
ENDIF()
ENDFOREACH()
ENDMACRO()
# adds custom commands to a target that copy the passed debug and release DLLs
# to the corresponding output directories (currently not in use)
MACRO(ADD_COPY_DLL_COMMAND Target DebugDLLs ReleaseDLLs)
#MESSAGE(${${DebugDLLs}})
MESSAGE(${Target})
FOREACH(dll ${${DebugDLLs}})
MESSAGE(${dll})
ADD_CUSTOM_COMMAND(
TARGET ${Target}
COMMAND ${CMAKE_COMMAND} -E copy ${dll} ${VRN_HOME}/bin/Debug
)
ENDFOREACH()
FOREACH(dll ${${ReleaseDLLs}})
ADD_CUSTOM_COMMAND(
TARGET ${Target}
COMMAND ${CMAKE_COMMAND} -E copy ${dll} ${VRN_HOME}/bin/Release
)
ENDFOREACH()
ENDMACRO(ADD_COPY_DLL_COMMAND)
# adapted from: http://stackoverflow.com/questions/148570/using-pre-compiled-headers-with-cmake
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
IF(MSVC)
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
SET(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch")
SET(Sources ${${SourcesVar}})
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
OBJECT_OUTPUTS "${PrecompiledBinary}")
SET_SOURCE_FILES_PROPERTIES(${Sources}
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledBinary}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\""
OBJECT_DEPENDS "${PrecompiledBinary}")
# Add precompiled header to SourcesVar
LIST(APPEND ${SourcesVar} ${PrecompiledSource})
ENDIF(MSVC)
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
# adapted from: http://www.mail-archive.com/cmake@cmake.org/msg04394.html
MACRO(ADD_GCC_PRECOMPILED_HEADER _targetName _input )
GET_FILENAME_COMPONENT(_name ${_input} NAME)
SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
SET(_outdir "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch")
MAKE_DIRECTORY(${_outdir})
SET(_output "${_outdir}/${CMAKE_BUILD_TYPE}.c++")
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
SET(_compiler_FLAGS ${${_flags_var_name}})
GET_TARGET_PROPERTY(_type ${_targetName} TYPE)
IF(${_type} MATCHES SHARED_LIBRARY)
LIST(APPEND _compiler_FLAGS "-fPIC")
ENDIF()
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
FOREACH(item ${_directory_flags})
LIST(APPEND _compiler_FLAGS "-I${item}")
ENDFOREACH(item)
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
LIST(APPEND _compiler_FLAGS ${_directory_flags})
SEPARATE_ARGUMENTS(_compiler_FLAGS)
#MESSAGE("_compiler_FLAGS: ${_compiler_FLAGS}")
#message("${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}")
ADD_CUSTOM_COMMAND(
OUTPUT ${_output}
COMMAND ${CMAKE_CXX_COMPILER}
${_compiler_FLAGS}
-x c++-header
-o ${_output} ${_source}
DEPENDS ${_source} )
ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${_output})
ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch)
#SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include ${_name} -Winvalid-pch -H")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${_name} -Winvalid-pch")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES
COMPILE_FLAGS "-include ${_name} -Winvalid-pch"
)
ENDMACRO(ADD_GCC_PRECOMPILED_HEADER)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
The OpenGL Extension Wrangler Library
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
Copyright (C) 2002, Lev Povalahev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Mesa 3-D graphics library
Version: 7.0
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2007 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions: