upgrade build configuration to not rely on qt creator which is no longer required by qt installer

This commit is contained in:
Akash Mozumdar 2023-04-21 00:52:32 -04:00
parent ff1a7a358c
commit 446f6d44e6
6 changed files with 18 additions and 14 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
*.vscode/ *.vscode/
*.user *.user
*.aps *.aps
CMakeSettings.json

View File

@ -35,6 +35,10 @@ target_precompile_headers(pch PUBLIC include/common.h)
file(GLOB ASSETS assets/*) file(GLOB ASSETS assets/*)
file(COPY ${ASSETS} DESTINATION ${CMAKE_FINAL_OUTPUT_DIRECTORY}) file(COPY ${ASSETS} DESTINATION ${CMAKE_FINAL_OUTPUT_DIRECTORY})
include(QtUtils)
msvc_registry_search()
find_qt5(Core Widgets WinExtras WebSockets)
add_library(text text.cpp) add_library(text text.cpp)
target_compile_definitions(text PRIVATE ${TEXT_LANGUAGE}) target_compile_definitions(text PRIVATE ${TEXT_LANGUAGE})
link_libraries(text) link_libraries(text)

View File

@ -4,24 +4,28 @@
"name": "x86-Debug", "name": "x86-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"cmakeCommandArgs": "-DQT_ROOT=C:/Qt/",
"inheritEnvironments": [ "msvc_x86" ] "inheritEnvironments": [ "msvc_x86" ]
}, },
{ {
"name": "x86-RelWithDebInfo", "name": "x86-RelWithDebInfo",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "RelWithDebInfo", "configurationType": "RelWithDebInfo",
"cmakeCommandArgs": "-DQT_ROOT=C:/Qt/",
"inheritEnvironments": [ "msvc_x86" ] "inheritEnvironments": [ "msvc_x86" ]
}, },
{ {
"name": "x64-Debug", "name": "x64-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"cmakeCommandArgs": "-DQT_ROOT=C:/Qt/",
"inheritEnvironments": [ "msvc_x64" ] "inheritEnvironments": [ "msvc_x64" ]
}, },
{ {
"name": "x64-RelWithDebInfo", "name": "x64-RelWithDebInfo",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "RelWithDebInfo", "configurationType": "RelWithDebInfo",
"cmakeCommandArgs": "-DQT_ROOT=C:/Qt/",
"inheritEnvironments": [ "msvc_x64" ] "inheritEnvironments": [ "msvc_x64" ]
} }
] ]

View File

@ -1,7 +1,3 @@
include(QtUtils)
msvc_registry_search()
find_qt5(Core Widgets WinExtras)
add_executable(Textractor WIN32 add_executable(Textractor WIN32
main.cpp main.cpp
exception.cpp exception.cpp

View File

@ -1,12 +1,14 @@
macro(msvc_registry_search) macro(msvc_registry_search)
if(NOT DEFINED Qt5_DIR) if(NOT DEFINED Qt5_DIR)
# look for user-registry pointing to qtcreator if (NOT EXISTS ${QT_ROOT})
get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH) # look for user-registry pointing to qtcreator
get_filename_component(QT_ROOT [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH)
# get root path so we can search for 5.3, 5.4, 5.5, etc # get root path
string(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}") string(REPLACE "/Tools" ";" QT_ROOT "${QT_ROOT}")
list(GET QT_BIN 0 QT_BIN) list(GET QT_ROOT 0 QT_ROOT)
file(GLOB QT_VERSIONS "${QT_BIN}/5.1*") endif()
file(GLOB QT_VERSIONS "${QT_ROOT}/5.13*")
list(SORT QT_VERSIONS) list(SORT QT_VERSIONS)
# assume the latest version will be last alphabetically # assume the latest version will be last alphabetically

View File

@ -1,6 +1,3 @@
include(QtUtils)
msvc_registry_search()
find_qt5(Core Widgets WebSockets)
cmake_policy(SET CMP0037 OLD) cmake_policy(SET CMP0037 OLD)
add_library(Bing\ Translate MODULE bingtranslate.cpp translatewrapper.cpp network.cpp extensionimpl.cpp) add_library(Bing\ Translate MODULE bingtranslate.cpp translatewrapper.cpp network.cpp extensionimpl.cpp)