--- a/CMakeLists.txt Tue Mar 05 20:28:33 2013 -0500
+++ b/CMakeLists.txt Wed Mar 06 03:49:52 2013 +0100
@@ -29,8 +29,10 @@
option(BUILD_ENGINE_LIBRARY "Enable hwengine library [default: off]" OFF)
option(ANDROID "Enable Android build [default: off]" OFF)
-option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF)
option(MINIMAL_FLAGS "Respect system flags as much as possible [default: off]" OFF)
+if(APPLE)
+ option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF)
+endif()
set(FPFLAGS "" CACHE STRING "Additional Freepascal flags")
set(GHFLAGS "" CACHE STRING "Additional Haskell flags")
--- a/QTfrontend/CMakeLists.txt Tue Mar 05 20:28:33 2013 -0500
+++ b/QTfrontend/CMakeLists.txt Wed Mar 06 03:49:52 2013 +0100
@@ -175,6 +175,8 @@
list(APPEND hwfr_src util/platform/AutoUpdater.cpp
util/platform/SparkleAutoUpdater.mm)
list(APPEND HW_LINK_LIBS ${SPARKLE_LIBRARY})
+ else()
+ message(FATAL_ERROR "Missing Sparkle! Rerun cmake with -DNOAUTOUPDATE=on to disable autoupdating")
endif()
endif()
endif()
--- a/cmake_modules/FindFFMPEG.cmake Tue Mar 05 20:28:33 2013 -0500
+++ b/cmake_modules/FindFFMPEG.cmake Wed Mar 06 03:49:52 2013 +0100
@@ -1,96 +1,83 @@
-# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil)
+# Find ffmpeg/libav libraries (libavcodec, libavformat and libavutil)
# Once done this will define
#
-# FFMPEG_FOUND - system has ffmpeg or libav
-# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
-# FFMPEG_LIBRARIES - Link these to use ffmpeg
-# FFMPEG_LIBAVCODEC
-# FFMPEG_LIBAVFORMAT
-# FFMPEG_LIBAVUTIL
+# FFMPEG_FOUND - system has libavcodec, libavformat, libavutil
+# FFMPEG_INCLUDE_DIR - the libav include directories
+# FFMPEG_LIBRARIES - the libav libraries
+#
+# LIBAVCODEC_LIBRARY - the libavcodec library
+# LIBAVCODEC_INCLUDE_DIR - the libavcodec include directory
+# LIBAVFORMAT_LIBRARY - the libavformat library
+# LIBAVUTIL_LIBRARY - the libavutil library
#
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
# Modified for Hedgewars by Stepik777
+# Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
#
-set(FFMPEG_FOUND FALSE)
+include(FindPackageHandleStandardArgs)
+
-if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
- # in cache already
- set(FFMPEG_FOUND TRUE)
-else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
- # silence output option
- if (FFMPEG_FIND_QUIETLY)
- set(VERBOSITY "QUIET")
- endif ()
- # use pkg-config to get the directories and then use these values
- # in the FIND_PATH() and FIND_LIBRARY() calls
- find_package(PkgConfig)
- if (PKG_CONFIG_FOUND)
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
pkg_check_modules(_FFMPEG_AVCODEC libavcodec ${VERBOSITY})
pkg_check_modules(_FFMPEG_AVFORMAT libavformat ${VERBOSITY})
pkg_check_modules(_FFMPEG_AVUTIL libavutil ${VERBOSITY})
- endif (PKG_CONFIG_FOUND)
+endif (PKG_CONFIG_FOUND)
- find_path(FFMPEG_AVCODEC_INCLUDE_DIR
+find_path(LIBAVCODEC_INCLUDE_DIR
NAMES libavcodec/avcodec.h
- PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
+ PATHS ${_AVCODEC_INCLUDE_DIRS}
/usr/include /usr/local/include #system level
/opt/local/include #macports
/sw/include #fink
- PATH_SUFFIXES ffmpeg libav
- )
+ PATH_SUFFIXES libav ffmpeg
+)
- find_library(FFMPEG_LIBAVCODEC
+#TODO: add other include paths
+
+find_library(LIBAVCODEC_LIBRARY
NAMES avcodec
- PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}
+ PATHS ${_AVCODEC_LIBRARY_DIRS}
/usr/lib /usr/local/lib #system level
/opt/local/lib #macports
/sw/lib #fink
- )
+)
- find_library(FFMPEG_LIBAVFORMAT
+find_library(LIBAVFORMAT_LIBRARY
NAMES avformat
- PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS}
+ PATHS ${_AVFORMAT_LIBRARY_DIRS}
/usr/lib /usr/local/lib #system level
/opt/local/lib #macports
/sw/lib #fink
- )
+)
- find_library(FFMPEG_LIBAVUTIL
+find_library(LIBAVUTIL_LIBRARY
NAMES avutil
- PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}
+ PATHS ${_AVUTIL_LIBRARY_DIRS}
/usr/lib /usr/local/lib #system level
/opt/local/lib #macports
/sw/lib #fink
- )
-
- if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
- set(FFMPEG_FOUND TRUE)
- endif()
-
- if (FFMPEG_FOUND)
- set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
+)
- set(FFMPEG_LIBRARIES
- ${FFMPEG_LIBAVCODEC}
- ${FFMPEG_LIBAVFORMAT}
- ${FFMPEG_LIBAVUTIL}
- )
- endif (FFMPEG_FOUND)
+find_package_handle_standard_args(FFMPEG DEFAULT_MSG LIBAVCODEC_LIBRARY LIBAVCODEC_INCLUDE_DIR
+ LIBAVFORMAT_LIBRARY
+ LIBAVUTIL_LIBRARY
+ )
+set(FFMPEG_INCLUDE_DIR ${LIBAVCODEC_INCLUDE_DIR}
+ #TODO: add other include paths
+ )
+set(FFMPEG_LIBRARIES ${LIBAVCODEC_LIBRARY}
+ ${LIBAVFORMAT_LIBRARY}
+ ${LIBAVUTIL_LIBRARY}
+ )
- if (FFMPEG_FOUND)
- if (NOT FFMPEG_FIND_QUIETLY)
- message(STATUS "Found FFMPEG/LibAV: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
- endif (NOT FFMPEG_FIND_QUIETLY)
- else (FFMPEG_FOUND)
- if (FFMPEG_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find libavcodec or libavformat or libavutil")
- endif (FFMPEG_FIND_REQUIRED)
- endif (FFMPEG_FOUND)
+mark_as_advanced(FFMPEG_INCLUDE_DIR FFMPEG_LIBRARIES LIBAVCODEC_LIBRARY LIBAVCODEC_INCLUDE_DIR LIBAVFORMAT_LIBRARY LIBAVUTIL_LIBRARY)
-endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
--- a/cmake_modules/FindOggVorbis.cmake Tue Mar 05 20:28:33 2013 -0500
+++ b/cmake_modules/FindOggVorbis.cmake Wed Mar 06 03:49:52 2013 +0100
@@ -1,61 +1,68 @@
-### SuperTux - Removed unused vorbisenc library
-
# - Try to find the OggVorbis libraries
# Once done this will define
#
-# OGGVORBIS_FOUND - system has OggVorbis
-# OGGVORBIS_VERSION - set either to 1 or 2
+# OGGVORBIS_FOUND - system has both Ogg and Vorbis
+# OGGVORBIS_VERSION - set either to 1 or 2
# OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
-# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
-# OGG_LIBRARY - The Ogg library
-# VORBIS_LIBRARY - The Vorbis library
-# VORBISFILE_LIBRARY - The VorbisFile library
+# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
+#
+# OGG_LIBRARY - The Ogg library
+# OGG_INCLUDE_DIR - The Ogg include directory
+# VORBIS_LIBRARY - The Vorbis library
+# VORBIS_INCLUDE_DIR - The Vorbis include directory
+# VORBISFILE_LIBRARY - The VorbisFile library
+#
# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
+# Copyright (c) 2013, Vittorio Giovara, <vittorio.giovara@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+### sommer [SuperTux]
+## - Removed unused vorbisenc library
+## - reversed order of libraries, so that cmake 2.4.5 for Windows generates an MSYS Makefile that will link correctly
+
+### koda [Hedgewars]
+## - split ogg and vorbis lookup
+## - special case for framework handling
+## - standard variables handling
+
include (CheckLibraryExists)
-find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
+include (FindPackageHandleStandardArgs)
+
+find_path(OGG_INCLUDE_DIR ogg.h PATH_SUFFIXES ogg)
+find_path(VORBIS_INCLUDE_DIR vorbisfile.h PATH_SUFFIXES vorbis)
+
+find_library(OGG_LIBRARY NAMES Ogg ogg)
+find_library(VORBIS_LIBRARY NAMES Vorbis vorbis)
+find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
-find_library(OGG_LIBRARY NAMES ogg)
-find_library(VORBIS_LIBRARY NAMES vorbis)
-find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
-if(APPLE AND NOT VORBISFILE_LIBRARY)
-# [koda] (for Hedgewars) frameworks don't come with libvorbisfile
- set(VORBISFILE_LIBRARY "${VORBIS_LIBRARY}")
+set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
+set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
+check_library_exists(${VORBIS_LIBRARY} vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
+set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
+
+if(HAVE_LIBVORBISENC2)
+ set(OGGVORBIS_VERSION 2)
+else(HAVE_LIBVORBISENC2)
+ set(OGGVORBIS_VERSION 1)
+endif(HAVE_LIBVORBISENC2)
+
+if(${OGG_LIBRARY} MATCHES ".framework" AND ${VORBIS_LIBRARY} MATCHES ".framework")
+ set(VORBISFILE_LIBRARY "") #vorbisfile will appear as NOTFOUND and discarded
+ set(fphsa_vorbis_list VORBIS_LIBRARY)
+else()
+ set(fphsa_vorbis_list VORBISFILE_LIBRARY VORBIS_LIBRARY)
endif()
-if (OGG_LIBRARY AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
- set(OGGVORBIS_FOUND TRUE)
-# [sommer] (for SuperTux) reversed order of libraries, so that cmake 2.4.5 for Windows generates an MSYS Makefile that will link correctly
-# set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
- set(OGGVORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
- set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
- set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
- check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
- set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
- if (HAVE_LIBVORBISENC2)
- set (OGGVORBIS_VERSION 2)
- else (HAVE_LIBVORBISENC2)
- set (OGGVORBIS_VERSION 1)
- endif (HAVE_LIBVORBISENC2)
-else ()
- set(OGGVORBIS_VERSION)
- set(OGGVORBIS_FOUND FALSE)
-endif ()
-if (OGGVORBIS_FOUND)
- if (NOT OggVorbis_FIND_QUIETLY)
- message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
- endif (NOT OggVorbis_FIND_QUIETLY)
-else (OGGVORBIS_FOUND)
- if (OggVorbis_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find OggVorbis libraries")
- else (OggVorbis_FIND_REQUIRED)
- if (NOT OggVorbis_FIND_QUIETLY)
- message(STATUS "Could NOT find OggVorbis libraries")
- endif (NOT OggVorbis_FIND_QUIETLY)
- endif(OggVorbis_FIND_REQUIRED)
-endif (OGGVORBIS_FOUND)
+find_package_handle_standard_args(OggVorbis DEFAULT_MSG ${fphsa_vorbis_list} OGG_LIBRARY
+ OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR)
+unset(fphsa_vorbis_list)
+set(OGGVORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
+set(OGGVORBIS_INCLUDE_DIR ${VORBIS_INCLUDE_DIR} ${OGG_INCLUDE_DIR})
+
+mark_as_advanced(OGGVORBIS_VERSION OGGVORBIS_INCLUDE_DIR OGGVORBIS_LIBRARIES
+ OGG_LIBRARY OGG_INCLUDE_DIR VORBIS_LIBRARY VORBIS_INCLUDE_DIR VORBISFILE_LIBRARY)
+
--- a/cmake_modules/FindSDL_Extras.cmake Tue Mar 05 20:28:33 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#if the headers are not installed, the newer apis won't be activated
-
-#find which version of SDL_mixer we have (for Mix_Init)
-find_file(sdlmixer_h SDL_mixer.h ${SDLMIXER_INCLUDE_DIR})
-if(sdlmixer_h)
- file(STRINGS ${sdlmixer_h} sdlmixer_majorversion_tmp REGEX "SDL_MIXER_MAJOR_VERSION[\t' ']+[0-9]+")
- file(STRINGS ${sdlmixer_h} sdlmixer_minorversion_tmp REGEX "SDL_MIXER_MINOR_VERSION[\t' ']+[0-9]+")
- file(STRINGS ${sdlmixer_h} sdlmixer_patchversion_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+")
- string(REGEX MATCH ".([0-9]+)" sdlmixer_majorversion "${sdlmixer_majorversion_tmp}")
- string(REGEX MATCH ".([0-9]+)" sdlmixer_minorversion "${sdlmixer_minorversion_tmp}")
- string(REGEX MATCH ".([0-9]+)" sdlmixer_patchversion "${sdlmixer_patchversion_tmp}")
- math(EXPR sdlmixer_version "${sdlmixer_majorversion}*10000 + ${sdlmixer_minorversion}*100 + ${sdlmixer_patchversion}")
-
- if(sdlmixer_version GREATER "10209")
- message(STATUS "Mix_Init() is present")
- list(APPEND pascal_flags "-dSDL_MIXER_NEWER")
- endif()
-endif()
-
-#find which version of SDL_image we have (for IMG_Init)
-find_file(sdlimage_h SDL_image.h ${SDLIMAGE_INCLUDE_DIR})
-if(sdlimage_h)
- file(STRINGS ${sdlimage_h} sdlimage_majorversion_tmp REGEX "SDL_IMAGE_MAJOR_VERSION[\t' ']+[0-9]+")
- file(STRINGS ${sdlimage_h} sdlimage_minorversion_tmp REGEX "SDL_IMAGE_MINOR_VERSION[\t' ']+[0-9]+")
- file(STRINGS ${sdlimage_h} sdlimage_patchversion_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+")
- string(REGEX MATCH ".([0-9]+)" sdlimage_majorversion "${sdlimage_majorversion_tmp}")
- string(REGEX MATCH ".([0-9]+)" sdlimage_minorversion "${sdlimage_minorversion_tmp}")
- string(REGEX MATCH ".([0-9]+)" sdlimage_patchversion "${sdlimage_patchversion_tmp}")
- math(EXPR sdlimage_version "${sdlimage_majorversion}*10000 + ${sdlimage_minorversion}*100 + ${sdlimage_patchversion}")
-
- if(sdlimage_version GREATER "010207")
- message(STATUS "IMG_Init() is present")
- list(APPEND pascal_flags "-dSDL_IMAGE_NEWER")
- endif()
-endif()
-
--- a/cmake_modules/FindSparkle.cmake Tue Mar 05 20:28:33 2013 -0500
+++ b/cmake_modules/FindSparkle.cmake Wed Mar 06 03:49:52 2013 +0100
@@ -1,39 +1,23 @@
-### Hedgewars
-
-# - Try to find the Sparkle framework
+# Find Sparkle.framework
+#
# Once done this will define
-#
# SPARKLE_FOUND - system has Sparkle
# SPARKLE_INCLUDE_DIR - the Sparkle include directory
# SPARKLE_LIBRARY - The library needed to use Sparkle
# Copyright (c) 2009, Vittorio Giovara, <vittorio.giovara@gmail.com>
#
-# Redistribution and use is allowed according to the terms of a Creative Commons license.
-# For details see http://creativecommons.org/licenses/by-sa/3.0/
-# original version of this module was derived from Richard Laerkaeng, <richard@goteborg.utfors.se>
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+include(FindPackageHandleStandardArgs)
-include (CheckLibraryExists)
find_path(SPARKLE_INCLUDE_DIR Sparkle.h)
find_library(SPARKLE_LIBRARY NAMES Sparkle)
-if (SPARKLE_INCLUDE_DIR AND SPARKLE_LIBRARY)
- set(SPARKLE_FOUND TRUE)
-else ()
- set(SPARKLE_FOUND FALSE)
-endif ()
+find_package_handle_standard_args(Sparkle DEFAULT_MSG SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY)
+mark_as_advanced(SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY)
-if (SPARKLE_FOUND)
- if (NOT SPARKLE_FIND_QUIETLY)
- message(STATUS "Found Sparkle: ${SPARKLE_LIBRARY}")
- endif ()
-else ()
- if (SPARKLE_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find Sparkle framework")
- else ()
- if (NOT SPARKLE_FIND_QUIETLY)
- message(STATUS "Could NOT find Sparkle framework, autoupdate feature will be disabled")
- endif()
- endif ()
-endif ()
-
--- a/hedgewars/CMakeLists.txt Tue Mar 05 20:28:33 2013 -0500
+++ b/hedgewars/CMakeLists.txt Wed Mar 06 03:49:52 2013 +0100
@@ -4,7 +4,19 @@
find_package(SDL_ttf)
find_package(SDL_mixer)
-include(${CMAKE_SOURCE_DIR}/cmake_modules/FindSDL_Extras.cmake)
+
+include (CheckLibraryExists)
+#Mix_Init/Mix_Quit from SDL_mixer 1.2.9
+check_library_exists(${SDL_MIXER_LIBRARY} Mix_Init "" HAVE_MIXINIT)
+if(HAVE_MIXINIT)
+ list(APPEND pascal_flags "-dSDL_MIXER_NEWER")
+endif()
+#IMG_Init/IMG_Quit from SDL_image 1.2.7
+check_library_exists(${SDL_IMAGE_LIBRARY} IMG_Init "" HAVE_IMGINIT)
+if(HAVE_IMGINIT)
+ list(APPEND pascal_flags "-dSDL_IMAGE_NEWER")
+endif()
+
configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
@@ -180,7 +192,6 @@
if(NOT NOVIDEOREC)
- set(FFMPEG_FIND_QUIETLY true)
find_package(FFMPEG)
if(${FFMPEG_FOUND})
# TODO: this check is only for SDL < 2
--- a/share/CMakeLists.txt Tue Mar 05 20:28:33 2013 -0500
+++ b/share/CMakeLists.txt Wed Mar 06 03:49:52 2013 +0100
@@ -9,7 +9,6 @@
#silly libav that always brings in VideoDecoderAcceleration, avaible only from 10.6.3
if(NOT NOVIDEOREC)
- set(FFMPEG_FIND_QUIETLY true)
find_package(FFMPEG)
if(${FFMPEG_FOUND} AND ${minimum_macosx_version} VERSION_EQUAL "10.6")
set(minimum_macosx_version "10.6.3")
--- a/tools/CMakeLists.txt Tue Mar 05 20:28:33 2013 -0500
+++ b/tools/CMakeLists.txt Wed Mar 06 03:49:52 2013 +0100
@@ -13,10 +13,9 @@
find_package(SDL_net REQUIRED)
find_package(SDL_ttf REQUIRED)
find_package(SDL_mixer REQUIRED)
- find_package(OGGVORBIS REQUIRED)
+ find_package(OggVorbis REQUIRED)
if(NOT NOAUTOUPDATE)
- #needed for SPARKLE_FOUND variable
- find_package(Sparkle QUIET)
+ find_package(Sparkle) #needed for SPARKLE_FOUND variable
#needed because the 'if' clause in the script prints silly policy warnings
if(${SPARKLE_FOUND})
set(SPARKLE_FOUND 1)