mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 19:43:26 +00:00
326 lines
13 KiB
CMake
326 lines
13 KiB
CMake
# this is a preliminary version of the CMake build stuff and was originally created by am2cmake
|
|
|
|
# find all deps needed
|
|
FIND_PACKAGE( SDL 1.2.7 REQUIRED )
|
|
FIND_PACKAGE( SDL_image 1.2 REQUIRED )
|
|
FIND_PACKAGE( SDL_mixer 1.2 REQUIRED )
|
|
FIND_PACKAGE( SDL_net REQUIRED )
|
|
FIND_PACKAGE( SDL_ttf 2.0.8 REQUIRED )
|
|
# setting python to a "must have" for the moment, can later on be changed to be optional
|
|
FIND_PACKAGE( PythonInterp 2.4 )
|
|
FIND_PACKAGE( PythonLibs 2.4 )
|
|
FIND_PACKAGE( Boost 1.33 REQUIRED COMPONENTS boost_iostream boost_regex )
|
|
FIND_PACKAGE( ZLIB REQUIRED )
|
|
FIND_PACKAGE( PNG REQUIRED )
|
|
|
|
#Options
|
|
|
|
set(BINDIR "bin" CACHE STRING "Where to install binaries")
|
|
set(DATAROOTDIR "share" CACHE STRING "Sets the root of data directories to a non-default location")
|
|
set(DATADIR "${DATAROOTDIR}/wesnoth" CACHE STRING "Read-only architecture-independent game data")
|
|
set(LOCALEDIR "${DATADIR}/translations" CACHE STRING "sets the locale data directory to a non-default location")
|
|
set(PREFERENCES_DIR "" CACHE STRING "Use a non-default preferences directory (.wesnoth on unix)")
|
|
|
|
set(GUI "normal" CACHE STRING "Set for GUI reductions for resolutions down to 800x480 (eeePC, Nokia 8x0) or 320x240 (PDAs) (normal|small|tiny)")
|
|
|
|
if(NOT WIN32)
|
|
if(IS_ABSOLUTE DATADIR)
|
|
add_definitions(-DWESNOTH_PATH='\"${DATADIR}\"')
|
|
message("set -DWESNOTH_PATH='\"${DATADIR}\"'")
|
|
else(IS_ABSOLUTE DATADIR)
|
|
add_definitions(-DWESNOTH_PATH='\"${CMAKE_INSTALL_PREFIX}/${DATADIR}\"')
|
|
message("set -DWESNOTH_PATH='\"${CMAKE_INSTALL_PREFIX}/${DATADIR}\"'")
|
|
endif(IS_ABSOLUTE DATADIR)
|
|
endif(NOT WIN32)
|
|
|
|
add_definitions(-DLOCALEDIR=='\"${LOCALEDIR}\"')
|
|
message("set -DLOCALEDIR='\"${LOCALEDIR}\"'")
|
|
|
|
if(NOT IS_ABSOLUTE LOCALEDIR)
|
|
add_definitions(-DHAS_RELATIVE_LOCALEDIR)
|
|
message("set -DHAS_RELATIVE_LOCALEDIR")
|
|
endif(NOT IS_ABSOLUTE LOCALEDIR)
|
|
|
|
if(PREFERENCES_DIR)
|
|
add_definitions(-DPREFERENCES_DIR='\"${PREFERENCES_DIR}\"')
|
|
message("set -DPREFERENCES_DIR=='\"${PREFERENCES_DIR}\"'")
|
|
endif(PREFERENCES_DIR)
|
|
|
|
|
|
if(GUI STREQUAL "tiny")
|
|
add_definitions(-DUSE_TINY_GUI)
|
|
elseif(GUI STREQUAL "small")
|
|
add_definitions(-DUSE_SMALL_GUI)
|
|
endif(GUI STREQUAL "tiny")
|
|
|
|
|
|
option(ENABLE_GAME "Enable compilation of the game" ON)
|
|
option(ENABLE_CAMPAIGN_SERVER "Enable compilation of campaign server")
|
|
option(ENABLE_SERVER "Enable compilation of server")
|
|
option(ENABLE_EDITOR "Enable compilation of map editor")
|
|
option(ENABLE_TOOLS "Enable building and installation of tools for artists and WML maintainers")
|
|
option(ENABLE_TESTS "Build unit tests")
|
|
option(ENABLE_PYTHON "Enable in-game python extensions" ON)
|
|
|
|
if(ENABLE_PYTHON AND PYTHON_LIBRARY)
|
|
add_definitions(-DHAVE_PYTHON)
|
|
message("set -DHAVE_PYTHON")
|
|
endif(ENABLE_PYTHON AND PYTHON_LIBRARY)
|
|
|
|
|
|
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
# only one of the subdirs working so far...
|
|
#add_subdirectory(po)
|
|
#add_subdirectory(m4)
|
|
add_subdirectory(src)
|
|
#add_subdirectory(doc)
|
|
|
|
# some stuff from am2cmake
|
|
|
|
#message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: skipped subdir $(ISUBDIRS)")
|
|
|
|
########### install files ###############
|
|
|
|
# total bogus so far...
|
|
|
|
#install(FILES copyright changelog players_changelog campaign_server.dsp editor.dev editor_gcc4.dev map_editor.dsp server.dev server.dsp unit_test.dev wesnothd.dev wesnoth.dev wesnothd_gcc4.dev wesnoth.dsp wesnoth.dsw wesnoth_gcc4.dev wesnoth.kdevelop DESTINATION )
|
|
#install(FILES DESTINATION /share/@DATADIR@)
|
|
|
|
install(DIRECTORY data fonts images sounds translations DESTINATION ${DATADIR})
|
|
|
|
|
|
#original Makefile.am contents follow:
|
|
|
|
#ISUBDIRS = icons
|
|
#SUBDIRS = po m4 src doc $(ISUBDIRS)
|
|
#pkgdatadir=$(datadir)/@DATADIR@
|
|
#
|
|
#bin_SCRIPTS =
|
|
#
|
|
## Ignore junk -- object files, editor backup files, wmllint backup files.
|
|
#findfilterflags=! \( -name .svn -prune -o -name ".\#*" -o -name "*~" -o -name "*bak" -o -name 'Makefile' -o -name '*Makefile' -o -type d \)
|
|
#
|
|
## List all datafiles, ignoring junk
|
|
#finddata=(cd $(top_srcdir) && find data fonts icons images sounds $(findfilterflags) -print )
|
|
## List all data subdirectories
|
|
#finddatadirs=(cd $(top_srcdir) && find data fonts icons images sounds -type d \! \( -name .svn -prune \) -print )
|
|
## List non-installable utility files
|
|
#findnoinst=(cd $(top_srcdir) && find utils $(findfilterflags) -print )
|
|
#findnoinst_headers=(cd $(top_srcdir) && find src -name "*.hpp" -print )
|
|
#findsconscript=(cd $(top_srcdir) && find . -name "SConscript" -print )
|
|
#findsconstruct=(cd $(top_srcdir) && find . -name "SConstruct" -print )
|
|
#
|
|
## Find files derived from the manual that should go in a distribution
|
|
#finddocdist=(cd $(top_srcdir) && find doc/manual -name "*.html" -o -name "*.css" -o -name "*.jpg" -o -name "*.txt")
|
|
## Same list as previous, but with doc/ stripped off the front
|
|
#finddoc=($(finddocdist) | sed -e 's:doc/manual:manual:g' )
|
|
## List all document directories
|
|
#finddocdirs=(cd $(top_srcdir)/doc && find manual -type d \! \( -name .svn -prune \) -print; )
|
|
#
|
|
## This is a workaround to include manpage and manual translation files in the
|
|
## tarball. Manual and manpages are pre-built, so these files aren't actually
|
|
## needed to build Wesnoth, but are included because .po files are the
|
|
## preferred source of modification.
|
|
#findextrapo=(cd $(top_srcdir) && \
|
|
# find po/wesnoth-manpages po/wesnoth-manual \
|
|
# -name "*.pot" -o -name "*.po" -o -name "*.cfg")
|
|
#
|
|
#w_preparefileinstall = if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
|
# case $$p in \
|
|
# $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
|
# *) f=$$p;; \
|
|
# esac;
|
|
#
|
|
## Create Macintosh app bundle from the game
|
|
#bundle_contents=@PACKAGE_NAME@.app/Contents
|
|
#@PACKAGE@_bundle: src/@PACKAGE@
|
|
# mkdir -p "$(bundle_contents)/MacOS"
|
|
# mkdir -p "$(bundle_contents)/Resources"
|
|
# echo "APPL????" > "$(bundle_contents)/PkgInfo"
|
|
# $(INSTALL_PROGRAM) $< "$(bundle_contents)/MacOS/@PACKAGE_NAME@"
|
|
#
|
|
## Create Macintosh app bundle from the editor
|
|
#bundle_editor_contents=@PACKAGE_NAME@ Editor.app/Contents
|
|
#@PACKAGE@_editor_bundle: src/@PACKAGE@_editor
|
|
# mkdir -p "$(bundle_editor_contents)/MacOS"
|
|
# mkdir -p "$(bundle_editor_contents)/Resources"
|
|
# echo "APPL????" > "$(bundle_editor_contents)/PkgInfo"
|
|
# $(INSTALL_PROGRAM) $< "$(bundle_editor_contents)/MacOS/@PACKAGE_NAME@ Editor"
|
|
#
|
|
## Run this before release to check that POTs and data are in good shape
|
|
#sanity-check:
|
|
# cd utils; ./sanity_check
|
|
# cd data/tools; make sanity-check
|
|
#
|
|
## *** Not yet covered by scons recipe (dummylocales)
|
|
#install-data-local:
|
|
# @$(NORMAL_INSTALL)
|
|
#if INSTALLDATA
|
|
# @echo "Replicate data directory skeleton under target shared-data directory."
|
|
# @echo "Then copy all corresponding files."
|
|
# test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
|
|
# ( $(finddatadirs) ) | while read p; do \
|
|
# $(mkdir_p) "$(DESTDIR)$(pkgdatadir)/$$p"; \
|
|
# done; \
|
|
# srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
|
# ( $(finddata) ) | while read p; do \
|
|
# $(w_preparefileinstall) \
|
|
# echo $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
|
|
# $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
|
|
# done
|
|
# @echo "Replicate doc directory skeleton under target doc subdirectory"
|
|
# @echo "Then copy all corresponding files."
|
|
# test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)"
|
|
# ( $(finddocdirs) ) | while read p; do \
|
|
# $(mkdir_p) "$(DESTDIR)$(docdir)/$$p"; \
|
|
# done; \
|
|
# ( $(finddoc) ) | while read p; do \
|
|
# cd doc && $(w_preparefileinstall) \
|
|
# echo $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \
|
|
# $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; cd ..; \
|
|
# done
|
|
#if DUMMYLOCALES
|
|
# @echo "Create dummy locales beneath the Wesnoth data directory"
|
|
# $(mkdir_p) "$(DESTDIR)$(pkgdatadir)/locales"
|
|
# if test -d "$(DESTDIR)$(pkgdatadir)/locales/C" ; then rm -r "$(DESTDIR)$(pkgdatadir)/locales/C" ; fi
|
|
# echo | localedef --force "$(DESTDIR)$(pkgdatadir)/locales/C" 2> /dev/null; \
|
|
# for loc in `ls data/languages/*.cfg | sed -e's/data\/languages\/\(.*\)\.cfg/\1/'`; do \
|
|
# loclnk="$(DESTDIR)$(pkgdatadir)/locales/$$loc"@wesnoth; \
|
|
# if test -L "$$loclnk" ; then rm "$$loclnk" ; fi; \
|
|
# ln -s C "$$loclnk"; done; \
|
|
# true
|
|
#endif
|
|
#if TINYGUI
|
|
# @echo "Shrink installed images by a factor of two."
|
|
# (cd $(top_srcdir) && find data/core/images data/campaigns images \( $(findfilterflags) -a -name '*.png' -and -not -name 'bar-energy-tinygui.png' -print \) ) | while read p; do \
|
|
# $(w_preparefileinstall) \
|
|
# eval `identify $$d$$p | cut -f 3 -d ' ' | sed s/^/imagewidth=/ | sed s/x/\;imageheight=/` ;\
|
|
# case $${imagewidth}x$$imageheight in \
|
|
# 1024x768) dstsize=320x240 ;; \
|
|
# 640x480) dstsize=240x180 ;; \
|
|
# 205x205) dstsize=80x80 ;; \
|
|
# *) if [ $$imageheight -gt $$imagewidth ]; then max=`expr $$imageheight / 2`; else max=`expr $$imagewidth / 2`; fi ;\
|
|
# dstsize=$${max}x$${max} ;; \
|
|
# esac ; \
|
|
# file=`basename "$$p"`; \
|
|
# file "$$d$$p" | egrep "(RGBA|alpha)" >/dev/null 2>&1 && {\
|
|
# convert "$$d$$p" -filter point -resize $$dstsize "$(DESTDIR)$(pkgdatadir)/$$f";\
|
|
# } || { \
|
|
# convert "$$d$$p" -resize $$dstsize "$(DESTDIR)$(pkgdatadir)/$$f"; \
|
|
# } \
|
|
# done
|
|
#endif
|
|
# @echo "Local installation is complete"
|
|
#endif
|
|
#
|
|
#uninstall-local:
|
|
# @$(NORMAL_UNINSTALL)
|
|
#if INSTALLDATA
|
|
# @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
|
# ( $(finddata) ) | while read p; do \
|
|
# case $$p in \
|
|
# $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
|
# *) f=$$p;; \
|
|
# esac; \
|
|
# echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
|
|
# rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
|
|
# done
|
|
# ( $(finddoc) ) | while read p; do \
|
|
# case $$p in \
|
|
# $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
|
# *) f=$$p;; \
|
|
# esac; \
|
|
# echo " rm -f '$(DESTDIR)$(docadir)/$$f'"; \
|
|
# rm -f "$(DESTDIR)$(docdir)/$$f"; \
|
|
# done
|
|
# ( $(finddocdirs) | sed -e 's/ /\n/g' | sort -r ) | while read p; do \
|
|
# d=$(DESTDIR)$(docdir)/$$p && \
|
|
# if test -d $$d ; then echo "rmdir $$d"; echo `rmdir $$d` ; fi \
|
|
# done
|
|
#endif
|
|
#
|
|
#dist-hook:
|
|
# srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
|
# ( $(finddata); $(finddocdist); $(findnoinst); $(findnoinst_headers); $(findextrapo); $(findsconscript); $(findsconstruct) ) | (cd $(top_srcdir) && tar cf - -T -) | (cd $(distdir) && tar xf -)
|
|
#
|
|
#dist_noinst_DATA = copyright changelog players_changelog campaign_server.dsp editor.dev editor_gcc4.dev map_editor.dsp server.dev server.dsp unit_test.dev wesnothd.dev wesnoth.dev wesnothd_gcc4.dev wesnoth.dsp wesnoth.dsw wesnoth_gcc4.dev wesnoth.kdevelop
|
|
#
|
|
#uninstall-hook:
|
|
# if test -d $(pkgdatadir) ; then rm -r $(pkgdatadir) ; fi
|
|
# if test -d $(bindir) ; then echo `rmdir $(bindir)` ; fi
|
|
# if test -d $(datadir) ; then echo `rmdir $(datadir)` ; fi
|
|
# if test -d $(prefix) ; then echo `rmdir $(prefix)` ; fi
|
|
# if test -d $(docdir) ; then echo `rmdir $(docdir)` ; fi
|
|
#
|
|
#clean-local:
|
|
# rm -rf po/stamp* po/*/stamp*
|
|
#
|
|
#distclean-local:
|
|
# rm -rf translations
|
|
#
|
|
#BINARY_STAGING=/tmp/$(PACKAGE)-$(VERSION)-staging
|
|
#BINARY_DIST=/tmp/$(PACKAGE)-binary-$(VERSION).tar.gz
|
|
#DATA_DIST=/tmp/$(PACKAGE)-data-$(VERSION).tar.gz
|
|
#
|
|
#binary-dist:
|
|
# @rm -rf $(BINARY_STAGING) $(BINARY_DIST)
|
|
# @make install-exec DESTDIR=$(BINARY_STAGING)
|
|
# @cd $(BINARY_STAGING) ; tar cf - * | gzip -c >$(BINARY_DIST)
|
|
# @rm -rf $(BINARY_STAGING)
|
|
# @echo "Precompiled binary tarball is in $(BINARY_DIST)"
|
|
#
|
|
#data-dist:
|
|
# @rm -rf $(BINARY_STAGING) $(DATA_DIST)
|
|
# @make install-data DESTDIR=$(BINARY_STAGING)
|
|
# @cd $(BINARY_STAGING) ; tar cf - * | gzip -c >$(DATA_DIST)
|
|
# @rm -rf $(BINARY_STAGING)
|
|
# @echo "Precompiled data tarball is in $(DATA_DIST)"
|
|
#
|
|
#ACLOCAL_AMFLAGS = -I m4
|
|
#
|
|
#EXTRA_DIST = config/config.rpath config/mkinstalldirs config/py-compile
|
|
#
|
|
#if PYTHON_INSTALL
|
|
#pkgpython_PYTHON = data/tools/wesnoth/wmltools.py \
|
|
# data/tools/wesnoth/libsvn.py \
|
|
# data/tools/wesnoth/wescamp.py \
|
|
# data/tools/wesnoth/wmldata.py \
|
|
# data/tools/wesnoth/wmliterator.py \
|
|
# data/tools/wesnoth/wmlparser.py \
|
|
# data/tools/wesnoth/campaignserver_client.py \
|
|
# data/tools/wesnoth/__init__.py
|
|
#endif
|
|
#
|
|
#update-po:
|
|
# @cd po && make $@ || exit $?
|
|
#if MANUALUPDATE
|
|
# @cd doc/manual && make update-po || exit $?
|
|
#endif
|
|
#
|
|
#if PO4AUPDATE
|
|
#update-po4a:
|
|
# @cd po && make update-po4a || exit $?
|
|
# @echo -n "Removing empty man directories... "
|
|
# @find doc/man/ -maxdepth 1 -type d -empty -exec rmdir {} \; && \
|
|
# echo "done." || exit $?
|
|
#
|
|
#if MANUALUPDATE
|
|
# @cd doc/manual && make html || exit $?
|
|
#endif
|
|
#endif
|
|
#
|
|
#if MANUALUPDATE
|
|
#manual-en:
|
|
# @cd doc/manual && make manual.en.html || exit $?
|
|
#endif
|
|
#
|
|
## latest graph-includes.pl can be found currently at http://ydirson.free.fr/soft/wesnoth/graphs/
|
|
#wesnoth-deps.dot:
|
|
# PERL5LIB=$(top_srcdir) graph-includes -verbose --class wesnoth --consolidate 1-1 \
|
|
# -sysI /usr/include/c++/4.0 -sysI /usr/include -sysI /usr/include/SDL \
|
|
# --prefixstrip $(top_srcdir)/src/ -I $(top_srcdir)/src $(top_srcdir)/src > $@ || \
|
|
# ( rm $@; false )
|
|
#%.ps: %.dot
|
|
# dot -Tps $< > $@
|