From 6cbc36ac5c1318779495e4bccc6e762bd5b7ca13 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Tue, 11 May 2010 22:09:34 -0500 Subject: [PATCH] Resolved merges of FindOggVorbis.cmake and CMakeLists.txt --- CMakeLists.txt | 40 +++- Lugaru.sln | 21 -- Lugaru.vcproj | 360 ------------------------------ cmake/FindVorbis.cmake | 45 ---- cmake/Modules/FindOggVorbis.cmake | 91 ++++++++ makefile.orig => makefile.old | 0 makemac.sh | 4 +- 7 files changed, 129 insertions(+), 432 deletions(-) delete mode 100644 Lugaru.sln delete mode 100644 Lugaru.vcproj delete mode 100644 cmake/FindVorbis.cmake create mode 100644 cmake/Modules/FindOggVorbis.cmake rename makefile.orig => makefile.old (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 910e127..0ea8c47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,30 @@ project(lugaru) cmake_minimum_required(VERSION 2.6) -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" + FORCE) +endif(NOT CMAKE_BUILD_TYPE) +if(NOT LUGARU_INSTALL_PREFIX) + if(WIN32) + set(LUGARU_INSTALL_PREFIX C:\Lugaru CACHE PATH + "LUGARU_INSTALL_PREFIX: Install path prefix, prepended onto install directories." + FORCE) + else(WIN32) + set(LUGARU_INSTALL_PREFIX /usr/local/lugaru CACHE PATH + "CMAKE_INSTALL_PREFIX: Install path prefix, prepended onto install directories." + FORCE) + endif(WIN32) +endif(NOT LUGARU_INSTALL_PREFIX) + +set(CMAKE_INSTALL_PREFIX "${LUGARU_INSTALL_PREFIX}" CACHE INTERNAL "Prefix +prepended to install directories" FORCE) + + + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") find_package(OpenAL REQUIRED) find_package(BZip2 REQUIRED) find_package(PNG REQUIRED) @@ -12,7 +34,7 @@ find_package(ZLIB REQUIRED) find_package(OpenGL REQUIRED) find_package(GLU REQUIRED) find_package(SDL REQUIRED) -find_package(Vorbis REQUIRED) +find_package(OggVorbis REQUIRED) include_directories( ${OPENAL_INCLUDES} @@ -23,10 +45,20 @@ include_directories( ${OPENGL_INCLUDE_DIR} ${GLU_INCLUDE_DIR} ${SDL_INCLUDE_DIR} - ${VORBIS_INCLUDE_DIR} + ${VORBISFILE_INCLUDE_DIR} ${OGG_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/Source) -set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES} ${SDL_LIBRARY} ${GLU_LIBRARY} ${OPENGL_LIBRARY} ${VORBISFILE_LIBRARY} ${OGG_LIBRARY}) +set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES} ${SDL_LIBRARY} ${GLU_LIBRARY} ${OPENGL_LIBRARY} ${VORBISFILE_LIBS} ${OGG_LIBS}) add_subdirectory(Source) + +# Install target +if(WIN32) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Source/lugaru.exe DESTINATION ${CMAKE_INSTALL_PREFIX}) +else(WIN32) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Source/lugaru DESTINATION ${CMAKE_INSTALL_PREFIX}) +endif(WIN32) + +install(DIRECTORY ${CMAKE_SOURCE_DIR}/Data DESTINATION ${CMAKE_INSTALL_PREFIX}) + diff --git a/Lugaru.sln b/Lugaru.sln deleted file mode 100644 index cd2144e..0000000 --- a/Lugaru.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lugaru", "Lugaru.vcproj", "{71D87E45-76A7-497F-9176-DA2600007A65}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {71D87E45-76A7-497F-9176-DA2600007A65}.Debug.ActiveCfg = Debug|Win32 - {71D87E45-76A7-497F-9176-DA2600007A65}.Debug.Build.0 = Debug|Win32 - {71D87E45-76A7-497F-9176-DA2600007A65}.Release.ActiveCfg = Release|Win32 - {71D87E45-76A7-497F-9176-DA2600007A65}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/Lugaru.vcproj b/Lugaru.vcproj deleted file mode 100644 index 7661834..0000000 --- a/Lugaru.vcproj +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cmake/FindVorbis.cmake b/cmake/FindVorbis.cmake deleted file mode 100644 index e0cb2c1..0000000 --- a/cmake/FindVorbis.cmake +++ /dev/null @@ -1,45 +0,0 @@ -# - Find vorbis -# Find the native vorbis includes and libraries -# -# VORBIS_INCLUDE_DIR - where to find vorbis.h, etc. -# VORBIS_LIBRARIES - List of libraries when using vorbis(file). -# VORBIS_FOUND - True if vorbis found. - -if(NOT GP2XWIZ) - if(VORBIS_INCLUDE_DIR) - # Already in cache, be silent - set(VORBIS_FIND_QUIETLY TRUE) - endif(VORBIS_INCLUDE_DIR) - find_path(OGG_INCLUDE_DIR ogg/ogg.h) - find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) - # MSVC built ogg/vorbis may be named ogg_static and vorbis_static - find_library(OGG_LIBRARY NAMES ogg ogg_static) - find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static) - find_library(VORBISFILE_LIBRARY NAMES vorbisfile vorbisfile_static) - # Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND - # to TRUE if all listed variables are TRUE. - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(VORBIS DEFAULT_MSG - OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR - OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) -else(NOT GP2XWIZ) - find_path(VORBIS_INCLUDE_DIR tremor/ivorbisfile.h) - find_library(VORBIS_LIBRARY NAMES vorbis_dec) - find_package_handle_standard_args(VORBIS DEFAULT_MSG - VORBIS_INCLUDE_DIR VORBIS_LIBRARY) -endif(NOT GP2XWIZ) - -if(VORBIS_FOUND) - if(NOT GP2XWIZ) - set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} - ${OGG_LIBRARY}) - else(NOT GP2XWIZ) - set(VORBIS_LIBRARIES ${VORBIS_LIBRARY}) - endif(NOT GP2XWIZ) -else(VORBIS_FOUND) - set(VORBIS_LIBRARIES) -endif(VORBIS_FOUND) - -mark_as_advanced(OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR) -mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) - diff --git a/cmake/Modules/FindOggVorbis.cmake b/cmake/Modules/FindOggVorbis.cmake new file mode 100644 index 0000000..46ec694 --- /dev/null +++ b/cmake/Modules/FindOggVorbis.cmake @@ -0,0 +1,91 @@ +# - 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_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 +# VORBISENC_LIBRARY - The VorbisEnc library + +# Copyright (c) 2006, Richard Laerkaeng, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +include (CheckLibraryExists) + +find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) +find_path(OGG_INCLUDE_DIR ogg/ogg.h) + +find_library(OGG_LIBRARY NAMES ogg) +find_library(VORBIS_LIBRARY NAMES vorbis) +find_library(VORBISFILE_LIBRARY NAMES vorbisfile) +find_library(VORBISENC_LIBRARY NAMES vorbisenc) + +mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR + OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY) + + +if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) + set(OGGVORBIS_FOUND TRUE) + + set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_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 (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) + set (OGGVORBIS_VERSION) + set(OGGVORBIS_FOUND FALSE) +endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) + + +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") + endif (OggVorbis_FIND_REQUIRED) + if (NOT OggVorbis_FIND_QUITELY) + message(STATUS "Could NOT find OggVorbis libraries") + endif (NOT OggVorbis_FIND_QUITELY) +endif (OGGVORBIS_FOUND) + +check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H) +check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG) +check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS) +check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE) +check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC) +check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) + +if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) + message(STATUS "Ogg/Vorbis found") + set (VORBIS_LIBS "-lvorbis") + set (OGG_LIBS "-logg") + set (VORBISFILE_LIBS "-lvorbisfile") + set (VORBISENC_LIBS "-lvorbisenc") + set (OGGVORBIS_FOUND TRUE) + if (HAVE_LIBVORBISENC2) + set (HAVE_VORBIS 2) + else (HAVE_LIBVORBISENC2) + set (HAVE_VORBIS 1) + endif (HAVE_LIBVORBISENC2) +else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) + message(STATUS "Ogg/Vorbis not found") +endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) + + diff --git a/makefile.orig b/makefile.old similarity index 100% rename from makefile.orig rename to makefile.old diff --git a/makemac.sh b/makemac.sh index f02e189..ac33ff1 100755 --- a/makemac.sh +++ b/makemac.sh @@ -6,8 +6,8 @@ set -x NCPU=`sysctl -n hw.ncpu` for arch in ppc i386 x86_64 ; do - make macosx=true macosx_arch=$arch clean - make macosx=true macosx_arch=$arch -j$NCPU + make -f makefile.old macosx=true macosx_arch=$arch clean + make -f makefile.old macosx=true macosx_arch=$arch -j$NCPU # We always strip here. For debugging, you should do "make" directly. strip run/lugaru-$arch BINS="$BINS run/lugaru-$arch" -- 2.39.5