diff --git a/.github/scripts/build_lunahook.py b/.github/scripts/build_lunahook.py index 9d28b04c..51e9d532 100644 --- a/.github/scripts/build_lunahook.py +++ b/.github/scripts/build_lunahook.py @@ -66,10 +66,8 @@ cmake --build ../build/x64_{lang} --config Release --target ALL_BUILD -j 14 def build_langx_xp(lang): url = "https://github.com/Chuyu-Team/YY-Thunks/releases/download/v1.0.7/YY-Thunks-1.0.7-Binary.zip" - target = "YY-Thunks/objs/X86/YY_Thunks_for_WinXP.obj" - if os.path.exists(target) == False: - os.system(rf"curl -SLo YY-Thunks-1.0.7-Binary.zip " + url) - os.system(rf"7z x -y YY-Thunks-1.0.7-Binary.zip -o../YY-Thunks") + os.system(rf"curl -SLo YY-Thunks-1.0.7-Binary.zip " + url) + os.system(rf"7z x -y YY-Thunks-1.0.7-Binary.zip -o../../libs/YY-Thunks") os.system("dir") with open("do.bat", "w") as ff: ff.write( diff --git a/.github/scripts/build_lunatranslator.py b/.github/scripts/build_lunatranslator.py index 732e0ef3..d46a9497 100644 --- a/.github/scripts/build_lunatranslator.py +++ b/.github/scripts/build_lunatranslator.py @@ -205,7 +205,7 @@ def buildPlugins(arch): f"cmake --build ../build/x86 --config Release --target ALL_BUILD -j 14" ) # subprocess.run(f"python copytarget.py 1") - else: + elif arch=='x64': subprocess.run( f'cmake ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64 -DCMAKE_SYSTEM_VERSION=10.0.26621.0' ) @@ -213,8 +213,20 @@ def buildPlugins(arch): f"cmake --build ../build/x64 --config Release --target ALL_BUILD -j 14" ) # subprocess.run(f"python copytarget.py 0") + elif arch=='xp': + url = "https://github.com/Chuyu-Team/YY-Thunks/releases/download/v1.0.7/YY-Thunks-1.0.7-Binary.zip" + os.system(rf"curl -SLo YY-Thunks-1.0.7-Binary.zip " + url) + os.system(rf"7z x -y YY-Thunks-1.0.7-Binary.zip -o../libs/YY-Thunks") + with open("do.bat", "w") as ff: + ff.write( + rf""" - +cmake -DWINXP=ON ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_xp +cmake --build ../build/x86_xp --config Release --target ALL_BUILD -j 14 +call dobuildxp.bat +""" + ) + os.system(f"cmd /c do.bat") def downloadsomething(): pass # shutil.rmtree(rootDir + "\\files\\LunaTranslator_qss\\.git") diff --git a/.github/workflows/buildluna.yml b/.github/workflows/buildluna.yml index eee4fdd1..e6b417dd 100644 --- a/.github/workflows/buildluna.yml +++ b/.github/workflows/buildluna.yml @@ -2,6 +2,21 @@ name: buildluna on: workflow_call: jobs: + build_cpp_xp: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 + with: + sdk-version: 22621 + + - run: python .github/scripts/build_lunatranslator.py cpp xp + - uses: actions/upload-artifact@v4 + with: + name: cpp_xp + path: cpp/builds hook_xp: runs-on: windows-2019 permissions: diff --git a/.gitignore b/.gitignore index 6a5ca737..f90246b6 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,5 @@ cpp/libs/onnxruntime-static.zip cpp/libs/onnxruntime-static/onnxruntime-static.7z cpp/libs/opencv-static/opencv-static.7z cpp/LunaHook/.vscode/settings.json -cpp/LunaHook/YY-Thunks cpp/LunaHook/scripts/YY-Thunks-1.0.7-Binary.zip +cpp/libs/YY-Thunks diff --git a/cpp/LunaHook/CMakeLists.txt b/cpp/LunaHook/CMakeLists.txt index 6f40ef38..0662ab8d 100644 --- a/cpp/LunaHook/CMakeLists.txt +++ b/cpp/LunaHook/CMakeLists.txt @@ -40,10 +40,8 @@ option(WINXP "WINXP" OFF) if(WINXP) set(WINXPAPP "_winxp") -set(YY_Thunks_for_WinXP ${CMAKE_CURRENT_LIST_DIR}/YY-Thunks/objs/X86/YY_Thunks_for_WinXP.obj) else() set(WINXPAPP "") -set(YY_Thunks_for_WinXP) endif() add_definitions(-DLANGUAGE=${LANGUAGE}) diff --git a/cpp/LunaOCR/CMakeLists.txt b/cpp/LunaOCR/CMakeLists.txt index 87734ac0..0bcc0e18 100644 --- a/cpp/LunaOCR/CMakeLists.txt +++ b/cpp/LunaOCR/CMakeLists.txt @@ -14,7 +14,7 @@ set(OpenCV_STATIC ON) find_package(OpenCV REQUIRED) add_library(LunaOCR SHARED OCR.cpp ${versioninfo}) -target_link_libraries(LunaOCR ${OnnxRuntime_LIBS} ${OpenCV_LIBS} Clipper2Lib) +target_link_libraries(LunaOCR ${OnnxRuntime_LIBS} ${OpenCV_LIBS} Clipper2Lib ${YY_Thunks_for_WinXP}) target_precompile_headers(LunaOCR REUSE_FROM pch) if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) diff --git a/cpp/exec/CMakeLists.txt b/cpp/exec/CMakeLists.txt index 368967d8..1f582edd 100644 --- a/cpp/exec/CMakeLists.txt +++ b/cpp/exec/CMakeLists.txt @@ -18,8 +18,15 @@ set(sources PyStand.cpp luna.rc ${versioninfo}) add_executable(LunaTranslator_debug ${sources}) target_compile_definitions(LunaTranslator_debug PRIVATE PYSTAND_CONSOLE) add_executable(LunaTranslator WIN32 ${sources}) +if(not WINXP) add_executable(LunaTranslator_admin WIN32 ${sources}) set_target_properties(LunaTranslator_admin PROPERTIES LINK_FLAGS " /MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" ") -target_precompile_headers(LunaTranslator_debug REUSE_FROM pch) target_precompile_headers(LunaTranslator_admin REUSE_FROM pch) -target_precompile_headers(LunaTranslator REUSE_FROM pch) \ No newline at end of file +endif() +target_precompile_headers(LunaTranslator REUSE_FROM pch) +target_precompile_headers(LunaTranslator_debug REUSE_FROM pch) + +if(WINXP) +target_link_libraries(LunaTranslator ${YY_Thunks_for_WinXP}) +target_link_libraries(LunaTranslator_debug ${YY_Thunks_for_WinXP}) +endif() \ No newline at end of file diff --git a/cpp/libs/libs.cmake b/cpp/libs/libs.cmake index 44e5120e..c652face 100644 --- a/cpp/libs/libs.cmake +++ b/cpp/libs/libs.cmake @@ -44,4 +44,11 @@ set(OpenCV_DIR ${CMAKE_CURRENT_LIST_DIR}/opencv-static/windows-x86) set(OpenCV_ARCH x86) endif() set(OpenCV_RUNTIME vc16) +endif() + +option(WINXP "WINXP" OFF) +if(WINXP) +set(YY_Thunks_for_WinXP ${CMAKE_CURRENT_LIST_DIR}/YY-Thunks/objs/X86/YY_Thunks_for_WinXP.obj) +else() +set(YY_Thunks_for_WinXP) endif() \ No newline at end of file diff --git a/cpp/shareddllproxy/CMakeLists.txt b/cpp/shareddllproxy/CMakeLists.txt index cddc745a..076a0b03 100644 --- a/cpp/shareddllproxy/CMakeLists.txt +++ b/cpp/shareddllproxy/CMakeLists.txt @@ -28,6 +28,6 @@ if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy64") else() target_precompile_headers(voiceroid2 REUSE_FROM pch) - target_link_libraries(shareddllproxy nlohmann Mfplat mfuuid voiceroid2 Detours) + target_link_libraries(shareddllproxy nlohmann Mfplat mfuuid voiceroid2 Detours ${YY_Thunks_for_WinXP}) set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy32") endif() \ No newline at end of file diff --git a/cpp/wcocr/CMakeLists.txt b/cpp/wcocr/CMakeLists.txt index 1a8df647..6dffaab1 100644 --- a/cpp/wcocr/CMakeLists.txt +++ b/cpp/wcocr/CMakeLists.txt @@ -25,6 +25,6 @@ if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) target_link_libraries(wcocr ${CMAKE_SOURCE_DIR}/libs/wechat-ocr/spt/x64/libprotobuf-lite.lib ${CMAKE_SOURCE_DIR}/libs/wechat-ocr/spt/x64/mmmojo_64.lib) target_link_options(wcocr PRIVATE "/DELAYLOAD:mmmojo_64.dll") else() - target_link_libraries(wcocr ${CMAKE_SOURCE_DIR}/libs/wechat-ocr/spt/x86/libprotobuf-lite.lib ${CMAKE_SOURCE_DIR}/libs/wechat-ocr/spt/x86/mmmojo.lib) + target_link_libraries(wcocr ${CMAKE_SOURCE_DIR}/libs/wechat-ocr/spt/x86/libprotobuf-lite.lib ${CMAKE_SOURCE_DIR}/libs/wechat-ocr/spt/x86/mmmojo.lib ${YY_Thunks_for_WinXP}) target_link_options(wcocr PRIVATE "/DELAYLOAD:mmmojo.dll") endif() diff --git a/cpp/winsharedutils/CMakeLists.txt b/cpp/winsharedutils/CMakeLists.txt index cffdaee3..649e9f41 100644 --- a/cpp/winsharedutils/CMakeLists.txt +++ b/cpp/winsharedutils/CMakeLists.txt @@ -14,7 +14,7 @@ add_library(winsharedutils MODULE mp3enc.cpp webview2_extra.cpp AreoAcrylic.cpp applicationloopbackaudio/runer.cpp applicationloopbackaudio/LoopbackCapture.cpp SimpleBrowser.cpp MWebBrowser.cpp icon.cpp ${versioninfo}) target_precompile_headers(winsharedutils REUSE_FROM pch) -target_link_libraries(winsharedutils tinymp3 Shcore rapidfuzz wil webview2 Mfplat mfuuid Mmdevapi) +target_link_libraries(winsharedutils tinymp3 Shcore rapidfuzz wil webview2 Mfplat mfuuid Mmdevapi ${YY_Thunks_for_WinXP}) target_link_options(winsharedutils PRIVATE "/DELAYLOAD:Mmdevapi.dll") target_link_options(winsharedutils PRIVATE "/DELAYLOAD:Mfplat.dll") if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)