CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Tue, 23 Oct 2012 15:02:30 -0400
changeset 1311 ec7bcd927ccb
parent 1310 3382edc8a7f9
child 1315 c686e4f84ab5
permissions -rw-r--r--
Remove SWIG stuff from build. This is never going to work well everywhere. I'll leave the SWIG stuff elsewhere, though, for those that want to build their own bindings.
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
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   306
install(TARGETS ${PHYSFS_INSTALL_TARGETS}
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   307
        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
   308
        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
   309
        ARCHIVE DESTINATION lib${LIB_SUFFIX})
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   310
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
   311
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   312
find_package(Doxygen)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   313
if(DOXYGEN_FOUND)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   314
    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
   315
    configure_file(
1153
5cbedebaa623 Corrected doc paths for development branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 1152
diff changeset
   316
        "${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
   317
        "${PHYSFS_OUTPUT_DOXYFILE}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   318
        COPYONLY
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   319
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   320
    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
   321
    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
   322
    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
   323
    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
   324
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   325
    add_custom_target(
1151
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   326
        docs
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   327
        ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   328
        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
   329
        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
   330
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   331
else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   332
    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
   333
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   334
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   335
if(UNIX)
1310
3382edc8a7f9 Use .tar.bz2 on this branch, too.
Ryan C. Gordon <icculus@icculus.org>
parents: 1309
diff changeset
   336
    set(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.bz2")
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   337
    add_custom_target(
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   338
        dist
1310
3382edc8a7f9 Use .tar.bz2 on this branch, too.
Ryan C. Gordon <icculus@icculus.org>
parents: 1309
diff changeset
   339
        hg archive -t tbz2 "${PHYSFS_TARBALL}"
1042
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   340
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   341
        COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   342
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   343
    add_custom_target(
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   344
        uninstall
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   345
        "${CMAKE_CURRENT_SOURCE_DIR}/extras/uninstall.sh"
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   346
        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   347
        COMMENT "Uninstall the project..."
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   348
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   349
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   350
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   351
macro(message_bool_option _NAME _VALUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   352
    if(${_VALUE})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   353
        message(STATUS "  ${_NAME}: enabled")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   354
    else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   355
        message(STATUS "  ${_NAME}: disabled")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   356
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   357
endmacro()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   358
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   359
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
   360
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
   361
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
   362
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
   363
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
   364
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
   365
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
   366
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
   367
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
   368
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
   369
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
   370
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
   371
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
   372
if(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   373
    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
   374
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   375
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   376
# end of CMakeLists.txt ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   377