tweak setup_hifi_library to bubble up full path of Qt modules

This commit is contained in:
Stephen Birarda 2014-08-08 10:44:58 -07:00
parent 1f0a722d0d
commit c9f8433a2d
17 changed files with 59 additions and 113 deletions

View file

@ -13,14 +13,28 @@ macro(SETUP_HIFI_LIBRARY TARGET)
# grab the implemenation and header files
file(GLOB LIB_SRCS src/*.h src/*.cpp)
set(LIB_SRCS ${LIB_SRCS} ${WRAPPED_SRCS})
set(LIB_SRCS ${LIB_SRCS})
# create a library and set the property so it can be referenced later
add_library(${TARGET} ${LIB_SRCS} ${ARGN})
# create a library and set the property so it can be referenced later
add_library(${TARGET} ${LIB_SRCS} ${AUTOMTC_SRC})
find_package(Qt5Core REQUIRED)
qt5_use_modules(${TARGET} Core)
target_link_libraries(${TARGET} ${QT_LIBRARIES})
set(QT_MODULES_TO_LINK ${ARGN})
list(APPEND QT_MODULES_TO_LINK Core)
find_package(Qt5 COMPONENTS ${QT_MODULES_TO_LINK})
foreach(QT_MODULE ${QT_MODULES_TO_LINK})
# link this Qt module to ourselves
target_link_libraries(${TARGET} Qt5::${QT_MODULE})
get_target_property(QT_LIBRARY_LOCATION Qt5::${QT_MODULE} LOCATION)
# add the actual path to the Qt module to a QT_LIBRARIES variable
list(APPEND QT_LIBRARIES ${QT_LIBRARY_LOCATION})
endforeach()
if (QT_LIBRARIES)
set_target_properties(${TARGET} PROPERTIES DEPENDENCY_LIBRARIES "${QT_LIBRARIES}")
endif ()
endmacro(SETUP_HIFI_LIBRARY _target)

View file

@ -1,12 +1,6 @@
set(TARGET_NAME animation)
setup_hifi_library(${TARGET_NAME})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Script)
link_hifi_libraries(${TARGET_NAME} shared fbx)
find_package(Qt5 COMPONENTS Network Script)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Script Qt5::Network)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}")
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
link_hifi_libraries(${TARGET_NAME} shared fbx)

View file

@ -1,14 +1,8 @@
set(TARGET_NAME audio)
setup_hifi_library(${TARGET_NAME})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
link_hifi_libraries(${TARGET_NAME} networking shared)
find_package(Qt5 COMPONENTS Network)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Network)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES ${DEPENDENCY_LIBRARIES})
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
link_hifi_libraries(${TARGET_NAME} networking shared)

View file

@ -1,15 +1,9 @@
set(TARGET_NAME avatars)
setup_hifi_library(${TARGET_NAME})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Script)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
link_hifi_libraries(${TARGET_NAME} shared octree voxels networking)
include_hifi_library_headers(fbx)
find_package(Qt5 COMPONENTS Network Script)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Network Qt5::Script)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}")
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
include_hifi_library_headers(fbx)

View file

@ -1,17 +1,4 @@
set(ROOT_DIR ../..)
set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
# setup for find modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
set(TARGET_NAME embedded-webserver)
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
setup_hifi_library(${TARGET_NAME})
find_package(Qt5 COMPONENTS Network)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Network)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES ${DEPENDENCY_LIBRARIES})
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network)

View file

@ -1,5 +1,6 @@
set(TARGET_NAME fbx)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME})
include_glm(${TARGET_NAME} "${ROOT_DIR}")

View file

@ -2,16 +2,10 @@ set(TARGET_NAME metavoxels)
auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
setup_hifi_library(${TARGET_NAME} "${AUTOMTC_SRC}")
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Scripts Widgets)
# link in the networking library
link_hifi_libraries(${TARGET_NAME} shared networking)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
find_package(Qt5 COMPONENTS Network Script Widgets)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Script Qt5::Widgets Qt5::Network)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}")
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
include_glm(${TARGET_NAME} "${ROOT_DIR}")

View file

@ -1,14 +1,8 @@
set(TARGET_NAME models)
setup_hifi_library(${TARGET_NAME})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Script)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
link_hifi_libraries(${TARGET_NAME} shared octree fbx networking animation)
find_package(Qt5 COMPONENTS Network Script)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Network Qt5::Script)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}")
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
link_hifi_libraries(${TARGET_NAME} shared octree fbx networking animation)

View file

@ -1,12 +1,6 @@
set(TARGET_NAME networking)
setup_hifi_library(${TARGET_NAME})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network)
link_hifi_libraries(${TARGET_NAME} shared)
find_package(Qt5 COMPONENTS Network)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Network)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}")
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
link_hifi_libraries(${TARGET_NAME} shared)

View file

@ -1,5 +1,6 @@
set(TARGET_NAME octree)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME})
include_glm(${TARGET_NAME} "${ROOT_DIR}")
@ -15,4 +16,4 @@ include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${OPENSSL_INCLUDE_DIR}")
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES "${ZLIB_LIBRARIES}" "${OPENSSL_LIBRARIES}")
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES ${DEPENDENCY_LIBRARIES})
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})

View file

@ -1,15 +1,9 @@
set(TARGET_NAME particles)
setup_hifi_library(${TARGET_NAME})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Gui Network Script)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
link_hifi_libraries(${TARGET_NAME} shared octree fbx networking animation)
include_hifi_library_headers(script-engine)
find_package(Qt5 COMPONENTS Gui Network Script)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Network Qt5::Script Qt5::Gui)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}")
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
include_hifi_library_headers(script-engine)

View file

@ -1,14 +1,8 @@
set(TARGET_NAME script-engine)
setup_hifi_library(${TARGET_NAME})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Gui Network Script Widgets)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
link_hifi_libraries(${TARGET_NAME} shared octree voxels fbx particles models animation)
find_package(Qt5 COMPONENTS Gui Network Script Widgets)
# set a property indicating the libraries we are dependent on and link them to ourselves
set(DEPENDENCY_LIBRARIES Qt5::Gui Qt5::Network Qt5::Script Qt5::Widgets)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}")
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
link_hifi_libraries(${TARGET_NAME} shared octree voxels fbx particles models animation)

View file

@ -1,9 +1,4 @@
set(TARGET_NAME shared)
setup_hifi_library(${TARGET_NAME})
find_package(Qt5 COMPONENTS Network Widgets)
# bubble up the libraries we are dependent on and link them to ourselves
list(APPEND DEPENDENCY_LIBRARIES Qt5::Network Qt5::Widgets)
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}")
target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Widgets)

View file

@ -1,6 +1,7 @@
set(TARGET_NAME voxels)
setup_hifi_library(${TARGET_NAME})
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Widgets Script)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
@ -8,7 +9,8 @@ link_hifi_libraries(${TARGET_NAME} shared octree networking)
# link ZLIB
find_package(ZLIB)
find_package(Qt5 COMPONENTS Widgets Script)
include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}" Qt5::Widgets Qt5::Script)
get_target_property(LINKED_LIBRARIES ${TARGET_NAME} DEPENDENCY_LIBRARIES)
list(APPEND DEPENDENCY_LIBRARIES "${ZLIB_LIBRARIES}")
list(REMOVE_DUPLICATES DEPENDENCY_LIBRARIES)

View file

@ -6,4 +6,4 @@ setup_hifi_project(${TARGET_NAME} TRUE)
include_glm(${TARGET_NAME} ${ROOT_DIR})
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME} shared audio networking)
link_hifi_libraries(${TARGET_NAME} shared audio networking)

View file

@ -1,4 +1,3 @@
# add the tool directories
add_subdirectory(bitstream2json)
add_subdirectory(json2bitstream)

View file

@ -1,7 +1,2 @@
set(TARGET_NAME mtc)
set(ROOT_DIR ../..)
set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
include(${MACRO_DIR}/SetupHifiProject.cmake)
setup_hifi_project(${TARGET_NAME} TRUE)