some macro renaming and cleanup

This commit is contained in:
Stephen Birarda 2016-01-04 10:26:37 -08:00
parent 9520bd7ba7
commit b3e46d1ed8
9 changed files with 82 additions and 83 deletions

View file

@ -232,5 +232,5 @@ if (HIFI_MEMORY_DEBUGGING)
endif (UNIX) endif (UNIX)
endif () endif ()
include_application_version() set_packaging_parameters()
generate_installers() generate_installers()

View file

@ -3,12 +3,11 @@ set(TARGET_NAME assignment-client)
setup_hifi_project(Core Gui Network Script Quick Widgets WebSockets) setup_hifi_project(Core Gui Network Script Quick Widgets WebSockets)
# link in the shared libraries # link in the shared libraries
link_hifi_libraries( link_hifi_libraries(
audio avatars octree environment gpu model fbx entities audio avatars octree environment gpu model fbx entities
networking animation recording shared script-engine embedded-webserver networking animation recording shared script-engine embedded-webserver
controllers physics controllers physics
) )
include_application_version()
package_libraries_for_deployment() package_libraries_for_deployment()
consolidate_stack_components() consolidate_installer_components()

View file

@ -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 $<TARGET_FILE_DIR:${TARGET_NAME}> ${CMAKE_BINARY_DIR}/package-bundle
)
else ()
add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory $<TARGET_FILE_DIR:${TARGET_NAME}> ${CMAKE_BINARY_DIR}/package-bundle
)
endif ()
endif ()
endmacro()

View file

@ -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 $<TARGET_FILE_DIR:${TARGET_NAME}> ${CMAKE_BINARY_DIR}/package-bundle
)
else ()
add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory $<TARGET_FILE_DIR:${TARGET_NAME}> ${CMAKE_BINARY_DIR}/package-bundle
)
endif ()
endif ()
endif ()
endmacro()

View file

@ -1,5 +1,5 @@
# #
# IncludeApplicationVersion.cmake # SetPackagingParameters.cmake
# cmake/macros # cmake/macros
# #
# Created by Leonardo Murillo on 07/14/2015. # Created by Leonardo Murillo on 07/14/2015.
@ -7,12 +7,12 @@
# #
# Distributed under the Apache License, Version 2.0. # Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(INCLUDE_APPLICATION_VERSION) # This macro checks some Jenkins defined environment variables to determine the origin of this build
# # and decides how targets should be packaged.
# 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 macro(SET_PACKAGING_PARAMETERS)
if (DEFINED ENV{JOB_ID}) if (DEFINED ENV{JOB_ID})
set(DEPLOY_PACKAGE 1) set(DEPLOY_PACKAGE 1)
set(BUILD_SEQ $ENV{JOB_ID}) set(BUILD_SEQ $ENV{JOB_ID})
@ -37,6 +37,9 @@ macro(INCLUDE_APPLICATION_VERSION)
set(INTERFACE_ICON "interface-beta.ico") set(INTERFACE_ICON "interface-beta.ico")
set(STACK_MANAGER_ICON "icon-beta.ico") set(STACK_MANAGER_ICON "icon-beta.ico")
endif () endif ()
configure_file("${MACRO_DIR}/ApplicationVersion.h.in" "${PROJECT_BINARY_DIR}/includes/ApplicationVersion.h")
include_directories("${PROJECT_BINARY_DIR}/includes") # create a header file our targets can use to find out the application version
endmacro(INCLUDE_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)

View file

