2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-07-06 01:55:52 +00:00

Fix Qt5::WindowsIntegrationPlugin being included on non-windows platforms

This commit is contained in:
Phillip Stephens 2021-02-26 15:12:44 -08:00
parent cb2d826cbd
commit 92fe1a9577

View File

@ -4,153 +4,160 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
if(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64) if (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
set(QT_HOMEBREW_PATH /usr/local/opt/qt) set(QT_HOMEBREW_PATH /usr/local/opt/qt)
elseif(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL arm64) elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
set(QT_HOMEBREW_PATH /opt/homebrew/opt/qt) set(QT_HOMEBREW_PATH /opt/homebrew/opt/qt)
else() else ()
set(QT_HOMEBREW_PATH "") set(QT_HOMEBREW_PATH "")
endif() endif ()
find_package(Qt6Widgets QUIET PATHS ${QT_HOMEBREW_PATH}) find_package(Qt6Widgets QUIET PATHS ${QT_HOMEBREW_PATH})
if(Qt6Widgets_FOUND) if (Qt6Widgets_FOUND)
find_package(Qt6 COMPONENTS Core5Compat Network Widgets Xml Gui REQUIRED PATHS ${QT_HOMEBREW_PATH}) find_package(Qt6 COMPONENTS Core5Compat Network Widgets Xml Gui REQUIRED PATHS ${QT_HOMEBREW_PATH})
set(QUAZIP_QT_MAJOR_VERSION 6 CACHE STRING "") set(QUAZIP_QT_MAJOR_VERSION 6 CACHE STRING "")
else() else ()
find_package(Qt5Widgets REQUIRED PATHS ${QT_HOMEBREW_PATH}) find_package(Qt5Widgets REQUIRED PATHS ${QT_HOMEBREW_PATH})
find_package(Qt5 COMPONENTS Network Widgets Xml Gui REQUIRED PATHS ${QT_HOMEBREW_PATH}) find_package(Qt5 COMPONENTS Network Widgets Xml Gui REQUIRED PATHS ${QT_HOMEBREW_PATH})
set(QUAZIP_QT_MAJOR_VERSION 5 CACHE STRING "") set(QUAZIP_QT_MAJOR_VERSION 5 CACHE STRING "")
endif() endif ()
set(BUILD_SHARED_LIBS OFF CACHE BOOL "") set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(QUAZIP_INSTALL OFF CACHE BOOL "") set(QUAZIP_INSTALL OFF CACHE BOOL "")
add_subdirectory(quazip) add_subdirectory(quazip)
add_executable(hecl-gui WIN32 MACOSX_BUNDLE add_executable(hecl-gui WIN32 MACOSX_BUNDLE
ArgumentEditor.cpp ArgumentEditor.cpp
ArgumentEditor.hpp ArgumentEditor.hpp
ArgumentEditor.ui ArgumentEditor.ui
Common.cpp Common.cpp
Common.hpp Common.hpp
CVarDialog.cpp CVarDialog.cpp
CVarDialog.hpp CVarDialog.hpp
CVarDialog.ui CVarDialog.ui
DownloadManager.cpp DownloadManager.cpp
DownloadManager.hpp DownloadManager.hpp
ErrorLabel.hpp ErrorLabel.hpp
EscapeSequenceParser.cpp EscapeSequenceParser.cpp
EscapeSequenceParser.hpp EscapeSequenceParser.hpp
ExtractZip.cpp ExtractZip.cpp
ExtractZip.hpp ExtractZip.hpp
FileDirDialog.hpp FileDirDialog.hpp
FindBlender.cpp FindBlender.cpp
FindBlender.hpp FindBlender.hpp
MainWindow.cpp MainWindow.cpp
MainWindow.hpp MainWindow.hpp
MainWindow.ui MainWindow.ui
SysReqTableView.cpp SysReqTableView.cpp
SysReqTableView.hpp SysReqTableView.hpp
VectorISATableModel.hpp VectorISATableModel.hpp
VectorISATableModelIntel.hpp VectorISATableModelIntel.hpp
VectorISATableView.cpp VectorISATableView.cpp
VectorISATableView.hpp VectorISATableView.hpp
main.cpp main.cpp
${QUAZIP_SRCS} ${QUAZIP_SRCS}
) )
target_compile_definitions(hecl-gui PRIVATE target_compile_definitions(hecl-gui PRIVATE
# Disable implicit conversions from ASCII to QString. # Disable implicit conversions from ASCII to QString.
-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_ASCII
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_TO_ASCII
# Disable implicit conversions of QByteArray to const char* or const void* # Disable implicit conversions of QByteArray to const char* or const void*
-DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_FROM_BYTEARRAY
# Disable narrowing conversions in signal/slot connect() calls. # Disable narrowing conversions in signal/slot connect() calls.
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
# Disable unsafe overloads of QProcess' start() function. # Disable unsafe overloads of QProcess' start() function.
-DQT_NO_PROCESS_COMBINED_ARGUMENT_START -DQT_NO_PROCESS_COMBINED_ARGUMENT_START
# Disable implicit QString->QUrl conversions to enforce use of proper resolving functions. # Disable implicit QString->QUrl conversions to enforce use of proper resolving functions.
-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_URL_CAST_FROM_STRING
# Allows for more efficient string concatenation, resulting in less temporaries. # Allows for more efficient string concatenation, resulting in less temporaries.
-DQT_USE_QSTRINGBUILDER -DQT_USE_QSTRINGBUILDER
) )
if(Qt6Widgets_FOUND) if (Qt6Widgets_FOUND)
set(Qt_LIBS set(Qt_LIBS
Qt6::Core Qt6::Core
Qt6::Core5Compat Qt6::Core5Compat
Qt6::Gui Qt6::Gui
Qt6::Network Qt6::Network
Qt6::Widgets Qt6::Widgets
Qt6::Xml) Qt6::Xml)
else() set(QT5_WINDOWS_INTEGRATION_PLUGIN "")
set(Qt_LIBS else ()
Qt5::Core set(Qt_LIBS
Qt5::Gui Qt5::Core
Qt5::Network Qt5::Gui
Qt5::Widgets Qt5::Network
Qt5::Xml Qt5::Widgets
Qt5::WindowsIntegrationPlugin) Qt5::Xml)
endif()
if (WIN32)
set(QT5_WINDOWS_INTEGRATION_PLUGIN
Qt5::WindowsIntegrationPlugin)
else ()
set(QT5_WINDOWS_INTEGRATION_PLUGIN "")
endif ()
endif ()
target_link_libraries(hecl-gui PRIVATE target_link_libraries(hecl-gui PRIVATE
${Qt_LIBS} ${Qt_LIBS}
hecl-light hecl-light
zeus zeus
QuaZip::QuaZip QuaZip::QuaZip
) ${QT5_WINDOWS_INTEGRATION_PLUGIN})
target_include_directories(hecl-gui PRIVATE quazip/quazip) target_include_directories(hecl-gui PRIVATE quazip/quazip)
target_compile_definitions(hecl-gui PRIVATE QUAZIP_STATIC=1) target_compile_definitions(hecl-gui PRIVATE QUAZIP_STATIC=1)
if(APPLE) if (APPLE)
target_sources(hecl-gui PRIVATE target_sources(hecl-gui PRIVATE
MacOSSystemVersion.hpp MacOSSystemVersion.hpp
MacOSSystemVersion.mm MacOSSystemVersion.mm
) )
set_source_files_properties(MacOSSystemVersion.mm set_source_files_properties(MacOSSystemVersion.mm
PROPERTIES COMPILE_FLAGS -fobjc-arc PROPERTIES COMPILE_FLAGS -fobjc-arc
) )
find_library(FOUNDATION_LIBRARY Foundation) find_library(FOUNDATION_LIBRARY Foundation)
target_link_libraries(hecl-gui PRIVATE ${FOUNDATION_LIBRARY}) target_link_libraries(hecl-gui PRIVATE ${FOUNDATION_LIBRARY})
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
target_link_libraries(hecl-gui PRIVATE target_link_libraries(hecl-gui PRIVATE
dl dl
pthread pthread
) )
endif() endif ()
if(WIN32) if (WIN32)
target_sources(hecl-gui PRIVATE target_sources(hecl-gui PRIVATE
platforms/win/hecl-gui.manifest platforms/win/hecl-gui.manifest
platforms/win/hecl-gui.rc platforms/win/hecl-gui.rc
) )
target_link_libraries(hecl-gui PRIVATE target_link_libraries(hecl-gui PRIVATE
Version) Version)
elseif(APPLE) elseif (APPLE)
target_sources(hecl-gui PRIVATE platforms/mac/mainicon.icns) target_sources(hecl-gui PRIVATE platforms/mac/mainicon.icns)
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources MACOSX_PACKAGE_LOCATION Resources
) )
endif() endif ()
add_subdirectory(platforms/freedesktop) add_subdirectory(platforms/freedesktop)
declare_qticon_target() declare_qticon_target()
target_sources(hecl-gui PRIVATE mainicon_qt.cpp) target_sources(hecl-gui PRIVATE mainicon_qt.cpp)
if(COMMAND add_sanitizers) if (COMMAND add_sanitizers)
add_sanitizers(hecl-gui) add_sanitizers(hecl-gui)
endif() endif ()
if (NOT MSVC) if (NOT MSVC)
target_compile_options(hecl-gui PRIVATE -Wno-misleading-indentation) target_compile_options(hecl-gui PRIVATE -Wno-misleading-indentation)
endif() endif ()
set_target_properties(hecl-gui PROPERTIES set_target_properties(hecl-gui PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist" MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist"
) )