root/OpenSceneGraph/trunk/src/OpenThreads/CMakeLists.txt @ 13482

Revision 13482, 4.0 kB (checked in by robert, 10 hours ago)

Added in source shaders

  • Property svn:eol-style set to native
Line 
1# This is mainly for Windows declspec, but other platforms know
2# what to do with it.
3ADD_DEFINITIONS(-DOPENTHREADS_EXPORTS)
4
5SET(OPENTHREADS_MAJOR_VERSION 2)
6SET(OPENTHREADS_MINOR_VERSION 6)
7SET(OPENTHREADS_PATCH_VERSION 0)
8SET(OPENTHREADS_SOVERSION 12)
9
10SET(OPENTHREADS_VERSION ${OPENTHREADS_MAJOR_VERSION}.${OPENTHREADS_MINOR_VERSION}.${OPENTHREADS_PATCH_VERSION})
11
12IF(NOT ANDROID)
13    INCLUDE(CheckAtomicOps)
14ENDIF()
15
16# User Options
17OPTION(DYNAMIC_OPENTHREADS "Set to ON to build OpenThreads for dynamic linking.  Use OFF for static." ON)
18IF(DYNAMIC_OPENTHREADS)
19    SET(OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
20ELSE()
21    SET(OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
22    SET(OT_LIBRARY_STATIC 1)
23ENDIF()
24
25################################################################################
26# Set Config file
27
28SET(OPENTHREADS_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/OpenThreads/Config")
29CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/common/Config.in"
30               "${OPENTHREADS_CONFIG_HEADER}")
31
32SET(OPENTHREADS_VERSION_HEADER "${PROJECT_SOURCE_DIR}/include/OpenThreads/Version")
33CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/common/Version.in"
34               "${OPENTHREADS_VERSION_HEADER}")
35
36
37################################################################################
38# Set Version Info resource file
39
40IF(MSVC)
41    SET(OPENTHREADS_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenThreadsVersionInfo.rc")
42    CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenThreadsVersionInfo.rc.in"
43                   "${OPENTHREADS_VERSIONINFO_RC}")
44ENDIF()
45
46
47# INSTALL_FILES(/include/OpenThreads/ FILES "${OPENTHREADS_CONFIG_HEADER}")
48
49################################################################################
50
51SET(HEADER_PATH ${OpenThreads_SOURCE_DIR}/include/OpenThreads)
52SET(OpenThreads_PUBLIC_HEADERS
53    ${HEADER_PATH}/Atomic
54    ${HEADER_PATH}/Barrier
55    ${HEADER_PATH}/Block
56    ${HEADER_PATH}/Condition
57    ${HEADER_PATH}/Exports
58    ${HEADER_PATH}/Mutex 
59    ${HEADER_PATH}/ReadWriteMutex 
60    ${HEADER_PATH}/ReentrantMutex 
61    ${HEADER_PATH}/ScopedLock 
62    ${HEADER_PATH}/Thread
63    ${HEADER_PATH}/Version
64    ${OPENTHREADS_CONFIG_HEADER}
65)
66
67IF(NOT ANDROID)
68# Use our modified version of FindThreads.cmake which has Sproc hacks.
69    FIND_PACKAGE(Threads)
70ENDIF()
71# Do we have sproc?
72IF(CMAKE_SYSTEM MATCHES IRIX)
73    IF(CMAKE_USE_SPROC_INIT)
74        # In this case, only Sproc exists, so no option.
75        SET(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS 1)
76    ELSE()
77        IF(CMAKE_HAVE_SPROC_H)
78            OPTION(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS "Set to ON to build OpenThreads against sproc instead of pthreads" OFF)
79        ENDIF()
80    ENDIF()
81ENDIF(CMAKE_SYSTEM MATCHES IRIX)
82
83# Add support for using Qt threads
84IF(QT4_FOUND OR Qt5Widgets_FOUND)
85    OPTION(BUILD_OPENTHREADS_WITH_QT "Build OpenThreads with Qt threading support." OFF)
86ENDIF()
87
88# Maybe we should be using the FindThreads.cmake module?
89IF(ANDROID)
90    SUBDIRS(pthreads)
91ELSEIF((QT4_FOUND OR Qt5Widgets_FOUND) AND BUILD_OPENTHREADS_WITH_QT)
92    SUBDIRS(qt)
93ELSEIF(WIN32)
94    # So I think Cygwin wants to use pthreads
95    IF(CYGWIN)
96        SUBDIRS(pthreads)
97    ELSE()
98        # Everybody else including Msys should probably go here
99        SUBDIRS(win32)
100        # examples)
101    ENDIF()
102ELSE()
103    IF(UNIX)
104        IF(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS)
105            SUBDIRS(sproc)
106        ELSE()
107            SUBDIRS(pthreads)
108        ENDIF()
109    ELSE()
110        MESSAGE("Sorry, OpenThreads may not support your platform")
111    ENDIF()
112ENDIF()
113
114# Make sure everyone can find Config
115INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
116
117# Generate pkg-config configuration file
118
119CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/openthreads.pc.in
120        ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openthreads.pc
121    @ONLY
122    )
123
124INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openthreads.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig  COMPONENT libopenthreads-dev)
Note: See TracBrowser for help on using the browser.