refactor LinkHifiLibrary, add SetupHifiLibrary macro

This commit is contained in:
Stephen Birarda 2013-04-15 14:41:59 -07:00
parent 613d5ab5f6
commit d094c6fc3b
3 changed files with 14 additions and 17 deletions

View file

@ -3,12 +3,6 @@ MACRO(LINK_HIFI_LIBRARY LIBRARY TARGET ROOT_DIR)
add_subdirectory(${ROOT_DIR}/libraries/${LIBRARY} ${ROOT_DIR}/libraries/${LIBRARY})
endif (NOT TARGET ${LIBRARY})
string(TOUPPER ${LIBRARY} UPPERCASED_LIBRARY_NAME)
set(HIFI_LIBRARY_PROPERTY "HIFI_${UPPERCASED_LIBRARY_NAME}_LIBRARY")
get_directory_property(HIFI_LIBRARY
DIRECTORY ${ROOT_DIR}/libraries/${LIBRARY}
DEFINITION ${HIFI_LIBRARY_PROPERTY})
include_directories(${ROOT_DIR}/libraries/${LIBRARY}/src)
add_dependencies(${TARGET} ${LIBRARY})

View file

@ -0,0 +1,9 @@
MACRO(SETUP_HIFI_LIBRARY TARGET)
project(${TARGET_NAME})
# grab the implemenation and header files
file(GLOB LIB_SRCS src/*.h src/*.cpp)
# create a library and set the property so it can be referenced later
add_library(${TARGET_NAME} ${LIB_SRCS})
ENDMACRO(SETUP_HIFI_LIBRARY _target)

View file

@ -8,19 +8,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cm
set(TARGET_NAME voxels)
project(${TARGET_NAME})
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
setup_hifi_library(${TARGET_NAME})
# set up the external glm library
# include glm
include(${MACRO_DIR}/IncludeGLM.cmake)
include_glm(${TARGET_NAME} ${MACRO_DIR})
# grab the implemenation and header files
file(GLOB HIFI_VOXELS_SRCS src/*.h src/*.cpp)
# create a library and set the property so it can be referenced later
add_library(${TARGET_NAME} ${HIFI_VOXELS_SRCS})
# link the shared library
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
set(HIFI_VOXELS_LIBRARY ${TARGET_NAME})
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})