CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Tue, 23 Oct 2012 14:58:54 -0400
changeset 1309 df0609b72174
parent 1297 d842cd8c9f91
child 1310 3382edc8a7f9
permissions -rw-r--r--
Lowercased most of the CMake project file.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
# PhysicsFS; a portable, flexible file i/o abstraction.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
#
809
116b8fe30371 Renamed LICENSE to LICENSE.txt
Ryan C. Gordon <icculus@icculus.org>
parents: 805
diff changeset
     3
# Please see the file LICENSE.txt in the source's root directory.
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
     5
cmake_minimum_required(VERSION 2.8.4)
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
     6
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
     7
project(PhysicsFS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
     8
set(PHYSFS_VERSION 2.1.0)
950
7bb0b0d26479 Corrected soname.
Ryan C. Gordon <icculus@icculus.org>
parents: 919
diff changeset
     9
7bb0b0d26479 Corrected soname.
Ryan C. Gordon <icculus@icculus.org>
parents: 919
diff changeset
    10
# Increment this if/when we break backwards compatibility.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    11
set(PHYSFS_SOVERSION 1)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    14
if(WIN32 AND NOT WINDOWS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    15
    set(WINDOWS TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    16
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
# Bleh, let's do it for "APPLE" too.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    19
if(APPLE AND NOT MACOSX)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    20
    set(MACOSX TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    21
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
1171
e4ca84e1d289 Treat Haiku as BeOS in CMakeLists.txt ... this lets CD-ROM support build, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1159
diff changeset
    23
# For now, Haiku and BeOS are the same, as far as the build system cares.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    24
if(HAIKU AND NOT BEOS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    25
    set(BEOS TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    26
endif()
1171
e4ca84e1d289 Treat Haiku as BeOS in CMakeLists.txt ... this lets CD-ROM support build, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1159
diff changeset
    27
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    28
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    29
    set(SOLARIS TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    30
endif()
985
dc38a51538aa More Solaris fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 981
diff changeset
    31
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    32
include(CheckIncludeFile)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    33
include(CheckLibraryExists)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    34
include(CheckCSourceCompiles)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    36
include_directories(./src)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    38
if(MACOSX)
803
4b1e0994ab97 Clarified a comment.
Ryan C. Gordon <icculus@icculus.org>
parents: 802
diff changeset
    39
    # Fallback to older OS X on PowerPC to support wider range of systems...
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    40
    if(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    41
        add_definitions(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    42
        set(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    43
    endif()
803
4b1e0994ab97 Clarified a comment.
Ryan C. Gordon <icculus@icculus.org>
parents: 802
diff changeset
    44
4b1e0994ab97 Clarified a comment.
Ryan C. Gordon <icculus@icculus.org>
parents: 802
diff changeset
    45
    # Need these everywhere...
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    46
    add_definitions(-fno-common)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    47
    set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework Carbon -framework IOKit")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    48
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
# Add some gcc-specific command lines.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    51
if(CMAKE_COMPILER_IS_GNUCC)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
    # Always build with debug symbols...you can strip it later.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    53
    add_definitions(-g -pipe -Werror -fsigned-char)
821
c7dd97edaa4e Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents: 818
diff changeset
    54
c7dd97edaa4e Fixes for BeOS and gcc2.
Ryan C. Gordon <icculus@icculus.org>
parents: 818
diff changeset
    55
    # Stupid BeOS generates warnings in the system headers.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    56
    if(NOT BEOS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    57
        add_definitions(-Wall)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    58
    endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    60
    check_c_source_compiles("
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
        #if ((defined(__GNUC__)) && (__GNUC__ >= 4))
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
        int main(int argc, char **argv) { int is_gcc4 = 1; return 0; }
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
        #else
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
        #error This is not gcc4.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
        #endif
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
    " PHYSFS_IS_GCC4)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    68
    if(PHYSFS_IS_GCC4)
1009
56a3873c63e4 Don't use -fvisibility=hidden on Windows, since MinGW doesn't support it. :(
Ryan C. Gordon <icculus@icculus.org>
parents: 1005
diff changeset
    69
        # Not supported on several operating systems at this time.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    70
        if(NOT SOLARIS AND NOT WINDOWS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    71
            add_definitions(-fvisibility=hidden)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    72
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    73
    endif()
1040
5fc90d008821 Prevent bogus addition of -rpath to libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 1039
diff changeset
    74
5fc90d008821 Prevent bogus addition of -rpath to libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 1039
diff changeset
    75
    # Don't use -rpath.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    76
    set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    77
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    79
if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    80
    add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    81
    add_definitions(-xldscope=hidden)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    82
endif()
989
70132355a297 Ignore empty files (like #ifdef'd out platform code) on Sun Studio compiler.
Ryan C. Gordon <icculus@icculus.org>
parents: 985
diff changeset
    83
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    84
if(MSVC)
836
6514fba91816 Patched to compile with latest Platform SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 833
diff changeset
    85
    # VS.NET 8.0 got really really anal about strcpy, etc, which even if we
6514fba91816 Patched to compile with latest Platform SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 833
diff changeset
    86
    #  cleaned up our code, zlib, etc still use...so disable the warning.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    87
    add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    88
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
# Basic chunks of source code ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    92
set(LZMA_SRCS
972
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    93
    src/lzma/C/7zCrc.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    94
    src/lzma/C/Archive/7z/7zBuffer.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    95
    src/lzma/C/Archive/7z/7zDecode.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    96
    src/lzma/C/Archive/7z/7zExtract.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    97
    src/lzma/C/Archive/7z/7zHeader.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    98
    src/lzma/C/Archive/7z/7zIn.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    99
    src/lzma/C/Archive/7z/7zItem.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   100
    src/lzma/C/Archive/7z/7zMethodID.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   101
    src/lzma/C/Compress/Branch/BranchX86.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   102
    src/lzma/C/Compress/Branch/BranchX86_2.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   103
    src/lzma/C/Compress/Lzma/LzmaDecode.c
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   106
if(BEOS)
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   107
    # We add this explicitly, since we don't want CMake to think this
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   108
    #  is a C++ project unless we're on BeOS.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   109
    set(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   110
    find_library(BE_LIBRARY be)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   111
    find_library(ROOT_LIBRARY root)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   112
    set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   113
endif()
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   114
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   115
# Almost everything is "compiled" here, but things that don't apply to the
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   116
#  build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   117
#  another project or bring up a new build system: just compile all the source
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   118
#  code and #define the things you want.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   119
set(PHYSFS_SRCS
972
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   120
    src/physfs.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   121
    src/physfs_byteorder.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   122
    src/physfs_unicode.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   123
    src/platform_posix.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   124
    src/platform_unix.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   125
    src/platform_macosx.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   126
    src/platform_windows.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   127
    src/archiver_dir.c
1128
067d8e76261e Moved most the cut-and-paste between simple archivers to one file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1066
diff changeset
   128
    src/archiver_unpacked.c
972
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   129
    src/archiver_grp.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   130
    src/archiver_hog.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   131
    src/archiver_lzma.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   132
    src/archiver_mvl.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   133
    src/archiver_qpak.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   134
    src/archiver_wad.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
   135
    src/archiver_zip.c
1064
cc4db73e87d1 ISO9660 archiver, compliments of Christoph Nelles.
Ryan C. Gordon <icculus@icculus.org>
parents: 1051
diff changeset
   136
    src/archiver_iso9660.c
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   137
    ${PHYSFS_BEOS_SRCS}
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
# platform layers ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   143
if(UNIX)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   144
    if(BEOS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   145
        set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   146
        set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   147
        set(HAVE_PTHREAD_H TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   148
    else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   149
        check_include_file(sys/ucred.h HAVE_UCRED_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   150
        if(HAVE_UCRED_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   151
            add_definitions(-DPHYSFS_HAVE_SYS_UCRED_H=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   152
            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   153
        endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   155
        check_include_file(mntent.h HAVE_MNTENT_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   156
        if(HAVE_MNTENT_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   157
            add_definitions(-DPHYSFS_HAVE_MNTENT_H=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   158
            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   159
        endif()
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   160
990
c25717b5c165 Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris.
Ryan C. Gordon <icculus@icculus.org>
parents: 989
diff changeset
   161
        # !!! FIXME: Solaris fails this, because mnttab.h implicitly
c25717b5c165 Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris.
Ryan C. Gordon <icculus@icculus.org>
parents: 989
diff changeset
   162
        # !!! FIXME:  depends on other system headers.  :(
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   163
        #check_include_file(sys/mnttab.h HAVE_SYS_MNTTAB_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   164
        check_c_source_compiles("
990
c25717b5c165 Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris.
Ryan C. Gordon <icculus@icculus.org>
parents: 989
diff changeset
   165
            #include <stdio.h>
c25717b5c165 Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris.
Ryan C. Gordon <icculus@icculus.org>
parents: 989
diff changeset
   166
            #include <sys/mnttab.h>
c25717b5c165 Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris.
Ryan C. Gordon <icculus@icculus.org>
parents: 989
diff changeset
   167
            int main(int argc, char **argv) { return 0; }
c25717b5c165 Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris.
Ryan C. Gordon <icculus@icculus.org>
parents: 989
diff changeset
   168
        " HAVE_SYS_MNTTAB_H)
c25717b5c165 Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris.
Ryan C. Gordon <icculus@icculus.org>
parents: 989
diff changeset
   169
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   170
        if(HAVE_SYS_MNTTAB_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   171
            add_definitions(-DPHYSFS_HAVE_SYS_MNTTAB_H=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   172
            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   173
        endif()
990
c25717b5c165 Added sys/mnttab.h CD-ROM detection. Fixes missing CD-ROM support on Solaris.
Ryan C. Gordon <icculus@icculus.org>
parents: 989
diff changeset
   174
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   175
        check_include_file(pthread.h HAVE_PTHREAD_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   176
        if(HAVE_PTHREAD_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   177
            set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   178
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   179
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   180
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   182
if(WINDOWS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   183
    set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   184
    set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   185
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   186
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   187
if(NOT PHYSFS_HAVE_CDROM_SUPPORT)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   188
    add_definitions(-DPHYSFS_NO_CDROM_SUPPORT=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   189
    message(WARNING " ***")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   190
    message(WARNING " *** There is no CD-ROM support in this build!")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   191
    message(WARNING " *** PhysicsFS will just pretend there are no discs.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   192
    message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   193
    message(WARNING " ***   but is this what you REALLY wanted?")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   194
    message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   195
    message(WARNING " ***")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   196
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   198
if(PHYSFS_HAVE_THREAD_SUPPORT)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   199
    add_definitions(-D_REENTRANT -D_THREAD_SAFE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   200
else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   201
    add_definitions(-DPHYSFS_NO_THREAD_SUPPORT=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   202
    message(WARNING " ***")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   203
    message(WARNING " *** There is no thread support in this build!")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   204
    message(WARNING " *** PhysicsFS will NOT be reentrant!")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   205
    message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   206
    message(WARNING " ***   but is this what you REALLY wanted?")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   207
    message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   208
    message(WARNING " ***")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   209
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   210
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
   211
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
# Archivers ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   214
option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   215
if(PHYSFS_ARCHIVE_ZIP)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   216
    add_definitions(-DPHYSFS_SUPPORTS_ZIP=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   217
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   219
option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   220
if(PHYSFS_ARCHIVE_7Z)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   221
    add_definitions(-DPHYSFS_SUPPORTS_7Z=1)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
    # !!! FIXME: rename to 7z.c?
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   223
    set(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   224
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   226
option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   227
if(PHYSFS_ARCHIVE_GRP)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   228
    add_definitions(-DPHYSFS_SUPPORTS_GRP=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   229
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   230
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   231
option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   232
if(PHYSFS_ARCHIVE_WAD)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   233
    add_definitions(-DPHYSFS_SUPPORTS_WAD=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   234
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   235
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   236
option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   237
if(PHYSFS_ARCHIVE_HOG)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   238
    add_definitions(-DPHYSFS_SUPPORTS_HOG=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   239
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   240
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   241
option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   242
if(PHYSFS_ARCHIVE_MVL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   243
    add_definitions(-DPHYSFS_SUPPORTS_MVL=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   244
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   245
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   246
option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   247
if(PHYSFS_ARCHIVE_QPAK)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   248
    add_definitions(-DPHYSFS_SUPPORTS_QPAK=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   249
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   250
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   251
option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   252
if(PHYSFS_ARCHIVE_ISO9660)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   253
    add_definitions(-DPHYSFS_SUPPORTS_ISO9660=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   254
endif()
1066
e1d83e3b5d32 Make ISO9660 archiver optional.
Ryan C. Gordon <icculus@icculus.org>
parents: 1064
diff changeset
   255
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   256
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   257
option(PHYSFS_BUILD_STATIC "Build static library" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   258
if(PHYSFS_BUILD_STATIC)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   259
    add_library(physfs-static STATIC ${PHYSFS_SRCS})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   260
    set_target_properties(physfs-static PROPERTIES OUTPUT_NAME "physfs")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   261
    set(PHYSFS_LIB_TARGET physfs-static)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   262
    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   263
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   264
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   265
option(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   266
if(PHYSFS_BUILD_SHARED)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   267
    add_library(physfs SHARED ${PHYSFS_SRCS})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   268
    set_target_properties(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   269
    set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   270
    target_link_libraries(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   271
    set(PHYSFS_LIB_TARGET physfs)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   272
    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   273
endif()
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   274
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   275
if(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   276
    message(FATAL "Both shared and static libraries are disabled!")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   277
endif()
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   278
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   279
# CMake FAQ says I need this...
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   280
if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   281
    set_target_properties(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   282
    set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   283
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   284
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   285
option(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   286
mark_as_advanced(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   287
if(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   288
    find_path(READLINE_H readline/readline.h)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   289
    find_path(HISTORY_H readline/history.h)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   290
    if(READLINE_H AND HISTORY_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   291
        find_library(CURSES_LIBRARY NAMES curses ncurses)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   292
        set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   293
        find_library(READLINE_LIBRARY readline)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   294
        if(READLINE_LIBRARY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   295
            set(HAVE_SYSTEM_READLINE TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   296
            set(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   297
            include_directories(${READLINE_H} ${HISTORY_H})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   298
            add_definitions(-DPHYSFS_HAVE_READLINE=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   299
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   300
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   301
    add_executable(test_physfs test/test_physfs.c)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   302
    target_link_libraries(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   303
    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   304
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   305
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   306
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   307
# Scripting language bindings...
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   308
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   309
#CMake's SWIG support is basically useless.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   310
#find_package(SWIG)
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   311
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   312
option(PHYSFS_BUILD_SWIG "Build ${_LANG} bindings." TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   313
mark_as_advanced(PHYSFS_BUILD_SWIG)
1159
06fa9794e5c6 Added an option to disable all SWIG bindings at once.
Ryan C. Gordon <icculus@icculus.org>
parents: 1158
diff changeset
   314
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   315
find_program(SWIG swig DOC "Path to swig command line app: http://swig.org/")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   316
if(NOT SWIG)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   317
    message(STATUS "SWIG not found. You won't be able to build scripting language bindings.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   318
else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   319
    mark_as_advanced(SWIG)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   320
    if(DEFINED CMAKE_BUILD_TYPE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   321
        if((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   322
            if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   323
                set(SWIG_OPT_CFLAGS "-small")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   324
            else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   325
                set(SWIG_OPT_CFLAGS "-O")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   326
            endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   327
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   328
    endif()
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   329
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   330
    set(SWIG_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/physfs-swig-bindings")
1038
16b7dedb02a5 Fixed filename collision when linking the library and script bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1037
diff changeset
   331
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   332
    macro(configure_swig_binding _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   333
        string(TOUPPER "${_LANG}" _UPPERLANG)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   334
        string(TOLOWER "${_LANG}" _LOWERLANG)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   335
        set(_TARGET "physfs-${_LOWERLANG}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   336
        set(_TARGETDIR "${SWIG_OUTPUT_DIR}/${_LOWERLANG}")
1038
16b7dedb02a5 Fixed filename collision when linking the library and script bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1037
diff changeset
   337
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   338
        if(NOT EXISTS "${_TARGETDIR}")
1038
16b7dedb02a5 Fixed filename collision when linking the library and script bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1037
diff changeset
   339
            FILE(MAKE_DIRECTORY "${_TARGETDIR}")
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   340
        endif()
1038
16b7dedb02a5 Fixed filename collision when linking the library and script bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1037
diff changeset
   341
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   342
        if(PHYSFS_BUILD_${_UPPERLANG})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   343
            add_custom_command(
1038
16b7dedb02a5 Fixed filename collision when linking the library and script bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1037
diff changeset
   344
                OUTPUT "${_TARGETDIR}/${_TARGET}.c" ${_EXTRAOUTPUTS}
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   345
                MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   346
                COMMAND "${SWIG}"
1038
16b7dedb02a5 Fixed filename collision when linking the library and script bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1037
diff changeset
   347
                ARGS ${SWIG_OPT_CFLAGS} -${_LOWERLANG} -outdir "${_TARGETDIR}" -o "${_TARGETDIR}/${_TARGET}.c" "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   348
                COMMENT "Generating ${_LANG} bindings..."
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   349
            )
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   350
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   351
            add_library(${_TARGET} SHARED "${_TARGETDIR}/${_TARGET}.c")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   352
            target_link_libraries(${_TARGET} ${PHYSFS_LIB_TARGET})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   353
            set_target_properties(${_TARGET} PROPERTIES
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   354
                COMPILE_FLAGS "${_EXTRACFLAGS}"
1035
f6ca3f9af74c More work on Perl bindings linking.
Ryan C. Gordon <icculus@icculus.org>
parents: 1034
diff changeset
   355
                LINK_FLAGS "${_EXTRALDFLAGS}"
1038
16b7dedb02a5 Fixed filename collision when linking the library and script bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1037
diff changeset
   356
                LIBRARY_OUTPUT_NAME "physfs"
16b7dedb02a5 Fixed filename collision when linking the library and script bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1037
diff changeset
   357
                LIBRARY_OUTPUT_DIRECTORY "${_TARGETDIR}"
1039
6ea910694da8 Not sure if this is still needed (it's definitely unneeded in CMake 2.8).
Ryan C. Gordon <icculus@icculus.org>
parents: 1038
diff changeset
   358
                CLEAN_DIRECT_OUTPUT 1
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   359
            )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   360
            install(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   361
            message(STATUS "${_LANG} bindings configured!")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   362
        else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   363
            message(STATUS "Couldn't figure out ${_LANG} configuration. Skipping ${_LANG} bindings.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   364
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   365
    endmacro()
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   366
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   367
    macro(add_script_binding_option _VAR _LANG _DEFVAL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   368
        set(BUILDSWIGVAL ${_DEFVAL})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   369
        if(NOT PHYSFS_BUILD_SWIG)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   370
            set(BUILDSWIGVAL FALSE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   371
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   372
        option(${_VAR} "Build ${_LANG} bindings." ${BUILDSWIGVAL})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   373
        mark_as_advanced(${_VAR})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   374
    endmacro()
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   375
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   376
    add_script_binding_option(PHYSFS_BUILD_PERL "Perl" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   377
    add_script_binding_option(PHYSFS_BUILD_RUBY "Ruby" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   378
endif()
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   379
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   380
if(PHYSFS_BUILD_PERL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   381
    message(STATUS "Configuring Perl bindings...")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   382
    find_program(PERL perl DOC "Path to perl command line app: http://perl.org/")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   383
    if(NOT PERL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   384
        message(STATUS "Perl not found. You won't be able to build perl bindings.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   385
        set(PHYSFS_BUILD_PERL FALSE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   386
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   387
    mark_as_advanced(PERL)
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   388
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   389
    macro(get_perl_config _KEY _VALUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   390
        if(PHYSFS_BUILD_PERL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   391
            message(STATUS "Figuring out perl config value '${_KEY}' ...")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   392
            execute_process(
1033
c846b83628f4 Use FIND_PROGRAM(perl) instead of FindPerl.
Ryan C. Gordon <icculus@icculus.org>
parents: 1032
diff changeset
   393
                COMMAND ${PERL} -w -e "use Config; print \$Config{${_KEY}};"
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   394
                RESULT_VARIABLE GET_PERL_CONFIG_RC
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   395
                OUTPUT_VARIABLE ${_VALUE}
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   396
            )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   397
            if(NOT GET_PERL_CONFIG_RC EQUAL 0)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   398
                message(STATUS "Perl executable ('${PERL}') reported failure: ${GET_PERL_CONFIG_RC}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   399
                set(PHYSFS_BUILD_PERL FALSE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   400
            endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   401
            if(NOT ${_VALUE})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   402
                message(STATUS "Perl executable ('${PERL}') didn't have a value for '${_KEY}'")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   403
                set(PHYSFS_BUILD_PERL FALSE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   404
            endif()
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   405
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   406
            if(PHYSFS_BUILD_PERL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   407
                message(STATUS "Perl says: '${${_VALUE}}'.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   408
            endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   409
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   410
    endmacro()
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   411
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   412
    # !!! FIXME: installsitearch might be the wrong location.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   413
    get_perl_config("archlibexp" PERL_INCLUDE_PATH)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   414
    get_perl_config("ccflags" PERL_CCFLAGS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   415
    get_perl_config("ldflags" PERL_LDFLAGS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   416
    get_perl_config("installsitearch" PERL_INSTALL_PATH)
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   417
1037
d452f4da0970 More perl bindings wanking.
Ryan C. Gordon <icculus@icculus.org>
parents: 1035
diff changeset
   418
    # !!! FIXME: this test for Mac OS X is wrong.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   419
    if(MACOSX)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   420
        get_perl_config("libperl" PERL_LIBPERL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   421
        set(TMPLIBPERL "${PERL_LIBPERL}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   422
        string(REGEX REPLACE "^lib" "" TMPLIBPERL "${TMPLIBPERL}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   423
        string(REGEX REPLACE "\\.so$" "" TMPLIBPERL "${TMPLIBPERL}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   424
        string(REGEX REPLACE "\\.dylib$" "" TMPLIBPERL "${TMPLIBPERL}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   425
        string(REGEX REPLACE "\\.dll$" "" TMPLIBPERL "${TMPLIBPERL}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   426
        if(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   427
            message(STATUS "Stripped '${PERL_LIBPERL}' down to '${TMPLIBPERL}'.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   428
            set(PERL_LIBPERL "${TMPLIBPERL}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   429
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   430
        set(PERL_LIBPERL "-l${PERL_LIBPERL}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   431
    endif()
1035
f6ca3f9af74c More work on Perl bindings linking.
Ryan C. Gordon <icculus@icculus.org>
parents: 1034
diff changeset
   432
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   433
    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}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   434
    install(FILES "${SWIG_OUTPUT_DIR}/perl/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   435
    install(
1044
c06cad5295c3 Install test_physfs.pl with the rest of the project.
Ryan C. Gordon <icculus@icculus.org>
parents: 1042
diff changeset
   436
        FILES test/test_physfs.pl
c06cad5295c3 Install test_physfs.pl with the rest of the project.
Ryan C. Gordon <icculus@icculus.org>
parents: 1042
diff changeset
   437
        DESTINATION bin
c06cad5295c3 Install test_physfs.pl with the rest of the project.
Ryan C. Gordon <icculus@icculus.org>
parents: 1042
diff changeset
   438
        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
c06cad5295c3 Install test_physfs.pl with the rest of the project.
Ryan C. Gordon <icculus@icculus.org>
parents: 1042
diff changeset
   439
                    GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
c06cad5295c3 Install test_physfs.pl with the rest of the project.
Ryan C. Gordon <icculus@icculus.org>
parents: 1042
diff changeset
   440
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   441
endif()
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   442
1051
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   443
# !!! FIXME: lots of cut-and-paste from perl bindings.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   444
if(PHYSFS_BUILD_RUBY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   445
    message(STATUS "Configuring Ruby bindings...")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   446
    find_program(RUBY ruby DOC "Path to ruby command line app: http://ruby-lang.org/")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   447
    if(NOT RUBY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   448
        message(STATUS "Ruby not found. You won't be able to build ruby bindings.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   449
        set(PHYSFS_BUILD_RUBY FALSE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   450
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   451
    mark_as_advanced(RUBY)
1051
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   452
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   453
    macro(get_ruby_config _KEY _VALUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   454
        if(PHYSFS_BUILD_RUBY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   455
            message(STATUS "Figuring out ruby config value '${_KEY}' ...")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   456
            execute_process(
1051
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   457
                COMMAND ${RUBY} -e "require 'rbconfig'; puts RbConfig::CONFIG['${_KEY}'];"
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   458
                RESULT_VARIABLE GET_RUBY_CONFIG_RC
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   459
                OUTPUT_VARIABLE ${_VALUE}
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   460
                OUTPUT_STRIP_TRAILING_WHITESPACE
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   461
            )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   462
            if(NOT GET_RUBY_CONFIG_RC EQUAL 0)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   463
                message(STATUS "Ruby executable ('${RUBY}') reported failure: ${GET_RUBY_CONFIG_RC}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   464
                set(PHYSFS_BUILD_RUBY FALSE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   465
            endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   466
            if(NOT ${_VALUE})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   467
                message(STATUS "Ruby executable ('${RUBY}') didn't have a value for '${_KEY}'")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   468
                set(PHYSFS_BUILD_RUBY FALSE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   469
            endif()
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   470
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   471
            if(PHYSFS_BUILD_RUBY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   472
                message(STATUS "Ruby says: '${${_VALUE}}'.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   473
            endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   474
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   475
    endmacro()
1051
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   476
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   477
    get_ruby_config("archdir" RUBY_INCLUDE_PATH)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   478
    get_ruby_config("CFLAGS" RUBY_CCFLAGS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   479
    get_ruby_config("LDFLAGS" RUBY_LDFLAGS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   480
    get_ruby_config("sitearchdir" RUBY_INSTALL_PATH)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   481
    get_ruby_config("LIBRUBYARG_SHARED" RUBY_LIBRUBY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   482
    get_ruby_config("libdir" RUBY_LIBDIR)
1051
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   483
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   484
    configure_swig_binding(Ruby "${RUBY_INSTALL_PATH}" "" "\"-I${RUBY_INCLUDE_PATH}\" ${RUBY_CCFLAGS} -w" "\"-L${RUBY_LIBDIR}\" ${RUBY_LIBRUBY} ${RUBY_LDFLAGS}")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   485
    set_target_properties(physfs-ruby PROPERTIES PREFIX "")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   486
    install(
1051
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   487
        FILES test/test_physfs.rb
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   488
        DESTINATION bin
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   489
        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   490
                    GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
42fef01c55d6 Added SWIG-based Ruby bindings.
Ryan C. Gordon <icculus@icculus.org>
parents: 1047
diff changeset
   491
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   492
endif()
1032
ea6aaadcfa04 Initial work on Ruby bindings, barely started.
Ryan C. Gordon <icculus@icculus.org>
parents: 1031
diff changeset
   493
1030
17c521170ba6 Hooked up Perl bindings, via SWIG.
Ryan C. Gordon <icculus@icculus.org>
parents: 1015
diff changeset
   494
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   495
install(TARGETS ${PHYSFS_INSTALL_TARGETS}
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   496
        RUNTIME DESTINATION bin
1140
079b6bf97b23 Use LIB_SUFFIX to install to lib64 instead of lib (thanks, Cristian!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1139
diff changeset
   497
        LIBRARY DESTINATION lib${LIB_SUFFIX}
079b6bf97b23 Use LIB_SUFFIX to install to lib64 instead of lib (thanks, Cristian!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1139
diff changeset
   498
        ARCHIVE DESTINATION lib${LIB_SUFFIX})
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   499
install(FILES src/physfs.h DESTINATION include)
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   500
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   501
find_package(Doxygen)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   502
if(DOXYGEN_FOUND)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   503
    set(PHYSFS_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   504
    configure_file(
1153
5cbedebaa623 Corrected doc paths for development branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 1152
diff changeset
   505
        "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile"
1151
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   506
        "${PHYSFS_OUTPUT_DOXYFILE}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   507
        COPYONLY
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   508
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   509
    file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   510
    file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${PHYSFS_VERSION}\"\n")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   511
    file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   512
    file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n")
1151
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   513
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   514
    add_custom_target(
1151
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   515
        docs
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   516
        ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   517
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   518
        COMMENT "Building documentation in 'docs' directory..."
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   519
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   520
else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   521
    message(STATUS "Doxygen not found. You won't be able to build documentation.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   522
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   523
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   524
if(UNIX)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   525
    set(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   526
    add_custom_target(
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   527
        dist
1042
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   528
        hg archive -t tgz "${PHYSFS_TARBALL}"
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   529
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   530
        COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   531
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   532
    add_custom_target(
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   533
        uninstall
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   534
        "${CMAKE_CURRENT_SOURCE_DIR}/extras/uninstall.sh"
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   535
        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   536
        COMMENT "Uninstall the project..."
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   537
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   538
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   539
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   540
macro(message_bool_option _NAME _VALUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   541
    if(${_VALUE})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   542
        message(STATUS "  ${_NAME}: enabled")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   543
    else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   544
        message(STATUS "  ${_NAME}: disabled")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   545
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   546
endmacro()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   547
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   548
message(STATUS "PhysicsFS will build with the following options:")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   549
message_bool_option("ZIP support" PHYSFS_ARCHIVE_ZIP)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   550
message_bool_option("7zip support" PHYSFS_ARCHIVE_7Z)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   551
message_bool_option("GRP support" PHYSFS_ARCHIVE_GRP)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   552
message_bool_option("WAD support" PHYSFS_ARCHIVE_WAD)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   553
message_bool_option("HOG support" PHYSFS_ARCHIVE_HOG)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   554
message_bool_option("MVL support" PHYSFS_ARCHIVE_MVL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   555
message_bool_option("QPAK support" PHYSFS_ARCHIVE_QPAK)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   556
message_bool_option("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   557
message_bool_option("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   558
message_bool_option("Build static library" PHYSFS_BUILD_STATIC)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   559
message_bool_option("Build shared library" PHYSFS_BUILD_SHARED)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   560
message_bool_option("Build Perl bindings" PHYSFS_BUILD_PERL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   561
message_bool_option("Build Ruby bindings" PHYSFS_BUILD_RUBY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   562
message_bool_option("Build stdio test program" PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   563
if(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   564
    message_bool_option("  Use readline in test program" HAVE_SYSTEM_READLINE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   565
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   566
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   567
# end of CMakeLists.txt ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   568