forked from aforsythe/IlmBase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
145 lines (128 loc) · 5.52 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT ( ILMBase )
IF ( NOT WIN32)
ADD_DEFINITIONS ( -pthread )
ENDIF ()
INCLUDE_DIRECTORIES ( Iex IexMath Imath Half config IlmThread IexTest ImathTest HalfTest )
MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_value)
GET_TARGET_PROPERTY (${_variable} ${_target} ${_property})
IF (${_variable} MATCHES NOTFOUND)
SET (${_variable} ${_default_value})
ENDIF (${_variable} MATCHES NOTFOUND)
ENDMACRO (GET_TARGET_PROPERTY_WITH_DEFAULT)
MACRO(CREATE_LIBTOOL_FILE _target _install_DIR)
GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_static_lib ${_target} STATIC_LIB "")
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dependency_libs ${_target} LT_DEPENDENCY_LIBS "")
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_current ${_target} LT_VERSION_CURRENT 0)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_age ${_target} LT_VERSION_AGE 0)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_revision ${_target} LT_VERSION_REVISION 0)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_installed ${_target} LT_INSTALLED yes)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "")
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "")
GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
SET(_laname ${PROJECT_BINARY_DIR}/${_laname}.la)
FILE(WRITE ${_laname} "# ${_laname} - a libtool library file\n")
FILE(WRITE ${_laname} "# Generated by CMake ${CMAKE_VERSION} (like GNU libtool)\n")
FILE(WRITE ${_laname} "\n# Please DO NOT delete this file!\n# It is necessary for linking the library with libtool.\n\n" )
FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
FILE(APPEND ${_laname} "dlname='${_soname}'\n\n")
FILE(APPEND ${_laname} "# Names of this library.\n")
FILE(APPEND ${_laname} "library_names='${_soname}.${_target_current}.${_target_age}.${_target_revision} ${_soname}.${_target_current} ${_soname}'\n\n")
FILE(APPEND ${_laname} "# The name of the static archive.\n")
FILE(APPEND ${_laname} "old_library='${_target_static_lib}'\n\n")
FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
FILE(APPEND ${_laname} "dependency_libs='${_target_dependency_libs}'\n\n")
FILE(APPEND ${_laname} "# Names of additional weak libraries provided by this library\n")
FILE(APPEND ${_laname} "weak_library_names=\n\n")
FILE(APPEND ${_laname} "# Version information for ${_laname}.\n")
FILE(APPEND ${_laname} "current=${_target_current}\n")
FILE(APPEND ${_laname} "age=${_target_age}\n")
FILE(APPEND ${_laname} "revision=${_target_revision}\n\n")
FILE(APPEND ${_laname} "# Is this an already installed library?\n")
FILE(APPEND ${_laname} "installed=${_target_installed}\n\n")
FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\n")
FILE(APPEND ${_laname} "shouldnotlink=${_target_shouldnotlink}\n\n")
FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\n")
FILE(APPEND ${_laname} "dlopen='${_target_dlopen}'\n")
FILE(APPEND ${_laname} "dlpreopen='${_target_dlpreopen}'\n\n")
FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}${_install_DIR}'\n")
INSTALL( FILES ${_laname} DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR})
ENDMACRO(CREATE_LIBTOOL_FILE)
ADD_SUBDIRECTORY ( Half )
ADD_SUBDIRECTORY ( Iex )
ADD_SUBDIRECTORY ( IexMath )
ADD_SUBDIRECTORY ( Imath )
ADD_SUBDIRECTORY ( IlmThread )
IF (WIN32)
FILE ( COPY ${CMAKE_SOURCE_DIR}/config.windows/IlmBaseConfig.h
DESTINATION ${CMAKE_SOURCE_DIR}/config
)
ELSE ()
FILE ( WRITE ${CMAKE_SOURCE_DIR}/config/IlmBaseConfig.h "#define HAVE_PTHREAD 1\n" )
FILE ( APPEND ${CMAKE_SOURCE_DIR}/config/IlmBaseConfig.h "#define HAVE_POSIX_SEMAPHORES 1\n" )
FILE ( APPEND ${CMAKE_SOURCE_DIR}/config/IlmBaseConfig.h "#define ILMBASE_VERSION_STRING \"2.0.0\"\n" )
FILE ( APPEND ${CMAKE_SOURCE_DIR}/config/IlmBaseConfig.h "#define ILMBASE_PACKAGE_STRING \"IlmBase 2.0.0\"\n" )
ENDIF ()
SET_TARGET_PROPERTIES ( Half
PROPERTIES
VERSION 10.0.0
SOVERSION 10
)
SET_TARGET_PROPERTIES ( Iex
PROPERTIES
VERSION 10.0.0
SOVERSION 10
)
SET_TARGET_PROPERTIES ( Imath
PROPERTIES
VERSION 10.0.0
SOVERSION 10
)
SET_TARGET_PROPERTIES ( IlmThread
PROPERTIES
VERSION 10.0.0
SOVERSION 10
)
SET_TARGET_PROPERTIES ( IexMath
PROPERTIES
VERSION 10.0.0
SOVERSION 10
)
IF ( NOT WIN32 )
CREATE_LIBTOOL_FILE ( Half /lib )
CREATE_LIBTOOL_FILE ( Iex /lib )
CREATE_LIBTOOL_FILE ( IexMath /lib )
CREATE_LIBTOOL_FILE ( Imath /lib )
CREATE_LIBTOOL_FILE ( IlmThread /lib )
ENDIF ()
# Tests
ADD_SUBDIRECTORY ( HalfTest )
ADD_SUBDIRECTORY ( IexTest )
ADD_SUBDIRECTORY ( ImathTest )
# Installation
INSTALL ( FILES
config/IlmBaseConfig.h
DESTINATION
include/OpenEXR
)
FILE ( WRITE ${CMAKE_BINARY_DIR}/IlmBase.pc "prefix=${CMAKE_INSTALL_PREFIX}\n" )
FILE ( APPEND ${CMAKE_BINARY_DIR}/IlmBase.pc "exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
OpenEXR_includedir=\${prefix}/include/OpenEXR
Name: IlmBase
Description: Base math and exception libraries
Version: 1.1.0
Libs: -L\${libdir} -lImath -lIexMath -lHalf -lIex -lIlmThread -pthread
Cflags: -pthread -I\${OpenEXR_includedir}
")
INSTALL ( FILES
${CMAKE_BINARY_DIR}/IlmBase.pc
DESTINATION
lib/pkgconfig
)