From 11f0d149f7d98e6ccdab27f1f49ef600a2e5c079 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Sat, 31 Jan 2015 19:41:04 -0800 Subject: [PATCH] Adding cmake support for finding and using oglplus / boostconfig --- cmake/macros/IncludeOGLPLUS.cmake | 27 +++++++++++++++++++++++++++ cmake/modules/FindBoostConfig.cmake | 26 ++++++++++++++++++++++++++ cmake/modules/FindOGLPLUS.cmake | 26 ++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 cmake/macros/IncludeOGLPLUS.cmake create mode 100644 cmake/modules/FindBoostConfig.cmake create mode 100644 cmake/modules/FindOGLPLUS.cmake diff --git a/cmake/macros/IncludeOGLPLUS.cmake b/cmake/macros/IncludeOGLPLUS.cmake new file mode 100644 index 0000000000..088f97fb6c --- /dev/null +++ b/cmake/macros/IncludeOGLPLUS.cmake @@ -0,0 +1,27 @@ +# +# IncludeOGLPLUS.cmake +# +# Copyright 2013 High Fidelity, Inc. +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +macro(INCLUDE_OGLPLUS) + find_package(OGLPLUS REQUIRED) + find_package(BOOSTCONFIG REQUIRED) + include_directories("${OGLPLUS_INCLUDE_DIRS}") + include_directories("${BOOSTCONFIG_INCLUDE_DIRS}") + + if (APPLE OR UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${OGLPLUS_INCLUDE_DIRS}") + endif () + + # force oglplus to work in header only mode, use GLEW for GL definitions + # and use boostconfig to determine compiler feature support. + add_definitions(-DOGLPLUS_NO_SITE_CONFIG=1) + add_definitions(-DOGLPLUS_USE_GLEW=1) + add_definitions(-DOGLPLUS_USE_GLCOREARB=0) + add_definitions(-DOGLPLUS_USE_BOOST_CONFIG=1) + +endmacro(INCLUDE_OGLPLUS) \ No newline at end of file diff --git a/cmake/modules/FindBoostConfig.cmake b/cmake/modules/FindBoostConfig.cmake new file mode 100644 index 0000000000..1568201bf7 --- /dev/null +++ b/cmake/modules/FindBoostConfig.cmake @@ -0,0 +1,26 @@ +# +# FindBOOSTCONFIG.cmake +# +# Try to find BOOSTCONFIG include path. +# Once done this will define +# +# BOOSTCONFIG_INCLUDE_DIRS +# +# Created on 1/30/2015 by Brad Davis +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +# setup hints for BOOSTCONFIG search +include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") +hifi_library_search_hints("boostconfig") + +# locate header +find_path(BOOSTCONFIG_INCLUDE_DIR "boost/config.hpp" PATH_SUFFIXES include HINTS ${BOOSTCONFIG_SEARCH_DIRS}) +set(BOOSTCONFIG_INCLUDE_DIRS "${BOOSTCONFIG_INCLUDE_DIR}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BOOSTCONFIG DEFAULT_MSG BOOSTCONFIG_INCLUDE_DIRS) + +mark_as_advanced(BOOSTCONFIG_INCLUDE_DIRS BOOSTCONFIG_SEARCH_DIRS) \ No newline at end of file diff --git a/cmake/modules/FindOGLPLUS.cmake b/cmake/modules/FindOGLPLUS.cmake new file mode 100644 index 0000000000..72bcb1f2cf --- /dev/null +++ b/cmake/modules/FindOGLPLUS.cmake @@ -0,0 +1,26 @@ +# +# FindOGLPLUS.cmake +# +# Try to find OGLPLUS include path. +# Once done this will define +# +# OGLPLUS_INCLUDE_DIRS +# +# Created on 1/30/2015 by Brad Davis +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +# setup hints for OGLPLUS search +include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") +hifi_library_search_hints("oglplus") + +# locate header +find_path(OGLPLUS_INCLUDE_DIR "oglplus/all.hpp" PATH_SUFFIXES include HINTS ${OGLPLUS_SEARCH_DIRS}) +set(OGLPLUS_INCLUDE_DIRS "${OGLPLUS_INCLUDE_DIR}/include") +list(APPEND OGLPLUS_INCLUDE_DIRS "${OGLPLUS_INCLUDE_DIR}/implement") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OGLPLUS DEFAULT_MSG OGLPLUS_INCLUDE_DIRS) +mark_as_advanced(OGLPLUS_INCLUDE_DIRS OGLPLUS_SEARCH_DIRS) \ No newline at end of file