[Tux4kids-commits] r1720 - in tuxmath/trunk: . cmake-modules src
B. Luchen
cheezmeister-guest at alioth.debian.org
Fri Jan 8 20:24:21 UTC 2010
Author: cheezmeister-guest
Date: 2010-01-08 20:24:21 +0000 (Fri, 08 Jan 2010)
New Revision: 1720
Added:
tuxmath/trunk/cmake-modules/Findt4kcommon.cmake
Modified:
tuxmath/trunk/config.h.cmake
tuxmath/trunk/src/CMakeLists.txt
tuxmath/trunk/src/SDL_extras.c
tuxmath/trunk/src/globals.h
tuxmath/trunk/src/menu.h
tuxmath/trunk/src/titlescreen.h
tuxmath/trunk/src/tuxmath.h
Log:
Start bringing in t4kcommon--messy but functional
Added: tuxmath/trunk/cmake-modules/Findt4kcommon.cmake
===================================================================
--- tuxmath/trunk/cmake-modules/Findt4kcommon.cmake (rev 0)
+++ tuxmath/trunk/cmake-modules/Findt4kcommon.cmake 2010-01-08 20:24:21 UTC (rev 1720)
@@ -0,0 +1,73 @@
+# - Locate t4kcommon library
+# This module defines
+# T4KCOMMON_LIBRARY, the library to link against
+# T4KCOMMON_FOUND, if false, do not try to link to t4kcommon
+# T4KCOMMON_INCLUDE_DIR, where to find t4kcommon.h
+#
+# $T4KCOMMONDIR is an environment variable that would
+# correspond to the ./configure --prefix=$T4KCOMMONDIR
+# used in building T4KCOMMON.
+# Adapted by Brendan Luchen from Tim Holy's FindSDL_Pango.cmake. # This was influenced by the FindSDL_ttf.cmake module by Eric Wing.
+FIND_PATH(T4KCOMMON_INCLUDE_DIR t4k-common.h
+ $ENV{T4KCOMMONDIR}/include
+ ~/Library/Frameworks/t4k-common.framework/Headers
+ /Library/Frameworks/t4k-common.framework/Headers
+ /usr/local/include/t4kcommon
+ /usr/include/t4kcommon
+ /usr/local/include
+ /usr/include
+ /sw/include/t4kcommon # Fink
+ /sw/include
+ /opt/local/include/t4kcommon # DarwinPorts
+ /opt/local/include
+ /opt/csw/include/t4kcommon # Blastwave
+ /opt/csw/include
+ /opt/include/t4kcommon
+ /opt/include
+ )
+# I'm not sure if I should do a special casing for Apple. It is
+# unlikely that other Unix systems will find the framework path.
+# But if they do ([Next|Open|GNU]Step?),
+# do they want the -framework option also?
+IF(${T4KCOMMON_INCLUDE_DIR} MATCHES ".framework")
+ # Extract the path the framework resides in so we can use it for the -F flag
+ STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" T4KCOMMON_FRAMEWORK_PATH_TEMP ${T4KCOMMON_INCLUDE_DIR})
+ IF("${T4KCOMMON_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
+ OR "${T4KCOMMON_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
+ )
+ # String is in default search path, don't need to use -F
+ SET(T4KCOMMON_LIBRARY "-framework t4k-common" CACHE STRING "t4k-common framework for OSX")
+ ELSE("${T4KCOMMON_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
+ OR "${T4KCOMMON_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
+ )
+ # String is not /Library/Frameworks, need to use -F
+ SET(T4KCOMMON_LIBRARY "-F${T4KCOMMON_FRAMEWORK_PATH_TEMP} -framework t4k-common" CACHE STRING "t4k-common framework for OSX")
+ ENDIF("${T4KCOMMON_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
+ OR "${T4KCOMMON_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
+ )
+ # Clear the temp variable so nobody can see it
+ SET(T4KCOMMON_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "")
+
+ELSE(${T4KCOMMON_INCLUDE_DIR} MATCHES ".framework")
+ FIND_LIBRARY(T4KCOMMON_LIBRARY
+ NAMES t4kcommon
+ PATHS
+ $ENV{T4KCOMMONDIR}/lib
+ /usr/local/lib
+ /usr/local/lib/t4kcommon
+ /usr/lib
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ENDIF(${T4KCOMMON_INCLUDE_DIR} MATCHES ".framework")
+
+message("Found ${T4KCOMMON_LIBRARY}")
+SET(T4KCOMMON_FOUND "NO")
+IF(T4KCOMMON_LIBRARY)
+ SET(T4KCOMMON_FOUND "YES")
+ELSE(T4KCOMMON_LIBRARY)
+ MESSAGE("Could not find t4kcommon library")
+ENDIF(T4KCOMMON_LIBRARY)
+
Modified: tuxmath/trunk/config.h.cmake
===================================================================
--- tuxmath/trunk/config.h.cmake 2010-01-08 19:04:32 UTC (rev 1719)
+++ tuxmath/trunk/config.h.cmake 2010-01-08 20:24:21 UTC (rev 1720)
@@ -5,6 +5,7 @@
#cmakedefine ENABLE_NLS 1
#cmakedefine SDL_Pango 1
#cmakedefine HAVE_RSVG 1
+#cmakedefine HAVE_T4KCOMMON 1
/* Stuff needed for linewrap */
#cmakedefine LINEBREAK 1
Modified: tuxmath/trunk/src/CMakeLists.txt
===================================================================
--- tuxmath/trunk/src/CMakeLists.txt 2010-01-08 19:04:32 UTC (rev 1719)
+++ tuxmath/trunk/src/CMakeLists.txt 2010-01-08 20:24:21 UTC (rev 1720)
@@ -6,9 +6,21 @@
find_package(SDL_image REQUIRED)
find_package(SDL_ttf REQUIRED)
find_package(SDL_mixer REQUIRED)
+find_package(t4kcommon)
find_package(SDL_gfx)
find_package(SDL_net)
+if (T4KCOMMON_FOUND)
+ set(HAVE_T4KCOMMON 1)
+ # link t4kcommon
+ target_link_libraries(tuxmath ${T4KCOMMON_LIBRARY} )
+ include_directories(${T4KCOMMON_INCLUDE_DIR} )
+
+else(T4KCOMMON_FOUND)
+ message("No t4kcommon found")
+endif(T4KCOMMON_FOUND)
+
+
if (NOT SDLGFX_FOUND)
message("Adding rotozoom")
set(TUXMATH_EXTRA_SRC ${TUXMATH_EXTRA_SRC} SDL_rotozoom.c)
@@ -143,6 +155,7 @@
)
endif (SDLGFX_FOUND)
+
if (APPLE)
# The following seems to be needed to compile under 10.5
set_target_properties(tuxmath tuxmathadmin
Modified: tuxmath/trunk/src/SDL_extras.c
===================================================================
--- tuxmath/trunk/src/SDL_extras.c 2010-01-08 19:04:32 UTC (rev 1719)
+++ tuxmath/trunk/src/SDL_extras.c 2010-01-08 20:24:21 UTC (rev 1720)
@@ -11,6 +11,10 @@
*/
#include <math.h>
+#ifdef HAVE_T4KCOMMON
+# include "t4kcommon.h"
+#endif
+
#include "SDL_extras.h"
#include "tuxmath.h"
#include "loaders.h"
Modified: tuxmath/trunk/src/globals.h
===================================================================
--- tuxmath/trunk/src/globals.h 2010-01-08 19:04:32 UTC (rev 1719)
+++ tuxmath/trunk/src/globals.h 2010-01-08 20:24:21 UTC (rev 1720)
@@ -37,7 +37,13 @@
#include <wchar.h>
+#ifdef HAVE_T4KCOMMON
+# include "t4kcommon.h"
+#endif
+
+#ifndef TUX4KIDS_COMMON_H
typedef enum { false, true } bool;
+#endif
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define max(a,b) (((a) > (b)) ? (a) : (b))
Modified: tuxmath/trunk/src/menu.h
===================================================================
--- tuxmath/trunk/src/menu.h 2010-01-08 19:04:32 UTC (rev 1719)
+++ tuxmath/trunk/src/menu.h 2010-01-08 20:24:21 UTC (rev 1720)
@@ -24,11 +24,16 @@
/* number of "real" frames per one sprite frame */
#define SPRITE_FRAME_DELAY 6
-/* these are all menu choices that are available in tuxmath.
- By using a define we can create both an enum and
- a string array without writing these names twice */
-#define QUIT -2
-#define STOP -1
+#ifdef HAVE_T4KCOMMON
+# include <t4kcommon.h>
+#else
+ /* these are all menu choices that are available in tuxmath.
+ By using a define we can create both an enum and
+ a string array without writing these names twice */
+# define RUN_MAIN_MENU -3
+# define QUIT -2
+# define STOP -1
+#endif
#define ACTIVITIES \
X( RUN_QUIT ),\
@@ -36,7 +41,7 @@
X( RUN_CAMPAIGN ),\
X( RUN_ARCADE ),\
X( RUN_CUSTOM ),\
- X( RUN_MAIN_MENU ),\
+/* X( RUN_MAIN_MENU ), */ \
X( RUN_LAN_HOST ),\
X( RUN_LAN_JOIN ),\
X( RUN_SCORE_SWEEP ),\
Modified: tuxmath/trunk/src/titlescreen.h
===================================================================
--- tuxmath/trunk/src/titlescreen.h 2010-01-08 19:04:32 UTC (rev 1719)
+++ tuxmath/trunk/src/titlescreen.h 2010-01-08 20:24:21 UTC (rev 1720)
@@ -45,6 +45,9 @@
#ifndef MACOSX
//#include "config.h"
#endif
+#ifdef HAVE_T4KCOMMON
+# include <t4kcommon.h>
+#endif
#include "tuxmath.h"
#include "loaders.h"
@@ -71,6 +74,7 @@
#define MUSIC_FADE_OUT_MS 80
+#ifndef TUX4KIDS_COMMON_H
enum {
WIPE_BLINDS_VERT,
WIPE_BLINDS_HORIZ,
@@ -79,6 +83,8 @@
NUM_WIPES
};
+#endif
+
// End of code from tuxtype's globals.h
/* --- timings for tux blinking --- */
Modified: tuxmath/trunk/src/tuxmath.h
===================================================================
--- tuxmath/trunk/src/tuxmath.h 2010-01-08 19:04:32 UTC (rev 1719)
+++ tuxmath/trunk/src/tuxmath.h 2010-01-08 20:24:21 UTC (rev 1720)
@@ -32,6 +32,7 @@
#endif
+#ifndef TUX4KIDS_COMMON_H
#define MAX_SPRITE_FRAMES 30
typedef struct {
@@ -40,6 +41,7 @@
int num_frames;
int cur;
} sprite;
+#endif
/* Global data gets 'externed' here: */
More information about the Tux4kids-commits
mailing list