From Rafa Gaitan, "I have added the macro SETUP_LIBRARY, similar to SETUP_PLUGIN or
SETUP_EXE, in order to have a unique entry point to build the libraries. With this changes the android integration will be less painful (currently is a big IF(ANDROID) for each CMakeLists.txt) and more maintainable in the future. I hope next submissions will be for supporting android from my colleague Jorge. "
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
# Required Vars:
|
||||
# ${LIB_NAME}
|
||||
# ${LIB_PUBLIC_HEADERS}
|
||||
# ${TARGET_H}
|
||||
|
||||
SET(INSTALL_INCDIR include)
|
||||
SET(INSTALL_BINDIR bin)
|
||||
@@ -18,7 +18,7 @@ SET(HEADERS_GROUP "Header Files")
|
||||
|
||||
SOURCE_GROUP(
|
||||
${HEADERS_GROUP}
|
||||
FILES ${LIB_PUBLIC_HEADERS}
|
||||
FILES ${TARGET_H}
|
||||
)
|
||||
|
||||
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
@@ -34,7 +34,7 @@ INSTALL(
|
||||
|
||||
IF(NOT OSG_COMPILE_FRAMEWORKS)
|
||||
INSTALL (
|
||||
FILES ${LIB_PUBLIC_HEADERS}
|
||||
FILES ${TARGET_H}
|
||||
DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}
|
||||
COMPONENT libopenscenegraph-dev
|
||||
)
|
||||
@@ -45,7 +45,7 @@ ELSE()
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
FRAMEWORK_VERSION ${OPENSCENEGRAPH_SOVERSION}
|
||||
PUBLIC_HEADER "${LIB_PUBLIC_HEADERS}"
|
||||
PUBLIC_HEADER "${TARGET_H}"
|
||||
INSTALL_NAME_DIR "${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}"
|
||||
)
|
||||
# MESSAGE("${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
|
||||
|
||||
@@ -197,6 +197,48 @@ MACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
|
||||
ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
|
||||
|
||||
|
||||
|
||||
#######################################################################################################
|
||||
# macro for common setup of libraries it expect some variables to be set:
|
||||
# either within the local CMakeLists or higher in hierarchy
|
||||
# LIB_NAME is the name of the target library
|
||||
# TARGET_SRC are the sources of the target
|
||||
# TARGET_H are the eventual headers of the target
|
||||
# TARGET_LIBRARIES are the libraries to link to that are internal to the project and have d suffix for debug
|
||||
# TARGET_EXTERNAL_LIBRARIES are external libraries and are not differentiated with d suffix
|
||||
# TARGET_LABEL is the label IDE should show up for targets
|
||||
##########################################################################################################
|
||||
|
||||
MACRO(SETUP_LIBRARY LIB_NAME)
|
||||
|
||||
SET(TARGET_NAME ${LIB_NAME} )
|
||||
SET(TARGET_TARGETNAME ${LIB_NAME} )
|
||||
|
||||
ADD_LIBRARY(${LIB_NAME}
|
||||
${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC}
|
||||
${TARGET_H}
|
||||
${TARGET_SRC}
|
||||
)
|
||||
|
||||
IF(TARGET_LABEL)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
||||
ENDIF(TARGET_LABEL)
|
||||
|
||||
IF(TARGET_LIBRARIES)
|
||||
LINK_INTERNAL(${LIB_NAME} ${TARGET_LIBRARIES})
|
||||
ENDIF()
|
||||
IF(TARGET_EXTERNAL_LIBRARIES)
|
||||
LINK_EXTERNAL(${LIB_NAME} ${TARGET_EXTERNAL_LIBRARIES})
|
||||
ENDIF()
|
||||
IF(TARGET_LIBRARIES_VARS)
|
||||
LINK_WITH_VARIABLES(${LIB_NAME} ${TARGET_LIBRARIES_VARS})
|
||||
ENDIF(TARGET_LIBRARIES_VARS)
|
||||
LINK_CORELIB_DEFAULT(${LIB_NAME})
|
||||
|
||||
INCLUDE(ModuleInstall OPTIONAL)
|
||||
|
||||
ENDMACRO(SETUP_LIBRARY LIB_NAME)
|
||||
|
||||
MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||
|
||||
SET(TARGET_NAME ${PLUGIN_NAME} )
|
||||
|
||||
Reference in New Issue
Block a user