Improve detection of for shared libs in both sdl and Qt (zlib, libzip, snappy and glew).

This commit is contained in:
sergiobenrocha2 2015-09-16 00:59:31 -03:00
parent 69fa5b179d
commit 5ec87f3459
9 changed files with 70 additions and 16 deletions

View File

@ -403,8 +403,10 @@ else()
endif()
find_package(Snappy)
if(NOT SNAPPY_FOUND)
add_subdirectory(ext/snappy)
if(SNAPPY_FOUND)
add_definitions(-DSHARED_SNAPPY)
else()
add_subdirectory(ext/snappy)
endif()
add_subdirectory(ext/udis86)
@ -583,6 +585,7 @@ endif()
find_package(ZLIB)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
add_definitions(-DSHARED_ZLIB)
else()
add_library(zlib STATIC
ext/zlib/adler32.c
@ -638,7 +641,9 @@ endif()
find_package(LibZip)
if(NOT LIBZIP_FOUND)
if(LIBZIP_FOUND)
add_definitions(-DSHARED_LIBZIP)
else()
add_library(libzip STATIC
ext/native/ext/libzip/zip.h
ext/native/ext/libzip/mkstemp.c

View File

@ -40,7 +40,11 @@
#include "Common.h"
#include "FileUtil.h"
#ifdef SHARED_SNAPPY
#include <snappy-c.h>
#else
#include "../ext/snappy/snappy-c.h"
#endif
#if defined(MACGNUSTD)
namespace std {

View File

@ -15,7 +15,11 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#ifdef SHARED_ZLIB
#include <zlib.h>
#else
#include "../ext/zlib/zlib.h"
#endif
#include "sceAdler.h"
#include "Common/Log.h"

View File

@ -20,7 +20,11 @@
#include <cstring>
#include "file/file_util.h"
#ifdef SHARED_LIBZIP
#include <zip.h>
#else
#include "ext/libzip/zip.h"
#endif
#include "thread/thread.h"
#include "util/text/utf8.h"

View File

@ -6,7 +6,9 @@ CONFIG += staticlib
include(Settings.pri)
INCLUDEPATH += $$P/ $$P/ext/native $$P/Core/MIPS $$P/ext/xbrz
!contains(DEFINES, USING_GLES2): INCLUDEPATH += $$P/ext/native/ext/glew
!exists( /usr/include/GL/glew.h ) {
!contains(DEFINES, USING_GLES2): INCLUDEPATH += $$P/ext/native/ext/glew
}
arm {
SOURCES += $$P/Core/MIPS/ARM/*.cpp #CoreARM

View File

@ -7,7 +7,9 @@ CONFIG += staticlib
include(Settings.pri)
INCLUDEPATH += $$P/ $$P/ext/native
!contains(DEFINES, USING_GLES2): INCLUDEPATH += $$P/ext/native/ext/glew
!exists( /usr/include/GL/glew.h ) {
!contains(DEFINES, USING_GLES2): INCLUDEPATH += $$P/ext/native/ext/glew
}
win32 {
SOURCES += $$P/Windows/OpenGLBase.cpp

View File

@ -11,10 +11,12 @@ linux-g++:system($$QMAKE_CXX --version | grep "4.6."): DEFINES+=override
INCLUDEPATH += $$P/ext/native
!contains(DEFINES,USING_GLES2) {
SOURCES += $$P/ext/native/ext/glew/glew.c
HEADERS += $$P/ext/native/ext/glew/GL/*.h
INCLUDEPATH += $$P/ext/native/ext/glew
!exists( /usr/include/GL/glew.h ) {
!contains(DEFINES,USING_GLES2) {
SOURCES += $$P/ext/native/ext/glew/glew.c
HEADERS += $$P/ext/native/ext/glew/GL/*.h
INCLUDEPATH += $$P/ext/native/ext/glew
}
}
# RG_ETC1
@ -41,10 +43,11 @@ HEADERS += $$P/ext/native/ext/stb_vorbis/stb_vorbis.h
INCLUDEPATH += $$P/ext/native/ext/stb_vorbis
# Snappy
SOURCES += $$P/ext/snappy/*.cpp
HEADERS += $$P/ext/snappy/*.h
INCLUDEPATH += $$P/ext/snappy
!exists( /usr/include/snappy-c.h ) {
SOURCES += $$P/ext/snappy/*.cpp
HEADERS += $$P/ext/snappy/*.h
INCLUDEPATH += $$P/ext/snappy
}
# udis86
@ -67,8 +70,10 @@ win32|contains(QT_CONFIG, no-zlib) {
}
# Libzip
SOURCES += $$P/ext/native/ext/libzip/*.c
HEADERS += $$P/ext/native/ext/libzip/*.h
!exists( /usr/include/zip.h ) {
SOURCES += $$P/ext/native/ext/libzip/*.c
HEADERS += $$P/ext/native/ext/libzip/*.h
}
# Native

View File

@ -49,6 +49,18 @@ macx|equals(PLATFORM_NAME, "linux") {
}
}
exists( /usr/include/GL/glew.h ) {
LIBS += -lGLEW
}
exists( /usr/include/snappy-c.h ) {
LIBS += -lsnappy
}
exists( /usr/include/zip.h ) {
LIBS += -lzip
}
unix:contains(QT_CONFIG, system-zlib) {
LIBS += -lz
}
@ -77,7 +89,11 @@ SOURCES += $$P/UI/*.cpp \
arm:android: SOURCES += $$P/android/jni/ArmEmitterTest.cpp
HEADERS += $$P/UI/*.h
INCLUDEPATH += $$P $$P/Common $$P/ext/native $$P/ext/native/ext $$P/ext/native/ext/glew
exists( /usr/include/GL/glew.h ) {
INCLUDEPATH += $$P $$P/Common $$P/ext/native $$P/ext/native/ext
} else {
INCLUDEPATH += $$P $$P/Common $$P/ext/native $$P/ext/native/ext $$P/ext/native/ext/glew
}
mobile_platform {
!no_assets: RESOURCES += $$P/Qt/assets.qrc

View File

@ -1,6 +1,18 @@
VERSION = 1.0.1.0
DEFINES += USING_QT_UI USE_FFMPEG
exists( /usr/include/snappy-c.h ) {
DEFINES += SHARED_SNAPPY
}
unix:contains(QT_CONFIG, system-zlib) {
DEFINES += SHARED_ZLIB
}
exists( /usr/include/zip.h ) {
DEFINES += SHARED_LIBZIP
}
# Global specific
win32:CONFIG(release, debug|release): CONFIG_DIR = $$join(OUT_PWD,,,/release)
else:win32:CONFIG(debug, debug|release): CONFIG_DIR = $$join(OUT_PWD,,,/debug)