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