[Tux4kids-commits] r461 - in tuxmath/trunk: . data/images/sprites po src

tholy-guest at alioth.debian.org tholy-guest at alioth.debian.org
Sat Apr 19 11:41:39 UTC 2008


Author: tholy-guest
Date: 2008-04-19 11:41:38 +0000 (Sat, 19 Apr 2008)
New Revision: 461

Added:
   tuxmath/trunk/CMakeLists.txt
   tuxmath/trunk/FindMSGFMT.cmake
   tuxmath/trunk/po/CMakeLists.txt
   tuxmath/trunk/src/CMakeLists.txt
Modified:
   tuxmath/trunk/data/images/sprites/Makefile.in
   tuxmath/trunk/src/Makefile.in
   tuxmath/trunk/src/SDL_extras.h
   tuxmath/trunk/src/credits.c
   tuxmath/trunk/src/fileops.c
   tuxmath/trunk/src/game.c
   tuxmath/trunk/src/options.c
   tuxmath/trunk/src/scandir.c
   tuxmath/trunk/src/setup.c
   tuxmath/trunk/src/titlescreen.h
   tuxmath/trunk/src/tuxmath.h
   tuxmath/trunk/src/tuxmathadmin.c
Log:
Add the ability to build with CMake, as a possible solution to our Mac
OSX problems.  This has been tested only on Linux, but it seems to
work there.  Cross-building is the preferred strategy: from trunk,
create a directory build-cmake.  From inside that directory, you'd say
     cmake ../trunk
or
     cmake ../trunk -DCMAKE_INSTALL_PREFIX=/tmp/tm

if you want to install in a different location (like --prefix=/tmp/tm
for automake).

There are a number of small changes to the #include file handling to
try to make the path setting more cross-platform; that accounts for
the changes to the source code files.