@ -1,27 +1,30 @@
# #
# SetupHifiProject.cmake # SetupHifiProject.cmake
# #
# Copyright 2013 High Fidelity, Inc. # Copyright 2013 High Fidelity, Inc.
# #
# Distributed under the Apache License, Version 2.0. # Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
# #
macro(SETUP_HIFI_PROJECT) macro(SETUP_HIFI_PROJECT)
project(${TARGET_NAME}) project(${TARGET_NAME})
# grab the implemenation and header files # grab the implemenation and header files
file(GLOB TARGET_SRCS src/*) file(GLOB TARGET_SRCS src/*)
file(GLOB SRC_SUBDIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/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}) foreach(DIR ${SRC_SUBDIRS})
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/${DIR}") if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/${DIR}")
file(GLOB DIR_CONTENTS "src/${DIR}/*") file(GLOB DIR_CONTENTS "src/${DIR}/*")
set(TARGET_SRCS ${TARGET_SRCS} "${DIR_CONTENTS}") set(TARGET_SRCS ${TARGET_SRCS} "${DIR_CONTENTS}")
endif () endif ()
endforeach() endforeach()
if (DEFINED BUILD_BUNDLE AND BUILD_BUNDLE AND APPLE) if (DEFINED BUILD_BUNDLE AND BUILD_BUNDLE AND APPLE)
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${TARGET_SRCS} ${AUTOMTC_SRC} ${AUTOSCRIBE_SHADER_LIB_SRC}) add_executable(${TARGET_NAME} MACOSX_BUNDLE ${TARGET_SRCS} ${AUTOMTC_SRC} ${AUTOSCRIBE_SHADER_LIB_SRC})
else () else ()
@ -30,7 +33,7 @@ macro(SETUP_HIFI_PROJECT)
set(${TARGET_NAME}_DEPENDENCY_QT_MODULES ${ARGN}) set(${TARGET_NAME}_DEPENDENCY_QT_MODULES ${ARGN})
list(APPEND ${TARGET_NAME}_DEPENDENCY_QT_MODULES Core) list(APPEND ${TARGET_NAME}_DEPENDENCY_QT_MODULES Core)
# find these Qt modules and link them to our own target # find these Qt modules and link them to our own target
find_package(Qt5 COMPONENTS ${${TARGET_NAME}_DEPENDENCY_QT_MODULES} REQUIRED) 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}) foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES})
target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE}) target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE})
endforeach() endforeach()
target_glm() target_glm()
endmacro() endmacro()

View file

@ -36,6 +36,5 @@ if (UNIX)
target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS}) target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS})
endif (UNIX) endif (UNIX)
include_application_version()
package_libraries_for_deployment() package_libraries_for_deployment()
consolidate_stack_components() consolidate_installer_components()

View file

@ -20,12 +20,10 @@ find_package(Qt5LinguistTools REQUIRED)
find_package(Qt5LinguistToolsMacros) find_package(Qt5LinguistToolsMacros)
if (WIN32) if (WIN32)
add_definitions(-D_USE_MATH_DEFINES) # apparently needed to get M_PI and other defines from cmath/math.h 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(-DWINDOWS_LEAN_AND_MEAN) # needed to make sure windows doesn't go to crazy with its defines
endif() endif()
include_application_version()
# grab the implementation and header files from src dirs # grab the implementation and header files from src dirs
file(GLOB_RECURSE INTERFACE_SRCS "src/*.cpp" "src/*.h") file(GLOB_RECURSE INTERFACE_SRCS "src/*.cpp" "src/*.h")
GroupSources("src") GroupSources("src")
@ -45,8 +43,8 @@ else ()
list(REMOVE_ITEM INTERFACE_SRCS ${SPEECHRECOGNIZER_CPP}) list(REMOVE_ITEM INTERFACE_SRCS ${SPEECHRECOGNIZER_CPP})
endif () endif ()
find_package(Qt5 COMPONENTS find_package(Qt5 COMPONENTS
Gui Multimedia Network OpenGL Qml Quick Script Svg Gui Multimedia Network OpenGL Qml Quick Script Svg
WebChannel WebEngine WebEngineWidgets WebKitWidgets WebSockets) WebChannel WebEngine WebEngineWidgets WebKitWidgets WebSockets)
# grab the ui files in resources/ui # grab the ui files in resources/ui
@ -69,19 +67,19 @@ if (APPLE)
set(MACOSX_BUNDLE_BUNDLE_NAME Interface) set(MACOSX_BUNDLE_BUNDLE_NAME Interface)
set(MACOSX_BUNDLE_GUI_IDENTIFIER io.highfidelity.Interface) set(MACOSX_BUNDLE_GUI_IDENTIFIER io.highfidelity.Interface)
if (UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE OR UPPER_CMAKE_BUILD_TYPE MATCHES RELWITHDEBINFO) if (UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE OR UPPER_CMAKE_BUILD_TYPE MATCHES RELWITHDEBINFO)
set(ICON_FILENAME "interface.icns") set(ICON_FILENAME "interface.icns")
else () else ()
set(ICON_FILENAME "interface-beta.icns") set(ICON_FILENAME "interface-beta.icns")
endif () endif ()
# set how the icon shows up in the Info.plist file # set how the icon shows up in the Info.plist file
SET(MACOSX_BUNDLE_ICON_FILE "${ICON_FILENAME}") SET(MACOSX_BUNDLE_ICON_FILE "${ICON_FILENAME}")
# set where in the bundle to put the resources file # 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_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/icon/${ICON_FILENAME} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(DISCOVERED_RESOURCES "") set(DISCOVERED_RESOURCES "")
# use the add_resources_to_os_x_bundle macro to recurse into 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 # append the discovered resources to our list of interface sources
list(APPEND INTERFACE_SRCS ${DISCOVERED_RESOURCES}) list(APPEND INTERFACE_SRCS ${DISCOVERED_RESOURCES})
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/icon/${ICON_FILENAME}") set(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/icon/${ICON_FILENAME}")
endif() endif()
@ -102,7 +100,7 @@ else()
add_executable(${TARGET_NAME} ${INTERFACE_SRCS} ${QM}) add_executable(${TARGET_NAME} ${INTERFACE_SRCS} ${QM})
endif() 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 # binary directories get added to the fixup path
add_dependency_external_projects(sixense) add_dependency_external_projects(sixense)
add_dependency_external_projects(sdl2) add_dependency_external_projects(sdl2)
@ -121,9 +119,9 @@ if (WIN32)
endif() endif()
# link required hifi libraries # link required hifi libraries
link_hifi_libraries(shared octree environment gpu gl procedural model render link_hifi_libraries(shared octree environment gpu gl procedural model render
recording fbx networking model-networking entities avatars recording fbx networking model-networking entities avatars
audio audio-client animation script-engine physics audio audio-client animation script-engine physics
render-utils entities-renderer ui auto-updater render-utils entities-renderer ui auto-updater
controllers plugins display-plugins input-plugins ) controllers plugins display-plugins input-plugins )
@ -138,34 +136,34 @@ endif()
# perform standard include and linking for found externals # perform standard include and linking for found externals
foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
if (${${EXTERNAL}_UPPERCASE}_REQUIRED) if (${${EXTERNAL}_UPPERCASE}_REQUIRED)
find_package(${EXTERNAL} REQUIRED) find_package(${EXTERNAL} REQUIRED)
else () else ()
find_package(${EXTERNAL}) find_package(${EXTERNAL})
endif () endif ()
if (${${EXTERNAL}_UPPERCASE}_FOUND AND NOT DISABLE_${${EXTERNAL}_UPPERCASE}) if (${${EXTERNAL}_UPPERCASE}_FOUND AND NOT DISABLE_${${EXTERNAL}_UPPERCASE})
add_definitions(-DHAVE_${${EXTERNAL}_UPPERCASE}) add_definitions(-DHAVE_${${EXTERNAL}_UPPERCASE})
# include the library directories (ignoring warnings) # include the library directories (ignoring warnings)
if (NOT ${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS) if (NOT ${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS)
set(${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIR}) set(${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIR})
endif () endif ()
include_directories(SYSTEM ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS}) include_directories(SYSTEM ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS})
# perform the system include hack for OS X to ignore warnings # perform the system include hack for OS X to ignore warnings
if (APPLE) if (APPLE)
foreach(EXTERNAL_INCLUDE_DIR ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS}) foreach(EXTERNAL_INCLUDE_DIR ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${EXTERNAL_INCLUDE_DIR}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${EXTERNAL_INCLUDE_DIR}")
endforeach() endforeach()
endif () endif ()
if (NOT ${${EXTERNAL}_UPPERCASE}_LIBRARIES) if (NOT ${${EXTERNAL}_UPPERCASE}_LIBRARIES)
set(${${EXTERNAL}_UPPERCASE}_LIBRARIES ${${${EXTERNAL}_UPPERCASE}_LIBRARY}) set(${${EXTERNAL}_UPPERCASE}_LIBRARIES ${${${EXTERNAL}_UPPERCASE}_LIBRARY})
endif () endif ()
if (NOT APPLE OR NOT ${${EXTERNAL}_UPPERCASE} MATCHES "SIXENSE") if (NOT APPLE OR NOT ${${EXTERNAL}_UPPERCASE} MATCHES "SIXENSE")
target_link_libraries(${TARGET_NAME} ${${${EXTERNAL}_UPPERCASE}_LIBRARIES}) target_link_libraries(${TARGET_NAME} ${${${EXTERNAL}_UPPERCASE}_LIBRARIES})
elseif (APPLE AND NOT INSTALLER_BUILD) elseif (APPLE AND NOT INSTALLER_BUILD)
@ -179,13 +177,13 @@ include_directories("${PROJECT_SOURCE_DIR}/src")
target_link_libraries( target_link_libraries(
${TARGET_NAME} ${TARGET_NAME}
Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL
Qt5::Qml Qt5::Quick Qt5::Script Qt5::Svg Qt5::Qml Qt5::Quick Qt5::Script Qt5::Svg
Qt5::WebChannel Qt5::WebEngine Qt5::WebEngineWidgets Qt5::WebKitWidgets Qt5::WebChannel Qt5::WebEngine Qt5::WebEngineWidgets Qt5::WebKitWidgets
) )
# Issue causes build failure unless we add this directory. # Issue causes build failure unless we add this directory.
# See https://bugreports.qt.io/browse/QTBUG-43351 # See https://bugreports.qt.io/browse/QTBUG-43351
if (WIN32) if (WIN32)
add_paths_to_fixup_libs(${Qt5_DIR}/../../../plugins/qtwebengine) add_paths_to_fixup_libs(${Qt5_DIR}/../../../plugins/qtwebengine)
endif() endif()
@ -199,7 +197,7 @@ if (APPLE)
find_library(AppKit AppKit) find_library(AppKit AppKit)
target_link_libraries(${TARGET_NAME} ${OpenGL} ${AppKit}) target_link_libraries(${TARGET_NAME} ${OpenGL} ${AppKit})
# install command for OS X bundle # install command for OS X bundle
INSTALL(TARGETS ${TARGET_NAME} INSTALL(TARGETS ${TARGET_NAME}
BUNDLE DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/install" COMPONENT Runtime BUNDLE DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/install" COMPONENT Runtime
@ -229,4 +227,4 @@ if (WIN32)
endif() endif()
package_libraries_for_deployment() package_libraries_for_deployment()
consolidate_stack_components() consolidate_installer_components()

View file

@ -31,4 +31,3 @@ endif (UNIX)
# append tbb includes to our list of includes to bubble # append tbb includes to our list of includes to bubble
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS}) target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS})
include_application_version()