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/
*.user
*.aps
CMakeSettings.json

View File

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

View File

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

View File

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

View File

@ -1,12 +1,14 @@
macro(msvc_registry_search)
if(NOT DEFINED Qt5_DIR)
# look for user-registry pointing to qtcreator
get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH)
if (NOT EXISTS ${QT_ROOT})
# 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
string(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}")
list(GET QT_BIN 0 QT_BIN)
file(GLOB QT_VERSIONS "${QT_BIN}/5.1*")
# get root path
string(REPLACE "/Tools" ";" QT_ROOT "${QT_ROOT}")
list(GET QT_ROOT 0 QT_ROOT)
endif()
file(GLOB QT_VERSIONS "${QT_ROOT}/5.13*")
list(SORT QT_VERSIONS)
# 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)
add_library(Bing\ Translate MODULE bingtranslate.cpp translatewrapper.cpp network.cpp extensionimpl.cpp)