Added: tuxmath/trunk/CMakeLists.txt
===================================================================
--- tuxmath/trunk/CMakeLists.txt	                        (rev 0)
+++ tuxmath/trunk/CMakeLists.txt	2008-04-19 11:41:38 UTC (rev 461)
@@ -0,0 +1,41 @@
+project (tuxmath)
+
+message("CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX}")
+
+set (TUXMATH_VERSION "1.6.1")
+set (TUXMATHADMIN_VERSION "0.1.1")
+
+## Define the extra paths
+set (DATA_TUXMATH ${tuxmath_SOURCE_DIR}/data)
+set (DOC_TUXMATH ${tuxmath_SOURCE_DIR}/doc)
+set (PO_TUXMATH ${tuxmath_SOURCE_DIR}/po)
+
+## Set up OS-specific path information
+if (APPLE)
+  set(DATA_PREFIX TuxMath.app/Contents/Resources/data)
+  set(LOCALEDIR TuxMath.app/Contents/Resources/locale)
+  set_source_files_properties (
+    ${DATA_TUXMATH}
+    PROPERTIES
+    MACOSX_PACKAGE_LOCATION Resources
+    )
+elseif (UNIX)
+  # A non-apple Unix (Linux, Solaris, etc.)
+  set (DATA_PREFIX ${CMAKE_INSTALL_PREFIX}/share/tuxmath)
+  set (LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
+endif (APPLE)
+
+## Code for internationalization: if we don't have gettext, we need to
+## compile the intl library
+include (CheckSymbolExists)
+check_symbol_exists (gettext libintl.h HAVE_GETTEXT)
+set(CMAKE_MODULE_PATH "${tuxmath_SOURCE_DIR}")
+find_package (MSGFMT)
+
+## Add subdirectories
+add_subdirectory (src)
+if (HAVE_GETTEXT)
+  add_subdirectory (po)
+endif (HAVE_GETTEXT)
+
+

Added: tuxmath/trunk/FindMSGFMT.cmake
===================================================================
--- tuxmath/trunk/FindMSGFMT.cmake	                        (rev 0)
+++ tuxmath/trunk/FindMSGFMT.cmake	2008-04-19 11:41:38 UTC (rev 461)
@@ -0,0 +1,49 @@
+#
+# Find the msgfmt program
+#
+# Defined variables:
+#  MSGFMT_FOUND
+#  MSGFMT_EXECUTABLE
+#
+# Macro:
+#  ADD_TRANSLATIONS
+#
+# This requires that the variable LOCALEDIR be set to the place you
+# want to install the .mo files.
+
+
+IF(MSGFMT_EXECUTABLE)
+    SET(MSGFMT_FOUND TRUE)
+ELSE(MSGFMT_EXECUTABLE)
+    FIND_PROGRAM(MSGFMT_EXECUTABLE
+	NAMES msgfmt gmsgfmt
+	PATHS /bin /usr/bin /usr/local/bin )
+    IF(MSGFMT_EXECUTABLE)
+        SET(MSGFMT_FOUND TRUE)
+    ELSE(MSGFMT_EXECUTABLE)
+	IF(NOT MSGFMT_FIND_QUIETLY)
+	    IF(MSGFMT_FIND_REQUIRED)
+                MESSAGE(FATAL_ERROR "msgfmt program couldn't be found")
+	    ENDIF(MSGFMT_FIND_REQUIRED)
+	ENDIF(NOT MSGFMT_FIND_QUIETLY)
+    ENDIF(MSGFMT_EXECUTABLE)
+    MARK_AS_ADVANCED(MSGFMT_EXECUTABLE)
+ENDIF (MSGFMT_EXECUTABLE)
+
+MACRO(ADD_TRANSLATIONS _baseName)
+    SET(_outputs)
+    FOREACH(_file ${ARGN})
+	GET_FILENAME_COMPONENT(_file_we ${_file} NAME_WE)
+	SET(_out "${CMAKE_CURRENT_BINARY_DIR}/${_file_we}.gmo")
+	SET(_in  "${CMAKE_CURRENT_SOURCE_DIR}/${_file_we}.po")
+	ADD_CUSTOM_COMMAND(
+	    OUTPUT ${_out}
+	    COMMAND ${MSGFMT_EXECUTABLE} -o ${_out} ${_in}
+	    DEPENDS ${_in} )
+	INSTALL(FILES ${_out}
+	    DESTINATION ${LOCALEDIR}/${_file_we}/LC_MESSAGES/
+	    RENAME ${_baseName}.mo )
+	SET(_outputs ${_outputs} ${_out})
+    ENDFOREACH(_file)
+    ADD_CUSTOM_TARGET(translations ALL DEPENDS ${_outputs})
+ENDMACRO(ADD_TRANSLATIONS)

Modified: tuxmath/trunk/data/images/sprites/Makefile.in
===================================================================
--- tuxmath/trunk/data/images/sprites/Makefile.in	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/data/images/sprites/Makefile.in	2008-04-19 11:41:38 UTC (rev 461)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -56,7 +56,7 @@
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 SOURCES =

Added: tuxmath/trunk/po/CMakeLists.txt
===================================================================
--- tuxmath/trunk/po/CMakeLists.txt	                        (rev 0)
+++ tuxmath/trunk/po/CMakeLists.txt	2008-04-19 11:41:38 UTC (rev 461)
@@ -0,0 +1,2 @@
+file (GLOB PO_FILES *.po)
+add_translations (tuxmath ${PO_FILES})

Added: tuxmath/trunk/src/CMakeLists.txt
===================================================================
--- tuxmath/trunk/src/CMakeLists.txt	                        (rev 0)
+++ tuxmath/trunk/src/CMakeLists.txt	2008-04-19 11:41:38 UTC (rev 461)
@@ -0,0 +1,106 @@
+#The following isn't necessary because of the SDL workaround
+#cmake_minimum_required(VERSION 2.4.7 FATAL_ERROR)
+
+## Define the source files used for each executable
+# tuxmath
+set (SOURCES_TUXMATH
+  audio.c
+  ConvertUTF.c
+  credits.c
+  fileops.c
+  game.c
+  highscore.c
+  lessons.c
+  loaders.c
+  mathcards.c
+  options.c
+  scandir.c
+  SDL_extras.c
+  setup.c
+  titlescreen.c
+  tuxmath.c
+  )
+
+# tuxmathadmin
+set (SOURCES_TUXMATHADMIN
+  tuxmathadmin.c
+  )
+
+## Libraries
+find_package (SDL REQUIRED)
+find_package (SDL_image REQUIRED)
+find_package (SDL_ttf REQUIRED)
+find_package (SDL_mixer REQUIRED)
+
+if (NOT SDL_FOUND)
+  # Workaround for REQUIRED flag not working with cmake < 2.4.7.
+  # Should put other libraries in, too.
+  message (FATAL_ERROR "SDL not found!")
+endif (NOT SDL_FOUND)
+
+# Other library functionality
+check_symbol_exists(scandir dirent.h HAVE_SCANDIR)
+
+include (CheckIncludeFiles)
+check_include_file (error.h HAVE_ERROR_H)
+
+link_libraries (
+  ${SDL_LIBRARY}
+  ${SDLIMAGE_LIBRARY}
+  ${SDLTTF_LIBRARY}
+  ${SDLMIXER_LIBRARY}
+  SDLmain
+  )
+
+## Include files
+#set (CMAKE_INCLUDE_PATH /usr/include/SDL)
+configure_file(${tuxmath_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
+## OSX
+# Build universal binaries on OSX
+set(CMAKE_OSX_ARCHITECTURES ppc i386)
+
+## Define the executables
+add_executable (
+  tuxmath
+  MACOSX_BUNDLE
+  WIN32
+  ${SOURCES_TUXMATH} ${DATA_TUXMATH}
+  )
+
+add_executable (
+  tuxmathadmin
+  MACOSX_BUNDLE
+  WIN32
+  ${SOURCES_TUXMATHADMIN}
+  )
+
+set_target_properties (
+  tuxmath
+  PROPERTIES COMPILE_FLAGS 
+  "-DDATA_PREFIX=\\\"${DATA_PREFIX}\\\" -DVERSION=\\\"${TUXMATH_VERSION}\\\" -DLOCALEDIR=\\\"${LOCALEDIR}\\\" -DPACKAGE=\\\"tuxmath\\\""
+  )
+
+set_target_properties (
+  tuxmathadmin
+  PROPERTIES COMPILE_FLAGS 
+  "-DDATA_PREFIX=\\\"${DATA_PREFIX}\\\" -DVERSION=\\\"${TUXMATHADMIN_VERSION}\\\" -DLOCALEDIR=\\\"${LOCALEDIR}\\\" -DPACKAGE=\\\"tuxmathadmin\\\""
+  )
+
+## Installation specifications
+if (UNIX AND NOT APPLE)
+  install (TARGETS tuxmath tuxmathadmin
+    RUNTIME DESTINATION bin)
+  install (DIRECTORY ${DATA_TUXMATH}/
+    DESTINATION share/tuxmath
+    PATTERN Makefile* EXCLUDE
+    PATTERN .svn EXCLUDE
+    PATTERN *~ EXCLUDE
+    )
+  install (DIRECTORY ${DOC_TUXMATH}/
+    DESTINATION doc/tuxmath
+    PATTERN Makefile* EXCLUDE
+    PATTERN .svn EXCLUDE
+    PATTERN *~ EXCLUDE
+    )
+endif(UNIX AND NOT APPLE)

Modified: tuxmath/trunk/src/Makefile.in
===================================================================
--- tuxmath/trunk/src/Makefile.in	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/Makefile.in	2008-04-19 11:41:38 UTC (rev 461)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -60,7 +60,7 @@
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
@@ -89,7 +89,7 @@
 tuxmathadmin_OBJECTS = $(am_tuxmathadmin_OBJECTS)
 tuxmathadmin_LDADD = $(LDADD)
 tuxmathadmin_DEPENDENCIES =
-DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -408,8 +408,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -421,8 +421,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -432,13 +432,12 @@
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxmath/trunk/src/SDL_extras.h
===================================================================
--- tuxmath/trunk/src/SDL_extras.h	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/SDL_extras.h	2008-04-19 11:41:38 UTC (rev 461)
@@ -13,8 +13,8 @@
 #ifndef SDL_EXTRAS_H
 #define SDL_EXTRAS_H
 
-#include "SDL.h"
-#include "SDL_ttf.h"
+#include <SDL/SDL.h>
+#include <SDL/SDL_ttf.h>
 
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
 #define rmask 0xff000000

Modified: tuxmath/trunk/src/credits.c
===================================================================
--- tuxmath/trunk/src/credits.c	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/credits.c	2008-04-19 11:41:38 UTC (rev 461)
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <SDL.h>
+#include <SDL/SDL.h>
 
 #include "tuxmath.h"
 #include "options.h"

Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/fileops.c	2008-04-19 11:41:38 UTC (rev 461)
@@ -26,7 +26,7 @@
 *
 */
 
-#include <config.h>
+#include "config.h"
 
 /* Tuxmath includes: */
 #include "tuxmath.h"
@@ -49,13 +49,13 @@
 
 
 /* SDL includes: */
-#include <SDL.h>
+#include <SDL/SDL.h>
 
 #ifndef NOSOUND
-#include <SDL_mixer.h>
+#include <SDL/SDL_mixer.h>
 #endif
 
-#include <SDL_image.h>
+#include <SDL/SDL_image.h>
 
 /* OS includes - NOTE: these may not be very portable */
 #include <dirent.h>  /* for opendir() */

Modified: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/game.c	2008-04-19 11:41:38 UTC (rev 461)
@@ -25,11 +25,11 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "SDL.h"
+#include <SDL/SDL.h>
 #ifndef NOSOUND
-#include "SDL_mixer.h"
+#include <SDL/SDL_mixer.h>
 #endif
-#include "SDL_image.h"
+#include <SDL/SDL_image.h>
 
 #include "game.h"
 #include "fileops.h"

Modified: tuxmath/trunk/src/options.c
===================================================================
--- tuxmath/trunk/src/options.c	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/options.c	2008-04-19 11:41:38 UTC (rev 461)
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <SDL.h>
+#include <SDL/SDL.h>
 
 #include "mathcards.h"
 

Modified: tuxmath/trunk/src/scandir.c
===================================================================
--- tuxmath/trunk/src/scandir.c	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/scandir.c	2008-04-19 11:41:38 UTC (rev 461)
@@ -4,7 +4,7 @@
 /* #ifndef HAVE_SCANDIR.  */
 
 /* We only need to compile this file if the host platform doesn't have scandir(): */
-#include <config.h>
+#include "config.h"
 #ifndef HAVE_SCANDIR
 
 /*
@@ -257,4 +257,4 @@
 }
 
 #endif /* WIN32 */
-#endif /* HAVE_SCANDIR */
\ No newline at end of file
+#endif /* HAVE_SCANDIR */

Modified: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/setup.c	2008-04-19 11:41:38 UTC (rev 461)
@@ -30,14 +30,14 @@
 /* FIXME maybe unistd.h not needed, even less sure about portability */
 //#include <unistd.h>
 
-#include <SDL.h>
-#include <SDL_ttf.h>
+#include <SDL/SDL.h>
+#include <SDL/SDL_ttf.h>
 
 #ifndef NOSOUND
-#include <SDL_mixer.h>
+#include <SDL/SDL_mixer.h>
 #endif
 
-#include <SDL_image.h>
+#include <SDL/SDL_image.h>
 
 #include "options.h"
 #include "tuxmath.h"

Modified: tuxmath/trunk/src/titlescreen.h
===================================================================
--- tuxmath/trunk/src/titlescreen.h	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/titlescreen.h	2008-04-19 11:41:38 UTC (rev 461)
@@ -38,13 +38,13 @@
 #include <sys/stat.h>
 #include <dirent.h>
 
-#include <SDL.h>
-#include <SDL_image.h>
-#include <SDL_mixer.h>
-#include <SDL_ttf.h>
+#include <SDL/SDL.h>
+#include <SDL/SDL_image.h>
+#include <SDL/SDL_mixer.h>
+#include <SDL/SDL_ttf.h>
 
 #ifndef MACOSX
-#include "../config.h"
+#include "config.h"
 #endif
 
 #include "tuxmath.h"

Modified: tuxmath/trunk/src/tuxmath.h
===================================================================
--- tuxmath/trunk/src/tuxmath.h	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/tuxmath.h	2008-04-19 11:41:38 UTC (rev 461)
@@ -22,7 +22,7 @@
 #ifndef TUXMATH_H
 #define TUXMATH_H
 
-#include <config.h>
+#include "config.h"
 
 // Translation stuff (now works for Mac and Win too!): 
 #include "gettext.h"
@@ -33,11 +33,11 @@
 
 #include <wchar.h>
 
-#include "SDL.h"
-#include "SDL_ttf.h"
+#include <SDL/SDL.h>
+#include <SDL/SDL_ttf.h>
 
 #ifndef NOSOUND
-#include "SDL_mixer.h"
+#include <SDL/SDL_mixer.h>
 #endif
 
 //#define NOSOUND

Modified: tuxmath/trunk/src/tuxmathadmin.c
===================================================================
--- tuxmath/trunk/src/tuxmathadmin.c	2008-04-14 10:39:22 UTC (rev 460)
+++ tuxmath/trunk/src/tuxmathadmin.c	2008-04-19 11:41:38 UTC (rev 461)
@@ -15,7 +15,7 @@
   December 3, 2007
 */
 
-#include <config.h>
+#include "config.h"
 
 #include <stdio.h>
 #include <stdlib.h>




More information about the Tux4kids-commits mailing list