mirror of
https://github.com/overte-org/overte.git
synced 2025-06-17 06:20:22 +02:00
Merge pull request #4705 from birarda/avatar-mixer-throttling
add macro to recursively correctly handle OS X bundle resources
This commit is contained in:
commit
c685874b05
2 changed files with 47 additions and 10 deletions
40
cmake/macros/AddResourcesToOSXBundle.cmake
Normal file
40
cmake/macros/AddResourcesToOSXBundle.cmake
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#
|
||||||
|
# AddResourcesToOSXBundle.cmake
|
||||||
|
# cmake/macros
|
||||||
|
#
|
||||||
|
# Created by Stephen Birarda on 04/27/15.
|
||||||
|
# Copyright 2015 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(_RECURSIVELY_SET_PACKAGE_LOCATION _PATH)
|
||||||
|
# enumerate the items
|
||||||
|
foreach(_ITEM ${ARGN})
|
||||||
|
|
||||||
|
if (IS_DIRECTORY "${_ITEM}")
|
||||||
|
# recurse into the directory and check for more resources
|
||||||
|
file(GLOB _DIR_CONTENTS "${_ITEM}/*")
|
||||||
|
|
||||||
|
# figure out the path for this directory and then call ourselves to recurse into it
|
||||||
|
get_filename_component(_ITEM_PATH ${_ITEM} NAME)
|
||||||
|
_recursively_set_package_location("${_PATH}/${_ITEM_PATH}" ${_DIR_CONTENTS})
|
||||||
|
else ()
|
||||||
|
# add any files in the root to the resources folder directly
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(${_ITEM} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources${_PATH}")
|
||||||
|
list(APPEND DISCOVERED_RESOURCES ${_ITEM})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
endmacro(_RECURSIVELY_SET_PACKAGE_LOCATION _PATH)
|
||||||
|
|
||||||
|
macro(ADD_RESOURCES_TO_OS_X_BUNDLE _RSRC_FOLDER)
|
||||||
|
|
||||||
|
# GLOB the resource directory
|
||||||
|
file(GLOB _ROOT_ITEMS "${_RSRC_FOLDER}/*")
|
||||||
|
|
||||||
|
# recursively enumerate from the root items
|
||||||
|
_recursively_set_package_location("" ${_ROOT_ITEMS})
|
||||||
|
|
||||||
|
endmacro(ADD_RESOURCES_TO_OS_X_BUNDLE _RSRC_FOLDER)
|
|
@ -88,18 +88,15 @@ if (APPLE)
|
||||||
# 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)
|
||||||
|
|
||||||
# grab the directories in resources and put them in the right spot in Resources
|
set(DISCOVERED_RESOURCES "")
|
||||||
file(GLOB RESOURCE_SUBDIRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/resources" "${CMAKE_CURRENT_SOURCE_DIR}/resources/*")
|
|
||||||
foreach(DIR ${RESOURCE_SUBDIRS})
|
|
||||||
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/resources/${DIR}")
|
|
||||||
FILE(GLOB DIR_CONTENTS "resources/${DIR}/*")
|
|
||||||
SET_SOURCE_FILES_PROPERTIES(${DIR_CONTENTS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${DIR}")
|
|
||||||
|
|
||||||
SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${DIR_CONTENTS}")
|
# use the add_resources_to_os_x_bundle macro to recurse into resources
|
||||||
endif()
|
add_resources_to_os_x_bundle("${CMAKE_CURRENT_SOURCE_DIR}/resources")
|
||||||
endforeach()
|
|
||||||
|
|
||||||
SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/icon/${ICON_FILENAME}")
|
# 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()
|
endif()
|
||||||
|
|
||||||
# create the executable, make it a bundle on OS X
|
# create the executable, make it a bundle on OS X
|
||||||
|
|
Loading…
Reference in a new issue