| 1 |
INCLUDE(SimQtMacros) |
| 2 |
|
| 3 |
SET(Library Quarter) |
| 4 |
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) |
| 5 |
|
| 6 |
# We R internal |
| 7 |
ADD_DEFINITIONS(-DQUARTER_INTERNAL) |
| 8 |
|
| 9 |
FILE(GLOB CMakeCache RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/CMakeCache.txt) |
| 10 |
|
| 11 |
# Generate list of sources and headers for compilation |
| 12 |
FILE(GLOB_RECURSE Sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) |
| 13 |
FILE(GLOB_RECURSE PublicHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) |
| 14 |
FILE(GLOB_RECURSE PrivateHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../../include/Quarter/*.h) |
| 15 |
|
| 16 |
|
| 17 |
# Some convenient variables. The inclusion of the headers in the source variable is to force CMake to include the headers in VS project generation. |
| 18 |
SET(AllSources ${Sources} ${PublicHeaders} ${PrivateHeaders} ${CMakeCache}) |
| 19 |
|
| 20 |
|
| 21 |
IF (Spacenav_FOUND) |
| 22 |
SET(Extra_libraries ${Spacenav_LIBRARIES} ${Spacenav_LIBRARY}) |
| 23 |
ENDIF(Spacenav_FOUND) |
| 24 |
|
| 25 |
|
| 26 |
SET(AllLibs ${Coin_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Extra_libraries}) |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
# Ensure export of DLL definitions on Windows |
| 31 |
IF(WIN32 AND NOT Quarter_BUILD_STATIC_LIBRARY) |
| 32 |
ADD_DEFINITIONS(-DQUARTER_MAKE_DLL) |
| 33 |
ENDIF(WIN32 AND NOT Quarter_BUILD_STATIC_LIBRARY) |
| 34 |
|
| 35 |
# Add some files and filters to make the VS project more hierarchical and practical to work with |
| 36 |
IF(MSVC_IDE) |
| 37 |
FILE(GLOB DeviceSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} devices/*.cpp) |
| 38 |
FILE(GLOB DeviceHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} devices/*.h) |
| 39 |
FILE(GLOB PrivateDeviceHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../../include/Quarter/devices/*.h) |
| 40 |
|
| 41 |
FILE(GLOB EventHandlerSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} eventhandlers/*.cpp) |
| 42 |
FILE(GLOB EventHandlerHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} eventhandlers/*.h) |
| 43 |
FILE(GLOB PrivateEventHandlerHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../../include/Quarter/eventhandlers/*.h) |
| 44 |
|
| 45 |
SIM_VS_GENERATE_BASIC_TREE() |
| 46 |
SOURCE_GROUP("Source\\Devices" FILES ${DeviceSources}) |
| 47 |
SOURCE_GROUP("Source\\EventHandlers" FILES ${EventHandlerSources}) |
| 48 |
SOURCE_GROUP("Headers\\Devices" FILES ${DeviceHeaders}) |
| 49 |
SOURCE_GROUP("Headers\\Devices" FILES ${PrivateDeviceHeaders}) |
| 50 |
SOURCE_GROUP("Headers\\EventHandlers" FILES ${EventHandlerHeaders}) |
| 51 |
SOURCE_GROUP("Headers\\EventHandlers" FILES ${PrivateEventHandlerHeaders}) |
| 52 |
ENDIF(MSVC_IDE) |
| 53 |
|
| 54 |
# Create the library |
| 55 |
# FIXME: Support building as a framework on Mac OS X. kintel 20080707. |
| 56 |
IF(Quarter_BUILD_STATIC_LIBRARY) |
| 57 |
ADD_LIBRARY(${Library} STATIC ${AllSources}) |
| 58 |
ELSE(Quarter_BUILD_STATIC_LIBRARY) |
| 59 |
ADD_LIBRARY(${Library} SHARED ${AllSources}) |
| 60 |
TARGET_LINK_LIBRARIES(${Library} ${AllLibs}) |
| 61 |
ENDIF(Quarter_BUILD_STATIC_LIBRARY) |
| 62 |
|
| 63 |
# Install configuration |
| 64 |
# |
| 65 |
# Quarter will be installed into the directory configured by CMAKE_INSTALL_PREFIX. This |
| 66 |
# defaults to /usr/local/ on UNIX and c:/Program Files/Quarter on Windows. |
| 67 |
# |
| 68 |
# On Windows, the namimg convention is as follows (ripped from the "Coin" way of doing stuff): |
| 69 |
# Dynamic Release: Quarter.dll and Quarter.lib |
| 70 |
# Dynamic Debug: Quarterd.dll and Quarterd.lib |
| 71 |
# Static Release: Quarters.lib |
| 72 |
# Static Debug: Quartersd.lib |
| 73 |
|
| 74 |
INSTALL(TARGETS ${Library} |
| 75 |
RUNTIME DESTINATION bin |
| 76 |
LIBRARY DESTINATION lib |
| 77 |
ARCHIVE DESTINATION lib |
| 78 |
) |