From 8c998a65eee153ed4ed38765579a1df295ed3ed9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 13 Feb 2015 12:50:32 -0800 Subject: [PATCH] use the glm find_package and check externals --- assignment-client/CMakeLists.txt | 1 + cmake/externals/glm/CMakeLists.txt | 1 + cmake/macros/HifiLibrarySearchHints.cmake | 11 +++++---- cmake/modules/FindGLM.cmake | 28 ++++++++++++++++++++++ interface/CMakeLists.txt | 1 + libraries/audio/CMakeLists.txt | 1 + libraries/avatars/CMakeLists.txt | 1 + libraries/entities-renderer/CMakeLists.txt | 1 + libraries/entities/CMakeLists.txt | 1 + libraries/environment/CMakeLists.txt | 1 + libraries/fbx/CMakeLists.txt | 1 + libraries/metavoxels/CMakeLists.txt | 1 + libraries/model/CMakeLists.txt | 1 + libraries/octree/CMakeLists.txt | 1 + libraries/physics/CMakeLists.txt | 1 + libraries/render-utils/CMakeLists.txt | 1 + libraries/script-engine/CMakeLists.txt | 1 + tests/physics/CMakeLists.txt | 1 + 18 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 cmake/modules/FindGLM.cmake diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index d8d2d44090..b16314811b 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -3,6 +3,7 @@ set(TARGET_NAME assignment-client) setup_hifi_project(Core Gui Network Script Widgets) add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) # link in the shared libraries diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index 6246993df5..a3b64b9370 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -1,6 +1,7 @@ include(ExternalProject) ExternalProject_Add( glm + PREFIX glm URL https://github.com/g-truc/glm/archive/0.9.5.4.zip CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON diff --git a/cmake/macros/HifiLibrarySearchHints.cmake b/cmake/macros/HifiLibrarySearchHints.cmake index e22b442beb..e4b67af15e 100644 --- a/cmake/macros/HifiLibrarySearchHints.cmake +++ b/cmake/macros/HifiLibrarySearchHints.cmake @@ -10,22 +10,23 @@ macro(HIFI_LIBRARY_SEARCH_HINTS LIBRARY_FOLDER) string(TOUPPER ${LIBRARY_FOLDER} LIBRARY_PREFIX) - set(${LIBRARY_PREFIX}_SEARCH_DIRS "") + + set(${LIBRARY_PREFIX}_SEARCH_DIRS "${EXTERNAL_PROJECT_DIR}/${LIBRARY_FOLDER}/build/${LIBRARY_FOLDER}") if (${LIBRARY_PREFIX}_ROOT_DIR) - set(${LIBRARY_PREFIX}_SEARCH_DIRS "${${LIBRARY_PREFIX}_ROOT_DIR}") + list(APPEND ${LIBRARY_PREFIX}_SEARCH_DIRS "${${LIBRARY_PREFIX}_ROOT_DIR}") endif () if (ANDROID) - set(${LIBRARY_PREFIX}_SEARCH_DIRS "${${LIBRARY_PREFIX}_SEARCH_DIRS}" "/${LIBRARY_FOLDER}") + list(APPEND ${LIBRARY_PREFIX}_SEARCH_DIRS "/${LIBRARY_FOLDER}") endif () if (DEFINED ENV{${LIBRARY_PREFIX}_ROOT_DIR}) - set(${LIBRARY_PREFIX}_SEARCH_DIRS "${${LIBRARY_PREFIX}_SEARCH_DIRS}" "$ENV{${LIBRARY_PREFIX}_ROOT_DIR}") + list(APPEND ${LIBRARY_PREFIX}_SEARCH_DIRS "$ENV{${LIBRARY_PREFIX}_ROOT_DIR}") endif () if (DEFINED ENV{HIFI_LIB_DIR}) - set(${LIBRARY_PREFIX}_SEARCH_DIRS "${${LIBRARY_PREFIX}_SEARCH_DIRS}" "$ENV{HIFI_LIB_DIR}/${LIBRARY_FOLDER}") + list(APPEND ${LIBRARY_PREFIX}_SEARCH_DIRS "$ENV{HIFI_LIB_DIR}/${LIBRARY_FOLDER}") endif () endmacro(HIFI_LIBRARY_SEARCH_HINTS _library_folder) \ No newline at end of file diff --git a/cmake/modules/FindGLM.cmake b/cmake/modules/FindGLM.cmake new file mode 100644 index 0000000000..a75730b238 --- /dev/null +++ b/cmake/modules/FindGLM.cmake @@ -0,0 +1,28 @@ +# +# FindGLM.cmake +# +# Try to find GLM include path. +# Once done this will define +# +# GLM_INCLUDE_DIRS +# +# Created on 7/17/2014 by Stephen Birarda +# Copyright 2014 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 +# + +# setup hints for GLM search +include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") +hifi_library_search_hints("glm") + +# locate header +find_path(GLM_INCLUDE_DIR "glm/glm.hpp" HINTS ${GLM_SEARCH_DIRS}) + +set(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIRS) + +mark_as_advanced(GLM_INCLUDE_DIRS GLM_SEARCH_DIRS) \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 2be9f7bee2..7d581284e5 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -109,6 +109,7 @@ add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM}) # set up the external glm library add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) # link required hifi libraries diff --git a/libraries/audio/CMakeLists.txt b/libraries/audio/CMakeLists.txt index c44198ddef..6ec35e00fc 100644 --- a/libraries/audio/CMakeLists.txt +++ b/libraries/audio/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME audio) setup_hifi_library(Network) add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(networking shared) diff --git a/libraries/avatars/CMakeLists.txt b/libraries/avatars/CMakeLists.txt index c227e057e3..bb4b8fdde0 100644 --- a/libraries/avatars/CMakeLists.txt +++ b/libraries/avatars/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME avatars) setup_hifi_library(Network Script) add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(audio shared networking) diff --git a/libraries/entities-renderer/CMakeLists.txt b/libraries/entities-renderer/CMakeLists.txt index 46d6b8a462..e706b07538 100644 --- a/libraries/entities-renderer/CMakeLists.txt +++ b/libraries/entities-renderer/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME entities-renderer) setup_hifi_library(Widgets OpenGL Network Script) add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared gpu script-engine render-utils) diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index 8846dbfb89..d0c39cac84 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME entities) setup_hifi_library(Network Script) add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) include_bullet() diff --git a/libraries/environment/CMakeLists.txt b/libraries/environment/CMakeLists.txt index 7cd91823d3..e5e7b80701 100644 --- a/libraries/environment/CMakeLists.txt +++ b/libraries/environment/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME environment) setup_hifi_library() add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared networking) diff --git a/libraries/fbx/CMakeLists.txt b/libraries/fbx/CMakeLists.txt index 7e28f63fc9..da6d471c72 100644 --- a/libraries/fbx/CMakeLists.txt +++ b/libraries/fbx/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME fbx) setup_hifi_library() add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared gpu model networking octree) diff --git a/libraries/metavoxels/CMakeLists.txt b/libraries/metavoxels/CMakeLists.txt index 6143bce2dc..593ee800a7 100644 --- a/libraries/metavoxels/CMakeLists.txt +++ b/libraries/metavoxels/CMakeLists.txt @@ -9,6 +9,7 @@ setup_hifi_library(Network Script Widgets) link_hifi_libraries(shared networking) add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) # call macro to include our dependency includes and bubble them up via a property on our target diff --git a/libraries/model/CMakeLists.txt b/libraries/model/CMakeLists.txt index 6d729ea58c..0f71a25047 100755 --- a/libraries/model/CMakeLists.txt +++ b/libraries/model/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME model) setup_hifi_library() add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared gpu) diff --git a/libraries/octree/CMakeLists.txt b/libraries/octree/CMakeLists.txt index c55f3bae89..3c7e8e7749 100644 --- a/libraries/octree/CMakeLists.txt +++ b/libraries/octree/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME octree) setup_hifi_library() add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared networking) diff --git a/libraries/physics/CMakeLists.txt b/libraries/physics/CMakeLists.txt index 8b48501458..7fc3f82496 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME physics) setup_hifi_library() add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) include_bullet() diff --git a/libraries/render-utils/CMakeLists.txt b/libraries/render-utils/CMakeLists.txt index 0bf7e91951..054b30d7fb 100644 --- a/libraries/render-utils/CMakeLists.txt +++ b/libraries/render-utils/CMakeLists.txt @@ -9,6 +9,7 @@ qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts setup_hifi_library(Widgets OpenGL Network Script) add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(animation fbx shared gpu) diff --git a/libraries/script-engine/CMakeLists.txt b/libraries/script-engine/CMakeLists.txt index 2c325e4daf..4e13ddf513 100644 --- a/libraries/script-engine/CMakeLists.txt +++ b/libraries/script-engine/CMakeLists.txt @@ -4,6 +4,7 @@ set(TARGET_NAME script-engine) setup_hifi_library(Gui Network Script Widgets) add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared octree gpu model fbx entities animation audio physics metavoxels) diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt index 89fba47bea..e20f323392 100644 --- a/tests/physics/CMakeLists.txt +++ b/tests/physics/CMakeLists.txt @@ -3,6 +3,7 @@ set(TARGET_NAME physics-tests) setup_hifi_project() add_dependency_external_project(glm) +find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) include_bullet()