From 238750989651343fa64601db2d2d779df587867f Mon Sep 17 00:00:00 2001 From: Sacha Date: Tue, 10 Dec 2013 02:14:43 +1000 Subject: [PATCH] Proper fix for libpng16 includes. Improve Blackberry CMake toolchain. --- Blackberry/bb.toolchain.cmake | 8 ++++++++ CMakeLists.txt | 16 +++++++++++----- Qt/Native.pro | 2 +- Qt/PPSSPP.pro | 2 +- Qt/QtHost.cpp | 2 +- UI/NativeApp.cpp | 2 +- UI/UI.vcxproj | 8 ++++---- android/jni/Locals.mk | 2 +- native | 2 +- 9 files changed, 29 insertions(+), 15 deletions(-) diff --git a/Blackberry/bb.toolchain.cmake b/Blackberry/bb.toolchain.cmake index ef54e24def..381e3cf544 100644 --- a/Blackberry/bb.toolchain.cmake +++ b/Blackberry/bb.toolchain.cmake @@ -1,13 +1,21 @@ # Standard settings set (CMAKE_SYSTEM_NAME QNX) set (CMAKE_SYSTEM_VERSION 1) +set (CMAKE_PREFIX_PATH $ENV{QNX_TARGET}/usr) +set (CMAKE_INCLUDE_PATH $ENV{QNX_TARGET}/usr/include) if (SIMULATOR) set (CMAKE_SYSTEM_PROCESSOR x86) + set (CMAKE_LIBRARY_PATH $ENV{QNX_TARGET}/x86 $ENV{QNX_TARGET}/x86/usr) else() set (CMAKE_SYSTEM_PROCESSOR armv7) + set (CMAKE_LIBRARY_PATH $ENV{QNX_TARGET}/armle-v7 $ENV{QNX_TARGET}/armle-v7/usr) endif() set (UNIX True) +set (CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_LIBRARY_PATH} CACHE string "Blackberry find search path root") +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + include (CMakeForceCompiler) CMAKE_FORCE_C_COMPILER (nto${CMAKE_SYSTEM_PROCESSOR}-gcc nto${CMAKE_SYSTEM_PROCESSOR}-gcc) CMAKE_FORCE_CXX_COMPILER (nto${CMAKE_SYSTEM_PROCESSOR}-g++ nto${CMAKE_SYSTEM_PROCESSOR}-g++) diff --git a/CMakeLists.txt b/CMakeLists.txt index d13c271e65..b905335103 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -552,8 +552,14 @@ target_link_libraries(libzip ${ZLIB_LIBRARY}) include_directories(native/ext/libzip) set(LIBZIP_LIBRARY libzip) -if (BLACKBERRY) - set(LIBPNG_LIBRARY png) +# FindPNG does a few things we don't want. So do it ourselves. +# Fixed to libpng16, otherwise it can pick up earlier even if newer exists. +find_path(PNG_PNG_INCLUDE_DIR NAMES "libpng16/png.h") +find_library(PNG_LIBRARY NAMES png16 libpng16 ) +find_package(PackageHandleStandardArgs) +find_package_handle_standard_args(PNG REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR) +if (PNG_FOUND) + include_directories(${PNG_PNG_INCLUDE_DIR}) else() add_library(png16 STATIC native/ext/libpng16/pngconf.h @@ -579,8 +585,8 @@ else() native/ext/libpng16/pngwrite.c native/ext/libpng16/pngwtran.c native/ext/libpng16/pngwutil.c) - set(LIBPNG_LIBRARY png16) - include_directories(native/ext/libpng16) + set(PNG_LIBRARY png16) + include_directories(native/ext) endif() set(nativeExtra) @@ -809,7 +815,7 @@ add_library(native STATIC native/ext/jpge/jpge.cpp native/ext/jpge/jpge.h) include_directories(native) -target_link_libraries(native ${LIBZIP_LIBRARY} ${LIBPNG_LIBRARY} rg_etc1 vjson stb_vorbis snappy ${GLEW_LIBRARIES}) +target_link_libraries(native ${LIBZIP_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson stb_vorbis snappy ${GLEW_LIBRARIES}) if(ANDROID) target_link_libraries(native log) diff --git a/Qt/Native.pro b/Qt/Native.pro index e73be3e4c6..1d54cc26f1 100755 --- a/Qt/Native.pro +++ b/Qt/Native.pro @@ -61,7 +61,7 @@ HEADERS += $$P/native/ext/libzip/*.h # Libpng SOURCES += $$P/native/ext/libpng16/*.c HEADERS += $$P/native/ext/libpng16/*.h -INCLUDEPATH += $$P/native/ext/libpng16 +INCLUDEPATH += $$P/native/ext # Native diff --git a/Qt/PPSSPP.pro b/Qt/PPSSPP.pro index 67bb7a4b41..5e1d0c6cd3 100755 --- a/Qt/PPSSPP.pro +++ b/Qt/PPSSPP.pro @@ -88,7 +88,7 @@ SOURCES += $$P/UI/*Screen.cpp \ $$P/android/jni/TestRunner.cpp HEADERS += $$P/UI/*.h -INCLUDEPATH += $$P $$P/Common $$P/native $$P/native/ext/libpng16 +INCLUDEPATH += $$P $$P/Common $$P/native $$P/native/ext # Use forms UI for desktop platforms !mobile_platform { diff --git a/Qt/QtHost.cpp b/Qt/QtHost.cpp index d9763d97ff..74d5215490 100644 --- a/Qt/QtHost.cpp +++ b/Qt/QtHost.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "QtHost.h" #include "LogManager.h" diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index af481ceb22..53144ce01b 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -29,7 +29,7 @@ #include #ifdef _WIN32 -#include +#include #include "ext/jpge/jpge.h" #endif diff --git a/UI/UI.vcxproj b/UI/UI.vcxproj index 39eca58a02..1333c3665a 100644 --- a/UI/UI.vcxproj +++ b/UI/UI.vcxproj @@ -115,7 +115,7 @@ Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - ../common;..;../native;../native/ext/glew;../ext/zlib;../native/ext/libpng16 + ../common;..;../native;../native/ext/glew;../ext/zlib;../native/ext true false false @@ -132,7 +132,7 @@ Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - ../common;..;../native;../native/ext/glew;../ext/zlib;../native/ext/libpng16 + ../common;..;../native;../native/ext/glew;../ext/zlib;../native/ext true false false @@ -151,7 +151,7 @@ true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - ../common;..;../native;../native/ext/glew;../ext/zlib;../native/ext/libpng16 + ../common;..;../native;../native/ext/glew;../ext/zlib;../native/ext false Speed true @@ -173,7 +173,7 @@ true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - ../common;..;../native;../native/ext/glew;../ext/zlib;../native/ext/libpng16 + ../common;..;../native;../native/ext/glew;../ext/zlib;../native/ext false true false diff --git a/android/jni/Locals.mk b/android/jni/Locals.mk index 1559aa1950..5a35dfd7d4 100644 --- a/android/jni/Locals.mk +++ b/android/jni/Locals.mk @@ -8,8 +8,8 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../../Common \ $(LOCAL_PATH)/../.. \ $(LOCAL_PATH)/$(NATIVE)/base \ + $(LOCAL_PATH)/$(NATIVE)/ext \ $(LOCAL_PATH)/$(NATIVE)/ext/libzip \ - $(LOCAL_PATH)/$(NATIVE)/ext/libpng16 \ $(LOCAL_PATH)/$(NATIVE) \ $(LOCAL_PATH) diff --git a/native b/native index 7e2b9d7e98..9a66b6e803 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 7e2b9d7e98629ea6ef23c7a4e49832e3cd4a6303 +Subproject commit 9a66b6e803f66db69864ad439b776e3f6c68aa98