From 42c40a716405cdd3806b0f0ec42a76c4ad2194c1 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 30 Apr 2015 13:32:25 -0700 Subject: [PATCH] attempt add of resources to executable sources --- cmake/macros/CopyDirectoryBesideTarget.cmake | 36 -------------------- cmake/macros/SetupHifiProject.cmake | 2 +- domain-server/CMakeLists.txt | 27 +++++++-------- 3 files changed, 14 insertions(+), 51 deletions(-) delete mode 100644 cmake/macros/CopyDirectoryBesideTarget.cmake diff --git a/cmake/macros/CopyDirectoryBesideTarget.cmake b/cmake/macros/CopyDirectoryBesideTarget.cmake deleted file mode 100644 index 2d20c7e192..0000000000 --- a/cmake/macros/CopyDirectoryBesideTarget.cmake +++ /dev/null @@ -1,36 +0,0 @@ -# -# CopyDirectoryBesideTarget.cmake -# cmake/macros -# -# Created by Stephen Birarda on 04/30/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(COPY_DIRECTORY_BESIDE_TARGET _SHOULD_SYMLINK _DIRECTORY _DESTINATION) - if (${_SHOULD_SYMLINK}) - # the caller wants a symlink, so just add a command to symlink the DIR beside target - add_custom_command( - TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E create_symlink - "${_DIRECTORY}" - $/${_DESTINATION} - ) - else () - # remove the current directory - add_custom_command( - TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E remove_directory $/${_DESTINATION} - ) - - # copy the directory - add_custom_command( - TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${_DIRECTORY} - $/${_DESTINATION} - ) - endif () - # glob everything in this directory - add a custom command to copy any files -endmacro(COPY_DIRECTORY_BESIDE_TARGET _SHOULD_SYMLINK _DIRECTORY) diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 1ed0d8a202..4b3cf5b37c 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -23,7 +23,7 @@ macro(SETUP_HIFI_PROJECT) endforeach() # add the executable, include additional optional sources - add_executable(${TARGET_NAME} ${TARGET_SRCS} "${AUTOMTC_SRC}") + add_executable(${TARGET_NAME} ${TARGET_SRCS} ${TARGET_RSRCS} "${AUTOMTC_SRC}" ) set(${TARGET_NAME}_DEPENDENCY_QT_MODULES ${ARGN}) list(APPEND ${TARGET_NAME}_DEPENDENCY_QT_MODULES Core) diff --git a/domain-server/CMakeLists.txt b/domain-server/CMakeLists.txt index bac1640207..9c7e6569b2 100644 --- a/domain-server/CMakeLists.txt +++ b/domain-server/CMakeLists.txt @@ -1,23 +1,22 @@ set(TARGET_NAME domain-server) +if (UPPER_CMAKE_BUILD_TYPE MATCHES DEBUG AND NOT WIN32) + set(_SHOULD_SYMLINK_RESOURCES FALSE) +else () + set(_SHOULD_SYMLINK_RESOURCES FALSE) +endif () + +if (NOT ${_SHOULD_SYMLINK_RESOURCES}) + # since we aren't going to symlink the resources, we should add them as sources for this target + # this should cause the target to be re-built should one of the files change + file(GLOB_RECURSE TARGET_RSRCS "${CMAKE_CURRENT_SOURCE_DIR}/resources/*") +endif () + # setup the project and link required Qt modules setup_hifi_project(Network) -if (UPPER_CMAKE_BUILD_TYPE MATCHES DEBUG AND NOT WIN32) - set(SHOULD_SYMLINK_RESOURCES TRUE) -else () - set(SHOULD_SYMLINK_RESOURCES TRUE) -endif () -copy_directory_beside_target(${SHOULD_SYMLINK_RESOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/resources" "resources") - -# copy all files in resources, including web -# add_custom_command( -# TARGET ${TARGET_NAME} POST_BUILD -# COMMAND "${CMAKE_COMMAND}" -E copy_directory -# "${PROJECT_SOURCE_DIR}/resources" -# $/resources -# ) +symlink_or_copy_directory_beside_target(${_SHOULD_SYMLINK_RESOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/resources" "resources") # link the shared hifi libraries link_hifi_libraries(embedded-webserver networking shared)