author | Vittorio Giovara <vittorio.giovara@gmail.com> |
Wed, 11 Nov 2015 18:40:52 +0100 | |
changeset 11371 | 78156dc2cab3 |
parent 9236 | ddd675825672 |
child 11381 | 5375b9168fc2 |
permissions | -rw-r--r-- |
7768 | 1 |
# PhysicsFS; a portable, flexible file i/o abstraction. |
2 |
# Copyright (C) 2007 Ryan C. Gordon. |
|
3 |
# |
|
4 |
# Please see the file LICENSE.txt in the source's root directory. |
|
5 |
||
8360 | 6 |
## lines starting with '##' are lines overridden/modified/added by Hedgewars configuration |
7 |
##CMAKE_MINIMUM_REQUIRED(VERSION 2.4) |
|
8 |
##PROJECT(PhysicsFS) |
|
9 |
set(PHYSFS_VERSION 2.1.0) |
|
7768 | 10 |
|
11 |
# Increment this if/when we break backwards compatibility. |
|
8360 | 12 |
set(PHYSFS_SOVERSION 1) |
7768 | 13 |
|
14 |
# I hate that they define "WIN32" ... we're about to move to Win64...I hope! |
|
8360 | 15 |
if(WIN32 AND NOT WINDOWS) |
16 |
set(WINDOWS TRUE) |
|
17 |
endif(WIN32 AND NOT WINDOWS) |
|
8286 | 18 |
|
7768 | 19 |
# Bleh, let's do it for "APPLE" too. |
8360 | 20 |
if(APPLE AND NOT MACOSX) |
21 |
set(MACOSX TRUE) |
|
22 |
endif(APPLE AND NOT MACOSX) |
|
7768 | 23 |
|
24 |
# For now, Haiku and BeOS are the same, as far as the build system cares. |
|
8360 | 25 |
if(HAIKU AND NOT BEOS) |
26 |
set(BEOS TRUE) |
|
27 |
endif(HAIKU AND NOT BEOS) |
|
7768 | 28 |
|
8360 | 29 |
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") |
30 |
set(SOLARIS TRUE) |
|
31 |
endif(CMAKE_SYSTEM_NAME STREQUAL "SunOS") |
|
7768 | 32 |
|
8360 | 33 |
include(CheckIncludeFile) |
34 |
include(CheckLibraryExists) |
|
35 |
include(CheckCSourceCompiles) |
|
7768 | 36 |
|
37 |
||
8360 | 38 |
if(MACOSX) |
7768 | 39 |
# Fallback to older OS X on PowerPC to support wider range of systems... |
8360 | 40 |
if(CMAKE_OSX_ARCHITECTURES MATCHES ppc) |
41 |
add_definitions(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020) |
|
9185 | 42 |
list(APPEND OTHER_LDFLAGS "-mmacosx-version-min=10.2") |
8360 | 43 |
endif(CMAKE_OSX_ARCHITECTURES MATCHES ppc) |
7768 | 44 |
|
45 |
# Need these everywhere... |
|
8360 | 46 |
add_definitions(-fno-common) |
9185 | 47 |
find_library(foundation_framework NAMES Foundation) |
48 |
list(APPEND OTHER_LDFLAGS ${foundation_framework}) |
|
8360 | 49 |
find_library(iokit_framework NAMES IOKit) |
50 |
list(APPEND OTHER_LDFLAGS ${iokit_framework}) |
|
51 |
endif(MACOSX) |
|
7768 | 52 |
|
53 |
# Add some gcc-specific command lines. |
|
8360 | 54 |
if(CMAKE_COMPILER_IS_GNUCC) |
9196 | 55 |
# Always build with debug symbols... you can strip it later. |
9158
b4d8baf4669a
this was getting annoying, don't error out on warnings physfs
koda
parents:
9117
diff
changeset
|
56 |
add_definitions(-g -fsigned-char) |
8360 | 57 |
endif(CMAKE_COMPILER_IS_GNUCC) |
7768 | 58 |
|
8360 | 59 |
if(CMAKE_C_COMPILER_ID STREQUAL "SunPro") |
60 |
add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT) |
|
61 |
add_definitions(-xldscope=hidden) |
|
62 |
endif(CMAKE_C_COMPILER_ID STREQUAL "SunPro") |
|
7768 | 63 |
|
8360 | 64 |
if(MSVC) |
7768 | 65 |
# VS.NET 8.0 got really really anal about strcpy, etc, which even if we |
66 |
# cleaned up our code, zlib, etc still use...so disable the warning. |
|
8360 | 67 |
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) |
68 |
endif(MSVC) |
|
69 |
||
7768 | 70 |
|
8360 | 71 |
if(BEOS) |
7768 | 72 |
# We add this explicitly, since we don't want CMake to think this |
73 |
# is a C++ project unless we're on BeOS. |
|
8360 | 74 |
set(PHYSFS_BEOS_SRCS src/platform_beos.cpp) |
75 |
find_library(BE_LIBRARY be) |
|
76 |
find_library(ROOT_LIBRARY root) |
|
8526
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
77 |
set(optional_library_libs ${optional_library_libs} ${BE_LIBRARY} ${ROOT_LIBRARY}) |
8360 | 78 |
endif(BEOS) |
79 |
||
7768 | 80 |
|
81 |
# Almost everything is "compiled" here, but things that don't apply to the |
|
82 |
# build are #ifdef'd out. This is to make it easy to embed PhysicsFS into |
|
83 |
# another project or bring up a new build system: just compile all the source |
|
84 |
# code and #define the things you want. |
|
8360 | 85 |
set(PHYSFS_SRCS |
8526
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
86 |
physfs.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
87 |
physfs_byteorder.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
88 |
physfs_unicode.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
89 |
platform_posix.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
90 |
platform_unix.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
91 |
platform_macosx.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
92 |
platform_windows.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
93 |
archiver_dir.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
94 |
archiver_unpacked.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
95 |
archiver_grp.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
96 |
archiver_hog.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
97 |
archiver_lzma.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
98 |
archiver_mvl.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
99 |
archiver_qpak.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
100 |
archiver_wad.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
101 |
archiver_zip.c |
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
102 |
archiver_iso9660.c |
7768 | 103 |
${PHYSFS_BEOS_SRCS} |
104 |
) |
|
105 |
||
106 |
||
107 |
# platform layers ... |
|
108 |
||
8360 | 109 |
if(UNIX) |
110 |
if(BEOS) |
|
111 |
set(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
112 |
set(PHYSFS_HAVE_THREAD_SUPPORT TRUE) |
|
113 |
set(HAVE_PTHREAD_H TRUE) |
|
114 |
else(BEOS) |
|
7768 | 115 |
CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H) |
8360 | 116 |
if(HAVE_UCRED_H) |
117 |
add_definitions(-DPHYSFS_HAVE_SYS_UCRED_H=1) |
|
118 |
set(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
119 |
endif(HAVE_UCRED_H) |
|
7768 | 120 |
|
121 |
CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H) |
|
8360 | 122 |
if(HAVE_MNTENT_H) |
123 |
add_definitions(-DPHYSFS_HAVE_MNTENT_H=1) |
|
124 |
set(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
125 |
endif(HAVE_MNTENT_H) |
|
7768 | 126 |
|
127 |
# !!! FIXME: Solaris fails this, because mnttab.h implicitly |
|
128 |
# !!! FIXME: depends on other system headers. :( |
|
129 |
#CHECK_INCLUDE_FILE(sys/mnttab.h HAVE_SYS_MNTTAB_H) |
|
130 |
CHECK_C_SOURCE_COMPILES(" |
|
131 |
#include <stdio.h> |
|
132 |
#include <sys/mnttab.h> |
|
133 |
int main(int argc, char **argv) { return 0; } |
|
134 |
" HAVE_SYS_MNTTAB_H) |
|
135 |
||
8360 | 136 |
if(HAVE_SYS_MNTTAB_H) |
137 |
add_definitions(-DPHYSFS_HAVE_SYS_MNTTAB_H=1) |
|
138 |
set(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
139 |
endif(HAVE_SYS_MNTTAB_H) |
|
7768 | 140 |
|
141 |
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H) |
|
8360 | 142 |
if(HAVE_PTHREAD_H) |
143 |
set(PHYSFS_HAVE_THREAD_SUPPORT TRUE) |
|
144 |
endif(HAVE_PTHREAD_H) |
|
145 |
endif(BEOS) |
|
146 |
endif(UNIX) |
|
7768 | 147 |
|
8360 | 148 |
if(WINDOWS) |
149 |
set(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
150 |
set(PHYSFS_HAVE_THREAD_SUPPORT TRUE) |
|
9192
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
151 |
list(APPEND OTHER_LDFLAGS ${SDL_LIBRARY}) |
8360 | 152 |
endif(WINDOWS) |
7768 | 153 |
|
8360 | 154 |
if(NOT PHYSFS_HAVE_CDROM_SUPPORT) |
155 |
add_definitions(-DPHYSFS_NO_CDROM_SUPPORT=1) |
|
156 |
message(WARNING " ***") |
|
157 |
message(WARNING " *** There is no CD-ROM support in this build!") |
|
158 |
message(WARNING " *** PhysicsFS will just pretend there are no discs.") |
|
159 |
message(WARNING " *** This may be fine, depending on how PhysicsFS is used,") |
|
160 |
message(WARNING " *** but is this what you REALLY wanted?") |
|
161 |
message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)") |
|
162 |
message(WARNING " ***") |
|
163 |
endif(NOT PHYSFS_HAVE_CDROM_SUPPORT) |
|
7768 | 164 |
|
8360 | 165 |
if(PHYSFS_HAVE_THREAD_SUPPORT) |
166 |
add_definitions(-D_REENTRANT -D_THREAD_SAFE) |
|
167 |
else(PHYSFS_HAVE_THREAD_SUPPORT) |
|
168 |
add_definitions(-DPHYSFS_NO_THREAD_SUPPORT=1) |
|
169 |
message(WARNING " ***") |
|
170 |
message(WARNING " *** There is no thread support in this build!") |
|
171 |
message(WARNING " *** PhysicsFS will NOT be reentrant!") |
|
172 |
message(WARNING " *** This may be fine, depending on how PhysicsFS is used,") |
|
173 |
message(WARNING " *** but is this what you REALLY wanted?") |
|
174 |
message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)") |
|
175 |
message(WARNING " ***") |
|
176 |
endif(PHYSFS_HAVE_THREAD_SUPPORT) |
|
7768 | 177 |
|
178 |
||
179 |
# Archivers ... |
|
180 |
||
8360 | 181 |
option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE) |
182 |
if(PHYSFS_ARCHIVE_ZIP) |
|
183 |
add_definitions(-DPHYSFS_SUPPORTS_ZIP=1) |
|
184 |
set(PHYSFS_FEATURES "ZIP") |
|
185 |
endif(PHYSFS_ARCHIVE_ZIP) |
|
7768 | 186 |
|
8542 | 187 |
#option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE) |
188 |
#if(PHYSFS_ARCHIVE_GRP) |
|
189 |
# add_definitions(-DPHYSFS_SUPPORTS_GRP=1) |
|
190 |
# set(PHYSFS_FEATURES "${PHYSFS_FEATURES} GRP") |
|
191 |
#endif(PHYSFS_ARCHIVE_GRP) |
|
7768 | 192 |
|
8542 | 193 |
#option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE) |
194 |
#if(PHYSFS_ARCHIVE_WAD) |
|
195 |
# add_definitions(-DPHYSFS_SUPPORTS_WAD=1) |
|
196 |
# set(PHYSFS_FEATURES "${PHYSFS_FEATURES} WAD") |
|
197 |
#endif(PHYSFS_ARCHIVE_WAD) |
|
7768 | 198 |
|
8542 | 199 |
#option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE) |
200 |
#if(PHYSFS_ARCHIVE_HOG) |
|
201 |
# add_definitions(-DPHYSFS_SUPPORTS_HOG=1) |
|
202 |
# set(PHYSFS_FEATURES "${PHYSFS_FEATURES} HOG") |
|
203 |
#endif(PHYSFS_ARCHIVE_HOG) |
|
7768 | 204 |
|
8542 | 205 |
#option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE) |
206 |
#if(PHYSFS_ARCHIVE_MVL) |
|
207 |
# add_definitions(-DPHYSFS_SUPPORTS_MVL=1) |
|
208 |
# set(PHYSFS_FEATURES "${PHYSFS_FEATURES} MVL") |
|
209 |
#endif(PHYSFS_ARCHIVE_MVL) |
|
7768 | 210 |
|
8542 | 211 |
#option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE) |
212 |
#if(PHYSFS_ARCHIVE_QPAK) |
|
213 |
# add_definitions(-DPHYSFS_SUPPORTS_QPAK=1) |
|
214 |
# set(PHYSFS_FEATURES "${PHYSFS_FEATURES} QPAK") |
|
215 |
#endif(PHYSFS_ARCHIVE_QPAK) |
|
7768 | 216 |
|
8542 | 217 |
#option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE) |
218 |
#if(PHYSFS_ARCHIVE_ISO9660) |
|
219 |
# add_definitions(-DPHYSFS_SUPPORTS_ISO9660=1) |
|
220 |
# set(PHYSFS_FEATURES "${PHYSFS_FEATURES} CD-ROM") |
|
221 |
#endif(PHYSFS_ARCHIVE_ISO9660) |
|
7768 | 222 |
|
8526
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
223 |
|
9192
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
224 |
##Hedgewars modifications |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
225 |
add_library(physfs ${PHYSFS_SRCS}) |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
226 |
set_target_properties(physfs PROPERTIES |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
227 |
VERSION ${PHYSFS_VERSION} |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
228 |
SOVERSION ${PHYSFS_SOVERSION} |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
229 |
OUTPUT_NAME ${physfs_output_name}) |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
230 |
target_link_libraries(physfs ${optional_library_libs} ${OTHER_LDFLAGS}) |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
231 |
install(TARGETS physfs RUNTIME DESTINATION ${target_binary_install_dir} |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
232 |
LIBRARY DESTINATION ${target_library_install_dir} |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
233 |
ARCHIVE DESTINATION ${target_library_install_dir}) |
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
234 |
get_target_property(physfs_fullpath physfs LOCATION) |
7768 | 235 |
|
8526
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
236 |
## added standard variables emulating the FindPhysFS.cmake ones (FORCE or cmake won't pick 'em) |
9209 | 237 |
set(PHYSFS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Physfs include dir" FORCE) |
9192
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
238 |
set(PHYSFS_LIBRARY ${physfs_fullpath} CACHE STRING "Physfs library path" FORCE) |
8526
9f2bd885d773
update cmake files to use the two libraries independently
koda
parents:
8522
diff
changeset
|
239 |
|
7768 | 240 |
|
9192
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
241 |
## removed language bindings and test program |
8360 | 242 |
## simplified configuration output |
9192
a8a717cf4a66
use BUILD_SHARED_LIBS to control whether a library is shared or static, make our bundled physfs library check for this configuration
koda
parents:
9188
diff
changeset
|
243 |
## merged shared and static library building |
7768 | 244 |
|
8542 | 245 |
#message(STATUS "PhysFS will be built with ${PHYSFS_FEATURES} support") |
7768 | 246 |