Qt: Make the Qt version compile on Windows

Tested working with AMD64 build with Visual Studio 19, Qt 5.12 and OpenGL 1

Add:
CMAKE_PREFIX_PATH = [path to your Qt]/Qt/Qt5.12.12/5.12.12/msvc2017_64/lib/cmake/Qt5
to CMake to make it work.
pull/1451/head
ruevs 2024-03-18 17:39:43 +02:00
parent 01d543e6b1
commit 7c0b3d5ce5
2 changed files with 9 additions and 4 deletions

View File

@ -21,7 +21,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
if(USE_QT_GUI) if(USE_QT_GUI)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
find_package(Qt5 COMPONENTS Core Gui Widgets OpenGL REQUIRED) find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
endif() endif()
# solvespace dependencies # solvespace dependencies
@ -299,7 +299,7 @@ if(ENABLE_GUI)
endif() endif()
# Platform-specific # Platform-specific
if(WIN32) if(WIN32 AND NOT USE_QT_GUI)
target_sources(solvespace PRIVATE target_sources(solvespace PRIVATE
platform/guiwin.cpp) platform/guiwin.cpp)
@ -376,7 +376,7 @@ if(ENABLE_GUI)
${FONTCONFIG_LIBRARY_DIRS}) ${FONTCONFIG_LIBRARY_DIRS})
target_link_libraries(solvespace PRIVATE target_link_libraries(solvespace PRIVATE
${FONTCONFIG_LIBRARIES} ${FONTCONFIG_LIBRARIES}
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) Qt5::Core Qt5::Gui Qt5::Widgets)
else() else()
target_sources(solvespace PRIVATE target_sources(solvespace PRIVATE
platform/guigtk.cpp) platform/guigtk.cpp)
@ -401,9 +401,9 @@ if(ENABLE_GUI)
endif() endif()
endif() endif()
if(ENABLE_CLI)
# solvespace headless library # solvespace headless library
if(ENABLE_CLI)
add_library(solvespace-headless STATIC EXCLUDE_FROM_ALL add_library(solvespace-headless STATIC EXCLUDE_FROM_ALL
${solvespace_core_gl_SOURCES} ${solvespace_core_gl_SOURCES}
platform/guinone.cpp platform/guinone.cpp

View File

@ -916,6 +916,11 @@ public:
} }
}; };
#if defined(WIN32)
// This interferes with our identifier.
# undef CreateWindow
#endif
WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) { WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) {
return std::make_shared<WindowImplQt>(kind, return std::make_shared<WindowImplQt>(kind,
std::static_pointer_cast<WindowImplQt>(parentWindow)); std::static_pointer_cast<WindowImplQt>(parentWindow));