diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml index a20c380fc..d5c6ab128 100644 --- a/.github/workflows/commit-ci.yml +++ b/.github/workflows/commit-ci.yml @@ -51,9 +51,10 @@ jobs: if: env.librime_build == 'stable' run: .\github.install.bat - - name: Build librime + - name: Build librime 64 bit if: env.librime_build == 'submodule' env: + ARCH: x64 RIME_PLUGINS: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict shell: bash run: | @@ -61,6 +62,36 @@ jobs: pushd librime ./action-install-plugins-windows.bat popd + # build librime + ./build.bat librime + # copy x64 files to weasel and rename + echo " ./lib/rimex64.dll" + cp ./librime/dist/lib/rime.dll ./lib/rimex64.dll + echo " ./lib/rimex64.lib" + cp ./librime/dist/lib/rime.lib ./lib/rimex64.lib + echo " ./output/x64/rime.dll" + cp ./librime/dist/lib/rime.dll ./output/x64/rime.dll + + - name: Build librime + if: env.librime_build == 'submodule' + env: + ARCH: Win32 + RIME_PLUGINS: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict + shell: bash + run: | + # clean x64 + rm -rf ./librime/deps/opencc/build/ + rm -rf ./librime/deps/glog/build/ + rm -rf ./librime/deps/googletest/build/ + rm -rf ./librime/deps/leveldb/build/ + rm -rf ./librime/deps/marisa-trie/build/ + rm -rf ./librime/deps/yaml-cpp/build/ + rm -rf ./librime/build/ + rm -rf ./librime/lib/*.lib + rm -rf ./librime/lib/cmake + rm -rf ./librime/lib/pkgconfig + rm -rf ./librime/dist + # build librime ./build.bat librime - name: Build Weasel diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 32ec6f942..d755a36ba 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -49,9 +49,10 @@ jobs: run: | .\github.install.bat - - name: Build librime + - name: Build librime 64 bit if: env.librime_build == 'submodule' env: + ARCH: x64 RIME_PLUGINS: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict shell: bash run: | @@ -59,6 +60,36 @@ jobs: pushd librime ./action-install-plugins-windows.bat popd + # build librime + ./build.bat librime + # copy x64 files to weasel and rename + echo " ./lib/rimex64.dll" + cp ./librime/dist/lib/rime.dll ./lib/rimex64.dll + echo " ./lib/rimex64.lib" + cp ./librime/dist/lib/rime.lib ./lib/rimex64.lib + echo " ./output/x64/rime.dll" + cp ./librime/dist/lib/rime.dll ./output/x64/rime.dll + + - name: Build librime + if: env.librime_build == 'submodule' + env: + ARCH: Win32 + RIME_PLUGINS: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict + shell: bash + run: | + # clean x64 + rm -rf ./librime/deps/opencc/build/ + rm -rf ./librime/deps/glog/build/ + rm -rf ./librime/deps/googletest/build/ + rm -rf ./librime/deps/leveldb/build/ + rm -rf ./librime/deps/marisa-trie/build/ + rm -rf ./librime/deps/yaml-cpp/build/ + rm -rf ./librime/build/ + rm -rf ./librime/lib/*.lib + rm -rf ./librime/lib/cmake + rm -rf ./librime/lib/pkgconfig + rm -rf ./librime/dist + # build librime ./build.bat librime - name: Build Weasel diff --git a/RimeWithWeasel/RimeWithWeasel.vcxproj b/RimeWithWeasel/RimeWithWeasel.vcxproj index 04ae9169e..1cc749487 100644 --- a/RimeWithWeasel/RimeWithWeasel.vcxproj +++ b/RimeWithWeasel/RimeWithWeasel.vcxproj @@ -1,216 +1,220 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - ReleaseHant - Win32 - - - ReleaseHant - x64 - - - Release - Win32 - - - Release - x64 - - - - {1C497821-BD63-4F02-9094-32B185B62F23} - RimeWithWeasel - Win32Proj - - - - - StaticLibrary - Unicode - true - $(PLATFORM_TOOLSET) - - - StaticLibrary - Unicode - true - $(PLATFORM_TOOLSET) - - - StaticLibrary - Unicode - $(PLATFORM_TOOLSET) - - - StaticLibrary - Unicode - true - $(PLATFORM_TOOLSET) - - - StaticLibrary - Unicode - true - $(PLATFORM_TOOLSET) - - - StaticLibrary - Unicode - $(PLATFORM_TOOLSET) - - - - - - - - - - - - - - - - - - - - - - - - - - Disabled - $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Use - Level3 - EditAndContinue - /Zc:threadSafeInit- %(AdditionalOptions) - - - - - MaxSpeed - true - $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreaded - true - Use - Level3 - ProgramDatabase - /Zc:threadSafeInit- %(AdditionalOptions) - - - - - - X64 - - - Disabled - $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Use - Level3 - ProgramDatabase - /Zc:threadSafeInit- %(AdditionalOptions) - - - - - X64 - - - MaxSpeed - true - $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreaded - true - Use - Level3 - ProgramDatabase - /Zc:threadSafeInit- %(AdditionalOptions) - - - - - MaxSpeed - true - $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreaded - true - Use - Level3 - ProgramDatabase - /Zc:threadSafeInit- %(AdditionalOptions) - - - - - X64 - - - MaxSpeed - true - $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreaded - true - Use - Level3 - ProgramDatabase - /Zc:threadSafeInit- %(AdditionalOptions) - - - - - - Create - Create - Create - Create - Create - Create - - - - - - - - - - - - - - - {10b3b8bf-7294-4661-9a8a-2ffc920fa2f4} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + ReleaseHant + Win32 + + + ReleaseHant + x64 + + + Release + Win32 + + + Release + x64 + + + + {1C497821-BD63-4F02-9094-32B185B62F23} + RimeWithWeasel + Win32Proj + 10.0 + + + + + StaticLibrary + Unicode + true + $(PLATFORM_TOOLSET) + + + StaticLibrary + Unicode + true + $(PLATFORM_TOOLSET) + + + StaticLibrary + Unicode + $(PLATFORM_TOOLSET) + + + StaticLibrary + Unicode + true + $(PLATFORM_TOOLSET) + + + StaticLibrary + Unicode + true + $(PLATFORM_TOOLSET) + + + StaticLibrary + Unicode + $(PLATFORM_TOOLSET) + + + + + + + + + + + + + + + + + + + + + + + + + $(Platform)$(Platform)\$(Configuration)\ + + + + Disabled + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + Use + Level3 + EditAndContinue + /Zc:threadSafeInit- %(AdditionalOptions) + + + + + MaxSpeed + true + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + Use + Level3 + ProgramDatabase + /Zc:threadSafeInit- %(AdditionalOptions) + + + + + + X64 + + + Disabled + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + Use + Level3 + ProgramDatabase + /Zc:threadSafeInit- %(AdditionalOptions) + + + + + X64 + + + MaxSpeed + true + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + Use + Level3 + ProgramDatabase + /Zc:threadSafeInit- %(AdditionalOptions) + + + + + MaxSpeed + true + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + Use + Level3 + ProgramDatabase + /Zc:threadSafeInit- %(AdditionalOptions) + + + + + X64 + + + MaxSpeed + true + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + Use + Level3 + ProgramDatabase + /Zc:threadSafeInit- %(AdditionalOptions) + + + + + + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + + {10b3b8bf-7294-4661-9a8a-2ffc920fa2f4} + false + + + + + \ No newline at end of file diff --git a/WeaselDeployer/Configurator.cpp b/WeaselDeployer/Configurator.cpp index bec68230d..14f1b5502 100644 --- a/WeaselDeployer/Configurator.cpp +++ b/WeaselDeployer/Configurator.cpp @@ -15,6 +15,7 @@ #pragma warning(default: 4005) #include #include +#include #include "WeaselDeployer.h" static void CreateFileIfNotExist(std::string filename) @@ -36,7 +37,11 @@ Configurator::Configurator() void Configurator::Initialize() { RIME_STRUCT(RimeTraits, weasel_traits); +#ifndef _WIN64 std::string shared_dir = wstring_to_string(WeaselSharedDataPath().wstring(), CP_UTF8); +#else + std::string shared_dir = wstring_to_string((WeaselSharedDataPath().parent_path().parent_path().append("data")).wstring(), CP_UTF8); +#endif std::string user_dir = wstring_to_string(WeaselUserDataPath().wstring(), CP_UTF8); weasel_traits.shared_data_dir = shared_dir.c_str(); weasel_traits.user_data_dir = user_dir.c_str(); diff --git a/WeaselDeployer/UIStyleSettings.cpp b/WeaselDeployer/UIStyleSettings.cpp index 20d093808..9b9a9f415 100644 --- a/WeaselDeployer/UIStyleSettings.cpp +++ b/WeaselDeployer/UIStyleSettings.cpp @@ -36,13 +36,6 @@ bool UIStyleSettings::GetPresetColorSchemes(std::vector* result return true; } -// check if a file exists -static inline bool IfFileExist(std::string filename) -{ - DWORD dwAttrib = GetFileAttributes(string_to_wstring(filename).c_str()); - return (INVALID_FILE_ATTRIBUTES != dwAttrib && 0 == (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); -} - // get preview image from user dir first, then shared_dir std::string UIStyleSettings::GetColorSchemePreview(const std::string& color_scheme_id) { std::string shared_dir = rime_get_api()->get_shared_data_dir(); diff --git a/WeaselDeployer/WeaselDeployer.vcxproj b/WeaselDeployer/WeaselDeployer.vcxproj index 2c12c00a0..8949a037f 100644 --- a/WeaselDeployer/WeaselDeployer.vcxproj +++ b/WeaselDeployer/WeaselDeployer.vcxproj @@ -1,133 +1,217 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B} - Win32Proj - WeaselDeployer - - - - - Application - true - Unicode - $(PLATFORM_TOOLSET) - - - Application - false - true - Unicode - $(PLATFORM_TOOLSET) - - - - - - - - - - - - - true - $(SolutionDir)output\ - - - false - $(SolutionDir)output\ - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) - MultiThreadedDebug - /Zc:threadSafeInit- %(AdditionalOptions) - - - Windows - true - $(SolutionDir)\lib;$(BOOST_ROOT)\stage\lib;$(SolutionDir)\librime\build\lib\Debug;%(AdditionalLibraryDirectories) - rime.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - $(SolutionDir)output\$(ProjectName)$(TargetExt) - - - - - Level3 - Use - Disabled - true - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include - MultiThreaded - /Zc:threadSafeInit- %(AdditionalOptions) - - - Windows - true - true - true - rime.lib;rime.lib;%(AdditionalDependencies) - $(SolutionDir)\lib;$(BOOST_ROOT)\stage\lib;$(SolutionDir)\librime\build\lib\Release;%(AdditionalLibraryDirectories) - $(SolutionDir)output\$(ProjectName)$(TargetExt) - - - PerMonitorHighDPIAware - - - - - - - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - {ce11a2df-8d20-4b07-a935-4b0d03f0303d} - false - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B} + Win32Proj + WeaselDeployer + 10.0 + + + + + Application + true + Unicode + $(PLATFORM_TOOLSET) + + + Application + true + Unicode + $(PLATFORM_TOOLSET) + + + Application + false + true + Unicode + $(PLATFORM_TOOLSET) + + + Application + false + true + Unicode + $(PLATFORM_TOOLSET) + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)output\ + + + true + + + false + $(SolutionDir)output\ + + + false + $(SolutionDir)output\$(Platform) + $(ProjectName) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) + MultiThreadedDebug + /Zc:threadSafeInit- %(AdditionalOptions) + + + Windows + true + $(SolutionDir)\lib;$(BOOST_ROOT)\stage\lib;$(SolutionDir)\librime\build\lib\Debug;%(AdditionalLibraryDirectories) + rime.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)output\$(ProjectName)$(TargetExt) + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include;%(AdditionalIncludeDirectories) + MultiThreadedDebug + /Zc:threadSafeInit- %(AdditionalOptions) + + + Windows + true + $(SolutionDir)$(Platform)\$(Configuration);$(SolutionDir)\lib;$(BOOST_ROOT)\stage\lib;$(SolutionDir)\librime\build\lib\Debug;%(AdditionalLibraryDirectories) + rimex64.lib;RimeWithWeasel.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)output\$(ProjectName)x64$(TargetExt) + + + + + Level3 + Use + Disabled + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include + MultiThreaded + /Zc:threadSafeInit- %(AdditionalOptions) + + + Windows + true + true + true + rime.lib;rime.lib;%(AdditionalDependencies) + $(SolutionDir)\lib;$(BOOST_ROOT)\stage\lib;$(SolutionDir)\librime\build\lib\Release;%(AdditionalLibraryDirectories) + $(SolutionDir)output\$(ProjectName)$(TargetExt) + + + PerMonitorHighDPIAware + + + + + Level3 + Use + Disabled + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\include;$(BOOST_ROOT);$(SolutionDir)\librime\include + MultiThreaded + /Zc:threadSafeInit- %(AdditionalOptions) + + + Windows + true + true + true + rime$(Platform).lib;%(AdditionalDependencies);RimeWithWeasel.lib + $(SolutionDir)$(Platform)\$(Configuration);$(SolutionDir)\lib;$(BOOST_ROOT)\stage\lib;$(SolutionDir)\librime\build\lib\Release;%(AdditionalLibraryDirectories) + $(SolutionDir)output\$(Platform)\$(ProjectName)$(TargetExt) + + + PerMonitorHighDPIAware + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + {1c497821-bd63-4f02-9094-32b185b62f23} + + + {ce11a2df-8d20-4b07-a935-4b0d03f0303d} + false + + + + + + + + \ No newline at end of file diff --git a/WeaselServer/WeaselServerApp.cpp b/WeaselServer/WeaselServerApp.cpp index 65e7ee656..814dd5e7a 100644 --- a/WeaselServer/WeaselServerApp.cpp +++ b/WeaselServer/WeaselServerApp.cpp @@ -47,10 +47,18 @@ void WeaselServerApp::SetupMenuHandlers() { boost::filesystem::path dir = install_dir(); m_server.AddMenuHandler(ID_WEASELTRAY_QUIT, [this] { return m_server.Stop() == 0; }); - m_server.AddMenuHandler(ID_WEASELTRAY_DEPLOY, std::bind(execute, dir / L"WeaselDeployer.exe", std::wstring(L"/deploy"))); - m_server.AddMenuHandler(ID_WEASELTRAY_SETTINGS, std::bind(execute, dir / L"WeaselDeployer.exe", std::wstring())); - m_server.AddMenuHandler(ID_WEASELTRAY_DICT_MANAGEMENT, std::bind(execute, dir / L"WeaselDeployer.exe", std::wstring(L"/dict"))); - m_server.AddMenuHandler(ID_WEASELTRAY_SYNC, std::bind(execute, dir / L"WeaselDeployer.exe", std::wstring(L"/sync"))); + if (is_wow64() && boost::filesystem::exists(dir / boost::filesystem::path(L"\\x64\\WeaselDeployer.exe")) + && boost::filesystem::exists(dir / boost::filesystem::path(L"\\x64\\rime.dll"))) { + m_server.AddMenuHandler(ID_WEASELTRAY_DEPLOY, std::bind(execute, dir / L"\\x64\\WeaselDeployer.exe", std::wstring(L"/deploy"))); + m_server.AddMenuHandler(ID_WEASELTRAY_SETTINGS, std::bind(execute, dir / L"\\x64\\WeaselDeployer.exe", std::wstring())); + m_server.AddMenuHandler(ID_WEASELTRAY_DICT_MANAGEMENT, std::bind(execute, dir / L"\\x64\\WeaselDeployer.exe", std::wstring(L"/dict"))); + m_server.AddMenuHandler(ID_WEASELTRAY_SYNC, std::bind(execute, dir / L"\\x64\\WeaselDeployer.exe", std::wstring(L"/sync"))); + } else { + m_server.AddMenuHandler(ID_WEASELTRAY_DEPLOY, std::bind(execute, dir / L"\\WeaselDeployer.exe", std::wstring(L"/deploy"))); + m_server.AddMenuHandler(ID_WEASELTRAY_SETTINGS, std::bind(execute, dir / L"\\WeaselDeployer.exe", std::wstring())); + m_server.AddMenuHandler(ID_WEASELTRAY_DICT_MANAGEMENT, std::bind(execute, dir / L"\\WeaselDeployer.exe", std::wstring(L"/dict"))); + m_server.AddMenuHandler(ID_WEASELTRAY_SYNC, std::bind(execute, dir / L"\\WeaselDeployer.exe", std::wstring(L"/sync"))); + } m_server.AddMenuHandler(ID_WEASELTRAY_WIKI, std::bind(open, L"https://rime.im/docs/")); m_server.AddMenuHandler(ID_WEASELTRAY_HOMEPAGE, std::bind(open, L"https://rime.im/")); m_server.AddMenuHandler(ID_WEASELTRAY_FORUM, std::bind(open, L"https://rime.im/discuss/")); diff --git a/WeaselTSF/LanguageBar.cpp b/WeaselTSF/LanguageBar.cpp index 0e02babc2..fcc4efcb2 100644 --- a/WeaselTSF/LanguageBar.cpp +++ b/WeaselTSF/LanguageBar.cpp @@ -283,18 +283,6 @@ void CLangBarItemButton::SetLangbarStatus(DWORD dwStatus, BOOL fSet) return; } -BOOL is_wow64() -{ - DWORD errorCode; - if (GetSystemWow64DirectoryW(NULL, 0) == 0) - if ((errorCode = GetLastError()) == ERROR_CALL_NOT_IMPLEMENTED) - return FALSE; - else - ExitProcess((UINT)errorCode); - else - return TRUE; -} - void WeaselTSF::_HandleLangBarMenuSelect(UINT wID) { if(wID != ID_WEASELTRAY_RERUN_SERVICE) diff --git a/env.bat.template b/env.bat.template index 8cc16f1a3..a6e36fc0d 100644 --- a/env.bat.template +++ b/env.bat.template @@ -1,9 +1,10 @@ rem Customize your build environment and save the modified copy to env.bat rem REQUIRED: path to Boost source directory -set BOOST_ROOT=C:\Libraries\boost_1_78_0 +set BOOST_ROOT=C:\Libraries\boost_1_83_0 rem OPTIONAL: Visual Studio version and platform toolset +if not defined ARCH set ARCH=Win32 rem set BJAM_TOOLSET=msvc-14.2 rem set PLATFORM_TOOLSET=v142 diff --git a/env.vs2019.bat b/env.vs2019.bat index e01e3dc94..f048165ad 100644 --- a/env.vs2019.bat +++ b/env.vs2019.bat @@ -3,10 +3,10 @@ rem Customize your build environment and save the modified copy to env.bat set WEASEL_ROOT=%CD% rem REQUIRED: path to Boost source directory -if not defined BOOST_ROOT set BOOST_ROOT=%WEASEL_ROOT%\deps\boost_1_78_0 +if not defined BOOST_ROOT set BOOST_ROOT=%WEASEL_ROOT%\deps\boost_1_83_0 rem OPTIONAL: architecture, Visual Studio version and platform toolset -set ARCH=Win32 +if not defined ARCH set ARCH=Win32 set BJAM_TOOLSET=msvc-14.2 set CMAKE_GENERATOR="Visual Studio 16 2019" set PLATFORM_TOOLSET=v142 diff --git a/env.vs2022.bat b/env.vs2022.bat index f289aa026..4c7318aa6 100644 --- a/env.vs2022.bat +++ b/env.vs2022.bat @@ -3,10 +3,10 @@ rem Customize your build environment and save the modified copy to env.bat set WEASEL_ROOT=%CD% rem REQUIRED: path to Boost source directory -if not defined BOOST_ROOT set BOOST_ROOT=%WEASEL_ROOT%\deps\boost_1_78_0 +if not defined BOOST_ROOT set BOOST_ROOT=%WEASEL_ROOT%\deps\boost_1_83_0 rem OPTIONAL: architecture, Visual Studio version and platform toolset -set ARCH=Win32 +if not defined ARCH set ARCH=Win32 set BJAM_TOOLSET=msvc-14.3 set CMAKE_GENERATOR="Visual Studio 17 2022" set PLATFORM_TOOLSET=v143 diff --git a/github.install.bat b/github.install.bat index f7256d04b..5bb327e89 100644 --- a/github.install.bat +++ b/github.install.bat @@ -3,21 +3,31 @@ setlocal git submodule init git submodule update plum -set rime_version=1.9.0 +set rime_version=1.10.0 -set download_archive=rime-a608767-Windows-msvc.7z -set download_archive_deps=rime-deps-a608767-Windows-msvc.7z +set download_archive=rime-295cb2a-Windows-msvc.7z +set download_archive_deps=rime-deps-295cb2a-Windows-msvc.7z + +set download_archive_x64=rime-295cb2a-Windows-clang.7z +set download_archive_deps_x64=rime-deps-295cb2a-Windows-clang.7z curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive% curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive_deps% +curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive_x64% +curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive_deps_x64% 7z x %download_archive% * -olibrime\ -y 7z x %download_archive_deps% * -olibrime\ -y +7z x %download_archive_x64% * -olibrime_x64\ -y +7z x %download_archive_deps_x64% * -olibrime_x64\ -y copy /Y librime\dist\include\rime_*.h include\ copy /Y librime\dist\lib\rime.lib lib\ copy /Y librime\dist\lib\rime.dll output\ +copy /Y librime_x64\dist\lib\rime.dll output\x64\ +copy /Y librime_x64\dist\lib\rime.lib lib\rimex64.lib + if not exist output\data\opencc mkdir output\data\opencc copy /Y librime\share\opencc\*.* output\data\opencc\ diff --git a/include/WeaselUtility.h b/include/WeaselUtility.h index dd0aec4d2..9e1cd55d9 100644 --- a/include/WeaselUtility.h +++ b/include/WeaselUtility.h @@ -76,5 +76,29 @@ inline std::string wstring_to_string(const std::wstring& wstr, int code_page = C return res; } +inline bool IfFileExistW(std::wstring filepathw) +{ + DWORD dwAttrib = GetFileAttributes(filepathw.c_str()); + return (INVALID_FILE_ATTRIBUTES != dwAttrib && 0 == (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); +} + +inline bool IfFileExist(std::string filepath, int code_page = CP_ACP) +{ + std::wstring filepathw{string_to_wstring(filepath, code_page)}; + DWORD dwAttrib = GetFileAttributes(filepathw.c_str()); + return (INVALID_FILE_ATTRIBUTES != dwAttrib && 0 == (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); +} + +inline bool is_wow64() { + DWORD errorCode; + if (GetSystemWow64DirectoryW(NULL, 0) == 0) + if ((errorCode = GetLastError()) == ERROR_CALL_NOT_IMPLEMENTED) + return false; + else + ExitProcess((UINT)errorCode); + else + return true; +} + // resource std::string GetCustomResource(const char *name, const char *type); diff --git a/librime b/librime index 6546689a2..295cb2ab6 160000 --- a/librime +++ b/librime @@ -1 +1 @@ -Subproject commit 6546689a2c9061860a0af5fa1209f9e8ea7d2132 +Subproject commit 295cb2ab68f89ee9d3237c7d4b8033bda3f3b635 diff --git a/output/install.nsi b/output/install.nsi index 3ff59f57f..cfbfc599d 100644 --- a/output/install.nsi +++ b/output/install.nsi @@ -206,6 +206,12 @@ program_files: ; images SetOutPath $INSTDIR\data\preview File "data\preview\*.png" + ; WeaselDeployerx64 files + ${If} ${RunningX64} + SetOutPath $INSTDIR\x64 + File /nonfatal "x64\WeaselDeployer.exe" + File /nonfatal "x64\rime.dll" + ${EndIf} SetOutPath $INSTDIR diff --git a/output/x64/.placeholder b/output/x64/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/weasel.sln b/weasel.sln index 7c90e714c..6104f0cb9 100644 --- a/weasel.sln +++ b/weasel.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.5.33516.290 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33529.622 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{53F79A24-5390-4640-84B5-19984EB3353B}" ProjectSection(SolutionItems) = preProject @@ -136,17 +136,20 @@ Global {1C497821-BD63-4F02-9094-32B185B62F23}.Debug|Win32.ActiveCfg = Debug|Win32 {1C497821-BD63-4F02-9094-32B185B62F23}.Debug|Win32.Build.0 = Debug|Win32 {1C497821-BD63-4F02-9094-32B185B62F23}.Debug|x64.ActiveCfg = Debug|x64 + {1C497821-BD63-4F02-9094-32B185B62F23}.Debug|x64.Build.0 = Debug|x64 {1C497821-BD63-4F02-9094-32B185B62F23}.Release|Win32.ActiveCfg = Release|Win32 {1C497821-BD63-4F02-9094-32B185B62F23}.Release|Win32.Build.0 = Release|Win32 {1C497821-BD63-4F02-9094-32B185B62F23}.Release|x64.ActiveCfg = Release|x64 + {1C497821-BD63-4F02-9094-32B185B62F23}.Release|x64.Build.0 = Release|x64 {1C497821-BD63-4F02-9094-32B185B62F23}.ReleaseHant|Win32.ActiveCfg = ReleaseHant|Win32 {1C497821-BD63-4F02-9094-32B185B62F23}.ReleaseHant|x64.ActiveCfg = ReleaseHant|x64 - {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Debug|Win32.ActiveCfg = Debug|Win32 - {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Debug|Win32.Build.0 = Debug|Win32 + {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Debug|Win32.ActiveCfg = Debug|x64 + {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Debug|Win32.Build.0 = Debug|x64 {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Debug|x64.ActiveCfg = Debug|Win32 {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Release|Win32.ActiveCfg = Release|Win32 {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Release|Win32.Build.0 = Release|Win32 - {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Release|x64.ActiveCfg = Release|Win32 + {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Release|x64.ActiveCfg = Release|x64 + {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.Release|x64.Build.0 = Release|x64 {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.ReleaseHant|Win32.ActiveCfg = Release|Win32 {F53F3E9C-CC4D-4D1D-9C2E-719FE60A7E6B}.ReleaseHant|x64.ActiveCfg = Release|Win32 {39F6E3F5-8F0B-4023-BC40-A66AE6C37095}.Debug|Win32.ActiveCfg = Debug|Win32