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