more
[gluon-bt:btcomponents.git] / CMakeLists.txt
1 project(btcomponents)
2 cmake_minimum_required(VERSION 2.6)
3
4 find_package(Qt4 REQUIRED)
5
6 if(APPLE)
7         
8         find_library(GLUON_CORE_LIBS NAMES GluonCore)
9         message("-- Found GluonCore:" ${GLUON_CORE_LIBS})
10
11         find_library(GLUON_ENGINE_LIBS NAMES GluonEngine)
12         message("-- Found GluonEngine:" ${GLUON_ENGINE_LIBS})
13                 
14         find_library(btlib NAMES SMARTS)
15         message("-- Found SMARTS:" ${btlib})
16         
17         
18         include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${GLUON_ENGINE_LIBS}/Headers/ ${GLUON_CORE_LIBS}/Headers/ ${QT_QTSCRIPT_INCLUDES} ${btlib}/Headers/)
19
20 else()
21
22         find_package(GluonCore REQUIRED)
23         find_package(GluonEngine REQUIRED)
24         
25         find_library(LIBBT
26     NAMES
27         libbtlib.so
28     PATHS
29         c:/repo/gluon-bt/src/gluon-bt-lib/qtcreator-build/
30         /usr/lib
31         /usr/lib64
32         )
33         message("-- Found libbtlib:" ${LIBBT})
34
35         find_path(LIBBTPATH
36     NAMES
37         libbtlib.so
38     PATHS
39         c:/repo/gluon-bt/src/gluon-bt-lib/qtcreator-build/
40         /usr/lib
41         /usr/lib64
42         )
43         message("-- Found libbt's path:" ${LIBBTPATH})
44         
45         include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${GLUON_ENGINE_INCLUDES} ${GLUON_CORE_INCLUDES} ${QT_QTSCRIPT_INCLUDES})
46         
47         add_library(btlib SHARED IMPORTED)
48         set_property(TARGET btlib PROPERTY IMPORTED_LOCATION ${LIBBT})
49         set_property(TARGET btlib PROPERTY IMPORTED_IMPLIB ${LIBBT})
50         
51 endif()
52
53
54 set(_Init_LIB_SUFFIX "")
55 if ("${QT_QTCORE_LIBRARY}" MATCHES lib64)
56    set(_Init_LIB_SUFFIX 64)
57 endif ("${QT_QTCORE_LIBRARY}" MATCHES lib64)
58 if ("${QT_QTCORE_LIBRARY}" MATCHES lib32)
59    set(_Init_LIB_SUFFIX 32)
60 endif ("${QT_QTCORE_LIBRARY}" MATCHES lib32)
61
62 set(LIB_SUFFIX              ${_Init_LIB_SUFFIX} CACHE STRING "The suffix of the system-wide library path")
63 set(LIB_INSTALL_DIR         ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}    CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed.")
64
65 set(behaviorTreeComponent_SRCs
66     src/assetprivate.cpp
67     src/asset.cpp
68     src/treeprivate.cpp
69     src/tree.cpp
70         src/characterprivate.cpp
71         src/character.cpp
72         src/btcharacterscriptable.cpp
73     src/btnodescriptable.cpp
74         src/viewcone.cpp
75         src/viewconeprivate.cpp
76         src/perceptionatom.cpp
77         src/perceptionatomprivate.cpp
78         src/perceptioninfo.cpp
79         src/perceptioninfoprivate.cpp
80         src/btperceptioninfoscriptable.cpp
81
82     src/bindings/com_trolltech_qt_gui_init.cpp
83     src/bindings/qtscript_QVector2D.cpp
84     src/bindings/qtscript_QVector3D.cpp
85     src/bindings/qtscript_QVector4D.cpp
86     src/bindings/qtscript_QColor.cpp
87     src/bindings/qtscript_QQuaternion.cpp
88    )
89
90 qt4_automoc(
91         ${behaviorTreeComponent_SRCs} 
92         )
93
94 add_definitions(-DMAKE_BTCOMPONENT_LIB)
95 add_definitions(-DMAKE_GLUON_LIB)
96
97 ADD_DEFINITIONS(${QT_DEFINITIONS})
98 ADD_DEFINITIONS(-DQT_PLUGIN)
99 ADD_DEFINITIONS(-DQT_NO_DEBUG)
100 ADD_DEFINITIONS(-DQT_SHARED)
101
102 add_library(gluon_plugin_asset_behaviortree SHARED ${behaviorTreeComponent_SRCs} )
103 set_target_properties(gluon_plugin_asset_behaviortree PROPERTIES VERSION "0.71.0" SOVERSION "0.71.0")
104
105 if(APPLE)
106         target_link_libraries(gluon_plugin_asset_behaviortree ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${GLUON_CORE_LIBS} ${GLUON_ENGINE_LIBS} ${QT_QTSCRIPT_LIBRARY} ${btlib})
107 else()
108         target_link_libraries(gluon_plugin_asset_behaviortree ${QT_QTCORE_LIBRARY} ${GLUON_CORE_LIBS} ${GLUON_ENGINE_LIBS} ${QT_QTSCRIPT_LIBRARY} btlib)
109 endif()
110
111
112 install(
113     TARGETS
114     gluon_plugin_asset_behaviortree
115     DESTINATION ${LIB_INSTALL_DIR}/gluon
116 )
117
118 add_subdirectory(testapp)