From 7d43ca512533b424c224c641f2f8385aa056275c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 5 Oct 2020 10:19:04 +0200 Subject: [PATCH] Fix Qt build by simply moving the offending file to the native project. No idea why Qt include paths only work there. --- CMakeLists.txt | 71 ++++++++++++++--------------- Common/GPU/thin3d.cpp | 5 +- Common/Render/Text/draw_text_qt.cpp | 1 + Common/Render/Text/draw_text_qt.h | 2 +- macshaders.sh | 11 ----- 5 files changed, 38 insertions(+), 52 deletions(-) delete mode 100644 macshaders.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index ff39a5b5ed..a62d384318 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,8 +164,6 @@ else() set(CoreLinkType STATIC) endif() -include_directories(ext/native) - # Work around for some misfeature of the current glslang build system include_directories(ext/glslang) @@ -302,12 +300,7 @@ if(NOT MSVC) if(IOS) elseif(APPLE AND NOT CMAKE_CROSSCOMPILING) - # We want C++11, so target 10.7+ - if(USING_QT_UI) - set(MACOSX_VERSION_MIN "10.8") - else() - set(MACOSX_VERSION_MIN "10.7") - endif() + set(MACOSX_VERSION_MIN "10.8") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN} -stdlib=libc++ -U__STRICT_ANSI__") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") @@ -357,6 +350,14 @@ macro(setup_target_project TargetName ProjectDir) endforeach() endmacro() +add_subdirectory(ext) + +if(WIN32) + include_directories(dx9sdk/Include) + include_directories(dx9sdk/Include/DX11) +endif() + + set(CommonX86 Common/ABI.cpp Common/ABI.h @@ -423,7 +424,6 @@ add_library(Common STATIC ${CommonARM64} ${CommonMIPS} ${CommonFake} - ${CommonVulkan} ${CommonD3D} Common/Serialize/Serializer.cpp Common/Serialize/Serializer.h @@ -567,8 +567,6 @@ add_library(Common STATIC Common/Render/Text/draw_text.h Common/Render/Text/draw_text_android.cpp Common/Render/Text/draw_text_android.h - Common/Render/Text/draw_text_qt.cpp - Common/Render/Text/draw_text_qt.h Common/Render/Text/draw_text_win.cpp Common/Render/Text/draw_text_win.h Common/Render/Text/draw_text_uwp.cpp @@ -644,39 +642,21 @@ add_library(Common STATIC Common/TimeUtil.h ) -add_subdirectory(ext) - include_directories(Common) setup_target_project(Common Common) target_link_libraries(Common Ext::Snappy) -if(WIN32) - include_directories(dx9sdk/Include) - include_directories(dx9sdk/Include/DX11) - if(MINGW) - set(CMAKE_RC_COMPILE_OBJECT " -O coff ") - # required when using the dx9sdk include paths - add_definitions(-include ${CMAKE_CURRENT_SOURCE_DIR}/Windows/mingw_defines.h) - else() - target_link_libraries(Common dxguid) - endif() - target_link_libraries(Common winmm d3d9 dsound) -endif() - -if(TARGET SDL2::SDL2) - target_link_libraries(Common SDL2::SDL2) -endif() - if(USING_GLES2 OR (USING_EGL AND NOT USING_FBDEV)) find_package(X11) endif() add_library(gason STATIC - ext/gason/gason.cpp - ext/gason/gason.h + ext/gason/gason.cpp + ext/gason/gason.h ) + if(USE_FFMPEG) if(NOT FFMPEG_DIR) if(NOT USE_SYSTEM_FFMPEG) @@ -981,11 +961,13 @@ elseif(USING_QT_UI) if(USING_GLES2) add_definitions(-DQT_OPENGL_ES -DQT_OPENGL_ES_2) endif() - include_directories(${CMAKE_CURRENT_BINARY_DIR} Qt) + + include_directories(Qt) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) set(nativeExtraLibs ${nativeExtraLibs} Qt5::OpenGL Qt5::Gui Qt5::Core Qt5::Multimedia) set(TargetBin PPSSPPQt) - # Enable SDL if found + # Enable SDL joystick if SDL is found if(SDL2_FOUND) add_definitions(-DSDL) set(nativeExtra ${nativeExtra} @@ -1026,6 +1008,22 @@ elseif(NOT LIBRETRO) message(FATAL_ERROR "Could not find SDL2. Failing.") endif() +if(WIN32) + if(MINGW) + set(CMAKE_RC_COMPILE_OBJECT " -O coff ") + # required when using the dx9sdk include paths + add_definitions(-include ${CMAKE_CURRENT_SOURCE_DIR}/Windows/mingw_defines.h) + else() + target_link_libraries(Common dxguid) + endif() + target_link_libraries(Common winmm d3d9 dsound) +endif() + +if(TARGET SDL2::SDL2) + target_link_libraries(Common SDL2::SDL2) +endif() + + list(APPEND NativeAppSource android/jni/TestRunner.cpp UI/DiscordIntegration.cpp @@ -1075,12 +1073,13 @@ endif() add_library(native STATIC ${nativeExtra} + Common/Render/Text/draw_text_qt.cpp + Common/Render/Text/draw_text_qt.h ext/jpge/jpgd.cpp ext/jpge/jpgd.h ext/jpge/jpge.cpp ext/jpge/jpge.h ) -include_directories(ext/native) if(LINUX AND NOT ANDROID) set(RT_LIB rt) @@ -1103,7 +1102,6 @@ elseif(WIN32) elseif(${CMAKE_SYSTEM_NAME} MATCHES "^(DragonFly|FreeBSD|NetBSD)$") target_link_libraries(native execinfo) endif() -setup_target_project(native native) add_library(kirk STATIC ext/libkirk/AES.c @@ -1809,7 +1807,6 @@ set(CoreExtraLibs ${CoreExtraLibs} armips) # target_link_libraries(native X11-xcb X11) #endif() - set(GlslangLibs glslang OGLCompiler OSDependent SPIRV SPVRemapper spirv-cross-glsl) if(WIN32) diff --git a/Common/GPU/thin3d.cpp b/Common/GPU/thin3d.cpp index dfac21e038..95dce26147 100644 --- a/Common/GPU/thin3d.cpp +++ b/Common/GPU/thin3d.cpp @@ -6,7 +6,6 @@ #include "Common/GPU/thin3d.h" #include "Common/Log.h" #include "Common/ColorConv.h" -#include "Core/Reporting.h" namespace Draw { @@ -450,7 +449,7 @@ void ConvertFromRGBA8888(uint8_t *dst, const uint8_t *src, uint32_t dstStride, u case Draw::DataFormat::R8G8B8A8_UNORM: case Draw::DataFormat::UNDEFINED: default: - WARN_LOG_REPORT_ONCE(convFromRGBA, G3D, "Unable to convert from format: %d", (int)format); + WARN_LOG(G3D, "Unable to convert from format: %d", (int)format); break; } } @@ -492,7 +491,7 @@ void ConvertFromBGRA8888(uint8_t *dst, const uint8_t *src, uint32_t dstStride, u dst += dstStride * 3; } } else { - WARN_LOG_REPORT_ONCE(convFromBGRA, G3D, "Unable to convert from format to BGRA: %d", (int)format); + WARN_LOG(G3D, "Unable to convert from format to BGRA: %d", (int)format); } } diff --git a/Common/Render/Text/draw_text_qt.cpp b/Common/Render/Text/draw_text_qt.cpp index 166aac3a47..ce0600cb81 100644 --- a/Common/Render/Text/draw_text_qt.cpp +++ b/Common/Render/Text/draw_text_qt.cpp @@ -10,6 +10,7 @@ #if defined(USING_QT_UI) +#include #include #include #include diff --git a/Common/Render/Text/draw_text_qt.h b/Common/Render/Text/draw_text_qt.h index 2ac661b4ad..47fb8ab48f 100644 --- a/Common/Render/Text/draw_text_qt.h +++ b/Common/Render/Text/draw_text_qt.h @@ -7,7 +7,7 @@ #if defined(USING_QT_UI) -#include +class QFont; class TextDrawerQt : public TextDrawer { public: diff --git a/macshaders.sh b/macshaders.sh deleted file mode 100644 index 19e8a352be..0000000000 --- a/macshaders.sh +++ /dev/null @@ -1,11 +0,0 @@ -# AWFUL way to make the shaders macosx compatible! - -cd assets/shaders -for i in *.vs *.fs -do - sed -i '' s/lowp\ //g $i - sed -i '' s/highp\ //g $i - sed -i '' s/mediump\ //g $i - sed -i '' s/#version\ 140//g $i -done -cd ../..