CMakeLists.txt
changeset 818 e36f23f49042
parent 809 116b8fe30371
child 821 c7dd97edaa4e
equal deleted inserted replaced
817:f2131d5dc3dd 818:e36f23f49042
     4 # Please see the file LICENSE.txt in the source's root directory.
     4 # Please see the file LICENSE.txt in the source's root directory.
     5 
     5 
     6 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
     6 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
     7 
     7 
     8 PROJECT(PhysicsFS)
     8 PROJECT(PhysicsFS)
     9 SET(PHYSFS_VERSION 1.1.2)
     9 SET(PHYSFS_VERSION 1.1.1)
    10 SET(PHYSFS_SOVERSION 1)
    10 SET(PHYSFS_SOVERSION 1)
    11 
    11 
    12 # I hate that they define "WIN32" ... we're about to move to Win64...I hope!
    12 # I hate that they define "WIN32" ... we're about to move to Win64...I hope!
    13 IF(WIN32 AND NOT WINDOWS)
    13 IF(WIN32 AND NOT WINDOWS)
    14     SET(WINDOWS TRUE)
    14     SET(WINDOWS TRUE)
    86     lzma/7zMethodID.c
    86     lzma/7zMethodID.c
    87     lzma/LzmaDecode.c
    87     lzma/LzmaDecode.c
    88     lzma/LzmaStateDecode.c
    88     lzma/LzmaStateDecode.c
    89 )
    89 )
    90 
    90 
       
    91 IF(BEOS)
       
    92     # We add this explicitly, since we don't want CMake to think this
       
    93     #  is a C++ project unless we're on BeOS.
       
    94     SET(PHYSFS_BEOS_SRCS platform/beos.cpp)
       
    95 ENDIF(BEOS)
       
    96 
       
    97 # Almost everything is "compiled" here, but things that don't apply to the
       
    98 #  build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
       
    99 #  another project or bring up a new build system: just compile all the source
       
   100 #  code and #define the things you want.
    91 SET(PHYSFS_SRCS
   101 SET(PHYSFS_SRCS
    92     physfs.c
   102     physfs.c
    93     physfs_byteorder.c
   103     physfs_byteorder.c
    94     physfs_unicode.c
   104     physfs_unicode.c
       
   105     platform/macclassic.c
       
   106     platform/os2.c
       
   107     platform/pocketpc.c
       
   108     platform/posix.c
       
   109     platform/unix.c
       
   110     platform/windows.c
    95     archivers/dir.c
   111     archivers/dir.c
       
   112     archivers/grp.c
       
   113     archivers/hog.c
       
   114     archivers/lzma.c
       
   115     archivers/mvl.c
       
   116     archivers/qpak.c
       
   117     archivers/wad.c
       
   118     archivers/zip.c
       
   119     ${PHYSFS_BEOS_SRCS}
    96 )
   120 )
    97 
   121 
    98 
   122 
    99 # platform layers ...
   123 # platform layers ...
   100 
   124 
   101 IF(UNIX)
   125 IF(UNIX)
   102     SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/posix.c)
       
   103     IF(BEOS)
   126     IF(BEOS)
   104         SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/beos.cpp)
       
   105         SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
   127         SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
       
   128         SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
       
   129         SET(HAVE_PTHREAD_H TRUE)
   106     ELSE(BEOS)
   130     ELSE(BEOS)
   107         SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/unix.c)
       
   108         # !!! FIXME
   131         # !!! FIXME
   109         #  AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek])
   132         #  AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek])
   110         CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H)
   133         CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H)
   111         IF(HAVE_UCRED_H)
   134         IF(HAVE_UCRED_H)
   112             ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1)
   135             ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1)
   116         CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H)
   139         CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H)
   117         IF(HAVE_MNTENT_H)
   140         IF(HAVE_MNTENT_H)
   118             ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1)
   141             ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1)
   119             SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
   142             SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
   120         ENDIF(HAVE_MNTENT_H)
   143         ENDIF(HAVE_MNTENT_H)
       
   144 
       
   145         CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
       
   146         IF(HAVE_PTHREAD_H)
       
   147             SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
       
   148         ELSE(HAVE_PTHREAD_H)
       
   149             ADD_DEFINITIONS(-DPHYSFS_NO_PTHREADS_SUPPORT=1)
       
   150         ENDIF(HAVE_PTHREAD_H)
   121     ENDIF(BEOS)
   151     ENDIF(BEOS)
   122 
       
   123     CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
       
   124     IF(HAVE_PTHREAD_H)
       
   125         SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
       
   126     ELSE(HAVE_PTHREAD_H)
       
   127         ADD_DEFINITIONS(-DPHYSFS_NO_PTHREADS_SUPPORT=1)
       
   128     ENDIF(HAVE_PTHREAD_H)
       
   129 ENDIF(UNIX)
   152 ENDIF(UNIX)
   130 
   153 
   131 IF(WINDOWS)
   154 IF(WINDOWS)
   132     SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/windows.c)
       
   133     SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
   155     SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
   134     SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
   156     SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
   135     # !!! FIXME: platform/pocketpc.c ... ?
       
   136 ENDIF(WINDOWS)
   157 ENDIF(WINDOWS)
   137 
   158 
   138 IF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
   159 IF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
   139     ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1)
   160     ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1)
   140     MESSAGE(WARNING " ***")
   161     MESSAGE(WARNING " ***")
   156     MESSAGE(WARNING " ***   but is this what you REALLY wanted?")
   177     MESSAGE(WARNING " ***   but is this what you REALLY wanted?")
   157     MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
   178     MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
   158     MESSAGE(WARNING " ***")
   179     MESSAGE(WARNING " ***")
   159 ENDIF(PHYSFS_HAVE_THREAD_SUPPORT)
   180 ENDIF(PHYSFS_HAVE_THREAD_SUPPORT)
   160 
   181 
       
   182 CHECK_INCLUDE_FILE(assert.h HAVE_ASSERT_H)
       
   183 IF(HAVE_ASSERT_H)
       
   184     ADD_DEFINITIONS(-DHAVE_ASSERT_H=1)
       
   185 ENDIF(HAVE_ASSERT_H)
       
   186 
       
   187 
       
   188 
   161 # Archivers ...
   189 # Archivers ...
   162 
   190 
   163 OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
   191 OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
   164 IF(PHYSFS_ARCHIVE_ZIP)
   192 IF(PHYSFS_ARCHIVE_ZIP)
   165     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1)
   193     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1)
   166     SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/zip.c)
       
   167     SET(PHYSFS_NEED_ZLIB TRUE)
   194     SET(PHYSFS_NEED_ZLIB TRUE)
   168 ENDIF(PHYSFS_ARCHIVE_ZIP)
   195 ENDIF(PHYSFS_ARCHIVE_ZIP)
   169 
   196 
   170 OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
   197 OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
   171 IF(PHYSFS_ARCHIVE_7Z)
   198 IF(PHYSFS_ARCHIVE_7Z)
   172     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1)
   199     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1)
   173     # !!! FIXME: rename to 7z.c?
   200     # !!! FIXME: rename to 7z.c?
   174     SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS} archivers/lzma.c)
   201     SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS})
   175     INCLUDE_DIRECTORIES(lzma)
   202     INCLUDE_DIRECTORIES(lzma)
   176     ADD_DEFINITIONS(-D_LZMA_IN_CB=1)
   203     ADD_DEFINITIONS(-D_LZMA_IN_CB=1)
   177     ADD_DEFINITIONS(-D_LZMA_PROB32=1)
   204     ADD_DEFINITIONS(-D_LZMA_PROB32=1)
   178     ADD_DEFINITIONS(-D_LZMA_SYSTEM_SIZE_T=1)
   205     ADD_DEFINITIONS(-D_LZMA_SYSTEM_SIZE_T=1)
   179     ADD_DEFINITIONS(-D_SZ_ONE_DIRECTORY=1)
   206     ADD_DEFINITIONS(-D_SZ_ONE_DIRECTORY=1)
   180 ENDIF(PHYSFS_ARCHIVE_7Z)
   207 ENDIF(PHYSFS_ARCHIVE_7Z)
   181 
   208 
   182 OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
   209 OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
   183 IF(PHYSFS_ARCHIVE_GRP)
   210 IF(PHYSFS_ARCHIVE_GRP)
   184     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1)
   211     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1)
   185     SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/grp.c)
       
   186 ENDIF(PHYSFS_ARCHIVE_GRP)
   212 ENDIF(PHYSFS_ARCHIVE_GRP)
   187 
   213 
   188 OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
   214 OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
   189 IF(PHYSFS_ARCHIVE_WAD)
   215 IF(PHYSFS_ARCHIVE_WAD)
   190     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1)
   216     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1)
   191     SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/wad.c)
       
   192 ENDIF(PHYSFS_ARCHIVE_WAD)
   217 ENDIF(PHYSFS_ARCHIVE_WAD)
   193 
   218 
   194 OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
   219 OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
   195 IF(PHYSFS_ARCHIVE_HOG)
   220 IF(PHYSFS_ARCHIVE_HOG)
   196     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1)
   221     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1)
   197     SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/hog.c)
       
   198 ENDIF(PHYSFS_ARCHIVE_HOG)
   222 ENDIF(PHYSFS_ARCHIVE_HOG)
   199 
   223 
   200 OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
   224 OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
   201 IF(PHYSFS_ARCHIVE_MVL)
   225 IF(PHYSFS_ARCHIVE_MVL)
   202     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1)
   226     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1)
   203     SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/mvl.c)
       
   204 ENDIF(PHYSFS_ARCHIVE_MVL)
   227 ENDIF(PHYSFS_ARCHIVE_MVL)
   205 
   228 
   206 OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
   229 OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
   207 IF(PHYSFS_ARCHIVE_QPAK)
   230 IF(PHYSFS_ARCHIVE_QPAK)
   208     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1)
   231     ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1)
   209     SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/qpak.c)
       
   210 ENDIF(PHYSFS_ARCHIVE_QPAK)
   232 ENDIF(PHYSFS_ARCHIVE_QPAK)
   211 
   233 
   212 
   234 
   213 # See if some archiver required zlib, and see about using system version.
   235 # See if some archiver required zlib, and see about using system version.
   214 
   236