root/OpenSceneGraph/trunk/src/osgWrappers/introspection/CMakeLists.txt @ 10966

Revision 10966, 5.5 kB (checked in by robert, 5 years ago)

Cleaned out all wrappers as will be moving them all into src/osgWrappers/introspection directory, and use genwrapper to generate the new ones

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