diff -r 0b8beb014a87 CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Wed May 12 23:41:52 2010 +0400 @@ -0,0 +1,70 @@ +PROJECT(lugaru) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) + +SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +# depends +FIND_PACKAGE(SDL REQUIRED) +FIND_PACKAGE(PNG REQUIRED) +FIND_PACKAGE(JPEG REQUIRED) +FIND_PACKAGE(OpenAL REQUIRED) +FIND_PACKAGE(OpenGL REQUIRED) +FIND_PACKAGE(Vorbis REQUIRED) + +# sources +SET(lugaru_SRCS + Source/Frustum.cpp + Source/GameDraw.cpp + Source/GameInitDispose.cpp + Source/GameTick.cpp + Source/Globals.cpp + Source/Lights.cpp + Source/Models.cpp + Source/Objects.cpp + Source/pack.c + Source/pack_private.c + Source/Person.cpp + Source/private.c + Source/Quaternions.cpp + Source/Random.c + Source/Skeleton.cpp + Source/Skybox.cpp + Source/Sprites.cpp + Source/Terrain.cpp + Source/Text.cpp + Source/TGALoader.cpp + Source/unpack.c + Source/unpack_private.c + Source/Weapons.cpp + Source/MacCompatibility.cpp + Source/logger/logger.cpp + Source/WinInput.cpp + Source/OpenGL_Windows.cpp + Source/openal_wrapper.cpp +) + +# platform definitions +IF(MACOSX) + ADD_DEFINITIONS(-DPLATFORM_MACOSX=1) +ENDIF(MACOSX) + +IF(WINDOWS) + ADD_DEFINITIONS(-DPLATFORM_WINDOWS=1) +ENDIF(WINDOWS) + +IF(UNIX) + ADD_DEFINITIONS(-DPLATFORM_UNIX=1) +ENDIF(UNIX) + +# common definitions +ADD_DEFINITIONS(-DUSE_SDL -DTRUE=1 -DFALSE=0 -DBinIO_STDINT_HEADER= -Dstricmp=strcasecmp -DUSE_OPENAL) + +# includes +INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${JPEG_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR}) + +# game executable +ADD_EXECUTABLE(lugaru ${lugaru_SRCS}) + +# libraries +TARGET_LINK_LIBRARIES(lugaru ${SDL_LIBRARY} ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${VORBIS_LIBRARY_VORBISFILE}) diff -r 0b8beb014a87 Source/GameInitDispose.cpp --- a/Source/GameInitDispose.cpp Tue May 11 12:25:50 2010 -0400 +++ b/Source/GameInitDispose.cpp Wed May 12 23:41:52 2010 +0400 @@ -1031,7 +1031,7 @@ char tempstring[256]; #if defined(__APPLE__) sprintf (tempstring, "%s", registrationname); - #elif defined(_MSC_VER) || defined(__linux__) + #elif defined(_MSC_VER) || defined(__linux__) || defined(__FreeBSD__) sprintf (tempstring, "%s-windows", registrationname); #else #error Please make sure you have the right registration key stuff here! diff -r 0b8beb014a87 Source/GameTick.cpp --- a/Source/GameTick.cpp Tue May 11 12:25:50 2010 -0400 +++ b/Source/GameTick.cpp Wed May 12 23:41:52 2010 +0400 @@ -3250,7 +3250,7 @@ char tempstring[256]; #if defined(__APPLE__) sprintf (tempstring, "%s", registrationname); - #elif defined(_MSC_VER) || defined(__linux__) + #elif defined(_MSC_VER) || defined(__linux__) || defined(__FreeBSD__) sprintf (tempstring, "%s-windows", registrationname); #else #error Please make sure you have the right registration key stuff here! diff -r 0b8beb014a87 Source/OpenGL_Windows.cpp --- a/Source/OpenGL_Windows.cpp Tue May 11 12:25:50 2010 -0400 +++ b/Source/OpenGL_Windows.cpp Wed May 12 23:41:52 2010 +0400 @@ -24,8 +24,6 @@ #include #endif -#include "Game.h" - #ifndef USE_DEVIL # ifdef WIN32 # define USE_DEVIL @@ -33,6 +31,8 @@ #endif #if USE_DEVIL + #include "Game.h" + #include "IL/il.h" #include "IL/ilu.h" #include "IL/ilut.h" @@ -43,6 +43,9 @@ #include "png.h" #include "jpeglib.h" } + // should come after png.h, as `head' define from Constants.h clash with + // one from zlib.h, but must come before prototypes below for TGAImageRec + #include "Game.h" static bool load_image(const char * fname, TGAImageRec & tex); static bool load_png(const char * fname, TGAImageRec & tex); static bool load_jpg(const char * fname, TGAImageRec & tex); @@ -2681,7 +2684,7 @@ png_init_io(png_ptr, fp); png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_PACKING, - png_voidp_NULL); + NULL); png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL); @@ -2731,7 +2734,7 @@ retval = true; png_done: - png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); if (fp) fclose(fp); return (retval); diff -r 0b8beb014a87 Source/gamegl.h --- a/Source/gamegl.h Tue May 11 12:25:50 2010 -0400 +++ b/Source/gamegl.h Wed May 12 23:41:52 2010 +0400 @@ -31,16 +31,10 @@ #include #ifndef WIN32 - #if PLATFORM_UNIX - #define GL_GLEXT_PROTOTYPES - #include "gl.h" - #include "glu.h" - #include "glext.h" - #else - #include - #include - #include - #endif + #define GL_GLEXT_PROTOTYPES + #include + #include + #include #else #define WIN32_LEAN_AND_MEAN #define Polygon WinPolygon diff -r 0b8beb014a87 cmake/FindVorbis.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/FindVorbis.cmake Wed May 12 23:41:52 2010 +0400 @@ -0,0 +1,75 @@ +## This is based on Findvorbis.cmake from glmixer project: +## +## http://code.google.com/p/glmixer/ +# +# Locate libvorbis libraries +# This module defines +# VORBIS_LIBRARIES, the name of the libraries to link against +# VORBIS_FOUND, if false, do not try to link +# VORBIS_INCLUDE_DIR, where to find header +# + +set( VORBIS_FOUND "NO" ) + +find_path( VORBIS_INCLUDE_DIR vorbis/codec.h + HINTS + PATH_SUFFIXES include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include + /usr/include + /sw/include + /opt/local/include + /opt/csw/include + /opt/include + /mingw +) + +find_library( VORBIS_LIBRARY_VORBIS + NAMES vorbis + HINTS + PATH_SUFFIXES lib64 lib + PATHS + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + /mingw +) + +find_library( VORBIS_LIBRARY_VORBISENC + NAMES vorbisenc + HINTS + PATH_SUFFIXES lib64 lib + PATHS + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + /mingw +) + +find_library( VORBIS_LIBRARY_VORBISFILE + NAMES vorbisfile + HINTS + PATH_SUFFIXES lib64 lib + PATHS + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + /mingw +) + +set( VORBIS_LIBRARIES ${VORBIS_LIBRARY_VORBIS} ${VORBIS_LIBRARY_VORBISENC} ) + +if(VORBIS_LIBRARY_VORBIS) +set( VORBIS_FOUND "YES" ) +endif(VORBIS_LIBRARY_VORBIS) diff -r 0b8beb014a87 makefile --- a/makefile Tue May 11 12:25:50 2010 -0400 +++ b/makefile Wed May 12 23:41:52 2010 +0400 @@ -8,7 +8,7 @@ endif #OPT += -O0 -OPT += -O3 -fno-strict-aliasing -falign-loops=16 -fno-math-errno +OPT ?= -O3 -fno-strict-aliasing -falign-loops=16 -fno-math-errno #OPT += -Os -fno-strict-aliasing BINDIR := bin @@ -101,21 +101,23 @@ LDFLAGS += -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework Carbon -framework OpenAL LDFLAGS += ./libSDL-1.2.0.dylib ./libSDLmain-osx.a else - CXX := /opt/crosstool/gcc-4.1.2-glibc-2.3.6/i686-unknown-linux-gnu/i686-unknown-linux-gnu/bin/g++ - CC := /opt/crosstool/gcc-4.1.2-glibc-2.3.6/i686-unknown-linux-gnu/i686-unknown-linux-gnu/bin/gcc - LD := /opt/crosstool/gcc-4.1.2-glibc-2.3.6/i686-unknown-linux-gnu/i686-unknown-linux-gnu/bin/g++ + CXX ?= g++ + CC ?= gcc + LD := $(CXX) + + SDL_CONFIG ?= sdl-config CFLAGS += -DPLATFORM_LINUX=1 - LDFLAGS += ./libSDL-1.2.so.0 -Wl,-rpath,\$$ORIGIN + LDFLAGS += `$(SDL_CONFIG) --libs` ifeq ($(strip $(use_devil)),true) - LDFLAGS += ./libIL.so.1 ./libILU.so.1 ./libILUT.so.1 + LDFLAGS += -lIL -lILY -lILUT endif ifeq ($(strip $(use_fmod)),true) - POSTLDFLAGS += -lpthread ./libfmod-linux-x86.a + POSTLDFLAGS += -pthread -lfmod else - LDFLAGS += ./libopenal.so.1 + LDFLAGS += -lopenal endif endif