From c7edfef9adb6a0e0f0e05d5c8f3d75dcdc635b2d Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Fri, 24 May 2019 13:30:12 -0400 Subject: [PATCH] upgrade build pipeline for x64 deployment --- CMakeLists.txt | 7 ++-- CMakeSettings.json | 4 +-- GUI/CMakeLists.txt | 10 +++--- deploy.ps1 | 85 +++++++++++++++++++++++++++++++--------------- text.cpp | 12 +++---- 5 files changed, 74 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84ca512..ea68f1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,9 +20,9 @@ else() set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86) set(LIBDIR x86libs) endif() -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_FINAL_OUTPUT_DIRECTORY}) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_FINAL_OUTPUT_DIRECTORY}) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_FINAL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) set(CMAKE_CONFIGURATION_TYPES Debug Release) @@ -33,6 +33,7 @@ include_directories(include) link_directories(${LIBDIR}) add_library(text text.cpp) +target_compile_definitions(text PRIVATE ${TEXT_LANGUAGE}) link_libraries(text) add_subdirectory(GUI) diff --git a/CMakeSettings.json b/CMakeSettings.json index dc850c5..70f0a9e 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -8,7 +8,7 @@ "inheritEnvironments": [ "msvc_x86" ] }, { - "name": "x86-Release", + "name": "x86-RelWithDebInfo", "generator": "Ninja", "configurationType": "RelWithDebInfo", "inheritEnvironments": [ "msvc_x86" ] @@ -20,7 +20,7 @@ "inheritEnvironments": [ "msvc_x64" ] }, { - "name": "x64-Release", + "name": "x64-RelWithDebInfo", "generator": "Ninja", "configurationType": "RelWithDebInfo", "inheritEnvironments": [ "msvc_x64" ] diff --git a/GUI/CMakeLists.txt b/GUI/CMakeLists.txt index f1fd998..222bab4 100644 --- a/GUI/CMakeLists.txt +++ b/GUI/CMakeLists.txt @@ -13,8 +13,10 @@ add_executable(${PROJECT_NAME} WIN32 Textractor.rc Textractor.ico ) -target_compile_options(${PROJECT_NAME} PRIVATE $<$:/GL>) -target_link_libraries(${PROJECT_NAME} Qt5::Widgets shell32 winhttp $<$:-LTCG>) +target_link_libraries(${PROJECT_NAME} Qt5::Widgets shell32 winhttp) - -install_qt5_libs(${PROJECT_NAME}) # can be commented out for consecutive builds +if (NOT EXISTS ${CMAKE_FINAL_OUTPUT_DIRECTORY}/Qt5Core.dll) + if (NOT EXISTS ${CMAKE_FINAL_OUTPUT_DIRECTORY}/Qt5Cored.dll) + install_qt5_libs(${PROJECT_NAME}) + endif() +endif() diff --git a/deploy.ps1 b/deploy.ps1 index 00a4713..5e271b5 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -1,29 +1,60 @@ -param([string]$arch = "86", [string]$folder = "Textractor$($arch)") +param([string]$version) -Set-Location $PSScriptRoot; +cd $PSScriptRoot; +mkdir -Force -Verbose Builds; +cd Builds; +mkdir -Force -Verbose x86; +mkdir -Force -Verbose x64; -$targets = @( - "Textractor.exe", - "TextractorCLI.exe", - "texthook.dll", - "Qt5Core.dll", - "Qt5Gui.dll", - "Qt5Widgets.dll", - "LoaderDll.dll", - "LocaleEmulator.dll", - "Bing Translate.dll", - "Copy to Clipboard.dll", - "Extra Newlines.dll", - "Extra Window.dll", - "Google Translate.dll", - "Lua.dll", - "Regex Filter.dll", - "Remove Repetition.dll", - "Replacer.dll", - "Thread Linker.dll", - "platforms", - "styles" -) | ForEach-Object { "builds/RelWithDebInfo_x$($arch)/$($_)" }; -mkdir -Force -Verbose $folder; -Remove-Item -Force -Recurse -Verbose "$($folder)/*"; -Copy-Item -Force -Recurse -Verbose -Destination $folder -Path $targets; +foreach ($language in @{ + ENGLISH=""; + SPANISH="Español"; + SIMPLIFIED_CHINESE="简体中文"; + RUSSIAN="Русский"; + TURKISH="Türkçe"; +}.GetEnumerator()) +{ + $folder = "Textractor-$($language.Value)-$($version)"; + mkdir -Force -Verbose $folder; + rm -Force -Recurse -Verbose "$($folder)/*"; + + $files = @( + "Textractor.exe", + "TextractorCLI.exe", + "texthook.dll", + "Qt5Core.dll", + "Qt5Gui.dll", + "Qt5Widgets.dll", + "LoaderDll.dll", + "LocaleEmulator.dll", + "Bing Translate.dll", + "Copy to Clipboard.dll", + "Extra Newlines.dll", + "Extra Window.dll", + "Google Translate.dll", + "Lua.dll", + "Regex Filter.dll", + "Remove Repetition.dll", + "Replacer.dll", + "Thread Linker.dll", + "platforms", + "styles" + ); + cd "x86"; + cmake -G "Visual Studio 15 2017" -DTEXT_LANGUAGE="$($language.Key)" -DCMAKE_BUILD_TYPE="Release" ../..; + &"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv" Textractor.sln /build "Release|Win32"; + cd ..; + foreach ($file in $files) + { + copy -Force -Recurse -Verbose -Destination $folder -Path "Release_x86/$($file)"; + } + cd "x64"; + cmake -G "Visual Studio 15 2017 Win64" -DTEXT_LANGUAGE="$($language.Key)" -DCMAKE_BUILD_TYPE="Release" ../..; + &"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv" Textractor.sln /build "Release|x64"; + cd ..; + mkdir -Force -Verbose "$($folder)/x64"; + foreach ($file in $files) + { + copy -Force -Recurse -Verbose -Destination "$($folder)/x64" -Path "Release_x64/$($file)"; + } +} diff --git a/text.cpp b/text.cpp index e5b8b8a..1718716 100644 --- a/text.cpp +++ b/text.cpp @@ -1,10 +1,5 @@ #include "defs.h" -//#define TURKISH -//#define SPANISH -//#define SIMPLIFIED_CHINESE -//#define RUSSIAN - const char* ATTACH = u8"Attach to game"; const char* LAUNCH = u8"Launch game"; const char* DETACH = u8"Detach from game"; @@ -12,7 +7,7 @@ const char* ADD_HOOK = u8"Add hook"; const char* SAVE_HOOKS = u8"Save hook(s)"; const char* SETTINGS = u8"Settings"; const char* EXTENSIONS = u8"Extensions"; -const char* SELECT_PROCESS = u8"Select Process"; +const char* SELECT_PROCESS = u8"Select process"; const char* ATTACH_INFO = u8R"(If you don't see the process you want to attach, try running with admin rights You can also type in the process id)"; const char* SEARCH_GAME = u8"Select from computer"; @@ -33,6 +28,7 @@ S/Q/V: codepage/UTF-16/UTF-8 string null_length: length of null terminator used for string Negatives for data/split offset refer to registers -4 for EAX, -8 for ECX, -C for EDX, -10 for EBX, -14 for ESP, -18 for EBP, -1C for ESI, -20 for EDI +-4 for RAX, -C for RBX, -14 for RCX, -1C for RDX, and so on for RSP, RBP, RSI, RDI, R8-R15 * means dereference pointer+deref_offset)"; const char* SAVE_SETTINGS = u8"Save settings"; const char* EXTEN_WINDOW_INSTRUCTIONS = u8R"(Drag and drop extension (.dll) files here from your computer to add them @@ -57,8 +53,8 @@ If you like this project, please tell everyone about it :))"; const wchar_t* CL_OPTIONS = LR"(usage: Textractor [-p{process id|"process name"}]...)"; const wchar_t* UPDATE_AVAILABLE = L"Update available: download it from https://github.com/Artikash/Textractor/releases"; const wchar_t* ALREADY_INJECTED = L"Textractor: already injected"; -const wchar_t* NEED_32_BIT = L"Textractor: architecture mismatch: try 32 bit Textractor instead"; -const wchar_t* NEED_64_BIT = L"Textractor: architecture mismatch: try 64 bit Textractor instead (contact Artikash for the download location)"; +const wchar_t* NEED_32_BIT = L"Textractor: architecture mismatch: try x86 Textractor instead"; +const wchar_t* NEED_64_BIT = L"Textractor: architecture mismatch: try x64 Textractor instead"; const wchar_t* INJECT_FAILED = L"Textractor: couldn't inject"; const wchar_t* LAUNCH_FAILED = L"Textractor: couldn't launch"; const wchar_t* INVALID_CODE = L"Textractor: invalid code";