misc/physfs/CMakeLists.txt
author unc0rr
Sat, 17 Nov 2012 00:15:30 +0400
branchphysfslayer
changeset 8040 448d61778ca7
parent 7928 88fde28bbda6
child 8068 b35427506169
permissions -rw-r--r--
Keeping bruteforce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     1
# PhysicsFS; a portable, flexible file i/o abstraction.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     2
# Copyright (C) 2007  Ryan C. Gordon.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     3
#
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     4
# Please see the file LICENSE.txt in the source's root directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     5
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     6
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     7
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     8
PROJECT(PhysicsFS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     9
SET(PHYSFS_VERSION 2.1.0)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    10
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    11
# Increment this if/when we break backwards compatibility.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    12
SET(PHYSFS_SOVERSION 1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    13
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    14
# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    15
IF(WIN32 AND NOT WINDOWS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    16
    SET(WINDOWS TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    17
ENDIF(WIN32 AND NOT WINDOWS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    18
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    19
# Bleh, let's do it for "APPLE" too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    20
IF(APPLE AND NOT MACOSX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    21
    SET(MACOSX TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    22
ENDIF(APPLE AND NOT MACOSX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    23
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    24
# For now, Haiku and BeOS are the same, as far as the build system cares.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    25
IF(HAIKU AND NOT BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    26
    SET(BEOS TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    27
ENDIF(HAIKU AND NOT BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    28
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    29
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    30
    SET(SOLARIS TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    31
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    32
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    33
INCLUDE(CheckIncludeFile)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    34
INCLUDE(CheckLibraryExists)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    35
INCLUDE(CheckCSourceCompiles)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    36
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    37
INCLUDE_DIRECTORIES(./src)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    38
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    39
IF(MACOSX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    40
    # Fallback to older OS X on PowerPC to support wider range of systems...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    41
    IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    42
        ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    43
        SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    44
    ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    45
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    46
    # Need these everywhere...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    47
    ADD_DEFINITIONS(-fno-common)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    48
    SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework Carbon -framework IOKit")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    49
ENDIF(MACOSX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    50
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    51
# Add some gcc-specific command lines.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    52
IF(CMAKE_COMPILER_IS_GNUCC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    53
    # Always build with debug symbols...you can strip it later.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    54
    ADD_DEFINITIONS(-g -pipe -Werror -fsigned-char)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    55
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    56
    # Stupid BeOS generates warnings in the system headers.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    57
    IF(NOT BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    58
        ADD_DEFINITIONS(-Wall)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    59
    ENDIF(NOT BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    60
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    61
    CHECK_C_SOURCE_COMPILES("
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    62
        #if ((defined(__GNUC__)) && (__GNUC__ >= 4))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    63
        int main(int argc, char **argv) { int is_gcc4 = 1; return 0; }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    64
        #else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    65
        #error This is not gcc4.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    66
        #endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    67
    " PHYSFS_IS_GCC4)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    68
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    69
    IF(PHYSFS_IS_GCC4)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    70
        # Not supported on several operating systems at this time.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    71
        IF(NOT SOLARIS AND NOT WINDOWS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    72
            ADD_DEFINITIONS(-fvisibility=hidden)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    73
        ENDIF(NOT SOLARIS AND NOT WINDOWS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    74
    ENDIF(PHYSFS_IS_GCC4)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    75
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    76
    # Don't use -rpath.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    77
    SET(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    78
ENDIF(CMAKE_COMPILER_IS_GNUCC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    79
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    80
IF(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    81
    ADD_DEFINITIONS(-erroff=E_EMPTY_TRANSLATION_UNIT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    82
    ADD_DEFINITIONS(-xldscope=hidden)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    83
ENDIF(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    84
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    85
IF(MSVC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    86
    # VS.NET 8.0 got really really anal about strcpy, etc, which even if we
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    87
    #  cleaned up our code, zlib, etc still use...so disable the warning.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    88
    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    89
ENDIF(MSVC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    90
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    91
# Basic chunks of source code ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    92
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    93
SET(LZMA_SRCS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    94
    src/lzma/C/7zCrc.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    95
    src/lzma/C/Archive/7z/7zBuffer.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    96
    src/lzma/C/Archive/7z/7zDecode.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    97
    src/lzma/C/Archive/7z/7zExtract.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    98
    src/lzma/C/Archive/7z/7zHeader.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    99
    src/lzma/C/Archive/7z/7zIn.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   100
    src/lzma/C/Archive/7z/7zItem.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   101
    src/lzma/C/Archive/7z/7zMethodID.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   102
    src/lzma/C/Compress/Branch/BranchX86.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   103
    src/lzma/C/Compress/Branch/BranchX86_2.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   104
    src/lzma/C/Compress/Lzma/LzmaDecode.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   105
)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   106
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   107
IF(BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   108
    # We add this explicitly, since we don't want CMake to think this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   109
    #  is a C++ project unless we're on BeOS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   110
    SET(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   111
    FIND_LIBRARY(BE_LIBRARY be)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   112
    FIND_LIBRARY(ROOT_LIBRARY root)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   113
    SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   114
ENDIF(BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   115
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   116
# Almost everything is "compiled" here, but things that don't apply to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   117
#  build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   118
#  another project or bring up a new build system: just compile all the source
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   119
#  code and #define the things you want.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   120
SET(PHYSFS_SRCS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   121
    src/physfs.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   122
    src/physfs_byteorder.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   123
    src/physfs_unicode.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   124
    src/platform_posix.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   125
    src/platform_unix.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   126
    src/platform_macosx.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   127
    src/platform_windows.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   128
    src/archiver_dir.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   129
    src/archiver_unpacked.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   130
    src/archiver_grp.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   131
    src/archiver_hog.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   132
    src/archiver_lzma.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   133
    src/archiver_mvl.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   134
    src/archiver_qpak.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   135
    src/archiver_wad.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   136
    src/archiver_zip.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   137
    src/archiver_iso9660.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   138
    ${PHYSFS_BEOS_SRCS}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   139
)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   140
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   141
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   142
# platform layers ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   143
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   144
IF(UNIX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   145
    IF(BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   146
        SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   147
        SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   148
        SET(HAVE_PTHREAD_H TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   149
    ELSE(BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   150
        CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   151
        IF(HAVE_UCRED_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   152
            ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   153
            SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   154
        ENDIF(HAVE_UCRED_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   155
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   156
        CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   157
        IF(HAVE_MNTENT_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   158
            ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   159
            SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   160
        ENDIF(HAVE_MNTENT_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   161
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   162
        # !!! FIXME: Solaris fails this, because mnttab.h implicitly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   163
        # !!! FIXME:  depends on other system headers.  :(
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   164
        #CHECK_INCLUDE_FILE(sys/mnttab.h HAVE_SYS_MNTTAB_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   165
        CHECK_C_SOURCE_COMPILES("
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   166
            #include <stdio.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   167
            #include <sys/mnttab.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   168
            int main(int argc, char **argv) { return 0; }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   169
        " HAVE_SYS_MNTTAB_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   170
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   171
        IF(HAVE_SYS_MNTTAB_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   172
            ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_MNTTAB_H=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   173
            SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   174
        ENDIF(HAVE_SYS_MNTTAB_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   175
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   176
        CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   177
        IF(HAVE_PTHREAD_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   178
            SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   179
        ENDIF(HAVE_PTHREAD_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   180
    ENDIF(BEOS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   181
ENDIF(UNIX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   182
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   183
IF(WINDOWS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   184
    SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   185
    SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   186
ENDIF(WINDOWS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   187
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   188
IF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   189
    ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   190
    MESSAGE(WARNING " ***")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   191
    MESSAGE(WARNING " *** There is no CD-ROM support in this build!")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   192
    MESSAGE(WARNING " *** PhysicsFS will just pretend there are no discs.")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   193
    MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   194
    MESSAGE(WARNING " ***   but is this what you REALLY wanted?")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   195
    MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   196
    MESSAGE(WARNING " ***")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   197
ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   198
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   199
IF(PHYSFS_HAVE_THREAD_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   200
    ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   201
ELSE(PHYSFS_HAVE_THREAD_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   202
    ADD_DEFINITIONS(-DPHYSFS_NO_THREAD_SUPPORT=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   203
    MESSAGE(WARNING " ***")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   204
    MESSAGE(WARNING " *** There is no thread support in this build!")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   205
    MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   206
    MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   207
    MESSAGE(WARNING " ***   but is this what you REALLY wanted?")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   208
    MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   209
    MESSAGE(WARNING " ***")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   210
ENDIF(PHYSFS_HAVE_THREAD_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   211
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   212
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   213
# Archivers ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   214
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   215
OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   216
IF(PHYSFS_ARCHIVE_ZIP)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   217
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   218
ENDIF(PHYSFS_ARCHIVE_ZIP)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   219
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   220
OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   221
IF(PHYSFS_ARCHIVE_7Z)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   222
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   223
    # !!! FIXME: rename to 7z.c?
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   224
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   225
ENDIF(PHYSFS_ARCHIVE_7Z)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   226
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   227
OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   228
IF(PHYSFS_ARCHIVE_GRP)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   229
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   230
ENDIF(PHYSFS_ARCHIVE_GRP)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   231
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   232
OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   233
IF(PHYSFS_ARCHIVE_WAD)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   234
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   235
ENDIF(PHYSFS_ARCHIVE_WAD)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   236
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   237
OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   238
IF(PHYSFS_ARCHIVE_HOG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   239
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   240
ENDIF(PHYSFS_ARCHIVE_HOG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   241
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   242
OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   243
IF(PHYSFS_ARCHIVE_MVL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   244
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   245
ENDIF(PHYSFS_ARCHIVE_MVL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   246
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   247
OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   248
IF(PHYSFS_ARCHIVE_QPAK)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   249
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   250
ENDIF(PHYSFS_ARCHIVE_QPAK)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   251
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   252
OPTION(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   253
IF(PHYSFS_ARCHIVE_ISO9660)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   254
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ISO9660=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   255
ENDIF(PHYSFS_ARCHIVE_ISO9660)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   256
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   257
7778
3331b30e4ef1 Fix build
unc0rr
parents: 7768
diff changeset
   258
OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   259
IF(PHYSFS_BUILD_STATIC)
7928
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   260
    ADD_LIBRARY(physfs STATIC ${PHYSFS_SRCS})
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   261
    SET_TARGET_PROPERTIES(physfs PROPERTIES OUTPUT_NAME "physfs")
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   262
    SET(PHYSFS_LIB_TARGET physfs)
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   263
    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   264
ENDIF(PHYSFS_BUILD_STATIC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   265
7928
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   266
#OPTION(PHYSFS_BUILD_SHARED "Build shared library" FALSE)
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   267
#IF(PHYSFS_BUILD_SHARED)
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   268
#    ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS})
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   269
#    SET_TARGET_PROPERTIES(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   270
#    SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   271
#    TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   272
#    SET(PHYSFS_LIB_TARGET physfs)
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   273
#    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
88fde28bbda6 Merge with default
unc0rr
parents: 7778
diff changeset
   274
#ENDIF(PHYSFS_BUILD_SHARED)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   275
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   276
IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   277
    MESSAGE(FATAL "Both shared and static libraries are disabled!")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   278
ENDIF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   279
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   280
# CMake FAQ says I need this...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   281
IF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   282
    SET_TARGET_PROPERTIES(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   283
    SET_TARGET_PROPERTIES(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   284
ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   285
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   286
OPTION(PHYSFS_BUILD_TEST "Build stdio test program." FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   287
MARK_AS_ADVANCED(PHYSFS_BUILD_TEST)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   288
IF(PHYSFS_BUILD_TEST)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   289
    FIND_PATH(READLINE_H readline/readline.h)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   290
    FIND_PATH(HISTORY_H readline/history.h)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   291
    IF(READLINE_H AND HISTORY_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   292
        FIND_LIBRARY(CURSES_LIBRARY NAMES curses ncurses)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   293
        SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   294
        FIND_LIBRARY(READLINE_LIBRARY readline)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   295
        IF(READLINE_LIBRARY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   296
            SET(HAVE_SYSTEM_READLINE TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   297
            SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   298
            INCLUDE_DIRECTORIES(${READLINE_H} ${HISTORY_H})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   299
            ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   300
        ENDIF(READLINE_LIBRARY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   301
    ENDIF(READLINE_H AND HISTORY_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   302
    ADD_EXECUTABLE(test_physfs test/test_physfs.c)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   303
    TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   304
    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   305
ENDIF(PHYSFS_BUILD_TEST)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   306
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   307
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   308
# Scripting language bindings...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   309
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   310
#CMake's SWIG support is basically useless.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   311
#FIND_PACKAGE(SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   312
7778
3331b30e4ef1 Fix build
unc0rr
parents: 7768
diff changeset
   313
OPTION(PHYSFS_BUILD_SWIG "Build ${_LANG} bindings." FALSE)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   314
MARK_AS_ADVANCED(PHYSFS_BUILD_SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   315
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   316
FIND_PROGRAM(SWIG swig DOC "Path to swig command line app: http://swig.org/")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   317
IF(NOT SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   318
    MESSAGE(STATUS "SWIG not found. You won't be able to build scripting language bindings.")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   319
ELSE(NOT SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   320
    MARK_AS_ADVANCED(SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   321
    IF(DEFINED CMAKE_BUILD_TYPE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   322
        IF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   323
            IF(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   324
                SET(SWIG_OPT_CFLAGS "-small")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   325
            ELSE(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   326
                SET(SWIG_OPT_CFLAGS "-O")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   327
            ENDIF(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   328
        ENDIF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   329
    ENDIF(DEFINED CMAKE_BUILD_TYPE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   330
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   331
    SET(SWIG_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/physfs-swig-bindings")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   332
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   333
    MACRO(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   334
        STRING(TOUPPER "${_LANG}" _UPPERLANG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   335
        STRING(TOLOWER "${_LANG}" _LOWERLANG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   336
        SET(_TARGET "physfs-${_LOWERLANG}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   337
        SET(_TARGETDIR "${SWIG_OUTPUT_DIR}/${_LOWERLANG}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   338
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   339
        IF(NOT EXISTS "${_TARGETDIR}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   340
            FILE(MAKE_DIRECTORY "${_TARGETDIR}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   341
        ENDIF(NOT EXISTS "${_TARGETDIR}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   342
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   343
        IF(PHYSFS_BUILD_${_UPPERLANG})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   344
            ADD_CUSTOM_COMMAND(
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   345
                OUTPUT "${_TARGETDIR}/${_TARGET}.c" ${_EXTRAOUTPUTS}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   346
                MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   347
                COMMAND "${SWIG}"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   348
                ARGS ${SWIG_OPT_CFLAGS} -${_LOWERLANG} -outdir "${_TARGETDIR}" -o "${_TARGETDIR}/${_TARGET}.c" "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   349
                COMMENT "Generating ${_LANG} bindings..."
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   350
            )
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   351
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   352
            ADD_LIBRARY(${_TARGET} SHARED "${_TARGETDIR}/${_TARGET}.c")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   353
            TARGET_LINK_LIBRARIES(${_TARGET} ${PHYSFS_LIB_TARGET})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   354
            SET_TARGET_PROPERTIES(${_TARGET} PROPERTIES
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   355
                COMPILE_FLAGS "${_EXTRACFLAGS}"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   356
                LINK_FLAGS "${_EXTRALDFLAGS}"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   357
                LIBRARY_OUTPUT_NAME "physfs"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   358
                LIBRARY_OUTPUT_DIRECTORY "${_TARGETDIR}"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   359
                CLEAN_DIRECT_OUTPUT 1
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   360
            )
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   361
            INSTALL(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   362
            MESSAGE(STATUS "${_LANG} bindings configured!")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   363
        ELSE(PHYSFS_BUILD_${_UPPERLANG})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   364
            MESSAGE(STATUS "Couldn't figure out ${_LANG} configuration. Skipping ${_LANG} bindings.")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   365
        ENDIF(PHYSFS_BUILD_${_UPPERLANG})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   366
    ENDMACRO(CONFIGURE_SWIG_BINDING)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   367
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   368
    MACRO(ADD_SCRIPT_BINDING_OPTION _VAR _LANG _DEFVAL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   369
        SET(BUILDSWIGVAL ${_DEFVAL})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   370
        IF(NOT PHYSFS_BUILD_SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   371
            SET(BUILDSWIGVAL FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   372
        ENDIF(NOT PHYSFS_BUILD_SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   373
        OPTION(${_VAR} "Build ${_LANG} bindings." ${BUILDSWIGVAL})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   374
        MARK_AS_ADVANCED(${_VAR})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   375
    ENDMACRO(ADD_SCRIPT_BINDING_OPTION)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   376
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   377
    ADD_SCRIPT_BINDING_OPTION(PHYSFS_BUILD_PERL "Perl" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   378
    ADD_SCRIPT_BINDING_OPTION(PHYSFS_BUILD_RUBY "Ruby" TRUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   379
ENDIF(NOT SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   380
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   381
IF(PHYSFS_BUILD_PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   382
    MESSAGE(STATUS "Configuring Perl bindings...")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   383
    FIND_PROGRAM(PERL perl DOC "Path to perl command line app: http://perl.org/")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   384
    IF(NOT PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   385
        MESSAGE(STATUS "Perl not found. You won't be able to build perl bindings.")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   386
        SET(PHYSFS_BUILD_PERL FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   387
    ENDIF(NOT PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   388
    MARK_AS_ADVANCED(PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   389
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   390
    MACRO(GET_PERL_CONFIG _KEY _VALUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   391
        IF(PHYSFS_BUILD_PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   392
            MESSAGE(STATUS "Figuring out perl config value '${_KEY}' ...")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   393
            EXECUTE_PROCESS(
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   394
                COMMAND ${PERL} -w -e "use Config; print \$Config{${_KEY}};"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   395
                RESULT_VARIABLE GET_PERL_CONFIG_RC
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   396
                OUTPUT_VARIABLE ${_VALUE}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   397
            )
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   398
            IF(NOT GET_PERL_CONFIG_RC EQUAL 0)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   399
                MESSAGE(STATUS "Perl executable ('${PERL}') reported failure: ${GET_PERL_CONFIG_RC}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   400
                SET(PHYSFS_BUILD_PERL FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   401
            ENDIF(NOT GET_PERL_CONFIG_RC EQUAL 0)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   402
            IF(NOT ${_VALUE})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   403
                MESSAGE(STATUS "Perl executable ('${PERL}') didn't have a value for '${_KEY}'")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   404
                SET(PHYSFS_BUILD_PERL FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   405
            ENDIF(NOT ${_VALUE})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   406
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   407
            IF(PHYSFS_BUILD_PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   408
                MESSAGE(STATUS "Perl says: '${${_VALUE}}'.")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   409
            ENDIF(PHYSFS_BUILD_PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   410
        ENDIF(PHYSFS_BUILD_PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   411
    ENDMACRO(GET_PERL_CONFIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   412
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   413
    # !!! FIXME: installsitearch might be the wrong location.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   414
    GET_PERL_CONFIG("archlibexp" PERL_INCLUDE_PATH)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   415
    GET_PERL_CONFIG("ccflags" PERL_CCFLAGS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   416
    GET_PERL_CONFIG("ldflags" PERL_LDFLAGS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   417
    GET_PERL_CONFIG("installsitearch" PERL_INSTALL_PATH)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   418
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   419
    # !!! FIXME: this test for Mac OS X is wrong.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   420
    IF(MACOSX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   421
        GET_PERL_CONFIG("libperl" PERL_LIBPERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   422
        SET(TMPLIBPERL "${PERL_LIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   423
        STRING(REGEX REPLACE "^lib" "" TMPLIBPERL "${TMPLIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   424
        STRING(REGEX REPLACE "\\.so$" "" TMPLIBPERL "${TMPLIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   425
        STRING(REGEX REPLACE "\\.dylib$" "" TMPLIBPERL "${TMPLIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   426
        STRING(REGEX REPLACE "\\.dll$" "" TMPLIBPERL "${TMPLIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   427
        IF(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   428
            MESSAGE(STATUS "Stripped '${PERL_LIBPERL}' down to '${TMPLIBPERL}'.")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   429
            SET(PERL_LIBPERL "${TMPLIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   430
        ENDIF(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   431
        SET(PERL_LIBPERL "-l${PERL_LIBPERL}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   432
    ENDIF(MACOSX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   433
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   434
    CONFIGURE_SWIG_BINDING(Perl "${PERL_INSTALL_PATH}" "${SWIG_OUTPUT_DIR}/perl/physfs.pm" "\"-I${PERL_INCLUDE_PATH}/CORE\" ${PERL_CCFLAGS} -w" "\"-L${PERL_INCLUDE_PATH}/CORE\" ${PERL_LIBPERL} ${PERL_LDFLAGS}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   435
    INSTALL(FILES "${SWIG_OUTPUT_DIR}/perl/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   436
    INSTALL(
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   437
        FILES test/test_physfs.pl
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   438
        DESTINATION bin
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   439
        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   440
                    GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   441
    )
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   442
ENDIF(PHYSFS_BUILD_PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   443
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   444
# !!! FIXME: lots of cut-and-paste from perl bindings.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   445
IF(PHYSFS_BUILD_RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   446
    MESSAGE(STATUS "Configuring Ruby bindings...")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   447
    FIND_PROGRAM(RUBY ruby DOC "Path to ruby command line app: http://ruby-lang.org/")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   448
    IF(NOT RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   449
        MESSAGE(STATUS "Ruby not found. You won't be able to build ruby bindings.")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   450
        SET(PHYSFS_BUILD_RUBY FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   451
    ENDIF(NOT RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   452
    MARK_AS_ADVANCED(RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   453
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   454
    MACRO(GET_RUBY_CONFIG _KEY _VALUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   455
        IF(PHYSFS_BUILD_RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   456
            MESSAGE(STATUS "Figuring out ruby config value '${_KEY}' ...")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   457
            EXECUTE_PROCESS(
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   458
                COMMAND ${RUBY} -e "require 'rbconfig'; puts RbConfig::CONFIG['${_KEY}'];"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   459
                RESULT_VARIABLE GET_RUBY_CONFIG_RC
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   460
                OUTPUT_VARIABLE ${_VALUE}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   461
                OUTPUT_STRIP_TRAILING_WHITESPACE
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   462
            )
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   463
            IF(NOT GET_RUBY_CONFIG_RC EQUAL 0)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   464
                MESSAGE(STATUS "Ruby executable ('${RUBY}') reported failure: ${GET_RUBY_CONFIG_RC}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   465
                SET(PHYSFS_BUILD_RUBY FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   466
            ENDIF(NOT GET_RUBY_CONFIG_RC EQUAL 0)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   467
            IF(NOT ${_VALUE})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   468
                MESSAGE(STATUS "Ruby executable ('${RUBY}') didn't have a value for '${_KEY}'")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   469
                SET(PHYSFS_BUILD_RUBY FALSE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   470
            ENDIF(NOT ${_VALUE})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   471
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   472
            IF(PHYSFS_BUILD_RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   473
                MESSAGE(STATUS "Ruby says: '${${_VALUE}}'.")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   474
            ENDIF(PHYSFS_BUILD_RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   475
        ENDIF(PHYSFS_BUILD_RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   476
    ENDMACRO(GET_RUBY_CONFIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   477
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   478
    GET_RUBY_CONFIG("archdir" RUBY_INCLUDE_PATH)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   479
    GET_RUBY_CONFIG("CFLAGS" RUBY_CCFLAGS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   480
    GET_RUBY_CONFIG("LDFLAGS" RUBY_LDFLAGS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   481
    GET_RUBY_CONFIG("sitearchdir" RUBY_INSTALL_PATH)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   482
    GET_RUBY_CONFIG("LIBRUBYARG_SHARED" RUBY_LIBRUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   483
    GET_RUBY_CONFIG("libdir" RUBY_LIBDIR)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   484
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   485
    CONFIGURE_SWIG_BINDING(Ruby "${RUBY_INSTALL_PATH}" "" "\"-I${RUBY_INCLUDE_PATH}\" ${RUBY_CCFLAGS} -w" "\"-L${RUBY_LIBDIR}\" ${RUBY_LIBRUBY} ${RUBY_LDFLAGS}")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   486
    SET_TARGET_PROPERTIES(physfs-ruby PROPERTIES PREFIX "")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   487
    INSTALL(
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   488
        FILES test/test_physfs.rb
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   489
        DESTINATION bin
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   490
        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   491
                    GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   492
    )
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   493
ENDIF(PHYSFS_BUILD_RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   494
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   495
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   496
INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   497
        RUNTIME DESTINATION bin
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   498
        LIBRARY DESTINATION lib${LIB_SUFFIX}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   499
        ARCHIVE DESTINATION lib${LIB_SUFFIX})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   500
INSTALL(FILES src/physfs.h DESTINATION include)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   501
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   502
IF(UNIX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   503
    SET(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   504
    ADD_CUSTOM_TARGET(
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   505
        dist
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   506
        hg archive -t tgz "${PHYSFS_TARBALL}"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   507
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   508
        COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   509
    )
7778
3331b30e4ef1 Fix build
unc0rr
parents: 7768
diff changeset
   510
#    ADD_CUSTOM_TARGET(
3331b30e4ef1 Fix build
unc0rr
parents: 7768
diff changeset
   511
#        uninstall
3331b30e4ef1 Fix build
unc0rr
parents: 7768
diff changeset
   512
#        "${CMAKE_CURRENT_SOURCE_DIR}/extras/uninstall.sh"
3331b30e4ef1 Fix build
unc0rr
parents: 7768
diff changeset
   513
#        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
3331b30e4ef1 Fix build
unc0rr
parents: 7768
diff changeset
   514
#        COMMENT "Uninstall the project..."
3331b30e4ef1 Fix build
unc0rr
parents: 7768
diff changeset
   515
#    )
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   516
ENDIF(UNIX)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   517
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   518
MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   519
    IF(${_VALUE})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   520
        MESSAGE(STATUS "  ${_NAME}: enabled")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   521
    ELSE(${_VALUE})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   522
        MESSAGE(STATUS "  ${_NAME}: disabled")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   523
    ENDIF(${_VALUE})
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   524
ENDMACRO(MESSAGE_BOOL_OPTION)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   525
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   526
MESSAGE(STATUS "PhysicsFS will build with the following options:")
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   527
MESSAGE_BOOL_OPTION("ZIP support" PHYSFS_ARCHIVE_ZIP)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   528
MESSAGE_BOOL_OPTION("7zip support" PHYSFS_ARCHIVE_7Z)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   529
MESSAGE_BOOL_OPTION("GRP support" PHYSFS_ARCHIVE_GRP)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   530
MESSAGE_BOOL_OPTION("WAD support" PHYSFS_ARCHIVE_WAD)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   531
MESSAGE_BOOL_OPTION("HOG support" PHYSFS_ARCHIVE_HOG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   532
MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   533
MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   534
MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   535
MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   536
MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   537
MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   538
MESSAGE_BOOL_OPTION("Build Perl bindings" PHYSFS_BUILD_PERL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   539
MESSAGE_BOOL_OPTION("Build Ruby bindings" PHYSFS_BUILD_RUBY)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   540
MESSAGE_BOOL_OPTION("Build stdio test program" PHYSFS_BUILD_TEST)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   541
IF(PHYSFS_BUILD_TEST)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   542
    MESSAGE_BOOL_OPTION("  Use readline in test program" HAVE_SYSTEM_READLINE)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   543
ENDIF(PHYSFS_BUILD_TEST)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   544
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   545
# end of CMakeLists.txt ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   546