Initial support for CMake build system
This commit is contained in:
parent
31981a35b6
commit
9938ade670
9 changed files with 849 additions and 0 deletions
458
CMakeLists.txt
Normal file
458
CMakeLists.txt
Normal file
|
@ -0,0 +1,458 @@
|
|||
project(stratagus)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
# Stratagus sources
|
||||
|
||||
include_directories(
|
||||
src/include
|
||||
src/guichan/include
|
||||
src/guichan/include/guichan
|
||||
)
|
||||
|
||||
set(action_SRCS
|
||||
src/action/action_attack.cpp
|
||||
src/action/action_board.cpp
|
||||
src/action/action_build.cpp
|
||||
src/action/action_die.cpp
|
||||
src/action/action_follow.cpp
|
||||
src/action/action_move.cpp
|
||||
src/action/action_patrol.cpp
|
||||
src/action/action_repair.cpp
|
||||
src/action/action_research.cpp
|
||||
src/action/action_resource.cpp
|
||||
src/action/action_returngoods.cpp
|
||||
src/action/actions.cpp
|
||||
src/action/action_spellcast.cpp
|
||||
src/action/action_stand.cpp
|
||||
src/action/action_still.cpp
|
||||
src/action/action_train.cpp
|
||||
src/action/action_unload.cpp
|
||||
src/action/action_upgradeto.cpp
|
||||
src/action/command.cpp
|
||||
)
|
||||
|
||||
set(ai_SRCS
|
||||
src/ai/ai_building.cpp
|
||||
src/ai/ai.cpp
|
||||
src/ai/ai_force.cpp
|
||||
src/ai/ai_magic.cpp
|
||||
src/ai/ai_plan.cpp
|
||||
src/ai/ai_resource.cpp
|
||||
src/ai/script_ai.cpp
|
||||
)
|
||||
|
||||
set(beos_SRCS
|
||||
src/beos/beos.cpp
|
||||
)
|
||||
|
||||
set(editor_SRCS
|
||||
src/editor/editloop.cpp
|
||||
src/editor/editor.cpp
|
||||
src/editor/edmap.cpp
|
||||
src/editor/script_editor.cpp
|
||||
)
|
||||
|
||||
set(game_SRCS
|
||||
src/game/game.cpp
|
||||
src/game/loadgame.cpp
|
||||
src/game/replay.cpp
|
||||
src/game/savegame.cpp
|
||||
src/game/trigger.cpp
|
||||
)
|
||||
|
||||
set(guichan_SRCS
|
||||
src/guichan/cliprectangle.cpp
|
||||
src/guichan/color.cpp
|
||||
src/guichan/defaultfont.cpp
|
||||
src/guichan/exception.cpp
|
||||
src/guichan/focushandler.cpp
|
||||
src/guichan/gfont.cpp
|
||||
src/guichan/graphics.cpp
|
||||
src/guichan/gui.cpp
|
||||
src/guichan/guichan.cpp
|
||||
src/guichan/image.cpp
|
||||
src/guichan/imagefont.cpp
|
||||
src/guichan/key.cpp
|
||||
src/guichan/keyinput.cpp
|
||||
src/guichan/mouseinput.cpp
|
||||
# src/guichan/opengl/opengl.cpp
|
||||
# src/guichan/opengl/openglgraphics.cpp
|
||||
# src/guichan/opengl/openglimageloader.cpp
|
||||
src/guichan/rectangle.cpp
|
||||
src/guichan/sdl/gsdl.cpp
|
||||
src/guichan/sdl/sdlgraphics.cpp
|
||||
src/guichan/sdl/sdlimageloader.cpp
|
||||
src/guichan/sdl/sdlinput.cpp
|
||||
src/guichan/widget.cpp
|
||||
src/guichan/widgets/button.cpp
|
||||
src/guichan/widgets/container.cpp
|
||||
src/guichan/widgets/dropdown.cpp
|
||||
src/guichan/widgets/checkbox.cpp
|
||||
src/guichan/widgets/icon.cpp
|
||||
src/guichan/widgets/label.cpp
|
||||
src/guichan/widgets/listbox.cpp
|
||||
src/guichan/widgets/radiobutton.cpp
|
||||
src/guichan/widgets/scrollarea.cpp
|
||||
src/guichan/widgets/slider.cpp
|
||||
src/guichan/widgets/textbox.cpp
|
||||
src/guichan/widgets/textfield.cpp
|
||||
src/guichan/widgets/window.cpp
|
||||
)
|
||||
|
||||
set(map_SRCS
|
||||
src/map/map.cpp
|
||||
src/map/map_draw.cpp
|
||||
src/map/map_fog.cpp
|
||||
src/map/map_radar.cpp
|
||||
src/map/map_save.cpp
|
||||
src/map/map_wall.cpp
|
||||
src/map/minimap.cpp
|
||||
src/map/script_map.cpp
|
||||
src/map/script_tileset.cpp
|
||||
src/map/tileset.cpp
|
||||
)
|
||||
|
||||
set(network_SRCS
|
||||
src/network/commands.cpp
|
||||
src/network/lowlevel.cpp
|
||||
src/network/master.cpp
|
||||
src/network/netconnect.cpp
|
||||
src/network/network.cpp
|
||||
)
|
||||
|
||||
set(particle_SRCS
|
||||
src/particle/graphicanimation.cpp
|
||||
src/particle/chunkparticle.cpp
|
||||
src/particle/particlemanager.cpp
|
||||
src/particle/smokeparticle.cpp
|
||||
src/particle/staticparticle.cpp
|
||||
)
|
||||
|
||||
set(pathfinder_SRCS
|
||||
src/pathfinder/astar.cpp
|
||||
src/pathfinder/pathfinder.cpp
|
||||
src/pathfinder/script_pathfinder.cpp
|
||||
)
|
||||
|
||||
set(sound_SRCS
|
||||
src/sound/mikmod.cpp
|
||||
src/sound/music.cpp
|
||||
src/sound/ogg.cpp
|
||||
src/sound/script_sound.cpp
|
||||
src/sound/sound.cpp
|
||||
src/sound/sound_id.cpp
|
||||
src/sound/sound_server.cpp
|
||||
src/sound/unitsound.cpp
|
||||
src/sound/wav.cpp
|
||||
)
|
||||
|
||||
set(stratagusmain_SRCS
|
||||
src/stratagus/construct.cpp
|
||||
src/stratagus/groups.cpp
|
||||
src/stratagus/iolib.cpp
|
||||
src/stratagus/luacallback.cpp
|
||||
src/stratagus/mainloop.cpp
|
||||
src/stratagus/missile.cpp
|
||||
src/stratagus/player.cpp
|
||||
src/stratagus/script.cpp
|
||||
src/stratagus/script_missile.cpp
|
||||
src/stratagus/script_player.cpp
|
||||
src/stratagus/script_spell.cpp
|
||||
src/stratagus/selection.cpp
|
||||
src/stratagus/spells.cpp
|
||||
src/stratagus/stratagus.cpp
|
||||
src/stratagus/title.cpp
|
||||
src/stratagus/translate.cpp
|
||||
src/stratagus/util.cpp
|
||||
)
|
||||
|
||||
set(tolua_SRCS
|
||||
# src/tolua/tolua.cpp
|
||||
src/tolua/tolua_event.cpp
|
||||
src/tolua/tolua_is.cpp
|
||||
src/tolua/tolua_map.cpp
|
||||
src/tolua/tolua_push.cpp
|
||||
src/tolua/tolua_to.cpp
|
||||
)
|
||||
|
||||
set(ui_SRCS
|
||||
src/ui/botpanel.cpp
|
||||
src/ui/button_checks.cpp
|
||||
src/ui/icons.cpp
|
||||
src/ui/interface.cpp
|
||||
src/ui/mainscr.cpp
|
||||
src/ui/menu_proc.cpp
|
||||
src/ui/menus.cpp
|
||||
src/ui/mouse.cpp
|
||||
src/ui/script_ui.cpp
|
||||
src/ui/ui.cpp
|
||||
src/ui/widgets.cpp
|
||||
)
|
||||
|
||||
set(unit_SRCS
|
||||
src/unit/build.cpp
|
||||
src/unit/depend.cpp
|
||||
src/unit/script_unit.cpp
|
||||
src/unit/script_unittype.cpp
|
||||
src/unit/unit_cache.cpp
|
||||
src/unit/unit.cpp
|
||||
src/unit/unit_draw.cpp
|
||||
src/unit/unit_find.cpp
|
||||
src/unit/unit_manager.cpp
|
||||
src/unit/unit_save.cpp
|
||||
src/unit/unittype.cpp
|
||||
src/unit/upgrade.cpp
|
||||
)
|
||||
|
||||
set(video_SRCS
|
||||
src/video/cursor.cpp
|
||||
src/video/font.cpp
|
||||
src/video/graphic.cpp
|
||||
src/video/linedraw.cpp
|
||||
src/video/mng.cpp
|
||||
src/video/movie.cpp
|
||||
src/video/png.cpp
|
||||
src/video/sdl.cpp
|
||||
src/video/sprite.cpp
|
||||
src/video/video.cpp
|
||||
)
|
||||
|
||||
set(win32_SRCS
|
||||
src/stratagus/attachconsole.cpp
|
||||
src/stratagus.rc
|
||||
)
|
||||
|
||||
set(tolua_cpp_DEPS
|
||||
src/tolua/ai.pkg
|
||||
src/tolua/editor.pkg
|
||||
src/tolua/font.pkg
|
||||
src/tolua/game.pkg
|
||||
src/tolua/map.pkg
|
||||
src/tolua/minimap.pkg
|
||||
src/tolua/network.pkg
|
||||
src/tolua/particle.pkg
|
||||
src/tolua/pathfinder.pkg
|
||||
src/tolua/player.pkg
|
||||
src/tolua/sound.pkg
|
||||
src/tolua/stratagus.pkg
|
||||
src/tolua/trigger.pkg
|
||||
src/tolua/ui.pkg
|
||||
src/tolua/unit.pkg
|
||||
src/tolua/unittype.pkg
|
||||
src/tolua/upgrade.pkg
|
||||
src/tolua/video.pkg
|
||||
)
|
||||
|
||||
# Find all libraries
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||
|
||||
find_package(Lua51 REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(SDL REQUIRED)
|
||||
find_package(Tolua++ REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
find_package(BZip2)
|
||||
find_package(Mikmod)
|
||||
find_package(MNG)
|
||||
find_package(OggVorbis)
|
||||
find_package(Theora)
|
||||
|
||||
find_package(X11)
|
||||
find_package(OpenGL)
|
||||
find_package(OpenGLES)
|
||||
find_package(SDL_gles)
|
||||
|
||||
find_package(Sqlite)
|
||||
|
||||
# Additional platform checks
|
||||
|
||||
if(UNIX AND CMAKE_SYSTEM_NAME MATCHES BSD)
|
||||
set(BSD true)
|
||||
endif()
|
||||
|
||||
if(UNIX AND CMAKE_SYSTEM_NAME MATCHES Linux AND EXISTS /etc/maemo_version)
|
||||
set(MAEMO true)
|
||||
endif()
|
||||
|
||||
# Platform definitions
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DUSE_WIN32)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_definitions(-DUSE_MAC)
|
||||
endif()
|
||||
|
||||
if(BSD)
|
||||
add_definitions(-DBSD)
|
||||
endif()
|
||||
|
||||
if(BEOS)
|
||||
add_definitions(-DUSE_BEOS)
|
||||
endif()
|
||||
|
||||
if(MAEMO)
|
||||
add_definitions(-DUSE_MAEMO)
|
||||
find_package(LibOSSO REQUIRED)
|
||||
endif()
|
||||
|
||||
check_function_exists("strcasestr" HAVE_STRCASESTR)
|
||||
check_function_exists("strnlen" HAVE_STRNLEN)
|
||||
|
||||
if(HAVE_STRCASESTR)
|
||||
add_definitions(-DHAVE_STRCASESTR)
|
||||
endif()
|
||||
|
||||
if(HAVE_STRNLEN)
|
||||
add_definitions(-DHAVE_STRNLEN)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
||||
|
||||
# Options for compiling
|
||||
|
||||
if(WIN32)
|
||||
option(ENABLE_STDIO_REDIRECT "Redirect Stratagus console output to files on Windows" OFF)
|
||||
endif()
|
||||
|
||||
#option(ENABLE_TOUCHSCREEN "Use touchscreen input" ON)
|
||||
|
||||
option(WITH_BZIP2 "Compile Stratagus with BZip2 compression support" ON)
|
||||
option(WITH_MIKMOD "Compile Stratagus with Mikmod sound library" ON)
|
||||
option(WITH_MNG "Compile Stratagus with MNG image library" ON)
|
||||
option(WITH_OGGVORBIS "Compile Stratagus with OGG/Vorbis sound library" ON)
|
||||
option(WITH_THEORA "Compile Stratagus with Theroa video library" ON)
|
||||
|
||||
option(WITH_X "Compile Stratagus with X Window System clipboard pasting support" ON)
|
||||
#option(WITH_OPENGL "Use OpenGL for rendering" ON)
|
||||
option(WITH_OPENGLES "Compile Stratagus with OpenGL ES 1.1 rendering support instead OpenGL" OFF)
|
||||
|
||||
# Stratagus definitions
|
||||
|
||||
add_definitions(${PNG_DEFINITIONS} -DUSE_ZLIB)
|
||||
include_directories(${LUA_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${LUA_LIBRARIES} ${PNG_LIBRARIES} ${SDL_LIBRARY} ${ZLIB_LIBRARIES})
|
||||
|
||||
if(WIN32 AND NOT ENABLE_STDIO_REDIRECT)
|
||||
add_definitions(-DNO_STDIO_REDIRECT)
|
||||
endif()
|
||||
|
||||
# TODO: Add support for touchscreen input (not only for MAEMO)
|
||||
#if(ENABLE_TOUCHSCREEN)
|
||||
#
|
||||
#endif()
|
||||
|
||||
if(WITH_BZIP2 AND BZIP2_FOUND)
|
||||
add_definitions(-DUSE_BZ2LIB ${BZIP2_DEFINITIONS})
|
||||
include_directories(${BZIP2_INCLUDE_DIR})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${BZIP2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WITH_MIKMOD AND MIKMOD_FOUND)
|
||||
add_definitions(-DUSE_MIKMOD ${MIKMOD_DEFINITIONS})
|
||||
include_directories(${MIKMOD_INCLUDE_DIR})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${MIKMOD_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(WITH_MNG AND MNG_FOUND)
|
||||
add_definitions(-DUSE_MNG)
|
||||
include_directories(${MNG_INCLUDE_DIR})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${MNG_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(WITH_OGGVORBIS AND OGGVORBIS_FOUND)
|
||||
add_definitions(-DUSE_VORBIS)
|
||||
include_directories(${OGGVORBIS_INCLUDE_DIR})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${OGGVORBIS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WITH_THEORA AND THEORA_FOUND)
|
||||
add_definitions(-DUSE_THEORA)
|
||||
include_directories(${THEORA_INCLUDE_DIR})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${THEORA_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(WITH_X AND X11_FOUND)
|
||||
add_definitions(-DHAVE_X11)
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${X11_X11_LIB})
|
||||
endif()
|
||||
|
||||
# TODO: Add OpenGL support optional
|
||||
#if(WITH_OPENGL AND OPENGL_FOUND)
|
||||
if(NOT WITH_OPENGLES)
|
||||
# add_definitions(-DUSE_OPENGL)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${OPENGL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# TODO: Add OpenGL ES 1.1 support together with OpengL
|
||||
if(WITH_OPENGLES AND OPENGLES_FOUND AND SDLGLES_FOUND)
|
||||
add_definitions(-DUSE_GLES)
|
||||
include_directories(${OPENGLES_INCLUDE_DIR} ${SDLGLES_INCLUDE_DIR})
|
||||
set(stratagus_LIBS ${stratagus_LIBS} ${OPENGLES_LIBRARIES} ${SDLGLES_LIBRARY})
|
||||
endif()
|
||||
|
||||
set(stratagus_SRCS
|
||||
${action_SRCS}
|
||||
${ai_SRCS}
|
||||
${editor_SRCS}
|
||||
${game_SRCS}
|
||||
${guichan_SRCS}
|
||||
${map_SRCS}
|
||||
${network_SRCS}
|
||||
${particle_SRCS}
|
||||
${pathfinder_SRCS}
|
||||
${sound_SRCS}
|
||||
${stratagusmain_SRCS}
|
||||
${tolua_SRCS}
|
||||
${ui_SRCS}
|
||||
${unit_SRCS}
|
||||
${video_SRCS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tolua.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(stratagus_SRCS ${stratagus_SRCS} ${win32_SRCS})
|
||||
endif()
|
||||
|
||||
if(BEOS)
|
||||
set(stratagus_SRCS ${stratagus_SRCS} ${beos_SRCS})
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tolua.cpp COMMAND ${TOLUA++} -L stratagus.lua -o ${CMAKE_CURRENT_BINARY_DIR}/tolua.cpp stratagus.pkg DEPENDS ${tolua_cpp_DEPS} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/tolua)
|
||||
add_executable(stratagus WIN32 ${stratagus_SRCS})
|
||||
target_link_libraries(stratagus ${stratagus_LIBS})
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(metaserver_SRCS
|
||||
src/metaserver/cmd.cpp
|
||||
src/metaserver/db.cpp
|
||||
src/metaserver/games.cpp
|
||||
src/metaserver/main.cpp
|
||||
src/metaserver/netdriver.cpp
|
||||
src/network/lowlevel.cpp
|
||||
)
|
||||
|
||||
if(SQLITE_FOUND)
|
||||
add_executable(metaserver ${metaserver_SRCS})
|
||||
target_link_libraries(metaserver ${SDL_LIBRARY} ${SQLITE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(png2stratagus_SRCS
|
||||
tools/png2stratagus.cpp
|
||||
)
|
||||
|
||||
add_executable(png2stratagus ${png2stratagus_SRCS})
|
||||
target_link_libraries(png2stratagus ${PNG_LIBRARY})
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install(TARGETS stratagus DESTINATION games)
|
28
cmake/modules/FindMNG.cmake
Normal file
28
cmake/modules/FindMNG.cmake
Normal file
|
@ -0,0 +1,28 @@
|
|||
# - Try to find the MNG library
|
||||
# Once done this will define
|
||||
#
|
||||
# MNG_FOUND - system has Mikmod
|
||||
# MNG_INCLUDE_DIR - the Mikmod include directory
|
||||
# MNG_LIBRARY - The Mikmod library
|
||||
|
||||
# Copyright (c) 2011, Pali Rohár <pali.rohar@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if(MNG_INCLUDE_DIR AND MNG_LIBRARY)
|
||||
set(MNG_FOUND true)
|
||||
else()
|
||||
find_path(MNG_INCLUDE_DIR libmng.h)
|
||||
find_library(MNG_LIBRARY NAMES mng)
|
||||
|
||||
if(MNG_INCLUDE_DIR AND MNG_LIBRARY)
|
||||
set(MNG_FOUND true)
|
||||
message(STATUS "Found MNG: ${MNG_LIBRARY}")
|
||||
else()
|
||||
set(MNG_FOUND false)
|
||||
message(STATUS "Could not find MNG")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(MNG_INCLUDE_DIR MNG_LIBRARY)
|
||||
endif()
|
28
cmake/modules/FindMikmod.cmake
Normal file
28
cmake/modules/FindMikmod.cmake
Normal file
|
@ -0,0 +1,28 @@
|
|||
# - Try to find the Mikmod library
|
||||
# Once done this will define
|
||||
#
|
||||
# MIKMOD_FOUND - system has Mikmod
|
||||
# MIKMOD_INCLUDE_DIR - the Mikmod include directory
|
||||
# MIKMOD_LIBRARY - The Mikmod library
|
||||
|
||||
# Copyright (c) 2011, Pali Rohár <pali.rohar@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if(MIKMOD_INCLUDE_DIR AND MIKMOD_LIBRARY)
|
||||
set(MIKMOD_FOUND true)
|
||||
else()
|
||||
find_path(MIKMOD_INCLUDE_DIR mikmod.h)
|
||||
find_library(MIKMOD_LIBRARY NAMES mikmod)
|
||||
|
||||
if(MIKMOD_INCLUDE_DIR AND MIKMOD_LIBRARY)
|
||||
set(MIKMOD_FOUND true)
|
||||
message(STATUS "Found Mikmod: ${MIKMOD_LIBRARY}")
|
||||
else()
|
||||
set(MIKMOD_FOUND false)
|
||||
message(STATUS "Could not find Mikmod")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(MIKMOD_INCLUDE_DIR MIKMOD_LIBRARY)
|
||||
endif()
|
89
cmake/modules/FindOggVorbis.cmake
Normal file
89
cmake/modules/FindOggVorbis.cmake
Normal file
|
@ -0,0 +1,89 @@
|
|||
# - 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, <richard@goteborg.utfors.se>
|
||||
#
|
||||
# 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 -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)
|
||||
|
105
cmake/modules/FindOpenGLES.cmake
Normal file
105
cmake/modules/FindOpenGLES.cmake
Normal file
|
@ -0,0 +1,105 @@
|
|||
#-------------------------------------------------------------------
|
||||
# This file is part of the CMake build system for OGRE
|
||||
# (Object-oriented Graphics Rendering Engine)
|
||||
# For the latest info, see http://www.ogre3d.org/
|
||||
#
|
||||
# The contents of this file are placed in the public domain. Feel
|
||||
# free to make use of it in any way you like.
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# Copyright (c) 2011, Pali Rohár <pali.rohar@gmail.com>
|
||||
# Modified:
|
||||
# * Search for EGL library
|
||||
# * Show staus message
|
||||
# * Cleaned code
|
||||
|
||||
# - Try to find OpenGLES
|
||||
# Once done this will define
|
||||
#
|
||||
# OPENGLES_FOUND - system has OpenGLES
|
||||
# OPENGLES_INCLUDE_DIR - the GL include directory
|
||||
# OPENGLES_LIBRARIES - Link these to use OpenGLES
|
||||
|
||||
if(OPENGLES_INCLUDE_DIR AND OPENGLES_LIBRARIES)
|
||||
set(OPENGLES_FOUND true)
|
||||
else()
|
||||
|
||||
if(WIN32)
|
||||
|
||||
if(CYGWIN)
|
||||
find_path(OPENGLES_INCLUDE_DIR GLES/gl.h)
|
||||
find_library(OPENGLES_GL_LIBRARY libgles_cm)
|
||||
find_library(OPENGLES_EGL_LIBRARY EGL)
|
||||
elseif(BORLAND)
|
||||
set(OPENGLES_GL_LIBRARY import32 CACHE STRING "OpenGL ES 1.x library for win32")
|
||||
# TODO: EGL
|
||||
else()
|
||||
# MS compiler - todo - fix the following line:
|
||||
set(OPENGLES_GL_LIBRARY libgles_cm.lib CACHE STRING "OpenGL ES 1.x library for win32")
|
||||
# TODO: EGL
|
||||
endif()
|
||||
|
||||
elseif(APPLE)
|
||||
|
||||
create_search_paths(/Developer/Platforms)
|
||||
findpkg_framework(OpenGLES)
|
||||
set(OPENGLES_GL_LIBRARY "-framework OpenGLES")
|
||||
# TODO: EGL
|
||||
|
||||
elseif(SYMBIAN)
|
||||
|
||||
set(ORIGINAL_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_SYSYEM_OUT_DIR})
|
||||
find_library(OPENGLES_gl_LIBRARY libgles_cm)
|
||||
set(CMAKE_PREFIX_PATH ${ORIGINAL_CMAKE_PREFIX_PATH})
|
||||
# TODO: EGL
|
||||
|
||||
else()
|
||||
|
||||
find_path(OPENGLES_INCLUDE_DIR GLES/gl.h
|
||||
/usr/openwin/share/include
|
||||
/opt/graphics/OpenGL/include
|
||||
/usr/X11R6/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
find_library(OPENGLES_GL_LIBRARY NAMES GLES_CM PATHS
|
||||
/usr/openwin/lib
|
||||
/opt/graphics/OpenGL/lib
|
||||
/usr/shlib
|
||||
/usr/X11R6/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
find_library(OPENGLES_EGL_LIBRARY NAMES EGL PATHS
|
||||
/usr/openwin/lib
|
||||
/opt/graphics/OpenGL/lib
|
||||
/usr/shlib
|
||||
/usr/X11R6/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
# On Unix OpenGL most certainly always requires X11.
|
||||
# Feel free to tighten up these conditions if you don't
|
||||
# think this is always true.
|
||||
|
||||
find_package(X11)
|
||||
|
||||
if(X11_FOUND)
|
||||
set(OPENGLES_LIBRARIES ${OPENGLES_LIBRARIES} ${X11_LIBRARIES})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(OPENGLES_EGL_LIBRARY AND OPENGLES_GL_LIBRARY)
|
||||
set(OPENGLES_LIBRARIES ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARY} ${OPENGLES_GL_LIBRARY})
|
||||
set(OPENGLES_FOUND true)
|
||||
message(STATUS "Found OpenGL ES 1.1 libraries: ${OPENGLES_LIBRARIES}")
|
||||
else()
|
||||
set(OPENGLES_FOUND false)
|
||||
message(STATUS "Could not find OpenGL ES 1.1 libraries")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_LIBRARIES)
|
||||
|
||||
endif()
|
28
cmake/modules/FindSDL_gles.cmake
Normal file
28
cmake/modules/FindSDL_gles.cmake
Normal file
|
@ -0,0 +1,28 @@
|
|||
# - Try to find the SDL_gles library
|
||||
# Once done this will define
|
||||
#
|
||||
# SDLGLES_FOUND - system has SDL_gles
|
||||
# SDLGLES_INCLUDE_DIR - the SDL_gles include directory
|
||||
# SDLGLES_LIBRARY - The SDL_gles library
|
||||
|
||||
# Copyright (c) 2011, Pali Rohár <pali.rohar@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if(SDLGLES_INCLUDE_DIR AND SDLGLES_LIBRARY)
|
||||
set(SDLGLES_FOUND true)
|
||||
else()
|
||||
find_path(SDLGLES_INCLUDE_DIR SDL_gles.h PATH_SUFFIXES include/SDL)
|
||||
find_library(SDLGLES_LIBRARY NAMES SDL_gles)
|
||||
|
||||
if(SDLGLES_INCLUDE_DIR AND SDLGLES_LIBRARY)
|
||||
set(SDLGLES_FOUND true)
|
||||
message(STATUS "Found SDL_gles: ${SDLGLES_LIBRARY}")
|
||||
else()
|
||||
set(SDLGLES_FOUND false)
|
||||
message(STATUS "Could not find SDL_gles")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(SDLGLES_INCLUDE_DIR SDLGLES_LIBRARY)
|
||||
endif()
|
50
cmake/modules/FindSqlite.cmake
Normal file
50
cmake/modules/FindSqlite.cmake
Normal file
|
@ -0,0 +1,50 @@
|
|||
# - Try to find Sqlite
|
||||
# Once done this will define
|
||||
#
|
||||
# SQLITE_FOUND - system has Sqlite
|
||||
# SQLITE_INCLUDE_DIR - the Sqlite include directory
|
||||
# SQLITE_LIBRARIES - Link these to use Sqlite
|
||||
# SQLITE_DEFINITIONS - Compiler switches required for using Sqlite
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
|
||||
# Copyright (c) 2008, Gilles Caulier, <caulier.gilles@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES )
|
||||
# in cache already
|
||||
SET(Sqlite_FIND_QUIETLY TRUE)
|
||||
endif ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES )
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
if( NOT WIN32 )
|
||||
find_package(PkgConfig)
|
||||
|
||||
pkg_check_modules(PC_SQLITE sqlite3)
|
||||
|
||||
set(SQLITE_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER})
|
||||
endif( NOT WIN32 )
|
||||
|
||||
FIND_PATH(SQLITE_INCLUDE_DIR NAMES sqlite3.h
|
||||
PATHS
|
||||
${PC_SQLITE_INCLUDEDIR}
|
||||
${PC_SQLITE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SQLITE_LIBRARIES NAMES sqlite3
|
||||
PATHS
|
||||
${PC_SQLITE_LIBDIR}
|
||||
${PC_SQLITE_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sqlite DEFAULT_MSG SQLITE_INCLUDE_DIR SQLITE_LIBRARIES )
|
||||
|
||||
# show the SQLITE_INCLUDE_DIR and SQLITE_LIBRARIES variables only in the advanced view
|
||||
MARK_AS_ADVANCED(SQLITE_INCLUDE_DIR SQLITE_LIBRARIES )
|
||||
|
39
cmake/modules/FindTheora.cmake
Normal file
39
cmake/modules/FindTheora.cmake
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Option for build or not Theora
|
||||
|
||||
# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
if(THEORA_INCLUDE_DIR AND THEORA_LIB_LIBRARIES AND THEORA_VORBIS_LIBRARIES AND THEORA_OGG_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
set(Theora_FIND_QUIETLY TRUE)
|
||||
endif(THEORA_INCLUDE_DIR AND THEORA_LIB_LIBRARIES AND THEORA_VORBIS_LIBRARIES AND THEORA_OGG_LIBRARIES)
|
||||
|
||||
FIND_PATH(THEORA_INCLUDE_DIR theora/theora.h)
|
||||
|
||||
FIND_LIBRARY(THEORA_OGG_LIBRARIES NAMES ogg )
|
||||
|
||||
FIND_LIBRARY(THEORA_VORBIS_LIBRARIES NAMES vorbis)
|
||||
|
||||
FIND_LIBRARY(THEORA_LIB_LIBRARIES NAMES theora)
|
||||
|
||||
if(THEORA_LIB_LIBRARIES AND THEORA_VORBIS_LIBRARIES AND THEORA_OGG_LIBRARIES AND THEORA_INCLUDE_DIR)
|
||||
set(THEORA_LIBRARY ${THEORA_LIB_LIBRARIES} ${THEORA_OGG_LIBRARIES} ${THEORA_VORBIS_LIBRARIES})
|
||||
set(THEORA_FOUND TRUE)
|
||||
endif(THEORA_LIB_LIBRARIES AND THEORA_VORBIS_LIBRARIES AND THEORA_OGG_LIBRARIES AND THEORA_INCLUDE_DIR)
|
||||
|
||||
if (THEORA_FOUND)
|
||||
if (NOT Theora_FIND_QUIETLY)
|
||||
MESSAGE( STATUS "theora found: includes in ${THEORA_INCLUDE_DIR}, library in ${THEORA_LIBRARY}")
|
||||
endif (NOT Theora_FIND_QUIETLY)
|
||||
else (THEORA_FOUND)
|
||||
if (Theora_FIND_REQUIRED)
|
||||
MESSAGE( FATAL_ERROR "theora not found")
|
||||
endif (Theora_FIND_REQUIRED)
|
||||
endif (THEORA_FOUND)
|
||||
|
||||
|
||||
MARK_AS_ADVANCED(THEORA_INCLUDE_DIR THEORA_LIBRARY)
|
||||
|
24
cmake/modules/FindTolua++.cmake
Normal file
24
cmake/modules/FindTolua++.cmake
Normal file
|
@ -0,0 +1,24 @@
|
|||
# - Try to find the program tolua++
|
||||
# Once done this will define
|
||||
#
|
||||
# TOLUA++_FOUND - system has tolua++
|
||||
# TOLUA++ - program tolua++
|
||||
|
||||
# Copyright (c) 2011, Pali Rohár <pali.rohar@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if(TOLUA++)
|
||||
set(TOLUA++_FOUND true)
|
||||
else()
|
||||
find_program(TOLUA++ NAMES tolua++ tolua++5.1)
|
||||
if(TOLUA++)
|
||||
set(TOLUA++_FOUND true)
|
||||
message(STATUS "Found program tolua++: ${TOLUA++}")
|
||||
else()
|
||||
set(TOLUA++_FOUND false)
|
||||
message(FATAL_ERROR "Could not find program tolua++")
|
||||
endif()
|
||||
mark_as_advanced(TOLUA++)
|
||||
endif()
|
Loading…
Add table
Reference in a new issue