From: Ryan C. Gordon Date: Thu, 13 May 2010 20:06:37 +0000 (-0400) Subject: Fixed dependencies, made them optional (so you can override system libs). X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=b1f01eb2b335d313af30594d671a90f7d9cfed08;p=lugaru.git Fixed dependencies, made them optional (so you can override system libs). --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 700e9f4..caf1f24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,14 +143,17 @@ endif (APPLE) find_package(OpenGL REQUIRED) # force this include dir no matter what, so we get sane headers. -set(OPENGL_INCLUDE_DIR "${DEPDIR}/OpenGL") +include_directories("${DEPDIR}/OpenGL") find_package(OpenAL REQUIRED) # !!! FIXME: package a .dll for Windows? -find_package(SDL) -if (NOT SDL) +option (LUGARU_FORCE_INTERNAL_SDL "Force internal libSDL, even if there's a system version" False) +if (NOT LUGARU_FORCE_INTERNAL_SDL) + find_package(SDL) +endif (NOT LUGARU_FORCE_INTERNAL_SDL) +if (NOT SDL_FOUND) + message(STATUS "Using internal copy of SDL") set(LUGARU_MISSING_DEPS "${LUGARU_MISSING_DEPS} SDL") - message(STATUS "SDL not found, using internal copy") set(SDLDIR "${DEPDIR}/SDL12") set(SDL_INCLUDE_DIR "${SDLDIR}/include") set(SDL_LIBRARY "") @@ -173,12 +176,15 @@ if (NOT SDL) if (NOT LUGARU_HAS_INTERNAL_SDL) message(ERROR "We don't have a prebuilt SDL for this platform.") endif (NOT LUGARU_HAS_INTERNAL_SDL) -endif (NOT SDL) - -find_package(PNG) -if (NOT PNG) +endif (NOT SDL_FOUND) + +option (LUGARU_FORCE_INTERNAL_PNG "Force internal libPNG, even if there's a system version" False) +if (NOT LUGARU_FORCE_INTERNAL_PNG) + find_package(PNG) +endif (NOT LUGARU_FORCE_INTERNAL_PNG) +if (NOT PNG_FOUND) + message(STATUS "Using internal copy of libpng") set(LUGARU_MISSING_DEPS "${LUGARU_MISSING_DEPS} PNG") - message(STATUS "libpng not found, using internal copy") set(PNGDIR "${DEPDIR}/libpng") set(PNG_INCLUDE_DIR "${PNGDIR}") set(PNG_LIBRARY "") @@ -200,12 +206,15 @@ if (NOT PNG) ${PNGDIR}/pngwtran.c ${PNGDIR}/pngwutil.c ) -endif (NOT PNG) - -find_package(JPEG) -if (NOT JPEG) +endif (NOT PNG_FOUND) + +option (LUGARU_FORCE_INTERNAL_JPEG "Force internal libJPEG, even if there's a system version" False) +if (NOT LUGARU_FORCE_INTERNAL_JPEG) + find_package(JPEG) +endif (NOT LUGARU_FORCE_INTERNAL_JPEG) +if (NOT JPEG_FOUND) + message(STATUS "Using internal copy of libjpeg") set(LUGARU_MISSING_DEPS "${LUGARU_MISSING_DEPS} JPEG") - message(STATUS "libjpeg not found, using internal copy") set(JPEGDIR "${DEPDIR}/libjpeg") set(JPEG_INCLUDE_DIR "${JPEGDIR}") set(JPEG_LIBRARY "") @@ -257,12 +266,15 @@ if (NOT JPEG) ${JPEGDIR}/jdarith.c ${JPEGDIR}/jaricom.c ) -endif (NOT JPEG) - -find_package(ZLIB) -if (NOT ZLIB) +endif (NOT JPEG_FOUND) + +option (LUGARU_FORCE_INTERNAL_ZLIB "Force internal zlib, even if there's a system version" False) +if (NOT LUGARU_FORCE_INTERNAL_ZLIB) + find_package(ZLIB) +endif (NOT LUGARU_FORCE_INTERNAL_ZLIB) +if (NOT ZLIB_FOUND) + message(STATUS "Using internal copy of zlib") set(LUGARU_MISSING_DEPS "${LUGARU_MISSING_DEPS} ZLIB") - message(STATUS "zlib not found, using internal copy") set(ZLIBDIR "${DEPDIR}/zlib") set(ZLIB_INCLUDE_DIR "${ZLIBDIR}") set(ZLIB_LIBRARIES "") @@ -280,12 +292,15 @@ if (NOT ZLIB) ${ZLIBDIR}/uncompr.c ${ZLIBDIR}/zutil.c ) -endif (NOT ZLIB) - -find_package(GLU) -if (NOT GLU) +endif (NOT ZLIB_FOUND) + +option (LUGARU_FORCE_INTERNAL_GLU "Force internal libGLU, even if there's a system version" False) +if (NOT LUGARU_FORCE_INTERNAL_GLU) + find_package(GLU) +endif (NOT LUGARU_FORCE_INTERNAL_GLU) +if (NOT GLU_FOUND) + message(STATUS "Using internal copy of libGLU") set(LUGARU_MISSING_DEPS "${LUGARU_MISSING_DEPS} GLU") - message(STATUS "GLU not found, using internal copy") set(GLUDIR "${DEPDIR}/GLU") set(GLU_INCLUDE_DIR "${GLUDIR}") set(GLU_LIBRARY "") @@ -304,12 +319,15 @@ if (NOT GLU) ${GLUDIR}/tessmono.c ${GLUDIR}/util.c ) -endif (NOT GLU) - -find_package(OggVorbis) -if (NOT OggVorbis) +endif (NOT GLU_FOUND) + +option (LUGARU_FORCE_INTERNAL_VORBIS "Force internal Vorbis, even if there's a system version" False) +if (NOT LUGARU_FORCE_INTERNAL_VORBIS) + find_package(OggVorbis) +endif (NOT LUGARU_FORCE_INTERNAL_VORBIS) +if (NOT OggVorbis_FOUND) + message(STATUS "Using internal copy of Ogg Vorbis") set(LUGARU_MISSING_DEPS "${LUGARU_MISSING_DEPS} OggVorbis") - message(STATUS "Ogg Vorbis not found, using internal copy") set(OGGDIR "${DEPDIR}/libogg") set(OGG_INCLUDE_DIR "${OGGDIR}/include") set(OGG_LIBRARY "") @@ -341,7 +359,7 @@ if (NOT OggVorbis) ${VORBISDIR}/lib/vorbisfile.c ${VORBISDIR}/lib/window.c ) -endif (NOT OggVorbis) +endif (NOT OggVorbis_FOUND) include_directories( ${OPENAL_INCLUDE_DIR} diff --git a/Source/TGALoader.h b/Source/TGALoader.h index 82501be..b27cb18 100644 --- a/Source/TGALoader.h +++ b/Source/TGALoader.h @@ -36,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define Polygon WinPolygon #include #undef Polygon -#include +#include "GL/gl.h" #else #include "gamegl.h" // #include "MoreFilesX.h" diff --git a/Source/gamegl.h b/Source/gamegl.h index 20d94ce..e682361 100644 --- a/Source/gamegl.h +++ b/Source/gamegl.h @@ -30,32 +30,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#ifndef WIN32 - #if PLATFORM_UNIX - #define GL_GLEXT_PROTOTYPES - #include "GL/gl.h" - #include "GL/glu.h" - #include "GL/glext.h" - #else - #include - #include - #include - #endif -#else +#ifdef WIN32 #define WIN32_LEAN_AND_MEAN #define Polygon WinPolygon #include #undef Polygon - #define GL_GLEXT_PROTOTYPES - #include - #include - //#include -- EVIL and OLD, NEVER USE IT! - #include - #include "MacCompatibility.h" - //#include "il/ilut.h" - #endif +#define GL_GLEXT_PROTOTYPES 1 +#include "GL/gl.h" +#include "GL/glu.h" +#include "GL/glext.h" +#include "MacCompatibility.h" + #if !PLATFORM_MACOSX struct RGBColor {