root/OpenSceneGraph/trunk/src/osgWrappers/CMakeLists.txt @ 9878

Revision 9878, 5.8 kB (checked in by robert, 6 years ago)

Fixed osgWrappers for osgAnimation library

  • Property svn:eol-style set to native
Line 
1PROJECT(OSG_WRAPPERS)
2
3IF   (NOT DYNAMIC_OPENSCENEGRAPH)
4    ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
5ENDIF(NOT DYNAMIC_OPENSCENEGRAPH)
6
7SET(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/${OSG_PLUGINS}")
8
9SET(CMAKE_SHARED_MODULE_PREFIX ${OSG_PLUGIN_PREFIX})
10
11IF(MSVC80)
12  IF(NOT OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS)
13    SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO")
14  ENDIF(NOT OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS)
15ENDIF(MSVC80)
16
17MACRO(ADD_WRAPPER_LIB SUBDIR EXPORTDEF)
18    SET(TARGET_NAME "osgwrapper_${SUBDIR}")
19#    MESSAGE(STATUS "--inizio-->${TARGET_NAME}<->${LINK}<-")
20
21    FILE(GLOB SRC_FILES ${OSGWRAPPER_DIR}/${SUBDIR}/*.cpp)
22   
23    #-- extract link files, defines, exclude files form additional arguments
24
25    SET(LISTNAME "TEMP")
26    SET(DEFSTR "")
27
28    FOREACH(ARG ${ARGN})                    # parse remaining args
29        #MESSAGE(STATUS "+ [${ARG}]")
30        #MESSAGE("ARG-->${ARG}")
31        # if we find our keywords set the active list to given keyname
32        STRING(COMPARE EQUAL "${ARG}" "LINK" IS_LINK)
33        STRING(COMPARE EQUAL "${ARG}" "DEFINE" IS_DEFINE)
34        STRING(COMPARE EQUAL "${ARG}" "EXCLUDE" IS_EXCLUDE)
35       
36        #MESSAGE(STATUS "STRSTUFF L ${IS_LINK} D ${IS_DEFINE} E ${IS_EXCLUDE}")
37       
38        SET(EXPRESSION ${IS_LINK} OR ${IS_DEFINE} OR ${IS_EXCLUDE})
39        IF(${EXPRESSION})
40            SET(${LISTNAME} ${CURRLIST})
41            # MESSAGE(STATUS "STORED LIST [${LISTNAME}] = (${CURRLIST})")
42            SET(LISTNAME ${ARG})
43            REMOVE(CURRLIST ${CURRLIST} )
44           
45        ELSE(${EXPRESSION})
46            SET(CURRLIST ${CURRLIST} ${ARG})   
47           
48        ENDIF(${EXPRESSION})
49    ENDFOREACH(ARG)
50    SET(${LISTNAME} ${CURRLIST})
51    #MESSAGE(STATUS "STORED LIST [${LISTNAME}] = (${CURRLIST})")
52    REMOVE(CURRLIST ${CURRLIST} )
53   
54    #MESSAGE(STATUS "AFTER: EXC (${EXCLUDE}) DEF (${DEFINE}) LINK (${LINK})")
55    FOREACH(EXF ${EXCLUDE})
56        REMOVE(SRC_FILES ${OPENSCENEGRAPH_DIR}/src/${SUBDIR}/${EXF})
57    ENDFOREACH(EXF)
58       
59    FOREACH(DEF ${DEFINE})
60        SET(DEFSTR "${DEFSTR} /D \"${DEF}\"")
61        #MESSAGE(STATUS "add symbol : " ${DEF})
62    ENDFOREACH(DEF)
63   
64    IF(NOT DEFSTR STREQUAL "")
65        SET_SOURCE_FILES_PROPERTIES(${SRC_FILES} PROPERTIES COMPILE_FLAGS ${DEFSTR})
66        #MESSAGE(STATUS "*********  ADD COMPILE FLAGS ${DEFSTR} **********")
67    ENDIF(NOT DEFSTR STREQUAL "")
68   
69    #ADD_LIBRARY(${TARGET_NAME} SHARED ${SRC_FILES} )
70        ADD_LIBRARY(${TARGET_NAME} MODULE ${SRC_FILES} )
71       
72    #not sure if needed, but for plugins only msvc need the d suffix
73    IF(NOT MSVC)
74        SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "")
75  ELSE(NOT MSVC)
76        IF(OSG_MSVC_VERSIONED_DLL)
77                       
78                #this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
79                #the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property
80                #because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there,
81                #it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
82                #changing bin to something else breaks this hack
83                #the dll are placed in bin/${OSG_PLUGINS}
84               
85                IF(NOT MSVC_IDE)
86                    SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "../bin/${OSG_PLUGINS}/")
87                ELSE(NOT MSVC_IDE)
88                    SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../")
89                ENDIF(NOT MSVC_IDE)
90               
91               
92        ELSE(OSG_MSVC_VERSIONED_DLL)
93           
94            #in standard mode (unversioned) the .lib and .dll are placed in lib/<debug or release>/${OSG_PLUGINS}.
95            #here the PREFIX property has been used, the same result would be accomplidhe by prepending ${OSG_PLUGINS}/ to OUTPUT_NAME target property
96           
97            SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
98        ENDIF(OSG_MSVC_VERSIONED_DLL)
99    ENDIF(NOT MSVC)
100
101    SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES DEFINE_SYMBOL "${EXPORTDEF}" PROJECT_LABEL "Wrapper ${SUBDIR}")
102    IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
103        LINK_INTERNAL(${TARGET_NAME} ${LINK})
104        #when using full path name to specify linkage, it seems that already linked libs must be specified
105        LINK_EXTERNAL(${TARGET_NAME} ${OPENGL_LIBRARIES})
106
107    ELSE(MSVC AND OSG_MSVC_VERSIONED_DLL)
108        TARGET_LINK_LIBRARIES(${TARGET_NAME} ${LINK})
109    ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
110    #MESSAGE(STATUS "--TARGET_LINK_LIBRARIES-->${TARGET_NAME}<->${LINK}<-")
111   
112    REMOVE(DEFINE ${DEFINE})   
113    REMOVE(LINK ${LINK})   
114    REMOVE(EXCLUDE ${EXCLUDE})   
115   
116    IF(WIN32)
117        INSTALL(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib/${OSG_PLUGINS} LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT libopenscenegraph-wrappers)
118    ELSE(WIN32)
119        INSTALL(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-wrappers)
120    ENDIF(WIN32)
121   
122ENDMACRO(ADD_WRAPPER_LIB)
123
124
125
126SET(OSGWRAPPER_LIB_LIST
127    OpenThreads
128    osg
129    osgDB
130    osgFX
131    osgGA
132    osgManipulator
133    osgAnimation
134    osgParticle
135    osgShadow
136    osgSim
137    osgTerrain
138    osgText
139    osgUtil
140    osgViewer
141    osgVolume
142    osgWidget
143)
144
145
146SET(OSGWRAPPER_DIR ${CMAKE_CURRENT_SOURCE_DIR})
147IF(MSVC)
148    SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
149ENDIF(MSVC)
150FOREACH(LIB ${OSGWRAPPER_LIB_LIST} )
151    ADD_WRAPPER_LIB(${LIB}  OSGWRAPPERS_LIBRARY LINK OpenThreads osg osgGA ${LIB} osgIntrospection)   
152ENDFOREACH(LIB ${OSGWRAPPER_LIB_LIST} )
Note: See TracBrowser for help on using the browser.