From b2517ec38b9edaebb91ceb8092a1304727a477a3 Mon Sep 17 00:00:00 2001 From: fg Date: Tue, 10 Jan 2012 18:09:44 +0000 Subject: [PATCH] missed this one --- CMakeLists.txt | 113 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 82 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f3fcee..1675045 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,9 +31,35 @@ SET(LUADIR ${EXTLIBDIR}/lua-5.1.4) SET(LUASRCDIR ${LUADIR}/src) SET(LIBOGGDIR ${EXTLIBDIR}/libogg-1.2.0) SET(LIBVORBISDIR ${EXTLIBDIR}/libvorbis-1.3.1) +SET(ZLIBDIR ${EXTLIBDIR}/glpng/zlib) +SET(PNGDIR ${EXTLIBDIR}/glpng/png) ################ Look for external libraries +### zlib + +OPTION(AQUARIA_INTERNAL_ZLIB "Always use included zlib library" FALSE) +if(NOT AQUARIA_INTERNAL_ZLIB) + find_package(ZLIB) +endif(NOT AQUARIA_INTERNAL_ZLIB) +if(NOT ZLIB_FOUND) + set(ZLIB_INCLUDE_DIRS ${ZLIBDIR}) +endif(NOT ZLIB_FOUND) + +### PNG + +OPTION(AQUARIA_INTERNAL_PNG "Always use included PNG library" FALSE) +if(NOT AQUARIA_INTERNAL_PNG) + find_package(PNG) +endif(NOT AQUARIA_INTERNAL_PNG) +if(NOT PNG_FOUND) + set(PNG_PNG_INCLUDE_DIR ${PNGDIR}) + set(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS}) +endif(NOT PNG_FOUND) + +FILE(STRINGS "${PNG_PNG_INCLUDE_DIR}/png.h" PNG_H REGEX "^#define PNG_LIBPNG_VER[^0-9]*[0-9]+") +STRING(REGEX REPLACE "^.*PNG_LIBPNG_VER[^0-9]*([0-9]+).*$" "\\1" PNG_LIBPNG_VER "${PNG_H}") + ### FreeType OPTION(AQUARIA_INTERNAL_FREETYPE "Always use included FreeType library" FALSE) @@ -122,7 +148,7 @@ OPTION(AQUARIA_INTERNAL_SDL "Always use included SDL library" FALSE) if(NOT AQUARIA_INTERNAL_SDL) find_package(SDL) endif(NOT AQUARIA_INTERNAL_SDL) -if (NOT SDL_FOUND OR NOT SDLMAIN_FOUND) +if(NOT SDL_FOUND OR ((MACOSX OR WIN32) AND (NOT SDLMAIN_FOUND))) if(MACOSX) set(SDLDIR "${EXTLIBDIR}/SDL12") set(SDL_INCLUDE_DIR "${SDLDIR}/include") @@ -138,7 +164,7 @@ if (NOT SDL_FOUND OR NOT SDLMAIN_FOUND) else(MACOSX) message(SEND_ERROR "We don't have a prebuilt SDL for this platform.") endif(MACOSX) -endif (NOT SDL_FOUND OR NOT SDLMAIN_FOUND) +endif(NOT SDL_FOUND OR ((MACOSX OR WIN32) AND (NOT SDLMAIN_FOUND))) ### OpenAL @@ -159,10 +185,10 @@ endif (NOT OPENAL_FOUND) ################ End of external libraries -INCLUDE_DIRECTORIES(${EXTLIBDIR}) -INCLUDE_DIRECTORIES(${EXTLIBDIR}/GL) -INCLUDE_DIRECTORIES(${EXTLIBDIR}/glpng/zlib) INCLUDE_DIRECTORIES(${BBGEDIR}) +INCLUDE_DIRECTORIES(${BBGEDIR}/GL) +INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${SRCDIR}) INCLUDE_DIRECTORIES(${FTGLDIR}/include) INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS}) @@ -214,6 +240,7 @@ IF(WIN32) IF(AQUARIA_NO_CONSOLE) SET(EXETYPE WIN32) ENDIF(AQUARIA_NO_CONSOLE) + SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} aquaria.rc) ENDIF(WIN32) @@ -375,33 +402,46 @@ SET(BBGE_SRCS ${BBGEDIR}/TTFFont.cpp ${BBGEDIR}/Vector.cpp ${BBGEDIR}/FmodOpenALBridge.cpp - ${BBGEDIR}/tinyxml.cpp - ${BBGEDIR}/tinyxmlerror.cpp - ${BBGEDIR}/tinyxmlparser.cpp - ${BBGEDIR}/glfont2.cpp ${COCOA_SRCS} + ${EXTLIBDIR}/glfont2/glfont2.cpp ${EXTLIBDIR}/glpng/glpng.c - ${EXTLIBDIR}/glpng/png/png.c - ${EXTLIBDIR}/glpng/png/pngerror.c - ${EXTLIBDIR}/glpng/png/pngget.c - ${EXTLIBDIR}/glpng/png/pngmem.c - ${EXTLIBDIR}/glpng/png/pngpread.c - ${EXTLIBDIR}/glpng/png/pngread.c - ${EXTLIBDIR}/glpng/png/pngrio.c - ${EXTLIBDIR}/glpng/png/pngrtran.c - ${EXTLIBDIR}/glpng/png/pngrutil.c - ${EXTLIBDIR}/glpng/png/pngset.c - ${EXTLIBDIR}/glpng/png/pngtrans.c - ${EXTLIBDIR}/glpng/zlib/adler32.c - ${EXTLIBDIR}/glpng/zlib/crc32.c - ${EXTLIBDIR}/glpng/zlib/compress.c - ${EXTLIBDIR}/glpng/zlib/deflate.c - ${EXTLIBDIR}/glpng/zlib/inffast.c - ${EXTLIBDIR}/glpng/zlib/inflate.c - ${EXTLIBDIR}/glpng/zlib/inftrees.c - ${EXTLIBDIR}/glpng/zlib/trees.c - ${EXTLIBDIR}/glpng/zlib/uncompr.c - ${EXTLIBDIR}/glpng/zlib/zutil.c + ${EXTLIBDIR}/tinyxml.cpp + ${EXTLIBDIR}/tinyxmlerror.cpp + ${EXTLIBDIR}/tinyxmlparser.cpp +) + +if(NOT "${PNG_LIBPNG_VER}" LESS 10400) + SET_SOURCE_FILES_PROPERTIES( + ${EXTLIBDIR}/glpng/glpng.c + PROPERTIES COMPILE_FLAGS "-DLIBPNG_NEW_API" + ) +endif(NOT "${PNG_LIBPNG_VER}" LESS 10400) + +SET(ZLIB_SRCS + ${ZLIBDIR}/adler32.c + ${ZLIBDIR}/crc32.c + ${ZLIBDIR}/compress.c + ${ZLIBDIR}/deflate.c + ${ZLIBDIR}/inffast.c + ${ZLIBDIR}/inflate.c + ${ZLIBDIR}/inftrees.c + ${ZLIBDIR}/trees.c + ${ZLIBDIR}/uncompr.c + ${ZLIBDIR}/zutil.c +) + +SET(PNG_SRCS + ${PNGDIR}/png.c + ${PNGDIR}/pngerror.c + ${PNGDIR}/pngget.c + ${PNGDIR}/pngmem.c + ${PNGDIR}/pngpread.c + ${PNGDIR}/pngread.c + ${PNGDIR}/pngrio.c + ${PNGDIR}/pngrtran.c + ${PNGDIR}/pngrutil.c + ${PNGDIR}/pngset.c + ${PNGDIR}/pngtrans.c ) # Apparently not used at the moment. Listed here just for completeness. @@ -562,13 +602,24 @@ SET(LUA_SRCS IF(MACOSX) SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} "-framework Carbon") SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} "-framework Cocoa") - SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} "-framework OpenGL") SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} "-framework OpenAL") ENDIF(MACOSX) SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${SDL_LIBRARY}) SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${OPENAL_LIBRARY}) +IF(ZLIB_FOUND) + SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${ZLIB_LIBRARIES}) +ELSE(ZLIB_FOUND) + SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${ZLIB_SRCS}) +ENDIF(ZLIB_FOUND) + +IF(PNG_FOUND) + SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${PNG_LIBRARIES}) +ELSE(PNG_FOUND) + SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} ${PNG_SRCS}) +ENDIF(PNG_FOUND) + IF(FREETYPE_FOUND) SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${FREETYPE_LIBRARIES}) ELSE(FREETYPE_FOUND)