From c7b514bc757383a3307515bf6ff509a9e3897b86 Mon Sep 17 00:00:00 2001 From: kestred Date: Fri, 13 Dec 2013 03:27:52 -0700 Subject: [PATCH] CMake: Configure: Begin conversion to standard CMake find package syntax. --- cmake/modules/ConfigurePackage.cmake | 120 +++++------ cmake/modules/FindCg.cmake | 248 +++++++++------------ cmake/modules/FindEigen2.cmake | 87 ++------ cmake/modules/FindEigen3.cmake | 87 ++------ cmake/modules/FindFFTW.cmake | 203 ++++++++--------- cmake/modules/FindMiles.cmake | 212 +++++++++--------- cmake/modules/MangleFreetype.cmake | 29 --- cmake/modules/MangleJPEG.cmake | 23 -- cmake/modules/MangleOpenAL.cmake | 29 --- cmake/modules/MangleOpenSSL.cmake | 25 --- cmake/modules/ManglePNG.cmake | 28 --- cmake/modules/MangleTIFF.cmake | 25 --- cmake/modules/MangleZLIB.cmake | 35 --- dtool/Configure.cmake | 311 +++++++++++++-------------- 14 files changed, 542 insertions(+), 920 deletions(-) delete mode 100644 cmake/modules/MangleFreetype.cmake delete mode 100644 cmake/modules/MangleJPEG.cmake delete mode 100644 cmake/modules/MangleOpenAL.cmake delete mode 100644 cmake/modules/MangleOpenSSL.cmake delete mode 100644 cmake/modules/ManglePNG.cmake delete mode 100644 cmake/modules/MangleTIFF.cmake delete mode 100644 cmake/modules/MangleZLIB.cmake diff --git a/cmake/modules/ConfigurePackage.cmake b/cmake/modules/ConfigurePackage.cmake index c4e1df0d94..81551994f8 100644 --- a/cmake/modules/ConfigurePackage.cmake +++ b/cmake/modules/ConfigurePackage.cmake @@ -4,8 +4,6 @@ # This modules defines a function which finds and configures libraries # and packages for Panda3Ds configuration file headers (.h files). # -# Additionally, it defines a macro for including Mangle modules. -# # Assumes the file has already been found with find_package(). # # The following variables can be set to override the cached values of USE_XYZZY @@ -16,85 +14,65 @@ # # Usage: -# mangle_package(LIBRARY_NAME) -macro(mangle_package PKG_NAME) - include(Mangle${PKG_NAME}) -endmacro() - -# Usage: -# config_package(PACKAGE_NAME [REQUIRED] [COMMENT ]) +# config_package(PACKAGE_NAME []) function(config_package PKG_NAME) - # Set function vars to defaults - set(DISPLAY_NAME ${PKG_NAME}) + # Get package display name + foreach(arg ${ARGN}) + set(DISPLAY_NAME "${DISPLAY_NAME}${arg}") + endforeach() - # Handle optional function arguments - foreach(arg ${ARGN}) - if(ARG_IS_COMMENT) - unset(ARG_IS_COMMENT) - set(DISPLAY_NAME ${arg}) - break() - endif() + # Set function vars to defaults + if(NOT DISPLAY_NAME) + set(DISPLAY_NAME ${PKG_NAME}) + endif() - if(arg MATCHES "REQUIRED") - # TODO: Implement currently ignored - elseif(arg MATCHES "COMMENT") - set(ARG_IS_COMMENT TRUE) - else() - message(AUTHOR_WARNING "configure_package() unexpected argument: '${arg}'") - return() - endif() - endforeach() - if(ARG_IS_COMMENT) - message(AUTHOR_WARNING "configure_package() expected display-name after 'COMMENT'") - endif() + if(${PKG_NAME}_FOUND) + # Output success after finding the package for the first time + if(NOT DEFINED USE_${PKG_NAME} AND NOT CONFIG_DISABLE_EVERYTHING) + message(STATUS "+ ${DISPLAY_NAME}") + endif() - if(FOUND_${PKG_NAME}) - # Output success after finding the package for the first time - if(NOT DEFINED USE_${PKG_NAME} AND NOT CONFIG_DISABLE_EVERYTHING) - message(STATUS "+ ${DISPLAY_NAME}") - endif() + ### Add a USE_XYZZY config variable to the cache ### + if(CONFIG_ENABLE_EVERYTHING OR CONFIG_DISABLE_EVERYTHING OR CONFIG_ENABLE_FOUND) + unset(USE_${PKG_NAME} CACHE) + endif() - ### Add a USE_XYZZY config variable to the cache ### - if(CONFIG_ENABLE_EVERYTHING OR CONFIG_DISABLE_EVERYTHING OR CONFIG_ENABLE_FOUND) - unset(USE_${PKG_NAME} CACHE) - endif() - - if(CONFIG_DISABLE_EVERYTHING) - option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF) - else() - option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" ON) - endif() + if(CONFIG_DISABLE_EVERYTHING) + option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF) + else() + option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" ON) + endif() - # Update HAVE_XYZZY - if(USE_${PKG_NAME}) - set(HAVE_${PKG_NAME} TRUE PARENT_SCOPE) - endif() + # Update HAVE_XYZZY + if(USE_${PKG_NAME}) + set(HAVE_${PKG_NAME} TRUE PARENT_SCOPE) + endif() - elseif(DEFINED USE_${PKG_NAME}) - # If we were compiling with a particular package, but we can't find it; - # then inform the user the package was lost. - if(USE_${PKG_NAME}) - message(STATUS "- Can no longer find ${DISPLAY_NAME}") + elseif(DEFINED USE_${PKG_NAME}) + # If we were compiling with a particular package, but we can't find it; + # then inform the user the package was lost. + if(USE_${PKG_NAME}) + message(STATUS "- Can no longer find ${DISPLAY_NAME}") - # Only unset if USE_XYZZY is true; - # This allows us to set USE_XYZZY to false to silence the output - unset(USE_${PKG_NAME} CACHE) + # Only unset if USE_XYZZY is true; + # This allows us to set USE_XYZZY to false to silence the output + unset(USE_${PKG_NAME} CACHE) - # If using Discovery, we want to silently disable missing packages - if(CONFIG_DISABLE_MISSING) - option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF) - endif() - endif() + # If using Discovery, we want to silently disable missing packages + if(CONFIG_DISABLE_MISSING) + option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF) + endif() + endif() - else() - # If using DISCOVERED NOTHING, we want to silently disable missing packages - if(CONFIG_DISABLE_MISSING OR CONFIG_DISABLE_EVERYTHING) - option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF) + else() + # If using DISCOVERED NOTHING, we want to silently disable missing packages + if(CONFIG_DISABLE_MISSING OR CONFIG_DISABLE_EVERYTHING) + option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF) - else() - # Otherwise, output failure to find package - message(STATUS "- Did not find ${DISPLAY_NAME}") - endif() - endif() + else() + # Otherwise, output failure to find package + message(STATUS "- Did not find ${DISPLAY_NAME}") + endif() + endif() endfunction() diff --git a/cmake/modules/FindCg.cmake b/cmake/modules/FindCg.cmake index c8342fffc4..f22e279765 100644 --- a/cmake/modules/FindCg.cmake +++ b/cmake/modules/FindCg.cmake @@ -5,17 +5,15 @@ # find_package(Cg [REQUIRED] [QUIET]) # # It sets the following variables: -# FOUND_CG - system has NvidiaCg -# CG_IPATH - the NvidiaCg include directory -# CG_LPATH - the NvidiaCg library directory -# CG_LIBS - the Cg components found -# CG_LIBRARY - the path to the library binary +# CG_FOUND - system has NvidiaCg +# CG_INCLUDE_DIR - the NvidiaCg include directory +# CG_LIBRARY_DIR - the NvidiaCg library directory +# CG_LIBRARY - the path to the library binary # -# FOUND_CGGL - system has CgGL -# CGGL_IPATH - the CgGL include directory -# CGGL_LPATH - the CgGL library directory -# CGGL_LIBS - the CgGL components found -# CGGL_LIBRARY - the path to the library binary +# CGGL_FOUND - system has CgGL +# CGGL_INCLUDE_DIR - the CgGL include directory +# CGGL_LIBRARY_DIR - the CgGL library directory +# CGGL_LIBRARY - the path to the library binary # @@ -23,168 +21,130 @@ # Find Cg for OpenGL macro(find_cggl) - if(CGGL_LPATH AND CGGL_IPATH) - # If its cached, we don't need to refind it - set(FOUND_CGGL TRUE) - if(WIN32) - set(CGGL_LIBS cgGL.lib) - else() - set(CGGL_LIBS CgGL) - endif() - else() - # Find the include directory - find_path(CGGL_IPATH - NAMES "cgGL.h" - PATHS "C:/Program Files/Cg" - "C:/Program Files/NVIDIA Corporation/Cg/include" - "/usr/include" - "/usr/local/include" - "/opt/Cg" - "/opt/nvidia-cg-toolkit/include" # Gentoo - PATH_SUFFIXES "" "Cg" - DOC "The path to NvidiaCg's include directory." - ) + if(NOT CGGL_LIBRARY_DIR AND NOT CGGL_INCLUDE_DIR) + # Find the include directory + find_path(CGGL_INCLUDE_DIR + NAMES "cgGL.h" + PATHS "C:/Program Files/Cg" + "C:/Program Files/NVIDIA Corporation/Cg/include" + "/usr/include" + "/usr/local/include" + "/opt/Cg" + "/opt/nvidia-cg-toolkit/include" # Gentoo + PATH_SUFFIXES "" "Cg" + DOC "The path to NvidiaCgGL's include directory." + ) - # Find the library directory - find_library(CGGL_LIBRARY - NAMES "CgGL" "libCgGL" - PATHS "C:/Program Files/Cg" - "C:/Program Files/NVIDIA Corporation/Cg" - "/usr" - "/usr/local" - "/opt/Cg" - "/opt/nvidia-cg-toolkit" # Gentoo - PATH_SUFFIXES "" "lib" "lib32" "lib64" - ) - get_filename_component(CGGL_LIBRARY_DIR "${CGGL_LIBRARY}" PATH) - set(CGGL_LPATH "${CGGL_LIBRARY_DIR}" CACHE PATH "The path to the CgGL library directory.") # Library path + # Find the library directory + find_library(CGGL_LIBRARY + NAMES "CgGL" "libCgGL" + PATHS "C:/Program Files/Cg" + "C:/Program Files/NVIDIA Corporation/Cg" + "/usr" + "/usr/local" + "/opt/Cg" + "/opt/nvidia-cg-toolkit" # Gentoo + PATH_SUFFIXES "" "lib" "lib32" "lib64" + DOC "The filepath to NvidiaCgGL's libary binary." + ) + get_filename_component(CGGL_LIBRARY_DIR "${CGGL_LIBRARY}" PATH) + set(CGGL_LIBRARY_DIR "${CGGL_LIBRARY_DIR}" CACHE PATH "The path to the CgGL library directory.") # Library path - unset(CGGL_LIBRARY_DIR) + mark_as_advanced(CGGL_INCLUDE_DIR) + mark_as_advanced(CGGL_LIBRARY_DIR) + mark_as_advanced(CGGL_LIBRARY) + endif() - # Check if we have everything we need - if(CGGL_IPATH AND CGGL_LPATH) - set(FOUND_CGGL TRUE) - if(WIN32) - set(CGGL_LIBS cgGL.lib) - else() - set(CGGL_LIBS CgGL) - endif() - endif() + find_package_handle_standard_args(CgGL DEFAULT_MSG CGGL_LIBRARY CGGL_INCLUDE_DIR CGGL_LIBRARY_DIR) - mark_as_advanced(CGGL_IPATH) - mark_as_advanced(CGGL_LPATH) - mark_as_advanced(CGGL_LIBRARY) - endif() endmacro() # Find Cg for DirectX 8 macro(find_cgdx8) - # TODO: Implement + # TODO: Implement endmacro() # Find Cg for DirectX 9 macro(find_cgdx9) - # TODO: Implement + # TODO: Implement endmacro() # Find Cg for DirectX 10 macro(find_cgdx10) - # TODO: Implement + # TODO: Implement endmacro() # Find base Nvidia Cg -if(CG_LPATH AND CG_IPATH) - # If its cached, we don't need to refind it - set(FOUND_CG TRUE) - if(WIN32) - set(CG_LIBS cg.lib) - else() - set(CG_LIBS Cg) - endif() +if(NOT CG_LIBRARY_DIR AND NOT CG_INCLUDE_DIR) + # On OSX default to using the framework version of Cg. + if(APPLE) + include(${CMAKE_ROOT}/Modules/CMakeFindFrameworks.cmake) + set(CG_INCLUDES) - find_cggl() - find_cgdx8() - find_cgdx9() - find_cgdx10() + cmake_find_frameworks(Cg) + if(Cg_FRAMEWORKS) + foreach(dir ${Cg_FRAMEWORKS}) + set(CG_INCLUDES ${CG_INCLUDES} ${dir}/Headers ${dir}/PrivateHeaders) + endforeach(dir) + unset(Cg_FRAMEWORKS) -else() - # On OSX default to using the framework version of Cg. - if(APPLE) - include(${CMAKE_ROOT}/Modules/CMakeFindFrameworks.cmake) - set(CG_INCLUDES) + # Find the include dir + find_path(CG_INCLUDE_DIR + NAMES "cg.h" + PATHS ${CG_INCLUDES} + DOC "The path to NvidiaCg's include directory." + ) + unset(CG_INCLUDES) - cmake_find_frameworks(Cg) - if(Cg_FRAMEWORKS) - foreach(dir ${Cg_FRAMEWORKS}) - set(CG_INCLUDES ${CG_INCLUDES} ${dir}/Headers ${dir}/PrivateHeaders) - endforeach(dir) - unset(Cg_FRAMEWORKS) + # Set the library dir (TODO: Check the correctness on Mac OS X) + set(CG_LIBRARY_DIR "/Library/Frameworks/Cg.framework" CACHE PATH "The path to NvidiaCg's library directory.") + endif() - # Find the include dir - find_path(CG_IPATH - NAMES "cg.h" - PATHS ${CG_INCLUDES} - DOC "The path to NvidiaCg's include directory." - ) - unset(CG_INCLUDES) + else() + # Find the include directory + find_path(CG_INCLUDE_DIR + NAMES "cg.h" + PATHS "C:/Program Files/Cg" + "C:/Program Files/NVIDIA Corporation/Cg/include" + "/usr/include" + "/usr/local/include" + "/opt/Cg" + "/opt/nvidia-cg-toolkit/include" # Gentoo + PATH_SUFFIXES "" "Cg" + DOC "The path to NvidiaCg's include directory." + ) - # Set the library dir (TODO: Check the correctness on Mac OS X) - set(CG_LPATH "/Library/Frameworks/Cg.framework" CACHE PATH "The path to NvidiaCg's library directory.") - endif() + # Find the library directory + find_library(CG_LIBRARY + NAMES "Cg" "libCg" + PATHS "C:/Program Files/Cg" + "C:/Program Files/NVIDIA Corporation/Cg" + "/usr" + "/usr/local" + "/opt/Cg" + "/opt/nvidia-cg-toolkit" # Gentoo + PATH_SUFFIXES "" "lib" "lib32" "lib64" + ) + get_filename_component(CG_LIBRARY_DIR "${CG_LIBRARY}" PATH) + set(CG_LIBRARY_DIR "${CG_LIBRARY_DIR}" CACHE PATH "The path to NvidiaCG's library directory.") # Library path + endif() - else() - # Find the include directory - find_path(CG_IPATH - NAMES "cg.h" - PATHS "C:/Program Files/Cg" - "C:/Program Files/NVIDIA Corporation/Cg/include" - "/usr/include" - "/usr/local/include" - "/opt/Cg" - "/opt/nvidia-cg-toolkit/include" # Gentoo - PATH_SUFFIXES "" "Cg" - DOC "The path to NvidiaCg's include directory." - ) - - # Find the library directory - find_library(CG_LIBRARY - NAMES "Cg" "libCg" - PATHS "C:/Program Files/Cg" - "C:/Program Files/NVIDIA Corporation/Cg" - "/usr" - "/usr/local" - "/opt/Cg" - "/opt/nvidia-cg-toolkit" # Gentoo - PATH_SUFFIXES "" "lib" "lib32" "lib64" - ) - get_filename_component(CG_LIBRARY_DIR "${CG_LIBRARY}" PATH) - set(CG_LPATH "${CG_LIBRARY_DIR}" CACHE PATH "The path to NvidiaCG's library directory.") # Library path - - unset(CG_LIBRARY_DIR) - endif() - - # Check if we have everything we need - if(CG_IPATH AND CG_LPATH) - set(FOUND_CG TRUE) - if(WIN32) - set(CG_LIBS cg.lib) - else() - set(CG_LIBS Cg) - endif() - - find_cggl() - find_cgdx8() - find_cgdx9() - find_cgdx10() - - endif() - - mark_as_advanced(CG_IPATH) - mark_as_advanced(CG_LPATH) - mark_as_advanced(CG_LIBRARY) + mark_as_advanced(CG_INCLUDE_DIR) + mark_as_advanced(CG_LIBRARY_DIR) + mark_as_advanced(CG_LIBRARY) endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Cg DEFAULT_MSG CG_LIBRARY CG_INCLUDE_DIR CG_LIBRARY_DIR) + +if(FOUND_CG) + find_cggl() + find_cgdx8() + find_cgdx9() + find_cgdx10() +endif() \ No newline at end of file diff --git a/cmake/modules/FindEigen2.cmake b/cmake/modules/FindEigen2.cmake index 703c28aa46..bbdb28b620 100644 --- a/cmake/modules/FindEigen2.cmake +++ b/cmake/modules/FindEigen2.cmake @@ -1,77 +1,28 @@ # Filename: FindEigen2.cmake -# Authors: montel@kde.org, g.gael@free.fr -# Redistribution and use is allowed according to the terms of the BSD license. +# Authors: kestred (13 Dec, 2013) # -# Module modified to mangle the names for Panda3D. +# Usage: +# find_package(Eigen2 [REQUIRED] [QUIET]) # -# This module supports requiring a minimum version, e.g. you can do -# find_package(Eigen2 2.0.3) -# to require version 2.0.3 to newer of Eigen2. -# -# Once done this will define -# -# FOUND_EIGEN - system has eigen lib with correct version -# EIGEN_IPATH - the eigen include directory -# EIGEN_VERSION - eigen version +# Once done this will define: +# EIGEN_FOUND - system has Eigen2 +# EIGEN_INCLUDE_DIR - the Eigen2 include directory # -if(NOT EIGEN_FIND_VERSION) - if(NOT EIGEN_FIND_VERSION_MAJOR) - set(EIGEN_FIND_VERSION_MAJOR 2) - endif() - if(NOT EIGEN_FIND_VERSION_MINOR) - set(EIGEN_FIND_VERSION_MINOR 0) - endif() - if(NOT EIGEN_FIND_VERSION_PATCH) - set(EIGEN_FIND_VERSION_PATCH 0) - endif() - - set(EIGEN_FIND_VERSION "${EIGEN_FIND_VERSION_MAJOR}.${EIGEN_FIND_VERSION_MINOR}.${EIGEN_FIND_VERSION_PATCH}") +if(Eigen2_FIND_QUIETLY) + set(Eigen_FIND_QUIETLY TRUE) endif() +if(NOT EIGEN_INCLUED_DIR) + find_path(EIGEN_INCLUDE_DIR + NAMES Eigen/Core + PATHS ${INCLUDE_INSTALL_DIR} + ${KDE4_INCLUDE_DIR} + PATH_SUFFIXES eigen2 + ) -macro(_eigen_check_version) - # Read version from Macros.h - file(READ "${EIGEN_IPATH}/Eigen/src/Core/util/Macros.h" _eigen_version_header) - - # Parse version from read data - string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}") - set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}") - set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}") - set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") - - # Set EIGEN_VERSION - set(EIGEN_VERSION ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) - - # Make sure Eigen Version is at least the requested version - if((${EIGEN_WORLD_VERSION} NOTEQUAL 2) OR (${EIGEN_MAJOR_VERSION} GREATER 10) OR (${EIGEN_VERSION} VERSION_LESS ${EIGEN_FIND_VERSION})) - set(EIGEN_VERSION_OK FALSE) - else() - set(EIGEN_VERSION_OK TRUE) - endif() -endmacro() - - -if(EIGEN_IPATH) - # If already in cache, just check that the version is correct - _eigen_check_version() - set(FOUND_EIGEN ${EIGEN_VERSION_OK}) -else() - # Otherwise find it manually - find_path(EIGEN_IPATH - NAMES Eigen/Core - PATHS ${INCLUDE_INSTALL_DIR} - ${KDE4_INCLUDE_DIR} - PATH_SUFFIXES eigen2 - ) - - # Checking to make sure it has the write version - if(EIGEN_IPATH) - _eigen_check_version() - set(FOUND_EIGEN ${EIGEN_VERSION_OK}) - endif() - - mark_as_advanced(EIGEN_IPATH) + mark_as_advanced(EIGEN_INCLUDE_DIR) endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Eigen DEFAULT_MSG EIGEN_INCLUDE_DIR) diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake index a965b01288..3f7b5047d7 100644 --- a/cmake/modules/FindEigen3.cmake +++ b/cmake/modules/FindEigen3.cmake @@ -1,77 +1,28 @@ # Filename: FindEigen3.cmake -# Authors: montel@kde.org, g.gael@free.fr, jacob.benoit.1@gmail.com -# Redistribution and use is allowed according to the terms of the BSD license. +# Authors: kestred (13 Dec, 2013) # -# Module modified to mangle the names for Panda3D. +# Usage: +# find_package(Eigen3 [REQUIRED] [QUIET]) # -# This module supports requiring a minimum version, e.g. you can do -# find_package(Eigen3 3.1.2) -# to require version 3.1.2 or newer of Eigen3. -# -# Once done this will define -# -# FOUND_EIGEN - system has eigen lib with correct version -# EIGEN_IPATH - the eigen include directory -# EIGEN_VERSION - eigen version +# Once done this will define: +# EIGEN_FOUND - system has Eigen3 +# EIGEN_INCLUDE_DIR - the Eigen3 include directory # -if(NOT EIGEN_FIND_VERSION) - if(NOT EIGEN_FIND_VERSION_MAJOR) - set(EIGEN_FIND_VERSION_MAJOR 2) - endif() - if(NOT EIGEN_FIND_VERSION_MINOR) - set(EIGEN_FIND_VERSION_MINOR 91) - endif() - if(NOT EIGEN_FIND_VERSION_PATCH) - set(EIGEN_FIND_VERSION_PATCH 0) - endif() - - set(EIGEN_FIND_VERSION "${EIGEN_FIND_VERSION_MAJOR}.${EIGEN_FIND_VERSION_MINOR}.${EIGEN_FIND_VERSION_PATCH}") +if(Eigen3_FIND_QUIETLY) + set(Eigen_FIND_QUIETLY TRUE) endif() +if(NOT EIGEN_INCLUDE_DIR) + find_path(EIGEN_INCLUDE_DIR + NAMES signature_of_eigen3_matrix_library + PATHS ${CMAKE_INSTALL_PREFIX}/include + ${KDE4_INCLUDE_DIR} + PATH_SUFFIXES eigen3 eigen + ) -macro(_eigen_check_version) - # Read version from Macros.h - file(READ "${EIGEN_IPATH}/Eigen/src/Core/util/Macros.h" _eigen_version_header) - - # Parse version from read data - string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}") - set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}") - set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}") - set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") - - # Set EIGEN_VERSION - set(EIGEN_VERSION ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) - - # Make sure Eigen Version is at least the requested version - if(${EIGEN_VERSION} VERSION_LESS ${EIGEN_FIND_VERSION}) - set(EIGEN_VERSION_OK FALSE) - else(${EIGEN_VERSION} VERSION_LESS ${EIGEN_FIND_VERSION}) - set(EIGEN_VERSION_OK TRUE) - endif(${EIGEN_VERSION} VERSION_LESS ${EIGEN_FIND_VERSION}) -endmacro() - - -if(EIGEN_IPATH) - # If already in cache, just check that the version is correct - _eigen_check_version() - set(FOUND_EIGEN ${EIGEN_VERSION_OK}) -else() - # Otherwise find it manually - find_path(EIGEN_IPATH - NAMES signature_of_eigen3_matrix_library - PATHS ${CMAKE_INSTALL_PREFIX}/include - ${KDE4_INCLUDE_DIR} - PATH_SUFFIXES eigen3 eigen - ) - - # Checking to make sure it has the write version - if(EIGEN_IPATH) - _eigen_check_version() - set(FOUND_EIGEN ${EIGEN_VERSION_OK}) - endif() - - mark_as_advanced(EIGEN_IPATH) + mark_as_advanced(EIGEN_INCLUDE_DIR) endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Eigen DEFAULT_MSG EIGEN_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/modules/FindFFTW.cmake b/cmake/modules/FindFFTW.cmake index d735ed79b3..1fb9d3edf0 100644 --- a/cmake/modules/FindFFTW.cmake +++ b/cmake/modules/FindFFTW.cmake @@ -4,127 +4,106 @@ # Usage: # find_package(FFTW [REQUIRED] [QUIET]) # -# It sets the following variables: -# FOUND_FFTW - true if fftw is found on the system -# FFTW_IPATH - the fftw include directory -# FFTW_LPATH - the fftw library directory -# FFTW_LIBRARY - the path to the library binary +# Once done this will define: +# FFTW_FOUND - true if fftw is found on the system +# FFTW_INCLUDE_DIR - the fftw include directory +# FFTW_LIBRARY_DIR - the fftw library directory +# FFTW_LIBRARY - the path to the library binary # # The following variables will be checked by the function -# FFTW_USE_STATIC_LIBS - if true, only static libraries are found -# FFTW_ROOT - if set, the libraries are exclusively searched under this path +# FFTW_ROOT - if set, the libraries are exclusively searched under this path # -if(FFTW_IPATH AND FFTW_LPATH) - set(FOUND_FFTW TRUE) -else() - # Check if we can use PkgConfig - find_package(PkgConfig QUIET) +if(NOT FFTW_INCLUDE_DIR AND NOT FFTW_LIBRARY_DIR) + # Check if we can use PkgConfig + find_package(PkgConfig QUIET) - #Determine from PKG - if(PKG_CONFIG_FOUND AND NOT FFTW_ROOT) - pkg_check_modules(PKG_FFTW QUIET "fftw3") - endif() + #Determine from PKG + if(PKG_CONFIG_FOUND AND NOT FFTW_ROOT) + pkg_check_modules(PKG_FFTW QUIET "fftw3") + endif() - #Check whether to search static or dynamic libs - set(CMAKE_FIND_LIBRARY_SUFFIXES_SAVED ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(FFTW_ROOT) + # Try to find headers under root + find_path(FFTW_INCLUDE_DIR + NAMES "fftw3.h" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "include" + NO_DEFAULT_PATH + ) - if(${FFTW_USE_STATIC_LIBS}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() + # Try to find library under root + find_library(FFTW_LIBRARY + NAMES "fftw3" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library(FFTW_FFTWF_LIBRARY + NAMES "fftw3f" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library(FFTW_FFTWL_LIBRARY + NAMES "fftw3l" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + else() + # Find headers the normal way + find_path(FFTW_INCLUDE_DIR + NAMES "fftw3.h" + PATHS ${PKG_FFTW_INCLUDE_DIRS} + ${INCLUDE_INSTALL_DIR} + "/usr/include" + "/usr/local/include" + PATH_SUFFIXES "" "fftw" + ) + + # Find library the normal way + find_library(FFTW_LIBRARY + NAMES "fftw3" + PATHS ${PKG_FFTW_LIBRARY_DIRS} + ${LIB_INSTALL_DIR} + "/usr" + "/usr/local" + PATH_SUFFIXES "" "lib" "lib32" "lib64" + ) + + find_library(FFTW_FFTWF_LIBRARY + NAMES "fftw3f" + PATHS ${PKG_FFTW_LIBRARY_DIRS} + ${LIB_INSTALL_DIR} + "/usr" + "/usr/local" + PATH_SUFFIXES "" "lib" "lib32" "lib64" + ) - if(FFTW_ROOT) - # Try to find headers under root - find_path(FFTW_IPATH - NAMES "fftw3.h" - PATHS ${FFTW_ROOT} - PATH_SUFFIXES "include" - NO_DEFAULT_PATH - ) + find_library(FFTW_FFTWL_LIBRARY + NAMES "fftw3l" + PATHS ${PKG_FFTW_LIBRARY_DIRS} + ${LIB_INSTALL_DIR} + "/usr" + "/usr/local" + PATH_SUFFIXES "" "lib" "lib32" "lib64" + ) + endif() - # Try to find library under root - find_library(FFTW_LIBRARY - NAMES "fftw3" - PATHS ${FFTW_ROOT} - PATH_SUFFIXES "lib" "lib64" - NO_DEFAULT_PATH - ) + # Get the directory conaining FFTW_LIBRARY + get_filename_component(FFTW_LIBRARY_DIR "${FFTW_LIBRARY}" PATH) + set(FFTW_LIBRARY_DIR "${FFTW_LIBRARY_DIR}" CACHE PATH "The path to fftw's library directory.") # Library path - find_library(FFTW_FFTWF_LIBRARY - NAMES "fftw3f" - PATHS ${FFTW_ROOT} - PATH_SUFFIXES "lib" "lib64" - NO_DEFAULT_PATH - ) - - find_library(FFTW_FFTWL_LIBRARY - NAMES "fftw3l" - PATHS ${FFTW_ROOT} - PATH_SUFFIXES "lib" "lib64" - NO_DEFAULT_PATH - ) - else() - # Find headers the normal way - find_path(FFTW_IPATH - NAMES "fftw3.h" - PATHS ${PKG_FFTW_INCLUDE_DIRS} - ${INCLUDE_INSTALL_DIR} - "/usr/include" - "/usr/local/include" - PATH_SUFFIXES "" "fftw" - ) - - # Find library the normal way - find_library(FFTW_LIBRARY - NAMES "fftw3" - PATHS ${PKG_FFTW_LIBRARY_DIRS} - ${LIB_INSTALL_DIR} - "/usr" - "/usr/local" - PATH_SUFFIXES "" "lib" "lib32" "lib64" - ) - - find_library(FFTW_FFTWF_LIBRARY - NAMES "fftw3f" - PATHS ${PKG_FFTW_LIBRARY_DIRS} - ${LIB_INSTALL_DIR} - "/usr" - "/usr/local" - PATH_SUFFIXES "" "lib" "lib32" "lib64" - ) - - - find_library(FFTW_FFTWL_LIBRARY - NAMES "fftw3l" - PATHS ${PKG_FFTW_LIBRARY_DIRS} - ${LIB_INSTALL_DIR} - "/usr" - "/usr/local" - PATH_SUFFIXES "" "lib" "lib32" "lib64" - ) - endif() - - # Cleanup after the library suffixes - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAVED}) - unset(CMAKE_FIND_LIBRARY_SUFFIXES_SAVED) - - # Get the directory conaining FFTW_LIBRARY - get_filename_component(FFTW_LIBRARY_DIR "${FFTW_LIBRARY}" PATH) - set(FFTW_LPATH "${FFTW_LIBRARY_DIR}" CACHE PATH "The path to fftw's library directory.") # Library path - - - # Check if we have everything we need - if(FFTW_IPATH AND FFTW_LPATH) - set(FOUND_FFTW TRUE) - endif() - - unset(FFTW_LIBRARY_DIR) - mark_as_advanced(FFTW_IPATH) - mark_as_advanced(FFTW_LPATH) - mark_as_advanced(FFTW_LIBRARY) - mark_as_advanced(FFTW_FFTWF_LIBRARY) - mark_as_advanced(FFTW_FFTWL_LIBRARY) + mark_as_advanced(FFTW_INCLUDE_DIR) + mark_as_advanced(FFTW_LIBRARY_DIR) + mark_as_advanced(FFTW_LIBRARY) + mark_as_advanced(FFTW_FFTWF_LIBRARY) + mark_as_advanced(FFTW_FFTWL_LIBRARY) endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FFTW DEFAULT_MSG FFTW_LIBRARY FFTW_INCLUDE_DIR FFTW_LIBRARY_DIR) \ No newline at end of file diff --git a/cmake/modules/FindMiles.cmake b/cmake/modules/FindMiles.cmake index 8ec6598c2e..dde814df8d 100644 --- a/cmake/modules/FindMiles.cmake +++ b/cmake/modules/FindMiles.cmake @@ -18,119 +18,119 @@ # if(RAD_MSS_IPATH AND RAD_MSS_LPATH) - set(FOUND_RAD_MSS TRUE) - set(RAD_MSS_LIBS Mss32) + set(FOUND_RAD_MSS TRUE) + set(RAD_MSS_LIBS Mss32) - # Choose library - if(CMAKE_BUILD_TYPE MATCHES "Release" AND RAD_MSS_RELEASE_LIBRARY) - unset(RAD_MSS_LIBRARY) - set(RAD_MSS_LIBRARY ${RAD_MSS_RELEASE_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") - elseif(CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo" AND RAD_MSS_RELWITHDEBINFO_LIBRARY) - unset(RAD_MSS_LIBRARY) - set(RAD_MSS_LIBRARY ${RAD_MSS_RELWITHDEBINFO_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") - elseif(CMAKE_BUILD_TYPE MATCHES "MinSizeRel" AND RAD_MSS_MINSIZE_LIBRARY) - unset(RAD_MSS_LIBRARY) - set(RAD_MSS_LIBRARY ${RAD_MSS_MINSIZE_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") - elseif(CMAKE_BUILD_TYPE MATCHES "Debug" AND RAD_MSS_DEBUG_LIBRARY) - unset(RAD_MSS_LIBRARY) - set(RAD_MSS_LIBRARY ${RAD_MSS_DEBUG_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") - endif() + # Choose library + if(CMAKE_BUILD_TYPE MATCHES "Release" AND RAD_MSS_RELEASE_LIBRARY) + unset(RAD_MSS_LIBRARY) + set(RAD_MSS_LIBRARY ${RAD_MSS_RELEASE_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") + elseif(CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo" AND RAD_MSS_RELWITHDEBINFO_LIBRARY) + unset(RAD_MSS_LIBRARY) + set(RAD_MSS_LIBRARY ${RAD_MSS_RELWITHDEBINFO_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") + elseif(CMAKE_BUILD_TYPE MATCHES "MinSizeRel" AND RAD_MSS_MINSIZE_LIBRARY) + unset(RAD_MSS_LIBRARY) + set(RAD_MSS_LIBRARY ${RAD_MSS_MINSIZE_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") + elseif(CMAKE_BUILD_TYPE MATCHES "Debug" AND RAD_MSS_DEBUG_LIBRARY) + unset(RAD_MSS_LIBRARY) + set(RAD_MSS_LIBRARY ${RAD_MSS_DEBUG_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") + endif() - # Set library path - if(DEFINED RAD_MSS_LIBRARY) - unset(RAD_MSS_LPATH) - get_filename_component(RAD_MSS_LIBRARY_DIR "${RAD_MSS_LIBRARY}" PATH) - set(RAD_MSS_LPATH "${RAD_MSS_LIBRARY_DIR}" CACHE PATH "The path to the Miles SDK library directory.") - unset(RAD_MSS_LIBRARY_DIR) - endif() + # Set library path + if(DEFINED RAD_MSS_LIBRARY) + unset(RAD_MSS_LPATH) + get_filename_component(RAD_MSS_LIBRARY_DIR "${RAD_MSS_LIBRARY}" PATH) + set(RAD_MSS_LPATH "${RAD_MSS_LIBRARY_DIR}" CACHE PATH "The path to the Miles SDK library directory.") + unset(RAD_MSS_LIBRARY_DIR) + endif() else() - # Find the Miles SDK include files - find_path(RAD_MSS_IPATH - NAMES "miles.h" - PATHS "/usr/include" - "/usr/local/include" - "/opt/" - "C:/Program Files" - "C:/Program Files (x86)" - PATH_SUFFIXES "" "miles" "Miles6" "miles/include" "Miles6/include" - DOC "The path to the Miles SDK include directory." - ) + # Find the Miles SDK include files + find_path(RAD_MSS_IPATH + NAMES "miles.h" + PATHS "/usr/include" + "/usr/local/include" + "/opt/" + "C:/Program Files" + "C:/Program Files (x86)" + PATH_SUFFIXES "" "miles" "Miles6" "miles/include" "Miles6/include" + DOC "The path to the Miles SDK include directory." + ) - # Find the Miles SDK libraries (.a, .so) - find_library(RAD_MSS_RELEASE_LIBRARY - NAMES "miles" - PATHS "/usr" - "/usr/local" - "/opt/miles" - "/opt/Miles6" - "C:/Program Files/miles" - "C:/Program Files (x86)/miles" - "C:/Program Files/Miles6" - "C:/Program Files (x86)/Miles6" - PATH_SUFFIXES "lib" "lib32" - ) - find_library(RAD_MSS_MINSIZE_LIBRARY - NAMES "miles_s" - PATHS "/usr" - "/usr/local" - "/opt/miles" - "C:/Program Files/miles" - "C:/Program Files (x86)/miles" - "C:/Program Files/Miles6" - "C:/Program Files (x86)/Miles6" - PATH_SUFFIXES "lib" "lib32" - ) - find_library(RAD_MSS_RELWITHDEBINFO_LIBRARY - NAMES "miles_rd" - PATHS "/usr" - "/usr/local" - "/opt/miles" - "C:/Program Files/miles" - "C:/Program Files (x86)/miles" - "C:/Program Files/Miles6" - "C:/Program Files (x86)/Miles6" - PATH_SUFFIXES "lib" "lib32" - ) - find_library(RAD_MSS_DEBUG_LIBRARY - NAMES "miles_d" - PATHS "/usr" - "/usr/local" - "/opt/miles" - "C:/Program Files/miles" - "C:/Program Files (x86)/miles" - "C:/Program Files/Miles6" - "C:/Program Files (x86)/Miles6" - PATH_SUFFIXES "lib" "lib32" - ) + # Find the Miles SDK libraries (.a, .so) + find_library(RAD_MSS_RELEASE_LIBRARY + NAMES "miles" + PATHS "/usr" + "/usr/local" + "/opt/miles" + "/opt/Miles6" + "C:/Program Files/miles" + "C:/Program Files (x86)/miles" + "C:/Program Files/Miles6" + "C:/Program Files (x86)/Miles6" + PATH_SUFFIXES "lib" "lib32" + ) + find_library(RAD_MSS_MINSIZE_LIBRARY + NAMES "miles_s" + PATHS "/usr" + "/usr/local" + "/opt/miles" + "C:/Program Files/miles" + "C:/Program Files (x86)/miles" + "C:/Program Files/Miles6" + "C:/Program Files (x86)/Miles6" + PATH_SUFFIXES "lib" "lib32" + ) + find_library(RAD_MSS_RELWITHDEBINFO_LIBRARY + NAMES "miles_rd" + PATHS "/usr" + "/usr/local" + "/opt/miles" + "C:/Program Files/miles" + "C:/Program Files (x86)/miles" + "C:/Program Files/Miles6" + "C:/Program Files (x86)/Miles6" + PATH_SUFFIXES "lib" "lib32" + ) + find_library(RAD_MSS_DEBUG_LIBRARY + NAMES "miles_d" + PATHS "/usr" + "/usr/local" + "/opt/miles" + "C:/Program Files/miles" + "C:/Program Files (x86)/miles" + "C:/Program Files/Miles6" + "C:/Program Files (x86)/Miles6" + PATH_SUFFIXES "lib" "lib32" + ) - # Choose library - if(CMAKE_BUILD_TYPE MATCHES "Release" AND RAD_MSS_RELEASE_LIBRARY) - set(RAD_MSS_LIBRARY ${RAD_MSS_RELEASE_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") - elseif(CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo" AND RAD_MSS_RELWITHDEBINFO_LIBRARY) - set(RAD_MSS_LIBRARY ${RAD_MSS_RELWITHDEBINFO_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") - elseif(CMAKE_BUILD_TYPE MATCHES "MinSizeRel" AND RAD_MSS_MINSIZE_LIBRARY) - set(RAD_MSS_LIBRARY ${RAD_MSS_MINSIZE_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") - elseif(CMAKE_BUILD_TYPE MATCHES "Debug" AND RAD_MSS_DEBUG_LIBRARY) - set(RAD_MSS_LIBRARY ${RAD_MSS_DEBUG_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") - endif() + # Choose library + if(CMAKE_BUILD_TYPE MATCHES "Release" AND RAD_MSS_RELEASE_LIBRARY) + set(RAD_MSS_LIBRARY ${RAD_MSS_RELEASE_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") + elseif(CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo" AND RAD_MSS_RELWITHDEBINFO_LIBRARY) + set(RAD_MSS_LIBRARY ${RAD_MSS_RELWITHDEBINFO_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") + elseif(CMAKE_BUILD_TYPE MATCHES "MinSizeRel" AND RAD_MSS_MINSIZE_LIBRARY) + set(RAD_MSS_LIBRARY ${RAD_MSS_MINSIZE_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") + elseif(CMAKE_BUILD_TYPE MATCHES "Debug" AND RAD_MSS_DEBUG_LIBRARY) + set(RAD_MSS_LIBRARY ${RAD_MSS_DEBUG_LIBRARY} CACHE FILEPATH "The Miles SDK library file.") + endif() - # Set library path - get_filename_component(RAD_MSS_LIBRARY_DIR "${RAD_MSS_LIBRARY}" PATH) - set(RAD_MSS_LPATH "${RAD_MSS_LIBRARY_DIR}" CACHE PATH "The path to the Miles SDK library directory.") + # Set library path + get_filename_component(RAD_MSS_LIBRARY_DIR "${RAD_MSS_LIBRARY}" PATH) + set(RAD_MSS_LPATH "${RAD_MSS_LIBRARY_DIR}" CACHE PATH "The path to the Miles SDK library directory.") - # Check if we have everything we need - if(RAD_MSS_IPATH AND RAD_MSS_LPATH) - set(FOUND_RAD_MSS TRUE) - set(RAD_MSS_LIBS Mss32) - endif() + # Check if we have everything we need + if(RAD_MSS_IPATH AND RAD_MSS_LPATH) + set(FOUND_RAD_MSS TRUE) + set(RAD_MSS_LIBS Mss32) + endif() - unset(RAD_MSS_LIBRARY_DIR) - mark_as_advanced(RAD_MSS_IPATH) - mark_as_advanced(RAD_MSS_LPATH) - mark_as_advanced(RAD_MSS_LIBRARY) - mark_as_advanced(RAD_MSS_DEBUG_LIBRARY) - mark_as_advanced(RAD_MSS_RELEASE_LIBRARY) - mark_as_advanced(RAD_MSS_RELWITHDEBINFO_LIBRARY) - mark_as_advanced(RAD_MSS_MINSIZE_LIBRARY) + unset(RAD_MSS_LIBRARY_DIR) + mark_as_advanced(RAD_MSS_IPATH) + mark_as_advanced(RAD_MSS_LPATH) + mark_as_advanced(RAD_MSS_LIBRARY) + mark_as_advanced(RAD_MSS_DEBUG_LIBRARY) + mark_as_advanced(RAD_MSS_RELEASE_LIBRARY) + mark_as_advanced(RAD_MSS_RELWITHDEBINFO_LIBRARY) + mark_as_advanced(RAD_MSS_MINSIZE_LIBRARY) endif() diff --git a/cmake/modules/MangleFreetype.cmake b/cmake/modules/MangleFreetype.cmake deleted file mode 100644 index e4e85efed6..0000000000 --- a/cmake/modules/MangleFreetype.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# Filename: MangleFREETYPE.cmake -# Author: kestred (11 Dec, 2013) -# -# MangleFREETYPE replaces the output variables of the builtin FindFREETYPE -# with vars matching Panda3D's existing config-var names. -# - -if(FREETYPE_FOUND) - set(FOUND_FREETYPE TRUE) - - list(GET FREETYPE_INCLUDE_DIRS 0 FREETYPE_INCLUDE_DIR) - - get_filename_component(FREETYPE_LIBRARY_DIR "${FREETYPE_LIBRARY}" PATH) - - set(FREETYPE_IPATH "${FREETYPE_INCLUDE_DIR}" CACHE PATH "The path to Freetype's include directory.") # Include path - set(FREETYPE_LPATH "${FREETYPE_LIBRARY_DIR}" CACHE PATH "The path to Freetype's library directory.") # Library path - mark_as_advanced(FREETYPE_IPATH) - mark_as_advanced(FREETYPE_LPATH) - - set(FREETYPE_VERSION ${FREETYPE_VERSION_STRING}) - - unset(FREETYPE_FOUND) - unset(FREETYPE_INCLUDE_DIR) - unset(FREETYPE_LIBRARY_DIR) -endif() - -unset(FREETYPE_INCLUDE_DIRS CACHE) -unset(FREETYPE_INCLUDE_DIR_ft2build CACHE) -unset(FREETYPE_INCLUDE_DIR_freetype2 CACHE) diff --git a/cmake/modules/MangleJPEG.cmake b/cmake/modules/MangleJPEG.cmake deleted file mode 100644 index 5c8b5fd321..0000000000 --- a/cmake/modules/MangleJPEG.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# Filename: MangleJPEG.cmake -# Author: kestred (28 Nov, 2013) -# -# MangleJPEG replaces the output variables of the builtin FindJPEG -# with vars matching Panda3D's existing config-var names. -# - -if(JPEG_FOUND) - set(FOUND_JPEG TRUE) - set(JPEG_LIBS jpeg) - - get_filename_component(JPEG_LIBRARY_DIR "${JPEG_LIBRARY}" PATH) - - set(JPEG_IPATH "${JPEG_INCLUDE_DIR}" CACHE PATH "The path to libjpeg's include directory.") # Include path - set(JPEG_LPATH "${JPEG_LIBRARY_DIR}" CACHE PATH "The path to libjpeg's library directory.") # Library path - mark_as_advanced(JPEG_IPATH) - mark_as_advanced(JPEG_LPATH) - - unset(JPEG_FOUND) - unset(JPEG_LIBRARY_DIR) -endif() - -unset(JPEG_INCLUDE_DIR CACHE) diff --git a/cmake/modules/MangleOpenAL.cmake b/cmake/modules/MangleOpenAL.cmake deleted file mode 100644 index 5191f94721..0000000000 --- a/cmake/modules/MangleOpenAL.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# Filename: MangleOpenAL.cmake -# Author: kestred (28 Nov, 2013) -# -# MangleOpenAL replaces the output variables of the builtin FindOpenAL -# with vars matching Panda3D's existing config-var names. -# - -if(OPENAL_FOUND) - set(FOUND_OPENAL TRUE) - if(APPLE) - set(OPENAL_FRAMEWORK OpenAL) - else() - set(OPENAL_LIBS openal) - endif() - - get_filename_component(OPENAL_LIBRARY_DIR "${OPENAL_LIBRARY}" PATH) - - set(OPENAL_IPATH "${OPENAL_INCLUDE_DIR}" CACHE PATH "The path to OpenAL's include directory.") # Include path - set(OPENAL_LPATH "${OPENAL_LIBRARY_DIR}" CACHE PATH "The path to OpenAL's library directory.") # Library path - mark_as_advanced(OPENAL_IPATH) - mark_as_advanced(OPENAL_LPATH) - - set(OPENAL_VERSION ${OPENAL_VERSION_STRING}) - - unset(OPENAL_FOUND) - unset(OPENAL_LIBRARY_DIR) -endif() - -unset(OPENAL_INCLUDE_DIR CACHE) diff --git a/cmake/modules/MangleOpenSSL.cmake b/cmake/modules/MangleOpenSSL.cmake deleted file mode 100644 index c64b0d9e65..0000000000 --- a/cmake/modules/MangleOpenSSL.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Filename: MangleOpenSSL.cmake -# Author: kestred (28 Nov, 2013) -# -# MangleOpenSSL replaces the output variables of the builtin FindOpenSSL -# with vars matching Panda3D's existing config-var names. -# - -if(OPENSSL_FOUND) - set(FOUND_OPENSSL TRUE) - set(OPENSSL_LIBS ssl crypto) - - list(GET OPENSSL_LIBRARIES 0 OPENSSL_LIBRARY) - - get_filename_component(OPENSSL_LIBRARY_DIR "${OPENSSL_LIBRARY}" PATH) - - set(OPENSSL_IPATH "${OPENSSL_INCLUDE_DIR}" CACHE PATH "The path to OpenSSL's include directory.") # Include path - set(OPENSSL_LPATH "${OPENSSL_LIBRARY_DIR}" CACHE PATH "The path to OpenSSL's library directory.") # Library path - mark_as_advanced(OPENSSL_IPATH) - mark_as_advanced(OPENSSL_LPATH) - - unset(OPENSSL_FOUND) - unset(OPENSSL_LIBRARY_DIR) -endif() - -unset(OPENSSL_INCLUDE_DIR CACHE) diff --git a/cmake/modules/ManglePNG.cmake b/cmake/modules/ManglePNG.cmake deleted file mode 100644 index d34b5d35f3..0000000000 --- a/cmake/modules/ManglePNG.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# Filename: ManglePNG.cmake -# Author: kestred (28 Nov, 2013) -# -# ManglePNG replaces the output variables of the builtin FindPNG -# with vars matching Panda3D's existing config-var names. -# - -if(PNG_FOUND) - set(FOUND_PNG TRUE) - set(PNG_LIBS png) - - get_filename_component(PNG_LIBRARY_DIR "${PNG_LIBRARY}" PATH) - - set(PNG_IPATH "${PNG_INCLUDE_DIR}" CACHE PATH "The path to libPNG's include directory.") # Include path - set(PNG_LPATH "${PNG_LIBRARY_DIR}" CACHE PATH "The path to libPNG's library directory.") # Library path - mark_as_advanced(PNG_IPATH) - mark_as_advanced(PNG_LPATH) - - set(PNG_VERSION ${PNG_VERSION_STRING}) - - unset(PNG_FOUND) - unset(PNG_DEFINITIONS) - unset(PNG_LIBRARY_DIR) - unset(PNG_VERSION_STRING) -endif() - -unset(PNG_INCLUDE_DIR CACHE) -unset(PNG_PNG_INCLUDE_DIR CACHE) diff --git a/cmake/modules/MangleTIFF.cmake b/cmake/modules/MangleTIFF.cmake deleted file mode 100644 index 8bab70092e..0000000000 --- a/cmake/modules/MangleTIFF.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Filename: MangleTIFF.cmake -# Author: kestred (29 Nov, 2013) -# -# MangleTIFF replaces the output variables of the builtin FindTIFF -# with vars matching Panda3D's existing config-var names. -# - -if(TIFF_FOUND) - set(FOUND_TIFF TRUE) - set(TIFF_LIBS tiff z) - - get_filename_component(TIFF_LIBRARY_DIR "${TIFF_LIBRARY}" PATH) - - set(TIFF_IPATH "${TIFF_INCLUDE_DIR}" CACHE PATH "The path to libTIFF's include directory.") # Include path - set(TIFF_LPATH "${TIFF_LIBRARY_DIR}" CACHE PATH "The path to libTIFF's library directory.") # Library path - mark_as_advanced(TIFF_IPATH) - mark_as_advanced(TIFF_LPATH) - - set(TIFF_VERSION ${TIFF_VERSION_STRING}) - - unset(TIFF_FOUND) - unset(TIFF_LIBRARY_DIR) -endif() - -unset(TIFF_INCLUDE_DIR CACHE) diff --git a/cmake/modules/MangleZLIB.cmake b/cmake/modules/MangleZLIB.cmake deleted file mode 100644 index f663bc1c3e..0000000000 --- a/cmake/modules/MangleZLIB.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# Filename: MangleZLIB.cmake -# Author: kestred (9 Dec, 2013) -# -# MangleZLIB replaces the output variables of the builtin FindZLIB -# with vars matching Panda3D's existing config-var names. -# - -if(ZLIB_FOUND) - set(FOUND_ZLIB TRUE) - set(ZLIB_LIBS z) - - list(GET ZLIB_INCLUDE_DIRS 0 ZLIB_INCLUDE_DIR) - list(GET ZLIB_LIBRARIES 0 ZLIB_LIBRARY) - get_filename_component(ZLIB_LIBRARY_DIR "${ZLIB_LIBRARY}" PATH) - - set(ZLIB_IPATH "${ZLIB_INCLUDE_DIR}" CACHE PATH "The path to zlibs's include directory.") # Include path - set(ZLIB_LPATH "${ZLIB_LIBRARY_DIR}" CACHE PATH "The path to zlibs's library directory.") # Library path - mark_as_advanced(ZLIB_IPATH) - mark_as_advanced(ZLIB_LPATH) - - set(ZLIB_VERSION ${ZLIB_VERSION_STRING}) - - unset(ZLIB_FOUND) - unset(ZLIB_VERSION_STRING) - unset(ZLIB_VERSION_MAJOR) - unset(ZLIB_VERSION_MINOR) - unset(ZLIB_VERSION_PATCH) - unset(ZLIB_VERSION_TWEAK) - unset(ZLIB_MAJOR_VERSION) - unset(ZLIB_MINOR_VERSION) - unset(ZLIB_OATCH_VERSION) -endif() - -unset(ZLIB_INCLUDE_DIR CACHE) -unset(ZLIB_INCLUDE_DIRS CACHE) diff --git a/dtool/Configure.cmake b/dtool/Configure.cmake index 72bb43a358..38e1b426de 100644 --- a/dtool/Configure.cmake +++ b/dtool/Configure.cmake @@ -1,6 +1,7 @@ message(STATUS "") message("Configuring support for the following optional third-party packages:") + # Settings to change USE_PACKAGE behavior (these options override cached values) set(CONFIG_ENABLE_EVERYTHING Off) set(CONFIG_DISABLE_EVERYTHING Off) @@ -9,138 +10,134 @@ set(CONFIG_DISABLE_MISSING Off) # Update USE_PACKAGE settings based on CLI arguments if(EVERYTHING) - message("Re-enabling all disabled third-party libraries.") - set(CONFIG_ENABLE_EVERYTHING On) + message("Re-enabling all disabled third-party libraries.") + set(CONFIG_ENABLE_EVERYTHING On) elseif(DISCOVERED) - message("Enabling found and disabling not-found third-party libraries.") - set(CONFIG_ENABLE_FOUND On) - set(CONFIG_DISABLE_MISSING On) + message("Enabling found and disabling not-found third-party libraries.") + set(CONFIG_ENABLE_FOUND On) + set(CONFIG_DISABLE_MISSING On) elseif(NOTHING) - message("Disabling all third-party libraries.") - set(CONFIG_DISABLE_EVERYTHING On) + message("Disabling all third-party libraries.") + set(CONFIG_DISABLE_EVERYTHING On) endif() + include(ConfigurePackage) + # Find and configure Eigen library -find_package(Eigen3) -config_package(EIGEN COMMENT "eigen") +find_package(Eigen3 QUIET) +config_package(EIGEN "Eigen") if(HAVE_EIGEN) - if(WIN32) - set(EIGEN_CFLAGS "/arch:SSE2") - else() - set(EIGEN_CFLAGS "-msse2") - endif() + if(WIN32) + set(EIGEN_CFLAGS "/arch:SSE2") + else() + set(EIGEN_CFLAGS "-msse2") + endif() - if(CONFIG_ENABLE_EVERYTHING OR CONFIG_ENABLE_FOUND) - unset(BUILD_EIGEN_VECTORIZATION) - elseif(CONFIG_DISABLE_EVERYTHING) - option(BUILD_EIGEN_VECTORIZATION "If on, vectorization is enabled in build." OFF) - endif() + if(CONFIG_ENABLE_EVERYTHING OR CONFIG_ENABLE_FOUND) + unset(BUILD_EIGEN_VECTORIZATION) + elseif(CONFIG_DISABLE_EVERYTHING) + option(BUILD_EIGEN_VECTORIZATION "If on, vectorization is enabled in build." OFF) + endif() - if(NOT DEFINED BUILD_EIGEN_VECTORIZATION) - message(STATUS "+ (vectorization enabled in build)") - endif() + if(NOT DEFINED BUILD_EIGEN_VECTORIZATION) + message(STATUS "+ (vectorization enabled in build)") + endif() - option(BUILD_EIGEN_VECTORIZATION "If on, vectorization is enabled in build." ON) + option(BUILD_EIGEN_VECTORIZATION "If on, vectorization is enabled in build." ON) - if(BUILD_EIGEN_VECTORIZATION) - set(LINMATH_ALIGN TRUE) - endif() + if(BUILD_EIGEN_VECTORIZATION) + set(LINMATH_ALIGN TRUE) + endif() else() - unset(BUILD_EIGEN_VECTORIZATION CACHE) + unset(BUILD_EIGEN_VECTORIZATION CACHE) endif() + # Find and configure OpenSSL library find_package(OpenSSL QUIET COMPONENTS ssl crypto) -mangle_package(OpenSSL) -config_package(OPENSSL COMMENT "OpenSSL") +config_package(OPENSSL "OpenSSL") if(HAVE_OPENSSL) - if(CONFIG_ENABLE_EVERYTHING OR CONFIG_ENABLE_FOUND) - unset(BUILD_OPENSSL_ERROR_REPORTS) - endif() + if(CONFIG_ENABLE_EVERYTHING OR CONFIG_ENABLE_FOUND) + unset(BUILD_OPENSSL_ERROR_REPORTS) + endif() - if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 4) - option(BUILD_OPENSSL_ERROR_REPORTS "If on, OpenSSL reports verbose error messages when they occur." ON) - else() - set(BUILD_OPENSSL_ERROR_REPORTS "If on, OpenSSL reports verbose error messages when they occur." OFF) - endif() + if(CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + option(BUILD_OPENSSL_ERROR_REPORTS "If on, OpenSSL reports verbose error messages when they occur." ON) + else() + set(BUILD_OPENSSL_ERROR_REPORTS "If on, OpenSSL reports verbose error messages when they occur." OFF) + endif() - if(BUILD_OPENSSL_ERROR_REPORTS) - set(REPORT_OPENSSL_ERRORS TRUE) - endif() + if(BUILD_OPENSSL_ERROR_REPORTS) + set(REPORT_OPENSSL_ERRORS TRUE) + endif() else() - unset(BUILD_OPENSSL_ERROR_REPORTS CACHE) + unset(BUILD_OPENSSL_ERROR_REPORTS CACHE) endif() + # Find and configure JPEG library -find_package(JPEG QUIET COMPONENTS jpeg) -mangle_package(JPEG) -config_package(JPEG COMMENT "libjpeg") +find_package(JPEG QUIET) +config_package(JPEG "libjpeg") # Find and configure PNG library -find_package(PNG QUIET COMPONENTS png) -mangle_package(PNG) -config_package(PNG COMMENT "libpng") +find_package(PNG QUIET) +config_package(PNG "libpng") # Find and configure TIFF library find_package(TIFF QUIET COMPONENTS tiff z) -mangle_package(TIFF) -config_package(TIFF COMMENT "libtiff") +config_package(TIFF "libtiff") # Find and configure Tar library -find_package(Tar) -config_package(TAR COMMENT "libtar") +find_package(Tar QUIET) +config_package(TAR "libtar") # Find and configure FFTW library -find_package(FFTW) -config_package(FFTW COMMENT "fftw") +find_package(FFTW QUIET) +config_package(FFTW "fftw") # Find and configure Squish library -find_package(Squish) -config_package(SQUISH COMMENT "squish") +find_package(Squish QUIET) +config_package(SQUISH "squish") # Find and configure Cg library -find_package(Cg) -config_package(CG COMMENT "Nvidia Cg Shading Langauge") -config_package(CGGL COMMENT "Cg OpenGL API") -config_package(CGDX8 COMMENT "Cg DX8 API") -config_package(CGDX9 COMMENT "Cg DX9 API") -config_package(CGDX10 COMMENT "Cg DX10 API") +find_package(Cg QUIET) +config_package(CG "Nvidia Cg Shading Langauge") +config_package(CGGL "Cg OpenGL API") +config_package(CGDX8 "Cg DX8 API") +config_package(CGDX9 "Cg DX9 API") +config_package(CGDX10 "Cg DX10 API") # Find and configure VRPN library -find_package(VRPN) +find_package(VRPN QUIET) config_package(VRPN) # Find and configure zlib -find_package(ZLIB QUIET COMPONENTS z) -mangle_package(ZLIB) -config_package(ZLIB COMMENT "zlib") +find_package(ZLIB QUIET) +config_package(ZLIB "zlib") # Find and configure Miles Sound System -find_package(Miles) -config_package(RAD_MSS COMMENT "Miles Sound System") +find_package(Miles QUIET) +config_package(RAD_MSS "Miles Sound System") # Find and configure FMOD Ex -find_package(FMODEx) -config_package(FMODEX COMMENT "FMOD Ex sound library") +find_package(FMODEx QUIET) +config_package(FMODEX "FMOD Ex sound library") # Find and configure OpenAL find_package(OpenAL QUIET) -mangle_package(OpenAL) -config_package(OPENAL COMMENT "OpenAL sound library") +config_package(OPENAL "OpenAL sound library") # Find and configure GTK find_package(GTK2 QUIET) -mangle_package(GTK2) -config_package(GTK COMMENT "gtk+-2") +config_package(GTK "gtk+-2") # Find and configure Freetype find_package(Freetype QUIET) -mangle_package(Freetype) -config_package(FREETYPE COMMENT "Freetype") +config_package(FREETYPE "Freetype") if(HAVE_FREETYPE AND NOT WIN32) - set(FREETYPE_CONFIG freetype-config) + set(FREETYPE_CONFIG freetype-config) endif() @@ -225,14 +222,14 @@ endif() #find_package(FCollada) #config_package(FCOLLADA COMMENT "FCollada") #if(FOUND_COLLADA14DOM OR FOUND_COLLADA15DOM) -# set(USE_COLLADA TRUE CACHE BOOL "If true, compile Panda3D with COLLADA DOM") -# if(USE_COLLADA) -# if(FOUND_COLLADA15DOM) -# set(HAVE_COLLADA15DOM TRUE) -# else() -# set(HAVE_COLLADA14DOM TRUE) -# endif() -# endif() +# set(USE_COLLADA TRUE CACHE BOOL "If true, compile Panda3D with COLLADA DOM") +# if(USE_COLLADA) +# if(FOUND_COLLADA15DOM) +# set(HAVE_COLLADA15DOM TRUE) +# else() +# set(HAVE_COLLADA14DOM TRUE) +# endif() +# endif() #endif() # Find and configure Assimp @@ -247,22 +244,22 @@ endif() #find_package(Rocket) #config_package(ROCKET COMMENT "libRocket") #if(HAVE_ROCKET AND HAVE_PYTHON) -# # Check for rocket python bindings -# if(FOUND_ROCKET_PYTHON) -# option(USE_ROCKET_PYTHON "If on, compile Panda3D with python bindings for libRocket" ON) -# if(USE_ROCKET_PYTHON) -# set(HAVE_ROCKET_PYTHON TRUE) -# endif() +# # Check for rocket python bindings +# if(FOUND_ROCKET_PYTHON) +# option(USE_ROCKET_PYTHON "If on, compile Panda3D with python bindings for libRocket" ON) +# if(USE_ROCKET_PYTHON) +# set(HAVE_ROCKET_PYTHON TRUE) +# endif() # else() # unset(USE_ROCKET_PYTHON CACHE) -# endif() -# if(HAVE_ROCKET_PYTHON) -# message(STATUS "+ libRocket with Python bindings") -# else() -# message(STATUS "+ libRocket without Python bindings") -# endif() +# endif() +# if(HAVE_ROCKET_PYTHON) +# message(STATUS "+ libRocket with Python bindings") +# else() +# message(STATUS "+ libRocket without Python bindings") +# endif() #else() -# unset(USE_ROCKET_PYTHON CACHE) +# unset(USE_ROCKET_PYTHON CACHE) #endif() # Find and configure Bullet @@ -277,17 +274,17 @@ endif() ### Configure interrogate ### message(STATUS "") # simple line break if(HAVE_PYTHON) - option(USE_INTERROGATE "If on, Panda3D will generate python interfaces" ON) - if(USE_INTERROGATE) - set(HAVE_INTERROGATE TRUE) - endif() + option(USE_INTERROGATE "If on, Panda3D will generate python interfaces" ON) + if(USE_INTERROGATE) + set(HAVE_INTERROGATE TRUE) + endif() else() - unset(USE_INTERROGATE CACHE) + unset(USE_INTERROGATE CACHE) endif() if(HAVE_INTERROGATE) - message(STATUS "Compilation will generate Python interfaces.") + message(STATUS "Compilation will generate Python interfaces.") else() - message(STATUS "Configuring Panda without Python interfaces.") + message(STATUS "Configuring Panda without Python interfaces.") endif() @@ -295,88 +292,88 @@ endif() # Add basic use flag for threading option(USE_THREADS "If on, compile Panda3D with threading support." ON) if(USE_THREADS) - set(HAVE_THREADS TRUE) + set(HAVE_THREADS TRUE) else() - unset(BUILD_SIMPLE_THREADS CACHE) - unset(BUILD_OS_SIMPLE_THREADS CACHE) + unset(BUILD_SIMPLE_THREADS CACHE) + unset(BUILD_OS_SIMPLE_THREADS CACHE) endif() # Configure debug threads if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 3) - option(BUILD_DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" ON) + option(BUILD_DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" ON) else() - option(BUILD_DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" OFF) + option(BUILD_DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" OFF) endif() if(BUILD_DEBUG_THREADS) - set(DEBUG_THREADS TRUE) + set(DEBUG_THREADS TRUE) endif() # Add advanced threading configuration if(HAVE_THREADS) - option(BUILD_SIMPLE_THREADS "If on, compile with simulated threads." OFF) - if(BUILD_SIMPLE_THREADS) - message(STATUS "Compilation will include simulated threading support.") - option(BUILD_OS_SIMPLE_THREADS "If on, OS threading constructs will be used to perform context switches." ON) + option(BUILD_SIMPLE_THREADS "If on, compile with simulated threads." OFF) + if(BUILD_SIMPLE_THREADS) + message(STATUS "Compilation will include simulated threading support.") + option(BUILD_OS_SIMPLE_THREADS "If on, OS threading constructs will be used to perform context switches." ON) - set(SIMPLE_THREADS TRUE) - if(BUILD_OS_SIMPLE_THREADS) - set(OS_SIMPLE_THREADS TRUE) - endif() - else() - unset(BUILD_OS_SIMPLE_THREADS CACHE) + set(SIMPLE_THREADS TRUE) + if(BUILD_OS_SIMPLE_THREADS) + set(OS_SIMPLE_THREADS TRUE) + endif() + else() + unset(BUILD_OS_SIMPLE_THREADS CACHE) - option(BUILD_PIPELINING "If on, compile with pipelined rendering." ON) - if(BUILD_PIPELINING) - message(STATUS "Compilation will include full, pipelined threading support.") - else() - message(STATUS "Compilation will include nonpipelined threading support.") - endif() - endif() + option(BUILD_PIPELINING "If on, compile with pipelined rendering." ON) + if(BUILD_PIPELINING) + message(STATUS "Compilation will include full, pipelined threading support.") + else() + message(STATUS "Compilation will include nonpipelined threading support.") + endif() + endif() else() - message(STATUS "Configuring Panda without threading support.") + message(STATUS "Configuring Panda without threading support.") endif() set(HAVE_POSIX_THREADS FALSE) if(NOT WIN32) - find_path(PTHREAD_IPATH - NAMES "pthread.h" - PATHS "/usr/include" - ) - if(PTHREAD_IPATH) - set(HAVE_POSIX_THREADS TRUE) - set(THREAD_LIBS pthread) - set(CMAKE_CXX_FLAGS "-pthread") - set(CMAKE_CXX_FLAGS_DEBUG "-pthread") - set(CMAKE_CXX_FLAGS_RELEASE "-pthread") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-pthread") - set(CMAKE_CXX_FLAGS_MINSIZEREL "-pthread") + find_path(PTHREAD_IPATH + NAMES "pthread.h" + PATHS "/usr/include" + ) + if(PTHREAD_IPATH) + set(HAVE_POSIX_THREADS TRUE) + set(THREAD_LIBS pthread) + set(CMAKE_CXX_FLAGS "-pthread") + set(CMAKE_CXX_FLAGS_DEBUG "-pthread") + set(CMAKE_CXX_FLAGS_RELEASE "-pthread") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-pthread") + set(CMAKE_CXX_FLAGS_MINSIZEREL "-pthread") - mark_as_advanced(PTHREAD_IPATH) - endif() + mark_as_advanced(PTHREAD_IPATH) + endif() endif() ### Configure pipelining ### if(NOT DEFINED BUILD_PIPELINING) - if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 2) - option(BUILD_PIPELINING "If on, compile with pipelined rendering." ON) - else() - option(BUILD_PIPELINING "If on, compile with pipelined rendering." OFF) - endif() + if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 2) + option(BUILD_PIPELINING "If on, compile with pipelined rendering." ON) + else() + option(BUILD_PIPELINING "If on, compile with pipelined rendering." OFF) + endif() endif() if(BUILD_PIPELINING) - set(DO_PIPELINING TRUE) + set(DO_PIPELINING TRUE) endif() ### Configure OS X options ### if(OSX_PLATFORM) - option(BUILD_UNIVERSIAL_BINARIES "If on, compiling will create universal OS X binaries." ON) - if(BUILD_UNIVERSAL_BINARIES) - message(STATUS "Compilation will create universal binaries.") - set(UNIVERSAL_BINARIES TRUE) - else() - message(STATUS "Compilation will not create universal binaries.") - endif() + option(BUILD_UNIVERSIAL_BINARIES "If on, compiling will create universal OS X binaries." ON) + if(BUILD_UNIVERSAL_BINARIES) + message(STATUS "Compilation will create universal binaries.") + set(UNIVERSAL_BINARIES TRUE) + else() + message(STATUS "Compilation will not create universal binaries.") + endif() endif() message(STATUS "") @@ -418,9 +415,9 @@ set(HAVE_STREAMSIZE ON) set(HAVE_IOS_TYPEDEFS ON) if(WIN32) - set(DEFAULT_PATHSEP ";") + set(DEFAULT_PATHSEP ";") else() - set(DEFAULT_PATHSEP ":") + set(DEFAULT_PATHSEP ":") endif() configure_file(dtool_config.h.cmake ${CMAKE_BINARY_DIR}/include/dtool_config.h)