From b3e46d1ed8ac6c66f9d6cf376fb57e625a6ce6ba Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 4 Jan 2016 10:26:37 -0800 Subject: [PATCH] some macro renaming and cleanup --- CMakeLists.txt | 2 +- assignment-client/CMakeLists.txt | 7 ++- .../ConsolidateInstallerComponents.cmake | 26 ++++++++++ cmake/macros/ConsolidateStackComponents.cmake | 28 ---------- ...ion.cmake => SetPackagingParameters.cmake} | 23 ++++---- cmake/macros/SetupHifiProject.cmake | 23 ++++---- domain-server/CMakeLists.txt | 3 +- interface/CMakeLists.txt | 52 +++++++++---------- libraries/networking/CMakeLists.txt | 1 - 9 files changed, 82 insertions(+), 83 deletions(-) create mode 100644 cmake/macros/ConsolidateInstallerComponents.cmake delete mode 100644 cmake/macros/ConsolidateStackComponents.cmake rename cmake/macros/{IncludeApplicationVersion.cmake => SetPackagingParameters.cmake} (71%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cee3357a0..67fc64ae3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,5 +232,5 @@ if (HIFI_MEMORY_DEBUGGING) endif (UNIX) endif () -include_application_version() +set_packaging_parameters() generate_installers() diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 3064e97d70..a473a7427c 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -3,12 +3,11 @@ set(TARGET_NAME assignment-client) setup_hifi_project(Core Gui Network Script Quick Widgets WebSockets) # link in the shared libraries -link_hifi_libraries( - audio avatars octree environment gpu model fbx entities +link_hifi_libraries( + audio avatars octree environment gpu model fbx entities networking animation recording shared script-engine embedded-webserver controllers physics ) -include_application_version() package_libraries_for_deployment() -consolidate_stack_components() \ No newline at end of file +consolidate_installer_components() diff --git a/cmake/macros/ConsolidateInstallerComponents.cmake b/cmake/macros/ConsolidateInstallerComponents.cmake new file mode 100644 index 0000000000..395227b061 --- /dev/null +++ b/cmake/macros/ConsolidateInstallerComponents.cmake @@ -0,0 +1,26 @@ +macro(CONSOLIDATE_INSTALLER_COMPONENTS) + + if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE AND WIN32) + # Copy icon files for interface and stack manager + if (TARGET_NAME STREQUAL "interface" OR TARGET_NAME STREQUAL "package-console") + if (TARGET_NAME STREQUAL "interface") + set (ICON_FILE_PATH "${PROJECT_SOURCE_DIR}/icon/${INTERFACE_ICON}") + set (ICON_DESTINATION_NAME "interface.ico") + else () + set (ICON_FILE_PATH "${PROJECT_SOURCE_DIR}/assets/${STACK_MANAGER_ICON}") + set (ICON_DESTINATION_NAME "stack-manager.ico") + endif () + add_custom_command( + TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy ${ICON_FILE_PATH} ${CMAKE_BINARY_DIR}/package-bundle/${ICON_DESTINATION_NAME} + COMMAND "${CMAKE_COMMAND}" -E copy_directory $ ${CMAKE_BINARY_DIR}/package-bundle + ) + else () + add_custom_command( + TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory $ ${CMAKE_BINARY_DIR}/package-bundle + ) + endif () + endif () + +endmacro() diff --git a/cmake/macros/ConsolidateStackComponents.cmake b/cmake/macros/ConsolidateStackComponents.cmake deleted file mode 100644 index 2fc20f9506..0000000000 --- a/cmake/macros/ConsolidateStackComponents.cmake +++ /dev/null @@ -1,28 +0,0 @@ -macro(CONSOLIDATE_STACK_COMPONENTS) - - if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE) - if (WIN32) - # Copy icon files for interface and stack manager - if (TARGET_NAME STREQUAL "interface" OR TARGET_NAME STREQUAL "stack-manager") - if (TARGET_NAME STREQUAL "interface") - set (ICON_FILE_PATH "${PROJECT_SOURCE_DIR}/icon/${INTERFACE_ICON}") - set (ICON_DESTINATION_NAME "interface.ico") - else () - set (ICON_FILE_PATH "${PROJECT_SOURCE_DIR}/assets/${STACK_MANAGER_ICON}") - set (ICON_DESTINATION_NAME "stack-manager.ico") - endif () - add_custom_command( - TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy ${ICON_FILE_PATH} ${CMAKE_BINARY_DIR}/package-bundle/${ICON_DESTINATION_NAME} - COMMAND "${CMAKE_COMMAND}" -E copy_directory $ ${CMAKE_BINARY_DIR}/package-bundle - ) - else () - add_custom_command( - TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_directory $ ${CMAKE_BINARY_DIR}/package-bundle - ) - endif () - endif () - endif () - -endmacro() \ No newline at end of file diff --git a/cmake/macros/IncludeApplicationVersion.cmake b/cmake/macros/SetPackagingParameters.cmake similarity index 71% rename from cmake/macros/IncludeApplicationVersion.cmake rename to cmake/macros/SetPackagingParameters.cmake index a91f30f6cf..17408e0868 100644 --- a/cmake/macros/IncludeApplicationVersion.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -1,5 +1,5 @@ -# -# IncludeApplicationVersion.cmake +# +# SetPackagingParameters.cmake # cmake/macros # # Created by Leonardo Murillo on 07/14/2015. @@ -7,12 +7,12 @@ # # 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_APPLICATION_VERSION) - # - # We are relying on Jenkins defined environment variables to determine the origin of this build - # and will only package if this is a PR or Release build +# This macro checks some Jenkins defined environment variables to determine the origin of this build +# and decides how targets should be packaged. + +macro(SET_PACKAGING_PARAMETERS) + if (DEFINED ENV{JOB_ID}) set(DEPLOY_PACKAGE 1) set(BUILD_SEQ $ENV{JOB_ID}) @@ -37,6 +37,9 @@ macro(INCLUDE_APPLICATION_VERSION) set(INTERFACE_ICON "interface-beta.ico") set(STACK_MANAGER_ICON "icon-beta.ico") endif () - configure_file("${MACRO_DIR}/ApplicationVersion.h.in" "${PROJECT_BINARY_DIR}/includes/ApplicationVersion.h") - include_directories("${PROJECT_BINARY_DIR}/includes") -endmacro(INCLUDE_APPLICATION_VERSION) + + # create a header file our targets can use to find out the application version + file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/includes") + configure_file("${MACRO_DIR}/ApplicationVersion.h.in" "${CMAKE_BINARY_DIR}/includes/ApplicationVersion.h") + +endmacro(SET_PACKAGING_PARAMETERS) diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 77df280d1a..d06eb3dcfb 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -1,27 +1,30 @@ -# +# # SetupHifiProject.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(SETUP_HIFI_PROJECT) project(${TARGET_NAME}) - + # grab the implemenation and header files file(GLOB TARGET_SRCS src/*) - + file(GLOB SRC_SUBDIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/*) - + + # inlcude the generated application version header + include_directories("${CMAKE_BINARY_DIR}/includes") + foreach(DIR ${SRC_SUBDIRS}) if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/${DIR}") file(GLOB DIR_CONTENTS "src/${DIR}/*") set(TARGET_SRCS ${TARGET_SRCS} "${DIR_CONTENTS}") endif () endforeach() - + if (DEFINED BUILD_BUNDLE AND BUILD_BUNDLE AND APPLE) add_executable(${TARGET_NAME} MACOSX_BUNDLE ${TARGET_SRCS} ${AUTOMTC_SRC} ${AUTOSCRIBE_SHADER_LIB_SRC}) else () @@ -30,7 +33,7 @@ macro(SETUP_HIFI_PROJECT) set(${TARGET_NAME}_DEPENDENCY_QT_MODULES ${ARGN}) list(APPEND ${TARGET_NAME}_DEPENDENCY_QT_MODULES Core) - + # find these Qt modules and link them to our own target find_package(Qt5 COMPONENTS ${${TARGET_NAME}_DEPENDENCY_QT_MODULES} REQUIRED) @@ -44,7 +47,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/domain-server/CMakeLists.txt b/domain-server/CMakeLists.txt index 2200916765..6bcda2de4a 100644 --- a/domain-server/CMakeLists.txt +++ b/domain-server/CMakeLists.txt @@ -36,6 +36,5 @@ if (UNIX) target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS}) endif (UNIX) -include_application_version() package_libraries_for_deployment() -consolidate_stack_components() \ No newline at end of file +consolidate_installer_components() diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 638f27f367..28ff7397ff 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -20,12 +20,10 @@ find_package(Qt5LinguistTools REQUIRED) find_package(Qt5LinguistToolsMacros) if (WIN32) - add_definitions(-D_USE_MATH_DEFINES) # apparently needed to get M_PI and other defines from cmath/math.h - add_definitions(-DWINDOWS_LEAN_AND_MEAN) # needed to make sure windows doesn't go to crazy with its defines + add_definitions(-D_USE_MATH_DEFINES) # apparently needed to get M_PI and other defines from cmath/math.h + add_definitions(-DWINDOWS_LEAN_AND_MEAN) # needed to make sure windows doesn't go to crazy with its defines endif() -include_application_version() - # grab the implementation and header files from src dirs file(GLOB_RECURSE INTERFACE_SRCS "src/*.cpp" "src/*.h") GroupSources("src") @@ -45,8 +43,8 @@ else () list(REMOVE_ITEM INTERFACE_SRCS ${SPEECHRECOGNIZER_CPP}) endif () -find_package(Qt5 COMPONENTS - Gui Multimedia Network OpenGL Qml Quick Script Svg +find_package(Qt5 COMPONENTS + Gui Multimedia Network OpenGL Qml Quick Script Svg WebChannel WebEngine WebEngineWidgets WebKitWidgets WebSockets) # grab the ui files in resources/ui @@ -69,19 +67,19 @@ if (APPLE) set(MACOSX_BUNDLE_BUNDLE_NAME Interface) set(MACOSX_BUNDLE_GUI_IDENTIFIER io.highfidelity.Interface) - + if (UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE OR UPPER_CMAKE_BUILD_TYPE MATCHES RELWITHDEBINFO) set(ICON_FILENAME "interface.icns") else () set(ICON_FILENAME "interface-beta.icns") endif () - + # set how the icon shows up in the Info.plist file SET(MACOSX_BUNDLE_ICON_FILE "${ICON_FILENAME}") # set where in the bundle to put the resources file SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/icon/${ICON_FILENAME} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - + set(DISCOVERED_RESOURCES "") # use the add_resources_to_os_x_bundle macro to recurse into resources @@ -89,7 +87,7 @@ if (APPLE) # append the discovered resources to our list of interface sources list(APPEND INTERFACE_SRCS ${DISCOVERED_RESOURCES}) - + set(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/icon/${ICON_FILENAME}") endif() @@ -102,7 +100,7 @@ else() add_executable(${TARGET_NAME} ${INTERFACE_SRCS} ${QM}) endif() -# These are external plugins, but we need to do the 'add dependency' here so that their +# These are external plugins, but we need to do the 'add dependency' here so that their # binary directories get added to the fixup path add_dependency_external_projects(sixense) add_dependency_external_projects(sdl2) @@ -121,9 +119,9 @@ if (WIN32) endif() # link required hifi libraries -link_hifi_libraries(shared octree environment gpu gl procedural model render - recording fbx networking model-networking entities avatars - audio audio-client animation script-engine physics +link_hifi_libraries(shared octree environment gpu gl procedural model render + recording fbx networking model-networking entities avatars + audio audio-client animation script-engine physics render-utils entities-renderer ui auto-updater controllers plugins display-plugins input-plugins ) @@ -138,34 +136,34 @@ endif() # perform standard include and linking for found externals foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) - + if (${${EXTERNAL}_UPPERCASE}_REQUIRED) find_package(${EXTERNAL} REQUIRED) else () find_package(${EXTERNAL}) endif () - + if (${${EXTERNAL}_UPPERCASE}_FOUND AND NOT DISABLE_${${EXTERNAL}_UPPERCASE}) add_definitions(-DHAVE_${${EXTERNAL}_UPPERCASE}) - + # include the library directories (ignoring warnings) if (NOT ${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS) set(${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIR}) endif () - + include_directories(SYSTEM ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS}) - + # perform the system include hack for OS X to ignore warnings if (APPLE) foreach(EXTERNAL_INCLUDE_DIR ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${EXTERNAL_INCLUDE_DIR}") endforeach() endif () - + if (NOT ${${EXTERNAL}_UPPERCASE}_LIBRARIES) set(${${EXTERNAL}_UPPERCASE}_LIBRARIES ${${${EXTERNAL}_UPPERCASE}_LIBRARY}) endif () - + if (NOT APPLE OR NOT ${${EXTERNAL}_UPPERCASE} MATCHES "SIXENSE") target_link_libraries(${TARGET_NAME} ${${${EXTERNAL}_UPPERCASE}_LIBRARIES}) elseif (APPLE AND NOT INSTALLER_BUILD) @@ -179,13 +177,13 @@ include_directories("${PROJECT_SOURCE_DIR}/src") target_link_libraries( ${TARGET_NAME} - Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL - Qt5::Qml Qt5::Quick Qt5::Script Qt5::Svg + Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL + Qt5::Qml Qt5::Quick Qt5::Script Qt5::Svg Qt5::WebChannel Qt5::WebEngine Qt5::WebEngineWidgets Qt5::WebKitWidgets ) -# Issue causes build failure unless we add this directory. -# See https://bugreports.qt.io/browse/QTBUG-43351 +# Issue causes build failure unless we add this directory. +# See https://bugreports.qt.io/browse/QTBUG-43351 if (WIN32) add_paths_to_fixup_libs(${Qt5_DIR}/../../../plugins/qtwebengine) endif() @@ -199,7 +197,7 @@ if (APPLE) find_library(AppKit AppKit) target_link_libraries(${TARGET_NAME} ${OpenGL} ${AppKit}) - + # install command for OS X bundle INSTALL(TARGETS ${TARGET_NAME} BUNDLE DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/install" COMPONENT Runtime @@ -229,4 +227,4 @@ if (WIN32) endif() package_libraries_for_deployment() -consolidate_stack_components() +consolidate_installer_components() diff --git a/libraries/networking/CMakeLists.txt b/libraries/networking/CMakeLists.txt index 470c9145df..812e92fedf 100644 --- a/libraries/networking/CMakeLists.txt +++ b/libraries/networking/CMakeLists.txt @@ -31,4 +31,3 @@ endif (UNIX) # append tbb includes to our list of includes to bubble target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS}) -include_application_version()