From 6f5f6450dfcca1877d00ffc49ab6a49d5a724112 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Sun, 11 Oct 2015 00:01:03 -0700 Subject: [PATCH] Cleanup CMake files --- assignment-client/CMakeLists.txt | 4 -- cmake/macros/LinkHifiLibraries.cmake | 1 - cmake/macros/SetupHifiLibrary.cmake | 4 ++ cmake/macros/SetupHifiProject.cmake | 3 ++ cmake/macros/SetupHifiTestCase.cmake | 6 ++- cmake/macros/TargetBullet.cmake | 18 ++++++++ cmake/macros/TargetGlew.cmake | 14 ++++++ cmake/macros/TargetGlm.cmake | 12 +++++ cmake/macros/TargetNsight.cmake | 20 +++++++++ cmake/macros/TargetOglplus.cmake | 21 +++++++++ ...tupHifiOpenGL.cmake => TargetOpenGL.cmake} | 32 ++++--------- gvr-interface/CMakeLists.txt | 4 -- interface/CMakeLists.txt | 24 +++------- libraries/animation/CMakeLists.txt | 3 -- libraries/audio-client/CMakeLists.txt | 5 --- libraries/audio/CMakeLists.txt | 7 --- libraries/auto-updater/CMakeLists.txt | 1 - libraries/avatars/CMakeLists.txt | 7 --- libraries/display-plugins/CMakeLists.txt | 21 ++------- libraries/embedded-webserver/CMakeLists.txt | 2 - libraries/entities-renderer/CMakeLists.txt | 21 +-------- libraries/entities/CMakeLists.txt | 23 ++-------- libraries/environment/CMakeLists.txt | 7 --- libraries/fbx/CMakeLists.txt | 7 --- libraries/gpu/CMakeLists.txt | 45 +------------------ libraries/input-plugins/CMakeLists.txt | 27 +++++------ libraries/model-networking/CMakeLists.txt | 7 --- libraries/model/CMakeLists.txt | 9 +--- libraries/networking/CMakeLists.txt | 3 -- libraries/octree/CMakeLists.txt | 7 --- libraries/physics/CMakeLists.txt | 23 +--------- libraries/plugins/CMakeLists.txt | 8 ---- libraries/procedural/CMakeLists.txt | 9 +--- libraries/render-utils/CMakeLists.txt | 42 ++--------------- libraries/render/CMakeLists.txt | 21 +-------- libraries/script-engine/CMakeLists.txt | 7 --- libraries/shared/CMakeLists.txt | 6 +-- libraries/ui/CMakeLists.txt | 8 ---- tests/gpu-test/CMakeLists.txt | 8 ---- tests/physics/CMakeLists.txt | 17 +------ 40 files changed, 141 insertions(+), 373 deletions(-) create mode 100644 cmake/macros/TargetBullet.cmake create mode 100644 cmake/macros/TargetGlew.cmake create mode 100644 cmake/macros/TargetGlm.cmake create mode 100644 cmake/macros/TargetNsight.cmake create mode 100644 cmake/macros/TargetOglplus.cmake rename cmake/macros/{SetupHifiOpenGL.cmake => TargetOpenGL.cmake} (58%) diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 84a36c6c51..e543b3aa21 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -2,10 +2,6 @@ set(TARGET_NAME assignment-client) setup_hifi_project(Core Gui Network Script Widgets WebSockets) -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) - # link in the shared libraries link_hifi_libraries( audio avatars octree environment gpu model fbx entities diff --git a/cmake/macros/LinkHifiLibraries.cmake b/cmake/macros/LinkHifiLibraries.cmake index d0a12f3bea..70399bedb4 100644 --- a/cmake/macros/LinkHifiLibraries.cmake +++ b/cmake/macros/LinkHifiLibraries.cmake @@ -16,7 +16,6 @@ macro(LINK_HIFI_LIBRARIES) foreach(HIFI_LIBRARY ${LIBRARIES_TO_LINK}) if (NOT TARGET ${HIFI_LIBRARY}) add_subdirectory("${RELATIVE_LIBRARY_DIR_PATH}/${HIFI_LIBRARY}" "${RELATIVE_LIBRARY_DIR_PATH}/${HIFI_LIBRARY}") - set_target_properties(${HIFI_LIBRARY} PROPERTIES FOLDER "Libraries") endif () include_directories("${HIFI_LIBRARY_DIR}/${HIFI_LIBRARY}/src") diff --git a/cmake/macros/SetupHifiLibrary.cmake b/cmake/macros/SetupHifiLibrary.cmake index ccb5ca2484..9c6cbf6831 100644 --- a/cmake/macros/SetupHifiLibrary.cmake +++ b/cmake/macros/SetupHifiLibrary.cmake @@ -36,5 +36,9 @@ macro(SETUP_HIFI_LIBRARY) # Don't make scribed shaders cumulative set(AUTOSCRIBE_SHADER_LIB_SRC "") + + target_glm() + + set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Libraries") endmacro(SETUP_HIFI_LIBRARY) \ No newline at end of file diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index bd6cbef9dc..166a3fd4b9 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -34,4 +34,7 @@ macro(SETUP_HIFI_PROJECT) foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES}) target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE}) endforeach() + + target_glm() + endmacro() diff --git a/cmake/macros/SetupHifiTestCase.cmake b/cmake/macros/SetupHifiTestCase.cmake index 2507a30f5e..38239d6e97 100644 --- a/cmake/macros/SetupHifiTestCase.cmake +++ b/cmake/macros/SetupHifiTestCase.cmake @@ -94,6 +94,7 @@ macro(SETUP_HIFI_TESTCASE) EXCLUDE_FROM_DEFAULT_BUILD TRUE EXCLUDE_FROM_ALL TRUE) + list (APPEND ${TEST_PROJ_NAME}_TARGETS ${TARGET_NAME}) #list (APPEND ALL_TEST_TARGETS ${TARGET_NAME}) @@ -111,8 +112,9 @@ macro(SETUP_HIFI_TESTCASE) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "hidden/test-executables") # handle testcase-specific dependencies (this a macro that should be defined in the cmakelists.txt file in each tests subdir) - - SETUP_TESTCASE_DEPENDENCIES () + SETUP_TESTCASE_DEPENDENCIES() + target_glm() + endforeach () set(TEST_TARGET ${TEST_PROJ_NAME}-tests) diff --git a/cmake/macros/TargetBullet.cmake b/cmake/macros/TargetBullet.cmake new file mode 100644 index 0000000000..600ae9e63b --- /dev/null +++ b/cmake/macros/TargetBullet.cmake @@ -0,0 +1,18 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_BULLET) + add_dependency_external_projects(bullet) + find_package(Bullet REQUIRED) + # perform the system include hack for OS X to ignore warnings + if (APPLE) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}") + else() + target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) + endif() + target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) +endmacro() \ No newline at end of file diff --git a/cmake/macros/TargetGlew.cmake b/cmake/macros/TargetGlew.cmake new file mode 100644 index 0000000000..5f71f021ec --- /dev/null +++ b/cmake/macros/TargetGlew.cmake @@ -0,0 +1,14 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_GLEW) + add_dependency_external_projects(glew) + find_package(GLEW REQUIRED) + add_definitions(-DGLEW_STATIC) + target_include_directories(${TARGET_NAME} PUBLIC ${GLEW_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARY}) +endmacro() \ No newline at end of file diff --git a/cmake/macros/TargetGlm.cmake b/cmake/macros/TargetGlm.cmake new file mode 100644 index 0000000000..324cb1c17a --- /dev/null +++ b/cmake/macros/TargetGlm.cmake @@ -0,0 +1,12 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_GLM) + add_dependency_external_projects(glm) + find_package(GLM REQUIRED) + target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) +endmacro() \ No newline at end of file diff --git a/cmake/macros/TargetNsight.cmake b/cmake/macros/TargetNsight.cmake new file mode 100644 index 0000000000..4b7e87e9d3 --- /dev/null +++ b/cmake/macros/TargetNsight.cmake @@ -0,0 +1,20 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_NSIGHT) + if (WIN32) + if (USE_NSIGHT) + # try to find the Nsight package and add it to the build if we find it + find_package(NSIGHT) + if (NSIGHT_FOUND) + include_directories(${NSIGHT_INCLUDE_DIRS}) + add_definitions(-DNSIGHT_FOUND) + target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}") + endif () + endif() + endif (WIN32) +endmacro() \ No newline at end of file diff --git a/cmake/macros/TargetOglplus.cmake b/cmake/macros/TargetOglplus.cmake new file mode 100644 index 0000000000..16a50f3dd7 --- /dev/null +++ b/cmake/macros/TargetOglplus.cmake @@ -0,0 +1,21 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_OGLPLUS) + # our OGL plus setup requires glew + target_glew() + + # our OGL plus setup requires boostconfig + add_dependency_external_projects(boostconfig) + find_package(BoostConfig REQUIRED) + target_include_directories(${TARGET_NAME} PUBLIC ${BOOSTCONFIG_INCLUDE_DIRS}) + + + add_dependency_external_projects(oglplus) + find_package(OGLPLUS REQUIRED) + target_include_directories(${TARGET_NAME} PUBLIC ${OGLPLUS_INCLUDE_DIRS}) +endmacro() \ No newline at end of file diff --git a/cmake/macros/SetupHifiOpenGL.cmake b/cmake/macros/TargetOpenGL.cmake similarity index 58% rename from cmake/macros/SetupHifiOpenGL.cmake rename to cmake/macros/TargetOpenGL.cmake index 2b1858fd4b..7b3178d579 100644 --- a/cmake/macros/SetupHifiOpenGL.cmake +++ b/cmake/macros/TargetOpenGL.cmake @@ -1,38 +1,24 @@ - - -macro(SETUP_HIFI_OPENGL) - +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_OPENGL) if (APPLE) - # link in required OS X frameworks and include the right GL headers find_library(OpenGL OpenGL) target_link_libraries(${TARGET_NAME} ${OpenGL}) - - elseif (WIN32) - - if (USE_NSIGHT) - # try to find the Nsight package and add it to the build if we find it - find_package(NSIGHT) - if (NSIGHT_FOUND) - include_directories(${NSIGHT_INCLUDE_DIRS}) - add_definitions(-DNSIGHT_FOUND) - target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}") - endif() - endif() - elseif(ANDROID) - target_link_libraries(${TARGET_NAME} "-lGLESv3" "-lEGL") - else() - + target_nsight() find_package(OpenGL REQUIRED) if (${OPENGL_INCLUDE_DIR}) include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}") endif() target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}") target_include_directories(${TARGET_NAME} PUBLIC ${OPENGL_INCLUDE_DIR}) - endif() - endmacro() diff --git a/gvr-interface/CMakeLists.txt b/gvr-interface/CMakeLists.txt index 2c1e87c8b4..175706a3ff 100644 --- a/gvr-interface/CMakeLists.txt +++ b/gvr-interface/CMakeLists.txt @@ -24,10 +24,6 @@ endif () include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) - link_hifi_libraries(shared networking audio-client avatars) if (ANDROID) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 63d1445496..00f6d2ecea 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -1,8 +1,6 @@ set(TARGET_NAME interface) project(${TARGET_NAME}) -add_definitions(-DGLEW_STATIC) - # set a default root dir for each of our optional externals if it was not passed set(OPTIONAL_EXTERNALS "Faceshift" "LeapMotion" "RtMidi" "RSSDK" "3DConnexionClient" "iViewHMD") foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) @@ -97,29 +95,17 @@ else() add_executable(${TARGET_NAME} ${INTERFACE_SRCS} ${QM}) endif() -add_dependency_external_projects(glm bullet) - -# set up the external glm library -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) - -find_package(Bullet REQUIRED) - -# perform the system include hack for OS X to ignore warnings -if (APPLE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}") -else() - target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) -endif() - -target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) - # link required hifi libraries link_hifi_libraries(shared octree environment gpu procedural model render fbx networking model-networking entities avatars audio audio-client animation script-engine physics render-utils entities-renderer ui auto-updater plugins display-plugins input-plugins) +target_bullet() +target_glew() +target_opengl() + + add_dependency_external_projects(sdl2) # perform standard include and linking for found externals diff --git a/libraries/animation/CMakeLists.txt b/libraries/animation/CMakeLists.txt index 115a2e360c..3cf7bfa295 100644 --- a/libraries/animation/CMakeLists.txt +++ b/libraries/animation/CMakeLists.txt @@ -1,6 +1,3 @@ set(TARGET_NAME animation) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network Script) - link_hifi_libraries(shared gpu model fbx) diff --git a/libraries/audio-client/CMakeLists.txt b/libraries/audio-client/CMakeLists.txt index f631ec6387..90937edc5d 100644 --- a/libraries/audio-client/CMakeLists.txt +++ b/libraries/audio-client/CMakeLists.txt @@ -1,8 +1,5 @@ set(TARGET_NAME audio-client) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network Multimedia) - link_hifi_libraries(audio) # append audio includes to our list of includes to bubble @@ -10,9 +7,7 @@ target_include_directories(${TARGET_NAME} PUBLIC "${HIFI_LIBRARY_DIR}/audio/src" # have CMake grab externals for us add_dependency_external_projects(gverb) - find_package(Gverb REQUIRED) - target_link_libraries(${TARGET_NAME} ${GVERB_LIBRARIES}) target_include_directories(${TARGET_NAME} PRIVATE ${GVERB_INCLUDE_DIRS}) diff --git a/libraries/audio/CMakeLists.txt b/libraries/audio/CMakeLists.txt index 5134ccda36..c49c9547a5 100644 --- a/libraries/audio/CMakeLists.txt +++ b/libraries/audio/CMakeLists.txt @@ -1,10 +1,3 @@ set(TARGET_NAME audio) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network) - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - link_hifi_libraries(networking shared) diff --git a/libraries/auto-updater/CMakeLists.txt b/libraries/auto-updater/CMakeLists.txt index c3d6e74a6f..b3665af2cb 100644 --- a/libraries/auto-updater/CMakeLists.txt +++ b/libraries/auto-updater/CMakeLists.txt @@ -1,4 +1,3 @@ set(TARGET_NAME auto-updater) - setup_hifi_library(Network) link_hifi_libraries(shared networking) diff --git a/libraries/avatars/CMakeLists.txt b/libraries/avatars/CMakeLists.txt index acc939b25c..849828bbf6 100644 --- a/libraries/avatars/CMakeLists.txt +++ b/libraries/avatars/CMakeLists.txt @@ -1,10 +1,3 @@ set(TARGET_NAME avatars) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network Script) - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - link_hifi_libraries(audio shared networking) diff --git a/libraries/display-plugins/CMakeLists.txt b/libraries/display-plugins/CMakeLists.txt index b602327f4c..504370796a 100644 --- a/libraries/display-plugins/CMakeLists.txt +++ b/libraries/display-plugins/CMakeLists.txt @@ -1,27 +1,12 @@ set(TARGET_NAME display-plugins) - -add_definitions(-DGLEW_STATIC) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(OpenGL) - -setup_hifi_opengl() - link_hifi_libraries(shared plugins gpu render-utils) +target_opengl() + GroupSources("src/display-plugins") -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -add_dependency_external_projects(boostconfig) -find_package(BoostConfig REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${BOOSTCONFIG_INCLUDE_DIRS}) - -add_dependency_external_projects(oglplus) -find_package(OGLPLUS REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${OGLPLUS_INCLUDE_DIRS}) +target_oglplus() add_dependency_external_projects(LibOVR) find_package(LibOVR REQUIRED) diff --git a/libraries/embedded-webserver/CMakeLists.txt b/libraries/embedded-webserver/CMakeLists.txt index 45d9827d42..b23be3a7a2 100644 --- a/libraries/embedded-webserver/CMakeLists.txt +++ b/libraries/embedded-webserver/CMakeLists.txt @@ -1,4 +1,2 @@ set(TARGET_NAME embedded-webserver) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network) diff --git a/libraries/entities-renderer/CMakeLists.txt b/libraries/entities-renderer/CMakeLists.txt index d092f188e1..bb90c04c95 100644 --- a/libraries/entities-renderer/CMakeLists.txt +++ b/libraries/entities-renderer/CMakeLists.txt @@ -1,29 +1,12 @@ set(TARGET_NAME entities-renderer) - AUTOSCRIBE_SHADER_LIB(gpu model render render-utils) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Widgets Network Script) +link_hifi_libraries(shared gpu procedural model model-networking script-engine render render-utils) -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -add_dependency_external_projects(bullet) -find_package(Bullet REQUIRED) - -# perform the system include hack for OS X to ignore warnings -if (APPLE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}") -else() - target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) -endif() - -target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) +target_bullet() add_dependency_external_projects(polyvox) find_package(PolyVox REQUIRED) target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${POLYVOX_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${POLYVOX_LIBRARIES}) -link_hifi_libraries(shared gpu procedural model model-networking script-engine render render-utils) diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index f7936ff125..f6b2e0e280 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -1,24 +1,7 @@ set(TARGET_NAME entities) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network Script) - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -add_dependency_external_projects(bullet) - -find_package(Bullet REQUIRED) - -# perform the system include hack for OS X to ignore warnings -if (APPLE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}") -else() - target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) -endif() - -target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) - link_hifi_libraries(avatars shared octree gpu model fbx networking animation environment) + +target_bullet() + include_hifi_library_headers(render) diff --git a/libraries/environment/CMakeLists.txt b/libraries/environment/CMakeLists.txt index e3fc143c14..11538a8f2b 100644 --- a/libraries/environment/CMakeLists.txt +++ b/libraries/environment/CMakeLists.txt @@ -1,10 +1,3 @@ set(TARGET_NAME environment) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - -add_dependency_external_projects(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 9d9f57ad20..e10b6bcfd5 100644 --- a/libraries/fbx/CMakeLists.txt +++ b/libraries/fbx/CMakeLists.txt @@ -1,10 +1,3 @@ set(TARGET_NAME fbx) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - -add_dependency_external_projects(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/gpu/CMakeLists.txt b/libraries/gpu/CMakeLists.txt index 38fe5cb22f..63da1d8f8a 100644 --- a/libraries/gpu/CMakeLists.txt +++ b/libraries/gpu/CMakeLists.txt @@ -1,48 +1,7 @@ set(TARGET_NAME gpu) - AUTOSCRIBE_SHADER_LIB(gpu) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - link_hifi_libraries(shared) -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -add_dependency_external_projects(glew) -find_package(GLEW REQUIRED) -add_definitions(-DGLEW_STATIC) -target_include_directories(${TARGET_NAME} PUBLIC ${GLEW_INCLUDE_DIRS}) -target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARY}) - -if (APPLE) - # link in required OS X frameworks and include the right GL headers - find_library(OpenGL OpenGL) - target_link_libraries(${TARGET_NAME} ${OpenGL}) -elseif (WIN32) - target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARY} opengl32.lib) - - if (USE_NSIGHT) - # try to find the Nsight package and add it to the build if we find it - # note that this will also enable NSIGHT profilers in all the projects linking gpu - find_package(NSIGHT) - if (NSIGHT_FOUND) - target_include_directories(${TARGET_NAME} PUBLIC ${NSIGHT_INCLUDE_DIRS}) - target_compile_definitions(${TARGET_NAME} PUBLIC NSIGHT_FOUND) - target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}") - endif () - endif() -elseif (ANDROID) - target_link_libraries(${TARGET_NAME} "-lGLESv3" "-lEGL") -else () - - find_package(OpenGL REQUIRED) - - if (${OPENGL_INCLUDE_DIR}) - include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}") - endif () - - target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}") -endif (APPLE) +target_glew() +target_opengl() \ No newline at end of file diff --git a/libraries/input-plugins/CMakeLists.txt b/libraries/input-plugins/CMakeLists.txt index 1ac8047edc..094a697012 100644 --- a/libraries/input-plugins/CMakeLists.txt +++ b/libraries/input-plugins/CMakeLists.txt @@ -1,26 +1,9 @@ set(TARGET_NAME input-plugins) - -# set a default root dir for each of our optional externals if it was not passed -set(OPTIONAL_EXTERNALS "SDL2" "Sixense") -foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) - string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE) - if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR) - string(TOLOWER ${EXTERNAL} ${EXTERNAL}_LOWERCASE) - set(${${EXTERNAL}_UPPERCASE}_ROOT_DIR "${CMAKE_SOURCE_DIR}/interface/external/${${EXTERNAL}_LOWERCASE}") - endif () -endforeach() - setup_hifi_library() - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules link_hifi_libraries(shared plugins gpu render-utils) GroupSources("src/input-plugins") -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - if (WIN32) add_dependency_external_projects(OpenVR) find_package(OpenVR REQUIRED) @@ -33,6 +16,16 @@ endif() #target_include_directories(${TARGET_NAME} PRIVATE ${SIXENSE_INCLUDE_DIRS}) #target_link_libraries(${TARGET_NAME} ${SIXENSE_LIBRARIES}) +# set a default root dir for each of our optional externals if it was not passed +set(OPTIONAL_EXTERNALS "SDL2" "Sixense") +foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) + string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE) + if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR) + string(TOLOWER ${EXTERNAL} ${EXTERNAL}_LOWERCASE) + set(${${EXTERNAL}_UPPERCASE}_ROOT_DIR "${CMAKE_SOURCE_DIR}/interface/external/${${EXTERNAL}_LOWERCASE}") + endif () +endforeach() + # perform standard include and linking for found externals foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) diff --git a/libraries/model-networking/CMakeLists.txt b/libraries/model-networking/CMakeLists.txt index f014885794..29ab17f2ec 100644 --- a/libraries/model-networking/CMakeLists.txt +++ b/libraries/model-networking/CMakeLists.txt @@ -1,11 +1,4 @@ set(TARGET_NAME model-networking) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - link_hifi_libraries(shared networking gpu model fbx) diff --git a/libraries/model/CMakeLists.txt b/libraries/model/CMakeLists.txt index c30ffb7238..63f632e484 100755 --- a/libraries/model/CMakeLists.txt +++ b/libraries/model/CMakeLists.txt @@ -1,12 +1,5 @@ set(TARGET_NAME model) - AUTOSCRIBE_SHADER_LIB(gpu model) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - link_hifi_libraries(shared gpu) + diff --git a/libraries/networking/CMakeLists.txt b/libraries/networking/CMakeLists.txt index 274dae7420..470c9145df 100644 --- a/libraries/networking/CMakeLists.txt +++ b/libraries/networking/CMakeLists.txt @@ -1,8 +1,5 @@ set(TARGET_NAME networking) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network) - link_hifi_libraries(shared) if (WIN32) diff --git a/libraries/octree/CMakeLists.txt b/libraries/octree/CMakeLists.txt index cc36aead15..bea036add3 100644 --- a/libraries/octree/CMakeLists.txt +++ b/libraries/octree/CMakeLists.txt @@ -1,10 +1,3 @@ set(TARGET_NAME octree) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - -add_dependency_external_projects(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 b1f9fbb79c..b734c9ac2e 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -1,24 +1,5 @@ set(TARGET_NAME physics) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -add_dependency_external_projects(bullet) - -find_package(Bullet REQUIRED) - -# perform the system include hack for OS X to ignore warnings -if (APPLE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}") -else() - target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) -endif() - -target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) - link_hifi_libraries(shared fbx entities) -include_hifi_library_headers(fbx) + +target_bullet() diff --git a/libraries/plugins/CMakeLists.txt b/libraries/plugins/CMakeLists.txt index 42b8cb1625..f32650df94 100644 --- a/libraries/plugins/CMakeLists.txt +++ b/libraries/plugins/CMakeLists.txt @@ -1,11 +1,3 @@ set(TARGET_NAME plugins) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(OpenGL) - link_hifi_libraries(shared) - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) - -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/procedural/CMakeLists.txt b/libraries/procedural/CMakeLists.txt index 9595ef5f7a..0483b8d3a8 100644 --- a/libraries/procedural/CMakeLists.txt +++ b/libraries/procedural/CMakeLists.txt @@ -1,12 +1,5 @@ set(TARGET_NAME procedural) - AUTOSCRIBE_SHADER_LIB(gpu model) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - link_hifi_libraries(shared gpu model model-networking) + diff --git a/libraries/render-utils/CMakeLists.txt b/libraries/render-utils/CMakeLists.txt index fa6cc6fe77..c74089a238 100644 --- a/libraries/render-utils/CMakeLists.txt +++ b/libraries/render-utils/CMakeLists.txt @@ -1,45 +1,9 @@ set(TARGET_NAME render-utils) - AUTOSCRIBE_SHADER_LIB(gpu model render) - # pull in the resources.qrc file qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts.qrc") - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Widgets OpenGL Network Qml Quick Script) - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -add_dependency_external_projects(boostconfig) -find_package(BoostConfig REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${BOOSTCONFIG_INCLUDE_DIRS}) - -add_dependency_external_projects(oglplus) -find_package(OGLPLUS REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${OGLPLUS_INCLUDE_DIRS}) - -add_definitions(-DGLEW_STATIC) - -if (WIN32) - if (USE_NSIGHT) - # try to find the Nsight package and add it to the build if we find it - find_package(NSIGHT) - if (NSIGHT_FOUND) - include_directories(${NSIGHT_INCLUDE_DIRS}) - add_definitions(-DNSIGHT_FOUND) - target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}") - endif () - endif() -endif (WIN32) - -add_dependency_external_projects(boostconfig) -find_package(BoostConfig REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${BOOSTCONFIG_INCLUDE_DIRS}) - -add_dependency_external_projects(oglplus) -find_package(OGLPLUS REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${OGLPLUS_INCLUDE_DIRS}) - link_hifi_libraries(shared gpu procedural model model-networking render environment animation fbx) + +target_nsight() +target_oglplus() diff --git a/libraries/render/CMakeLists.txt b/libraries/render/CMakeLists.txt index f2bcb7c47c..76fc8303ce 100644 --- a/libraries/render/CMakeLists.txt +++ b/libraries/render/CMakeLists.txt @@ -1,24 +1,7 @@ set(TARGET_NAME render) - AUTOSCRIBE_SHADER_LIB(gpu model) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - link_hifi_libraries(shared gpu model) -if (WIN32) - if (USE_NSIGHT) - # try to find the Nsight package and add it to the build if we find it - find_package(NSIGHT) - if (NSIGHT_FOUND) - include_directories(${NSIGHT_INCLUDE_DIRS}) - add_definitions(-DNSIGHT_FOUND) - target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}") - endif () - endif() -endif (WIN32) + +target_nsight() diff --git a/libraries/script-engine/CMakeLists.txt b/libraries/script-engine/CMakeLists.txt index a458d4de51..cfe0afd220 100644 --- a/libraries/script-engine/CMakeLists.txt +++ b/libraries/script-engine/CMakeLists.txt @@ -1,10 +1,3 @@ set(TARGET_NAME script-engine) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Gui Network Script WebSockets Widgets) - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - link_hifi_libraries(shared networking octree gpu procedural model model-networking fbx entities animation audio physics) diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index 00a80619bc..d9df5eba7f 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -1,15 +1,11 @@ set(TARGET_NAME shared) -# use setup_hifi_library macro to setup our project and link appropriate Qt modules # TODO: there isn't really a good reason to have Script linked here - let's get what is requiring it out (RegisteredMetaTypes.cpp) setup_hifi_library(Gui Network Script Widgets) find_package(ZLIB REQUIRED) target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}) +target_include_directories(${TARGET_NAME} PUBLIC ${ZLIB_INCLUDE_DIRS}) if (WIN32) # Birarda will fix this when he finds it. diff --git a/libraries/ui/CMakeLists.txt b/libraries/ui/CMakeLists.txt index b07651f7d4..d4cd1fc2bb 100644 --- a/libraries/ui/CMakeLists.txt +++ b/libraries/ui/CMakeLists.txt @@ -1,11 +1,3 @@ set(TARGET_NAME ui) - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(OpenGL Network Qml Quick Script XmlPatterns) - link_hifi_libraries(render-utils shared) - -add_dependency_external_projects(glm) -find_package(GLM REQUIRED) - -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/tests/gpu-test/CMakeLists.txt b/tests/gpu-test/CMakeLists.txt index 1cb9e9f78e..0c183fc2f0 100644 --- a/tests/gpu-test/CMakeLists.txt +++ b/tests/gpu-test/CMakeLists.txt @@ -1,15 +1,7 @@ - set(TARGET_NAME gpu-test) - AUTOSCRIBE_SHADER_LIB(gpu model render-utils) - # This is not a testcase -- just set it up as a regular hifi project setup_hifi_project(Quick Gui OpenGL Script Widgets) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") - -#include_oglplus() - -# link in the shared libraries link_hifi_libraries(networking gpu procedural shared fbx model model-networking animation script-engine render-utils ) - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt index 36cf21c681..f789a7b2ba 100644 --- a/tests/physics/CMakeLists.txt +++ b/tests/physics/CMakeLists.txt @@ -1,22 +1,7 @@ # Declare dependencies macro (SETUP_TESTCASE_DEPENDENCIES) - add_dependency_external_projects(glm) - find_package(GLM REQUIRED) - target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - - add_dependency_external_projects(bullet) - - find_package(Bullet REQUIRED) - target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) - - # perform the system include hack for OS X to ignore warnings - if (APPLE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}") - else() - target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) - endif() - + target_bullet() link_hifi_libraries(shared physics) copy_dlls_beside_windows_executable() endmacro ()