Lowercased most of the CMake project file.

This commit is contained in:
Ryan C. Gordon 2012-10-23 14:58:54 -04:00
parent 724b71a657
commit 3f212a8a44
1 changed files with 358 additions and 359 deletions

View File

@ -1,64 +1,63 @@
# PhysicsFS; a portable, flexible file i/o abstraction. # PhysicsFS; a portable, flexible file i/o abstraction.
# Copyright (C) 2007 Ryan C. Gordon.
# #
# Please see the file LICENSE.txt in the source's root directory. # Please see the file LICENSE.txt in the source's root directory.
CMAKE_MINIMUM_REQUIRED(VERSION 2.4) cmake_minimum_required(VERSION 2.8.4)
PROJECT(PhysicsFS) project(PhysicsFS)
SET(PHYSFS_VERSION 2.1.0) set(PHYSFS_VERSION 2.1.0)
# Increment this if/when we break backwards compatibility. # Increment this if/when we break backwards compatibility.
SET(PHYSFS_SOVERSION 1) set(PHYSFS_SOVERSION 1)
# I hate that they define "WIN32" ... we're about to move to Win64...I hope! # I hate that they define "WIN32" ... we're about to move to Win64...I hope!
IF(WIN32 AND NOT WINDOWS) if(WIN32 AND NOT WINDOWS)
SET(WINDOWS TRUE) set(WINDOWS TRUE)
ENDIF(WIN32 AND NOT WINDOWS) endif()
# Bleh, let's do it for "APPLE" too. # Bleh, let's do it for "APPLE" too.
IF(APPLE AND NOT MACOSX) if(APPLE AND NOT MACOSX)
SET(MACOSX TRUE) set(MACOSX TRUE)
ENDIF(APPLE AND NOT MACOSX) endif()
# For now, Haiku and BeOS are the same, as far as the build system cares. # For now, Haiku and BeOS are the same, as far as the build system cares.
IF(HAIKU AND NOT BEOS) if(HAIKU AND NOT BEOS)
SET(BEOS TRUE) set(BEOS TRUE)
ENDIF(HAIKU AND NOT BEOS) endif()
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
SET(SOLARIS TRUE) set(SOLARIS TRUE)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") endif()
INCLUDE(CheckIncludeFile) include(CheckIncludeFile)
INCLUDE(CheckLibraryExists) include(CheckLibraryExists)
INCLUDE(CheckCSourceCompiles) include(CheckCSourceCompiles)
INCLUDE_DIRECTORIES(./src) include_directories(./src)
IF(MACOSX) if(MACOSX)
# Fallback to older OS X on PowerPC to support wider range of systems... # Fallback to older OS X on PowerPC to support wider range of systems...
IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) if(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020) add_definitions(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2") set(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2")
ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) endif()
# Need these everywhere... # Need these everywhere...
ADD_DEFINITIONS(-fno-common) add_definitions(-fno-common)
SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework Carbon -framework IOKit") set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework Carbon -framework IOKit")
ENDIF(MACOSX) endif()
# Add some gcc-specific command lines. # Add some gcc-specific command lines.
IF(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
# Always build with debug symbols...you can strip it later. # Always build with debug symbols...you can strip it later.
ADD_DEFINITIONS(-g -pipe -Werror -fsigned-char) add_definitions(-g -pipe -Werror -fsigned-char)
# Stupid BeOS generates warnings in the system headers. # Stupid BeOS generates warnings in the system headers.
IF(NOT BEOS) if(NOT BEOS)
ADD_DEFINITIONS(-Wall) add_definitions(-Wall)
ENDIF(NOT BEOS) endif()
CHECK_C_SOURCE_COMPILES(" check_c_source_compiles("
#if ((defined(__GNUC__)) && (__GNUC__ >= 4)) #if ((defined(__GNUC__)) && (__GNUC__ >= 4))
int main(int argc, char **argv) { int is_gcc4 = 1; return 0; } int main(int argc, char **argv) { int is_gcc4 = 1; return 0; }
#else #else
@ -66,31 +65,31 @@ IF(CMAKE_COMPILER_IS_GNUCC)
#endif #endif
" PHYSFS_IS_GCC4) " PHYSFS_IS_GCC4)
IF(PHYSFS_IS_GCC4) if(PHYSFS_IS_GCC4)
# Not supported on several operating systems at this time. # Not supported on several operating systems at this time.
IF(NOT SOLARIS AND NOT WINDOWS) if(NOT SOLARIS AND NOT WINDOWS)
ADD_DEFINITIONS(-fvisibility=hidden) add_definitions(-fvisibility=hidden)
ENDIF(NOT SOLARIS AND NOT WINDOWS) endif()
ENDIF(PHYSFS_IS_GCC4) endif()
# Don't use -rpath. # Don't use -rpath.
SET(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE) set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
ENDIF(CMAKE_COMPILER_IS_GNUCC) endif()
IF(CMAKE_C_COMPILER_ID STREQUAL "SunPro") if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
ADD_DEFINITIONS(-erroff=E_EMPTY_TRANSLATION_UNIT) add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
ADD_DEFINITIONS(-xldscope=hidden) add_definitions(-xldscope=hidden)
ENDIF(CMAKE_C_COMPILER_ID STREQUAL "SunPro") endif()
IF(MSVC) if(MSVC)
# VS.NET 8.0 got really really anal about strcpy, etc, which even if we # VS.NET 8.0 got really really anal about strcpy, etc, which even if we
# cleaned up our code, zlib, etc still use...so disable the warning. # cleaned up our code, zlib, etc still use...so disable the warning.
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1) add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
ENDIF(MSVC) endif()
# Basic chunks of source code ... # Basic chunks of source code ...
SET(LZMA_SRCS set(LZMA_SRCS
src/lzma/C/7zCrc.c src/lzma/C/7zCrc.c
src/lzma/C/Archive/7z/7zBuffer.c src/lzma/C/Archive/7z/7zBuffer.c
src/lzma/C/Archive/7z/7zDecode.c src/lzma/C/Archive/7z/7zDecode.c
@ -104,20 +103,20 @@ SET(LZMA_SRCS
src/lzma/C/Compress/Lzma/LzmaDecode.c src/lzma/C/Compress/Lzma/LzmaDecode.c
) )
IF(BEOS) if(BEOS)
# We add this explicitly, since we don't want CMake to think this # We add this explicitly, since we don't want CMake to think this
# is a C++ project unless we're on BeOS. # is a C++ project unless we're on BeOS.
SET(PHYSFS_BEOS_SRCS src/platform_beos.cpp) set(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
FIND_LIBRARY(BE_LIBRARY be) find_library(BE_LIBRARY be)
FIND_LIBRARY(ROOT_LIBRARY root) find_library(ROOT_LIBRARY root)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY}) set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
ENDIF(BEOS) endif()
# Almost everything is "compiled" here, but things that don't apply to the # Almost everything is "compiled" here, but things that don't apply to the
# build are #ifdef'd out. This is to make it easy to embed PhysicsFS into # build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
# another project or bring up a new build system: just compile all the source # another project or bring up a new build system: just compile all the source
# code and #define the things you want. # code and #define the things you want.
SET(PHYSFS_SRCS set(PHYSFS_SRCS
src/physfs.c src/physfs.c
src/physfs_byteorder.c src/physfs_byteorder.c
src/physfs_unicode.c src/physfs_unicode.c
@ -141,207 +140,207 @@ SET(PHYSFS_SRCS
# platform layers ... # platform layers ...
IF(UNIX) if(UNIX)
IF(BEOS) if(BEOS)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
SET(HAVE_PTHREAD_H TRUE) set(HAVE_PTHREAD_H TRUE)
ELSE(BEOS) else()
CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H) check_include_file(sys/ucred.h HAVE_UCRED_H)
IF(HAVE_UCRED_H) if(HAVE_UCRED_H)
ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1) add_definitions(-DPHYSFS_HAVE_SYS_UCRED_H=1)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
ENDIF(HAVE_UCRED_H) endif()
CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H) check_include_file(mntent.h HAVE_MNTENT_H)
IF(HAVE_MNTENT_H) if(HAVE_MNTENT_H)
ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1) add_definitions(-DPHYSFS_HAVE_MNTENT_H=1)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
ENDIF(HAVE_MNTENT_H) endif()
# !!! FIXME: Solaris fails this, because mnttab.h implicitly # !!! FIXME: Solaris fails this, because mnttab.h implicitly
# !!! FIXME: depends on other system headers. :( # !!! FIXME: depends on other system headers. :(
#CHECK_INCLUDE_FILE(sys/mnttab.h HAVE_SYS_MNTTAB_H) #check_include_file(sys/mnttab.h HAVE_SYS_MNTTAB_H)
CHECK_C_SOURCE_COMPILES(" check_c_source_compiles("
#include <stdio.h> #include <stdio.h>
#include <sys/mnttab.h> #include <sys/mnttab.h>
int main(int argc, char **argv) { return 0; } int main(int argc, char **argv) { return 0; }
" HAVE_SYS_MNTTAB_H) " HAVE_SYS_MNTTAB_H)
IF(HAVE_SYS_MNTTAB_H) if(HAVE_SYS_MNTTAB_H)
ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_MNTTAB_H=1) add_definitions(-DPHYSFS_HAVE_SYS_MNTTAB_H=1)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
ENDIF(HAVE_SYS_MNTTAB_H) endif()
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H) check_include_file(pthread.h HAVE_PTHREAD_H)
IF(HAVE_PTHREAD_H) if(HAVE_PTHREAD_H)
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
ENDIF(HAVE_PTHREAD_H) endif()
ENDIF(BEOS) endif()
ENDIF(UNIX) endif()
IF(WINDOWS) if(WINDOWS)
SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
ENDIF(WINDOWS) endif()
IF(NOT PHYSFS_HAVE_CDROM_SUPPORT) if(NOT PHYSFS_HAVE_CDROM_SUPPORT)
ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1) add_definitions(-DPHYSFS_NO_CDROM_SUPPORT=1)
MESSAGE(WARNING " ***") message(WARNING " ***")
MESSAGE(WARNING " *** There is no CD-ROM support in this build!") message(WARNING " *** There is no CD-ROM support in this build!")
MESSAGE(WARNING " *** PhysicsFS will just pretend there are no discs.") message(WARNING " *** PhysicsFS will just pretend there are no discs.")
MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,") message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
MESSAGE(WARNING " *** but is this what you REALLY wanted?") message(WARNING " *** but is this what you REALLY wanted?")
MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)") message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
MESSAGE(WARNING " ***") message(WARNING " ***")
ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT) endif()
IF(PHYSFS_HAVE_THREAD_SUPPORT) if(PHYSFS_HAVE_THREAD_SUPPORT)
ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE) add_definitions(-D_REENTRANT -D_THREAD_SAFE)
ELSE(PHYSFS_HAVE_THREAD_SUPPORT) else()
ADD_DEFINITIONS(-DPHYSFS_NO_THREAD_SUPPORT=1) add_definitions(-DPHYSFS_NO_THREAD_SUPPORT=1)
MESSAGE(WARNING " ***") message(WARNING " ***")
MESSAGE(WARNING " *** There is no thread support in this build!") message(WARNING " *** There is no thread support in this build!")
MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!") message(WARNING " *** PhysicsFS will NOT be reentrant!")
MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,") message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
MESSAGE(WARNING " *** but is this what you REALLY wanted?") message(WARNING " *** but is this what you REALLY wanted?")
MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)") message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
MESSAGE(WARNING " ***") message(WARNING " ***")
ENDIF(PHYSFS_HAVE_THREAD_SUPPORT) endif()
# Archivers ... # Archivers ...
OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE) option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
IF(PHYSFS_ARCHIVE_ZIP) if(PHYSFS_ARCHIVE_ZIP)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1) add_definitions(-DPHYSFS_SUPPORTS_ZIP=1)
ENDIF(PHYSFS_ARCHIVE_ZIP) endif()
OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE) option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
IF(PHYSFS_ARCHIVE_7Z) if(PHYSFS_ARCHIVE_7Z)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1) add_definitions(-DPHYSFS_SUPPORTS_7Z=1)
# !!! FIXME: rename to 7z.c? # !!! FIXME: rename to 7z.c?
SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS}) set(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS})
ENDIF(PHYSFS_ARCHIVE_7Z) endif()
OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE) option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
IF(PHYSFS_ARCHIVE_GRP) if(PHYSFS_ARCHIVE_GRP)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1) add_definitions(-DPHYSFS_SUPPORTS_GRP=1)
ENDIF(PHYSFS_ARCHIVE_GRP) endif()
OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE) option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
IF(PHYSFS_ARCHIVE_WAD) if(PHYSFS_ARCHIVE_WAD)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1) add_definitions(-DPHYSFS_SUPPORTS_WAD=1)
ENDIF(PHYSFS_ARCHIVE_WAD) endif()
OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE) option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
IF(PHYSFS_ARCHIVE_HOG) if(PHYSFS_ARCHIVE_HOG)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1) add_definitions(-DPHYSFS_SUPPORTS_HOG=1)
ENDIF(PHYSFS_ARCHIVE_HOG) endif()
OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE) option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
IF(PHYSFS_ARCHIVE_MVL) if(PHYSFS_ARCHIVE_MVL)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1) add_definitions(-DPHYSFS_SUPPORTS_MVL=1)
ENDIF(PHYSFS_ARCHIVE_MVL) endif()
OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE) option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
IF(PHYSFS_ARCHIVE_QPAK) if(PHYSFS_ARCHIVE_QPAK)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1) add_definitions(-DPHYSFS_SUPPORTS_QPAK=1)
ENDIF(PHYSFS_ARCHIVE_QPAK) endif()
OPTION(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE) option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
IF(PHYSFS_ARCHIVE_ISO9660) if(PHYSFS_ARCHIVE_ISO9660)
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ISO9660=1) add_definitions(-DPHYSFS_SUPPORTS_ISO9660=1)
ENDIF(PHYSFS_ARCHIVE_ISO9660) endif()
OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE) option(PHYSFS_BUILD_STATIC "Build static library" TRUE)
IF(PHYSFS_BUILD_STATIC) if(PHYSFS_BUILD_STATIC)
ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS}) add_library(physfs-static STATIC ${PHYSFS_SRCS})
SET_TARGET_PROPERTIES(physfs-static PROPERTIES OUTPUT_NAME "physfs") set_target_properties(physfs-static PROPERTIES OUTPUT_NAME "physfs")
SET(PHYSFS_LIB_TARGET physfs-static) set(PHYSFS_LIB_TARGET physfs-static)
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
ENDIF(PHYSFS_BUILD_STATIC) endif()
OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE) option(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
IF(PHYSFS_BUILD_SHARED) if(PHYSFS_BUILD_SHARED)
ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS}) add_library(physfs SHARED ${PHYSFS_SRCS})
SET_TARGET_PROPERTIES(physfs PROPERTIES VERSION ${PHYSFS_VERSION}) set_target_properties(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION}) set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) target_link_libraries(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
SET(PHYSFS_LIB_TARGET physfs) set(PHYSFS_LIB_TARGET physfs)
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs") set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
ENDIF(PHYSFS_BUILD_SHARED) endif()
IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC) if(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
MESSAGE(FATAL "Both shared and static libraries are disabled!") message(FATAL "Both shared and static libraries are disabled!")
ENDIF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC) endif()
# CMake FAQ says I need this... # CMake FAQ says I need this...
IF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC) if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
SET_TARGET_PROPERTIES(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1) set_target_properties(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC) endif()
OPTION(PHYSFS_BUILD_TEST "Build stdio test program." TRUE) option(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
MARK_AS_ADVANCED(PHYSFS_BUILD_TEST) mark_as_advanced(PHYSFS_BUILD_TEST)
IF(PHYSFS_BUILD_TEST) if(PHYSFS_BUILD_TEST)
FIND_PATH(READLINE_H readline/readline.h) find_path(READLINE_H readline/readline.h)
FIND_PATH(HISTORY_H readline/history.h) find_path(HISTORY_H readline/history.h)
IF(READLINE_H AND HISTORY_H) if(READLINE_H AND HISTORY_H)
FIND_LIBRARY(CURSES_LIBRARY NAMES curses ncurses) find_library(CURSES_LIBRARY NAMES curses ncurses)
SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY}) set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
FIND_LIBRARY(READLINE_LIBRARY readline) find_library(READLINE_LIBRARY readline)
IF(READLINE_LIBRARY) if(READLINE_LIBRARY)
SET(HAVE_SYSTEM_READLINE TRUE) set(HAVE_SYSTEM_READLINE TRUE)
SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY}) set(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
INCLUDE_DIRECTORIES(${READLINE_H} ${HISTORY_H}) include_directories(${READLINE_H} ${HISTORY_H})
ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1) add_definitions(-DPHYSFS_HAVE_READLINE=1)
ENDIF(READLINE_LIBRARY) endif()
ENDIF(READLINE_H AND HISTORY_H) endif()
ADD_EXECUTABLE(test_physfs test/test_physfs.c) add_executable(test_physfs test/test_physfs.c)
TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS}) target_link_libraries(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs") set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
ENDIF(PHYSFS_BUILD_TEST) endif()
# Scripting language bindings... # Scripting language bindings...
#CMake's SWIG support is basically useless. #CMake's SWIG support is basically useless.
#FIND_PACKAGE(SWIG) #find_package(SWIG)
OPTION(PHYSFS_BUILD_SWIG "Build ${_LANG} bindings." TRUE) option(PHYSFS_BUILD_SWIG "Build ${_LANG} bindings." TRUE)
MARK_AS_ADVANCED(PHYSFS_BUILD_SWIG) mark_as_advanced(PHYSFS_BUILD_SWIG)
FIND_PROGRAM(SWIG swig DOC "Path to swig command line app: http://swig.org/") find_program(SWIG swig DOC "Path to swig command line app: http://swig.org/")
IF(NOT SWIG) if(NOT SWIG)
MESSAGE(STATUS "SWIG not found. You won't be able to build scripting language bindings.") message(STATUS "SWIG not found. You won't be able to build scripting language bindings.")
ELSE(NOT SWIG) else()
MARK_AS_ADVANCED(SWIG) mark_as_advanced(SWIG)
IF(DEFINED CMAKE_BUILD_TYPE) if(DEFINED CMAKE_BUILD_TYPE)
IF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")) if((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
IF(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
SET(SWIG_OPT_CFLAGS "-small") set(SWIG_OPT_CFLAGS "-small")
ELSE(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") else()
SET(SWIG_OPT_CFLAGS "-O") set(SWIG_OPT_CFLAGS "-O")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") endif()
ENDIF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")) endif()
ENDIF(DEFINED CMAKE_BUILD_TYPE) endif()
SET(SWIG_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/physfs-swig-bindings") set(SWIG_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/physfs-swig-bindings")
MACRO(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS) macro(configure_swig_binding _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS)
STRING(TOUPPER "${_LANG}" _UPPERLANG) string(TOUPPER "${_LANG}" _UPPERLANG)
STRING(TOLOWER "${_LANG}" _LOWERLANG) string(TOLOWER "${_LANG}" _LOWERLANG)
SET(_TARGET "physfs-${_LOWERLANG}") set(_TARGET "physfs-${_LOWERLANG}")
SET(_TARGETDIR "${SWIG_OUTPUT_DIR}/${_LOWERLANG}") set(_TARGETDIR "${SWIG_OUTPUT_DIR}/${_LOWERLANG}")
IF(NOT EXISTS "${_TARGETDIR}") if(NOT EXISTS "${_TARGETDIR}")
FILE(MAKE_DIRECTORY "${_TARGETDIR}") FILE(MAKE_DIRECTORY "${_TARGETDIR}")
ENDIF(NOT EXISTS "${_TARGETDIR}") endif()
IF(PHYSFS_BUILD_${_UPPERLANG}) if(PHYSFS_BUILD_${_UPPERLANG})
ADD_CUSTOM_COMMAND( add_custom_command(
OUTPUT "${_TARGETDIR}/${_TARGET}.c" ${_EXTRAOUTPUTS} OUTPUT "${_TARGETDIR}/${_TARGET}.c" ${_EXTRAOUTPUTS}
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i" MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
COMMAND "${SWIG}" COMMAND "${SWIG}"
@ -349,221 +348,221 @@ ELSE(NOT SWIG)
COMMENT "Generating ${_LANG} bindings..." COMMENT "Generating ${_LANG} bindings..."
) )
ADD_LIBRARY(${_TARGET} SHARED "${_TARGETDIR}/${_TARGET}.c") add_library(${_TARGET} SHARED "${_TARGETDIR}/${_TARGET}.c")
TARGET_LINK_LIBRARIES(${_TARGET} ${PHYSFS_LIB_TARGET}) target_link_libraries(${_TARGET} ${PHYSFS_LIB_TARGET})
SET_TARGET_PROPERTIES(${_TARGET} PROPERTIES set_target_properties(${_TARGET} PROPERTIES
COMPILE_FLAGS "${_EXTRACFLAGS}" COMPILE_FLAGS "${_EXTRACFLAGS}"
LINK_FLAGS "${_EXTRALDFLAGS}" LINK_FLAGS "${_EXTRALDFLAGS}"
LIBRARY_OUTPUT_NAME "physfs" LIBRARY_OUTPUT_NAME "physfs"
LIBRARY_OUTPUT_DIRECTORY "${_TARGETDIR}" LIBRARY_OUTPUT_DIRECTORY "${_TARGETDIR}"
CLEAN_DIRECT_OUTPUT 1 CLEAN_DIRECT_OUTPUT 1
) )
INSTALL(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}") install(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
MESSAGE(STATUS "${_LANG} bindings configured!") message(STATUS "${_LANG} bindings configured!")
ELSE(PHYSFS_BUILD_${_UPPERLANG}) else()
MESSAGE(STATUS "Couldn't figure out ${_LANG} configuration. Skipping ${_LANG} bindings.") message(STATUS "Couldn't figure out ${_LANG} configuration. Skipping ${_LANG} bindings.")
ENDIF(PHYSFS_BUILD_${_UPPERLANG}) endif()
ENDMACRO(CONFIGURE_SWIG_BINDING) endmacro()
MACRO(ADD_SCRIPT_BINDING_OPTION _VAR _LANG _DEFVAL) macro(add_script_binding_option _VAR _LANG _DEFVAL)
SET(BUILDSWIGVAL ${_DEFVAL}) set(BUILDSWIGVAL ${_DEFVAL})
IF(NOT PHYSFS_BUILD_SWIG) if(NOT PHYSFS_BUILD_SWIG)
SET(BUILDSWIGVAL FALSE) set(BUILDSWIGVAL FALSE)
ENDIF(NOT PHYSFS_BUILD_SWIG) endif()
OPTION(${_VAR} "Build ${_LANG} bindings." ${BUILDSWIGVAL}) option(${_VAR} "Build ${_LANG} bindings." ${BUILDSWIGVAL})
MARK_AS_ADVANCED(${_VAR}) mark_as_advanced(${_VAR})
ENDMACRO(ADD_SCRIPT_BINDING_OPTION) endmacro()
ADD_SCRIPT_BINDING_OPTION(PHYSFS_BUILD_PERL "Perl" TRUE) add_script_binding_option(PHYSFS_BUILD_PERL "Perl" TRUE)
ADD_SCRIPT_BINDING_OPTION(PHYSFS_BUILD_RUBY "Ruby" TRUE) add_script_binding_option(PHYSFS_BUILD_RUBY "Ruby" TRUE)
ENDIF(NOT SWIG) endif()
IF(PHYSFS_BUILD_PERL) if(PHYSFS_BUILD_PERL)
MESSAGE(STATUS "Configuring Perl bindings...") message(STATUS "Configuring Perl bindings...")
FIND_PROGRAM(PERL perl DOC "Path to perl command line app: http://perl.org/") find_program(PERL perl DOC "Path to perl command line app: http://perl.org/")
IF(NOT PERL) if(NOT PERL)
MESSAGE(STATUS "Perl not found. You won't be able to build perl bindings.") message(STATUS "Perl not found. You won't be able to build perl bindings.")
SET(PHYSFS_BUILD_PERL FALSE) set(PHYSFS_BUILD_PERL FALSE)
ENDIF(NOT PERL) endif()
MARK_AS_ADVANCED(PERL) mark_as_advanced(PERL)
MACRO(GET_PERL_CONFIG _KEY _VALUE) macro(get_perl_config _KEY _VALUE)
IF(PHYSFS_BUILD_PERL) if(PHYSFS_BUILD_PERL)
MESSAGE(STATUS "Figuring out perl config value '${_KEY}' ...") message(STATUS "Figuring out perl config value '${_KEY}' ...")
EXECUTE_PROCESS( execute_process(
COMMAND ${PERL} -w -e "use Config; print \$Config{${_KEY}};" COMMAND ${PERL} -w -e "use Config; print \$Config{${_KEY}};"
RESULT_VARIABLE GET_PERL_CONFIG_RC RESULT_VARIABLE GET_PERL_CONFIG_RC
OUTPUT_VARIABLE ${_VALUE} OUTPUT_VARIABLE ${_VALUE}
) )
IF(NOT GET_PERL_CONFIG_RC EQUAL 0) if(NOT GET_PERL_CONFIG_RC EQUAL 0)
MESSAGE(STATUS "Perl executable ('${PERL}') reported failure: ${GET_PERL_CONFIG_RC}") message(STATUS "Perl executable ('${PERL}') reported failure: ${GET_PERL_CONFIG_RC}")
SET(PHYSFS_BUILD_PERL FALSE) set(PHYSFS_BUILD_PERL FALSE)
ENDIF(NOT GET_PERL_CONFIG_RC EQUAL 0) endif()
IF(NOT ${_VALUE}) if(NOT ${_VALUE})
MESSAGE(STATUS "Perl executable ('${PERL}') didn't have a value for '${_KEY}'") message(STATUS "Perl executable ('${PERL}') didn't have a value for '${_KEY}'")
SET(PHYSFS_BUILD_PERL FALSE) set(PHYSFS_BUILD_PERL FALSE)
ENDIF(NOT ${_VALUE}) endif()
IF(PHYSFS_BUILD_PERL) if(PHYSFS_BUILD_PERL)
MESSAGE(STATUS "Perl says: '${${_VALUE}}'.") message(STATUS "Perl says: '${${_VALUE}}'.")
ENDIF(PHYSFS_BUILD_PERL) endif()
ENDIF(PHYSFS_BUILD_PERL) endif()
ENDMACRO(GET_PERL_CONFIG) endmacro()
# !!! FIXME: installsitearch might be the wrong location. # !!! FIXME: installsitearch might be the wrong location.
GET_PERL_CONFIG("archlibexp" PERL_INCLUDE_PATH) get_perl_config("archlibexp" PERL_INCLUDE_PATH)
GET_PERL_CONFIG("ccflags" PERL_CCFLAGS) get_perl_config("ccflags" PERL_CCFLAGS)
GET_PERL_CONFIG("ldflags" PERL_LDFLAGS) get_perl_config("ldflags" PERL_LDFLAGS)
GET_PERL_CONFIG("installsitearch" PERL_INSTALL_PATH) get_perl_config("installsitearch" PERL_INSTALL_PATH)
# !!! FIXME: this test for Mac OS X is wrong. # !!! FIXME: this test for Mac OS X is wrong.
IF(MACOSX) if(MACOSX)
GET_PERL_CONFIG("libperl" PERL_LIBPERL) get_perl_config("libperl" PERL_LIBPERL)
SET(TMPLIBPERL "${PERL_LIBPERL}") set(TMPLIBPERL "${PERL_LIBPERL}")
STRING(REGEX REPLACE "^lib" "" TMPLIBPERL "${TMPLIBPERL}") string(REGEX REPLACE "^lib" "" TMPLIBPERL "${TMPLIBPERL}")
STRING(REGEX REPLACE "\\.so$" "" TMPLIBPERL "${TMPLIBPERL}") string(REGEX REPLACE "\\.so$" "" TMPLIBPERL "${TMPLIBPERL}")
STRING(REGEX REPLACE "\\.dylib$" "" TMPLIBPERL "${TMPLIBPERL}") string(REGEX REPLACE "\\.dylib$" "" TMPLIBPERL "${TMPLIBPERL}")
STRING(REGEX REPLACE "\\.dll$" "" TMPLIBPERL "${TMPLIBPERL}") string(REGEX REPLACE "\\.dll$" "" TMPLIBPERL "${TMPLIBPERL}")
IF(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}") if(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
MESSAGE(STATUS "Stripped '${PERL_LIBPERL}' down to '${TMPLIBPERL}'.") message(STATUS "Stripped '${PERL_LIBPERL}' down to '${TMPLIBPERL}'.")
SET(PERL_LIBPERL "${TMPLIBPERL}") set(PERL_LIBPERL "${TMPLIBPERL}")
ENDIF(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}") endif()
SET(PERL_LIBPERL "-l${PERL_LIBPERL}") set(PERL_LIBPERL "-l${PERL_LIBPERL}")
ENDIF(MACOSX) endif()
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}") 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}")
INSTALL(FILES "${SWIG_OUTPUT_DIR}/perl/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}") install(FILES "${SWIG_OUTPUT_DIR}/perl/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
INSTALL( install(
FILES test/test_physfs.pl FILES test/test_physfs.pl
DESTINATION bin DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
ENDIF(PHYSFS_BUILD_PERL) endif()
# !!! FIXME: lots of cut-and-paste from perl bindings. # !!! FIXME: lots of cut-and-paste from perl bindings.
IF(PHYSFS_BUILD_RUBY) if(PHYSFS_BUILD_RUBY)
MESSAGE(STATUS "Configuring Ruby bindings...") message(STATUS "Configuring Ruby bindings...")
FIND_PROGRAM(RUBY ruby DOC "Path to ruby command line app: http://ruby-lang.org/") find_program(RUBY ruby DOC "Path to ruby command line app: http://ruby-lang.org/")
IF(NOT RUBY) if(NOT RUBY)
MESSAGE(STATUS "Ruby not found. You won't be able to build ruby bindings.") message(STATUS "Ruby not found. You won't be able to build ruby bindings.")
SET(PHYSFS_BUILD_RUBY FALSE) set(PHYSFS_BUILD_RUBY FALSE)
ENDIF(NOT RUBY) endif()
MARK_AS_ADVANCED(RUBY) mark_as_advanced(RUBY)
MACRO(GET_RUBY_CONFIG _KEY _VALUE) macro(get_ruby_config _KEY _VALUE)
IF(PHYSFS_BUILD_RUBY) if(PHYSFS_BUILD_RUBY)
MESSAGE(STATUS "Figuring out ruby config value '${_KEY}' ...") message(STATUS "Figuring out ruby config value '${_KEY}' ...")
EXECUTE_PROCESS( execute_process(
COMMAND ${RUBY} -e "require 'rbconfig'; puts RbConfig::CONFIG['${_KEY}'];" COMMAND ${RUBY} -e "require 'rbconfig'; puts RbConfig::CONFIG['${_KEY}'];"
RESULT_VARIABLE GET_RUBY_CONFIG_RC RESULT_VARIABLE GET_RUBY_CONFIG_RC
OUTPUT_VARIABLE ${_VALUE} OUTPUT_VARIABLE ${_VALUE}
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
IF(NOT GET_RUBY_CONFIG_RC EQUAL 0) if(NOT GET_RUBY_CONFIG_RC EQUAL 0)
MESSAGE(STATUS "Ruby executable ('${RUBY}') reported failure: ${GET_RUBY_CONFIG_RC}") message(STATUS "Ruby executable ('${RUBY}') reported failure: ${GET_RUBY_CONFIG_RC}")
SET(PHYSFS_BUILD_RUBY FALSE) set(PHYSFS_BUILD_RUBY FALSE)
ENDIF(NOT GET_RUBY_CONFIG_RC EQUAL 0) endif()
IF(NOT ${_VALUE}) if(NOT ${_VALUE})
MESSAGE(STATUS "Ruby executable ('${RUBY}') didn't have a value for '${_KEY}'") message(STATUS "Ruby executable ('${RUBY}') didn't have a value for '${_KEY}'")
SET(PHYSFS_BUILD_RUBY FALSE) set(PHYSFS_BUILD_RUBY FALSE)
ENDIF(NOT ${_VALUE}) endif()
IF(PHYSFS_BUILD_RUBY) if(PHYSFS_BUILD_RUBY)
MESSAGE(STATUS "Ruby says: '${${_VALUE}}'.") message(STATUS "Ruby says: '${${_VALUE}}'.")
ENDIF(PHYSFS_BUILD_RUBY) endif()
ENDIF(PHYSFS_BUILD_RUBY) endif()
ENDMACRO(GET_RUBY_CONFIG) endmacro()
GET_RUBY_CONFIG("archdir" RUBY_INCLUDE_PATH) get_ruby_config("archdir" RUBY_INCLUDE_PATH)
GET_RUBY_CONFIG("CFLAGS" RUBY_CCFLAGS) get_ruby_config("CFLAGS" RUBY_CCFLAGS)
GET_RUBY_CONFIG("LDFLAGS" RUBY_LDFLAGS) get_ruby_config("LDFLAGS" RUBY_LDFLAGS)
GET_RUBY_CONFIG("sitearchdir" RUBY_INSTALL_PATH) get_ruby_config("sitearchdir" RUBY_INSTALL_PATH)
GET_RUBY_CONFIG("LIBRUBYARG_SHARED" RUBY_LIBRUBY) get_ruby_config("LIBRUBYARG_SHARED" RUBY_LIBRUBY)
GET_RUBY_CONFIG("libdir" RUBY_LIBDIR) get_ruby_config("libdir" RUBY_LIBDIR)
CONFIGURE_SWIG_BINDING(Ruby "${RUBY_INSTALL_PATH}" "" "\"-I${RUBY_INCLUDE_PATH}\" ${RUBY_CCFLAGS} -w" "\"-L${RUBY_LIBDIR}\" ${RUBY_LIBRUBY} ${RUBY_LDFLAGS}") configure_swig_binding(Ruby "${RUBY_INSTALL_PATH}" "" "\"-I${RUBY_INCLUDE_PATH}\" ${RUBY_CCFLAGS} -w" "\"-L${RUBY_LIBDIR}\" ${RUBY_LIBRUBY} ${RUBY_LDFLAGS}")
SET_TARGET_PROPERTIES(physfs-ruby PROPERTIES PREFIX "") set_target_properties(physfs-ruby PROPERTIES PREFIX "")
INSTALL( install(
FILES test/test_physfs.rb FILES test/test_physfs.rb
DESTINATION bin DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
ENDIF(PHYSFS_BUILD_RUBY) endif()
INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS} install(TARGETS ${PHYSFS_INSTALL_TARGETS}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX} LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}) ARCHIVE DESTINATION lib${LIB_SUFFIX})
INSTALL(FILES src/physfs.h DESTINATION include) install(FILES src/physfs.h DESTINATION include)
FIND_PACKAGE(Doxygen) find_package(Doxygen)
IF(DOXYGEN_FOUND) if(DOXYGEN_FOUND)
SET(PHYSFS_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") set(PHYSFS_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
CONFIGURE_FILE( configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile" "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile"
"${PHYSFS_OUTPUT_DOXYFILE}" "${PHYSFS_OUTPUT_DOXYFILE}"
COPYONLY COPYONLY
) )
FILE(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n") file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n")
FILE(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${PHYSFS_VERSION}\"\n") file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${PHYSFS_VERSION}\"\n")
FILE(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n") file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n")
FILE(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n") file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n")
ADD_CUSTOM_TARGET( add_custom_target(
docs docs
${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}" ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Building documentation in 'docs' directory..." COMMENT "Building documentation in 'docs' directory..."
) )
ELSE(DOXYGEN_FOUND) else()
MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.") message(STATUS "Doxygen not found. You won't be able to build documentation.")
ENDIF(DOXYGEN_FOUND) endif()
IF(UNIX) if(UNIX)
SET(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz") set(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz")
ADD_CUSTOM_TARGET( add_custom_target(
dist dist
hg archive -t tgz "${PHYSFS_TARBALL}" hg archive -t tgz "${PHYSFS_TARBALL}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Building source tarball '${PHYSFS_TARBALL}'..." COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
) )
ADD_CUSTOM_TARGET( add_custom_target(
uninstall uninstall
"${CMAKE_CURRENT_SOURCE_DIR}/extras/uninstall.sh" "${CMAKE_CURRENT_SOURCE_DIR}/extras/uninstall.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Uninstall the project..." COMMENT "Uninstall the project..."
) )
ENDIF(UNIX) endif()
MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE) macro(message_bool_option _NAME _VALUE)
IF(${_VALUE}) if(${_VALUE})
MESSAGE(STATUS " ${_NAME}: enabled") message(STATUS " ${_NAME}: enabled")
ELSE(${_VALUE}) else()
MESSAGE(STATUS " ${_NAME}: disabled") message(STATUS " ${_NAME}: disabled")
ENDIF(${_VALUE}) endif()
ENDMACRO(MESSAGE_BOOL_OPTION) endmacro()
MESSAGE(STATUS "PhysicsFS will build with the following options:") message(STATUS "PhysicsFS will build with the following options:")
MESSAGE_BOOL_OPTION("ZIP support" PHYSFS_ARCHIVE_ZIP) message_bool_option("ZIP support" PHYSFS_ARCHIVE_ZIP)
MESSAGE_BOOL_OPTION("7zip support" PHYSFS_ARCHIVE_7Z) message_bool_option("7zip support" PHYSFS_ARCHIVE_7Z)
MESSAGE_BOOL_OPTION("GRP support" PHYSFS_ARCHIVE_GRP) message_bool_option("GRP support" PHYSFS_ARCHIVE_GRP)
MESSAGE_BOOL_OPTION("WAD support" PHYSFS_ARCHIVE_WAD) message_bool_option("WAD support" PHYSFS_ARCHIVE_WAD)
MESSAGE_BOOL_OPTION("HOG support" PHYSFS_ARCHIVE_HOG) message_bool_option("HOG support" PHYSFS_ARCHIVE_HOG)
MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL) message_bool_option("MVL support" PHYSFS_ARCHIVE_MVL)
MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK) message_bool_option("QPAK support" PHYSFS_ARCHIVE_QPAK)
MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT) message_bool_option("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT)
MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT) message_bool_option("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC) message_bool_option("Build static library" PHYSFS_BUILD_STATIC)
MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED) message_bool_option("Build shared library" PHYSFS_BUILD_SHARED)
MESSAGE_BOOL_OPTION("Build Perl bindings" PHYSFS_BUILD_PERL) message_bool_option("Build Perl bindings" PHYSFS_BUILD_PERL)
MESSAGE_BOOL_OPTION("Build Ruby bindings" PHYSFS_BUILD_RUBY) message_bool_option("Build Ruby bindings" PHYSFS_BUILD_RUBY)
MESSAGE_BOOL_OPTION("Build stdio test program" PHYSFS_BUILD_TEST) message_bool_option("Build stdio test program" PHYSFS_BUILD_TEST)
IF(PHYSFS_BUILD_TEST) if(PHYSFS_BUILD_TEST)
MESSAGE_BOOL_OPTION(" Use readline in test program" HAVE_SYSTEM_READLINE) message_bool_option(" Use readline in test program" HAVE_SYSTEM_READLINE)
ENDIF(PHYSFS_BUILD_TEST) endif()
# end of CMakeLists.txt ... # end of CMakeLists.txt ...