author | Ryan C. Gordon <icculus@icculus.org> |
Wed, 12 Mar 2008 21:22:22 +0000 | |
changeset 936 | 3b4b6c107a59 |
parent 919 | 932b44ae8335 |
child 950 | 7bb0b0d26479 |
permissions | -rw-r--r-- |
798 | 1 |
# PhysicsFS; a portable, flexible file i/o abstraction. |
2 |
# Copyright (C) 2007 Ryan C. Gordon. |
|
3 |
# |
|
809
116b8fe30371
Renamed LICENSE to LICENSE.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
805
diff
changeset
|
4 |
# Please see the file LICENSE.txt in the source's root directory. |
798 | 5 |
|
804
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
6 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.4) |
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
7 |
|
798 | 8 |
PROJECT(PhysicsFS) |
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
9 |
SET(PHYSFS_VERSION 1.1.1) |
805
b462f06edbca
Install libraries with a VERSION and SOVERSION.
Ryan C. Gordon <icculus@icculus.org>
parents:
804
diff
changeset
|
10 |
SET(PHYSFS_SOVERSION 1) |
798 | 11 |
|
12 |
# I hate that they define "WIN32" ... we're about to move to Win64...I hope! |
|
13 |
IF(WIN32 AND NOT WINDOWS) |
|
14 |
SET(WINDOWS TRUE) |
|
15 |
ENDIF(WIN32 AND NOT WINDOWS) |
|
16 |
||
17 |
# Bleh, let's do it for "APPLE" too. |
|
18 |
IF(APPLE AND NOT MACOSX) |
|
19 |
SET(MACOSX TRUE) |
|
20 |
ENDIF(APPLE AND NOT MACOSX) |
|
21 |
||
22 |
INCLUDE(CheckIncludeFile) |
|
23 |
INCLUDE(CheckLibraryExists) |
|
24 |
INCLUDE(CheckCSourceCompiles) |
|
25 |
||
26 |
INCLUDE_DIRECTORIES(.) |
|
27 |
#INCLUDE_DIRECTORIES(platform) |
|
28 |
#INCLUDE_DIRECTORIES(archivers) |
|
29 |
||
30 |
IF(MACOSX) |
|
803 | 31 |
# Fallback to older OS X on PowerPC to support wider range of systems... |
798 | 32 |
IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) |
801
a6d25b52f2c7
Fixes to CMakeLists.txt for Intel Mac.
Ryan C. Gordon <icculus@icculus.org>
parents:
799
diff
changeset
|
33 |
ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020) |
a6d25b52f2c7
Fixes to CMakeLists.txt for Intel Mac.
Ryan C. Gordon <icculus@icculus.org>
parents:
799
diff
changeset
|
34 |
SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2") |
798 | 35 |
ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) |
803 | 36 |
|
37 |
# Need these everywhere... |
|
38 |
ADD_DEFINITIONS(-fno-common) |
|
801
a6d25b52f2c7
Fixes to CMakeLists.txt for Intel Mac.
Ryan C. Gordon <icculus@icculus.org>
parents:
799
diff
changeset
|
39 |
SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -framework Carbon -framework IOKit") |
798 | 40 |
ENDIF(MACOSX) |
41 |
||
42 |
# Add some gcc-specific command lines. |
|
43 |
IF(CMAKE_COMPILER_IS_GNUCC) |
|
44 |
# Always build with debug symbols...you can strip it later. |
|
821
c7dd97edaa4e
Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents:
818
diff
changeset
|
45 |
ADD_DEFINITIONS(-g -pipe -Werror -fsigned-char) |
c7dd97edaa4e
Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents:
818
diff
changeset
|
46 |
|
c7dd97edaa4e
Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents:
818
diff
changeset
|
47 |
# Stupid BeOS generates warnings in the system headers. |
c7dd97edaa4e
Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents:
818
diff
changeset
|
48 |
IF(NOT BEOS) |
c7dd97edaa4e
Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents:
818
diff
changeset
|
49 |
ADD_DEFINITIONS(-Wall) |
c7dd97edaa4e
Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents:
818
diff
changeset
|
50 |
ENDIF(NOT BEOS) |
798 | 51 |
|
52 |
CHECK_C_SOURCE_COMPILES(" |
|
53 |
#if ((defined(__GNUC__)) && (__GNUC__ >= 4)) |
|
54 |
int main(int argc, char **argv) { int is_gcc4 = 1; return 0; } |
|
55 |
#else |
|
56 |
#error This is not gcc4. |
|
57 |
#endif |
|
58 |
" PHYSFS_IS_GCC4) |
|
59 |
||
60 |
IF(PHYSFS_IS_GCC4) |
|
61 |
ADD_DEFINITIONS(-fvisibility=hidden) |
|
62 |
ENDIF(PHYSFS_IS_GCC4) |
|
63 |
ENDIF(CMAKE_COMPILER_IS_GNUCC) |
|
64 |
||
836
6514fba91816
Patched to compile with latest Platform SDK.
Ryan C. Gordon <icculus@icculus.org>
parents:
833
diff
changeset
|
65 |
IF(MSVC) |
6514fba91816
Patched to compile with latest Platform SDK.
Ryan C. Gordon <icculus@icculus.org>
parents:
833
diff
changeset
|
66 |
# VS.NET 8.0 got really really anal about strcpy, etc, which even if we |
6514fba91816
Patched to compile with latest Platform SDK.
Ryan C. Gordon <icculus@icculus.org>
parents:
833
diff
changeset
|
67 |
# cleaned up our code, zlib, etc still use...so disable the warning. |
6514fba91816
Patched to compile with latest Platform SDK.
Ryan C. Gordon <icculus@icculus.org>
parents:
833
diff
changeset
|
68 |
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1) |
6514fba91816
Patched to compile with latest Platform SDK.
Ryan C. Gordon <icculus@icculus.org>
parents:
833
diff
changeset
|
69 |
ENDIF(MSVC) |
798 | 70 |
|
71 |
# Basic chunks of source code ... |
|
72 |
||
73 |
SET(ZLIB_SRCS |
|
74 |
zlib123/adler32.c |
|
75 |
zlib123/compress.c |
|
76 |
zlib123/crc32.c |
|
77 |
zlib123/deflate.c |
|
78 |
zlib123/gzio.c |
|
79 |
zlib123/infback.c |
|
80 |
zlib123/inffast.c |
|
81 |
zlib123/inflate.c |
|
82 |
zlib123/inftrees.c |
|
83 |
zlib123/trees.c |
|
84 |
zlib123/uncompr.c |
|
85 |
zlib123/zutil.c |
|
86 |
) |
|
87 |
||
88 |
SET(LZMA_SRCS |
|
919
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
89 |
lzma/C/7zCrc.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
90 |
lzma/C/Archive/7z/7zBuffer.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
91 |
lzma/C/Archive/7z/7zDecode.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
92 |
lzma/C/Archive/7z/7zExtract.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
93 |
lzma/C/Archive/7z/7zHeader.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
94 |
lzma/C/Archive/7z/7zIn.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
95 |
lzma/C/Archive/7z/7zItem.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
96 |
lzma/C/Archive/7z/7zMethodID.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
97 |
lzma/C/Compress/Branch/BranchX86.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
98 |
lzma/C/Compress/Branch/BranchX86_2.c |
932b44ae8335
Updated for lzma changes.
Ryan C. Gordon <icculus@icculus.org>
parents:
885
diff
changeset
|
99 |
lzma/C/Compress/Lzma/LzmaDecode.c |
798 | 100 |
) |
101 |
||
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
102 |
IF(BEOS) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
103 |
# We add this explicitly, since we don't want CMake to think this |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
104 |
# is a C++ project unless we're on BeOS. |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
105 |
SET(PHYSFS_BEOS_SRCS platform/beos.cpp) |
821
c7dd97edaa4e
Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents:
818
diff
changeset
|
106 |
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} be root) |
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
107 |
ENDIF(BEOS) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
108 |
|
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
109 |
# Almost everything is "compiled" here, but things that don't apply to the |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
110 |
# build are #ifdef'd out. This is to make it easy to embed PhysicsFS into |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
111 |
# another project or bring up a new build system: just compile all the source |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
112 |
# code and #define the things you want. |
798 | 113 |
SET(PHYSFS_SRCS |
114 |
physfs.c |
|
115 |
physfs_byteorder.c |
|
116 |
physfs_unicode.c |
|
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
117 |
platform/os2.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
118 |
platform/pocketpc.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
119 |
platform/posix.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
120 |
platform/unix.c |
847
5e5e6c067413
Split out Mac OS X code from unix.c and added some Carbon-specific code...
Ryan C. Gordon <icculus@icculus.org>
parents:
836
diff
changeset
|
121 |
platform/macosx.c |
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
122 |
platform/windows.c |
798 | 123 |
archivers/dir.c |
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
124 |
archivers/grp.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
125 |
archivers/hog.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
126 |
archivers/lzma.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
127 |
archivers/mvl.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
128 |
archivers/qpak.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
129 |
archivers/wad.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
130 |
archivers/zip.c |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
131 |
${PHYSFS_BEOS_SRCS} |
798 | 132 |
) |
133 |
||
134 |
||
135 |
# platform layers ... |
|
136 |
||
137 |
IF(UNIX) |
|
138 |
IF(BEOS) |
|
139 |
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
140 |
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
141 |
SET(HAVE_PTHREAD_H TRUE) |
798 | 142 |
ELSE(BEOS) |
143 |
# !!! FIXME |
|
144 |
# AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek]) |
|
145 |
CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H) |
|
146 |
IF(HAVE_UCRED_H) |
|
147 |
ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1) |
|
148 |
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
149 |
ENDIF(HAVE_UCRED_H) |
|
150 |
||
151 |
CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H) |
|
152 |
IF(HAVE_MNTENT_H) |
|
153 |
ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1) |
|
154 |
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
155 |
ENDIF(HAVE_MNTENT_H) |
|
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
156 |
|
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
157 |
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
158 |
IF(HAVE_PTHREAD_H) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
159 |
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
160 |
ELSE(HAVE_PTHREAD_H) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
161 |
ADD_DEFINITIONS(-DPHYSFS_NO_PTHREADS_SUPPORT=1) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
162 |
ENDIF(HAVE_PTHREAD_H) |
798 | 163 |
ENDIF(BEOS) |
164 |
ENDIF(UNIX) |
|
165 |
||
166 |
IF(WINDOWS) |
|
167 |
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) |
|
168 |
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) |
|
169 |
ENDIF(WINDOWS) |
|
170 |
||
171 |
IF(NOT PHYSFS_HAVE_CDROM_SUPPORT) |
|
172 |
ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1) |
|
173 |
MESSAGE(WARNING " ***") |
|
174 |
MESSAGE(WARNING " *** There is no CD-ROM support in this build!") |
|
175 |
MESSAGE(WARNING " *** PhysicsFS will just pretend there are no discs.") |
|
176 |
MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,") |
|
177 |
MESSAGE(WARNING " *** but is this what you REALLY wanted?") |
|
178 |
MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)") |
|
179 |
MESSAGE(WARNING " ***") |
|
180 |
ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT) |
|
181 |
||
182 |
IF(PHYSFS_HAVE_THREAD_SUPPORT) |
|
183 |
ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE) |
|
184 |
ELSE(PHYSFS_HAVE_THREAD_SUPPORT) |
|
185 |
MESSAGE(WARNING " ***") |
|
186 |
MESSAGE(WARNING " *** There is no thread support in this build!") |
|
187 |
MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!") |
|
188 |
MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,") |
|
189 |
MESSAGE(WARNING " *** but is this what you REALLY wanted?") |
|
190 |
MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)") |
|
191 |
MESSAGE(WARNING " ***") |
|
192 |
ENDIF(PHYSFS_HAVE_THREAD_SUPPORT) |
|
193 |
||
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
194 |
CHECK_INCLUDE_FILE(assert.h HAVE_ASSERT_H) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
195 |
IF(HAVE_ASSERT_H) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
196 |
ADD_DEFINITIONS(-DHAVE_ASSERT_H=1) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
197 |
ENDIF(HAVE_ASSERT_H) |
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
198 |
|
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
199 |
|
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
200 |
|
798 | 201 |
# Archivers ... |
202 |
||
203 |
OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE) |
|
204 |
IF(PHYSFS_ARCHIVE_ZIP) |
|
205 |
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1) |
|
206 |
SET(PHYSFS_NEED_ZLIB TRUE) |
|
207 |
ENDIF(PHYSFS_ARCHIVE_ZIP) |
|
208 |
||
209 |
OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE) |
|
210 |
IF(PHYSFS_ARCHIVE_7Z) |
|
211 |
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1) |
|
212 |
# !!! FIXME: rename to 7z.c? |
|
818
e36f23f49042
Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
213 |
SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS}) |
798 | 214 |
ENDIF(PHYSFS_ARCHIVE_7Z) |
215 |
||
216 |
OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE) |
|
217 |
IF(PHYSFS_ARCHIVE_GRP) |
|
218 |
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1) |
|
219 |
ENDIF(PHYSFS_ARCHIVE_GRP) |
|
220 |
||
221 |
OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE) |
|
222 |
IF(PHYSFS_ARCHIVE_WAD) |
|
223 |
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1) |
|
224 |
ENDIF(PHYSFS_ARCHIVE_WAD) |
|
225 |
||
226 |
OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE) |
|
227 |
IF(PHYSFS_ARCHIVE_HOG) |
|
228 |
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1) |
|
229 |
ENDIF(PHYSFS_ARCHIVE_HOG) |
|
230 |
||
231 |
OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE) |
|
232 |
IF(PHYSFS_ARCHIVE_MVL) |
|
233 |
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1) |
|
234 |
ENDIF(PHYSFS_ARCHIVE_MVL) |
|
235 |
||
236 |
OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE) |
|
237 |
IF(PHYSFS_ARCHIVE_QPAK) |
|
238 |
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1) |
|
239 |
ENDIF(PHYSFS_ARCHIVE_QPAK) |
|
240 |
||
241 |
||
242 |
# See if some archiver required zlib, and see about using system version. |
|
243 |
||
244 |
IF(PHYSFS_NEED_ZLIB) |
|
245 |
CHECK_INCLUDE_FILE(zlib.h HAVE_ZLIB_H) |
|
246 |
IF(HAVE_ZLIB_H) |
|
247 |
CHECK_LIBRARY_EXISTS("z" "inflate" "" HAVE_LIBZ) |
|
248 |
IF(HAVE_LIBZ) |
|
249 |
SET(HAVE_SYSTEM_ZLIB TRUE) |
|
250 |
ENDIF(HAVE_LIBZ) |
|
251 |
ENDIF(HAVE_ZLIB_H) |
|
252 |
||
253 |
IF(HAVE_SYSTEM_ZLIB) |
|
254 |
OPTION(PHYSFS_INTERNAL_ZLIB "Link own zlib instead of system library" FALSE) |
|
255 |
ELSE(HAVE_SYSTEM_ZLIB) |
|
256 |
SET(PHYSFS_INTERNAL_ZLIB TRUE) |
|
257 |
ENDIF(HAVE_SYSTEM_ZLIB) |
|
258 |
||
259 |
IF(PHYSFS_INTERNAL_ZLIB) |
|
260 |
INCLUDE_DIRECTORIES(zlib123) |
|
261 |
ADD_DEFINITIONS(-DZ_PREFIX=1) |
|
262 |
SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${ZLIB_SRCS}) |
|
263 |
ELSE(PHYSFS_INTERNAL_ZLIB) |
|
264 |
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} z) |
|
265 |
ENDIF(PHYSFS_INTERNAL_ZLIB) |
|
266 |
ENDIF(PHYSFS_NEED_ZLIB) |
|
267 |
||
802
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
268 |
OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
269 |
IF(PHYSFS_BUILD_STATIC) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
270 |
ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS}) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
271 |
SET_TARGET_PROPERTIES(physfs-static PROPERTIES OUTPUT_NAME "physfs") |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
272 |
SET(PHYSFS_LIB_TARGET physfs-static) |
833
b260f190aa59
Whoops, switched two strings in CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
827
diff
changeset
|
273 |
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") |
802
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
274 |
ENDIF(PHYSFS_BUILD_STATIC) |
798 | 275 |
|
802
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
276 |
OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
277 |
IF(PHYSFS_BUILD_SHARED) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
278 |
ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS}) |
805
b462f06edbca
Install libraries with a VERSION and SOVERSION.
Ryan C. Gordon <icculus@icculus.org>
parents:
804
diff
changeset
|
279 |
SET_TARGET_PROPERTIES(physfs PROPERTIES VERSION ${PHYSFS_VERSION}) |
b462f06edbca
Install libraries with a VERSION and SOVERSION.
Ryan C. Gordon <icculus@icculus.org>
parents:
804
diff
changeset
|
280 |
SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION}) |
802
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
281 |
TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
282 |
SET(PHYSFS_LIB_TARGET physfs) |
833
b260f190aa59
Whoops, switched two strings in CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
827
diff
changeset
|
283 |
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs") |
802
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
284 |
ENDIF(PHYSFS_BUILD_SHARED) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
285 |
|
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
286 |
IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
287 |
MESSAGE(FATAL "Both shared and static libraries are disabled!") |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
288 |
ENDIF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
289 |
|
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
290 |
# CMake FAQ says I need this... |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
291 |
IF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
292 |
SET_TARGET_PROPERTIES(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
293 |
SET_TARGET_PROPERTIES(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
294 |
ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC) |
798 | 295 |
|
878
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
296 |
OPTION(PHYSFS_BUILD_TEST "Build stdio test program." TRUE) |
798 | 297 |
MARK_AS_ADVANCED(PHYSFS_BUILD_TEST) |
298 |
IF(PHYSFS_BUILD_TEST) |
|
299 |
CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_H) |
|
300 |
CHECK_INCLUDE_FILE(readline/history.h HAVE_HISTORY_H) |
|
301 |
IF(HAVE_READLINE_H AND HAVE_HISTORY_H) |
|
302 |
SET(CMAKE_REQUIRED_LIBRARIES curses) |
|
303 |
CHECK_LIBRARY_EXISTS("readline" "readline" "" HAVE_LIBREADLINE) |
|
304 |
CHECK_LIBRARY_EXISTS("readline" "history" "" HAVE_LIBHISTORY) |
|
305 |
IF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY) |
|
306 |
SET(HAVE_SYSTEM_READLINE TRUE) |
|
307 |
SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} " " readline curses) |
|
308 |
ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1) |
|
309 |
ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY) |
|
310 |
ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H) |
|
311 |
ADD_EXECUTABLE(test_physfs test/test_physfs.c) |
|
802
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
312 |
TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS}) |
804
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
313 |
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs") |
798 | 314 |
ENDIF(PHYSFS_BUILD_TEST) |
315 |
||
878
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
316 |
OPTION(PHYSFS_BUILD_WX_TEST "Build wxWidgets test program." TRUE) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
317 |
MARK_AS_ADVANCED(PHYSFS_BUILD_WX_TEST) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
318 |
IF(PHYSFS_BUILD_WX_TEST) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
319 |
SET(wxWidgets_USE_LIBS base core adv) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
320 |
SET(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
321 |
FIND_PACKAGE(wxWidgets) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
322 |
IF(wxWidgets_FOUND) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
323 |
INCLUDE(${wxWidgets_USE_FILE}) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
324 |
ADD_EXECUTABLE(wxtest_physfs test/wxtest_physfs.cpp) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
325 |
SET_SOURCE_FILES_PROPERTIES(test/wxtest_physfs.cpp COMPILE_FLAGS ${wxWidgets_CXX_FLAGS}) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
326 |
TARGET_LINK_LIBRARIES(wxtest_physfs ${PHYSFS_LIB_TARGET} ${wxWidgets_LIBRARIES} ${OTHER_LDFLAGS}) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
327 |
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";wxtest_physfs") |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
328 |
ELSE(wxWidgets_FOUND) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
329 |
MESSAGE(STATUS "wxWidgets not found. Disabling wx test app.") |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
330 |
SET(PHYSFS_BUILD_WX_TEST FALSE) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
331 |
ENDIF(wxWidgets_FOUND) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
332 |
ENDIF(PHYSFS_BUILD_WX_TEST) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
333 |
|
804
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
334 |
INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS} |
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
335 |
RUNTIME DESTINATION bin |
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
336 |
LIBRARY DESTINATION lib |
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
337 |
ARCHIVE DESTINATION lib) |
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
338 |
INSTALL(FILES physfs.h DESTINATION include) |
45c29325e017
Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents:
803
diff
changeset
|
339 |
|
798 | 340 |
FIND_PACKAGE(Doxygen) |
341 |
IF(DOXYGEN_FOUND) |
|
342 |
ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} COMMENT "Building documentation") |
|
343 |
ELSE(DOXYGEN_FOUND) |
|
344 |
MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.") |
|
345 |
ENDIF(DOXYGEN_FOUND) |
|
346 |
||
885
e1fe7fe85939
Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
878
diff
changeset
|
347 |
IF(UNIX) |
e1fe7fe85939
Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
878
diff
changeset
|
348 |
ADD_CUSTOM_TARGET(dist ./extras/makedist.sh ${PHYSFS_VERSION} COMMENT "Building source tarball") |
e1fe7fe85939
Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
878
diff
changeset
|
349 |
ENDIF(UNIX) |
798 | 350 |
|
351 |
MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE) |
|
352 |
IF(${_VALUE}) |
|
353 |
MESSAGE(STATUS " ${_NAME}: enabled") |
|
354 |
ELSE(${_VALUE}) |
|
355 |
MESSAGE(STATUS " ${_NAME}: disabled") |
|
356 |
ENDIF(${_VALUE}) |
|
357 |
ENDMACRO(MESSAGE_BOOL_OPTION) |
|
358 |
||
359 |
MESSAGE(STATUS "PhysicsFS will build with the following options:") |
|
360 |
MESSAGE_BOOL_OPTION("ZIP support" PHYSFS_ARCHIVE_ZIP) |
|
361 |
MESSAGE_BOOL_OPTION("7zip support" PHYSFS_ARCHIVE_7Z) |
|
362 |
MESSAGE_BOOL_OPTION("GRP support" PHYSFS_ARCHIVE_GRP) |
|
363 |
MESSAGE_BOOL_OPTION("WAD support" PHYSFS_ARCHIVE_WAD) |
|
364 |
MESSAGE_BOOL_OPTION("HOG support" PHYSFS_ARCHIVE_HOG) |
|
365 |
MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL) |
|
366 |
MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK) |
|
367 |
MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT) |
|
368 |
MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT) |
|
369 |
MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB) |
|
802
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
370 |
MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC) |
d04103af68a5
Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents:
801
diff
changeset
|
371 |
MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED) |
878
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
372 |
MESSAGE_BOOL_OPTION("Build wxWidgets test program" PHYSFS_BUILD_WX_TEST) |
6d65c5e0049a
Added initial work on a wxWidgets-based test app.
Ryan C. Gordon <icculus@icculus.org>
parents:
847
diff
changeset
|
373 |
MESSAGE_BOOL_OPTION("Build stdio test program" PHYSFS_BUILD_TEST) |
798 | 374 |
IF(PHYSFS_BUILD_TEST) |
375 |
MESSAGE_BOOL_OPTION(" Use readline in test program" HAVE_SYSTEM_READLINE) |
|
376 |
ENDIF(PHYSFS_BUILD_TEST) |
|
377 |
||
378 |
# end of CMakeLists.txt ... |
|
379 |