Skip to content

Commit

Permalink
build script: improve magpie build
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayase authored and Ayase committed Apr 26, 2024
1 parent 8512137 commit 6029b91
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ def buildMecab():
subprocess.run(f"git clone {mecabUrl}")
os.chdir("mecab\\mecab")


os.makedirs(f"{rootDir}/ALL/DLL32",exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL64",exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL32", exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL64", exist_ok=True)
subprocess.run(f'cmd /c "{vcvars32Path}" & call make.bat')
shutil.move("src/libmecab.dll", f"{rootDir}/ALL/DLL32")

Expand All @@ -52,16 +51,12 @@ def buildWebview():
os.chdir(rootDir + "\\temp")
subprocess.run(f"git clone {webviewUrl}")
os.chdir("webview\\script")
os.makedirs(f"{rootDir}/ALL/DLL32",exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL64",exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL32", exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL64", exist_ok=True)
subprocess.run(f"cmd /c set TARGET_ARCH=x86 & call build.bat")
shutil.move(
"../build/library/webview.dll", f"{rootDir}/ALL/DLL32"
)
shutil.move("../build/library/webview.dll", f"{rootDir}/ALL/DLL32")
subprocess.run(f"cmd /c set TARGET_ARCH=x64 & call build.bat")
shutil.move(
"../build/library/webview.dll", f"{rootDir}/ALL/DLL64"
)
shutil.move("../build/library/webview.dll", f"{rootDir}/ALL/DLL64")


def buildLocaleRemulator():
Expand All @@ -70,7 +65,7 @@ def buildLocaleRemulator():
os.chdir("Locale_Remulator")
subprocess.run(f"nuget restore")
os.chdir("LRHook")
os.makedirs(f"{rootDir}/ALL/Locale_Remulator",exist_ok=True)
os.makedirs(f"{rootDir}/ALL/Locale_Remulator", exist_ok=True)
subprocess.run(
f'"{msbuildPath}" LRHook.vcxproj /p:Configuration=Release /p:Platform=x86'
)
Expand All @@ -87,7 +82,6 @@ def buildLocaleRemulator():
)



def buildLunaOCR():
os.chdir(rootDir + "\\temp")
subprocess.run(f"git clone {lunaOCRUrl}")
Expand Down Expand Up @@ -134,8 +128,8 @@ def buildLunaOCR():
subprocess.run(f"cmake --build . --config {buildType} --target install")

os.chdir(f"{rootDir}/temp/LunaOCR")
os.makedirs(f"{rootDir}/ALL/DLL32",exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL64",exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL32", exist_ok=True)
os.makedirs(f"{rootDir}/ALL/DLL64", exist_ok=True)
shutil.move(
f"build/win-{buildOutput}-{onnxType}-{arch32}/install/bin/LunaOCR32.dll",
f"{rootDir}/ALL/DLL32",
Expand All @@ -151,14 +145,13 @@ def buildMagpie():
subprocess.run(f"git clone {magpieUrl}")
os.chdir("Magpie_CLI")
subprocess.run(
f'"{msbuildPath}" -restore -p:RestorePackagesConfig=true;Configuration=Release;Platform=x64;OutDir={os.getcwd()}\\publish\\x64\\ Magpie.sln'
f'"{msbuildPath}" -restore -p:RestorePackagesConfig=true;Configuration=Release;Platform=x64;OutDir={os.getcwd()}\\publish\\x64\\ -t:Magpie_Core;Effects Magpie.sln'
)
os.makedirs(f"{rootDir}/ALL/Magpie", exist_ok=True)
shutil.move("publish/x64/Magpie.Core.exe", f"{rootDir}/ALL/Magpie")
shutil.move("publish/x64/effects", f"{rootDir}/ALL/Magpie")



if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -209,8 +202,6 @@ def buildMagpie():
if not os.path.exists("temp"):
os.mkdir("temp")



if not args.skip_build:
if not args.skip_vc_ltl:
installVCLTL()
Expand All @@ -220,6 +211,5 @@ def buildMagpie():
buildLunaOCR()
buildMagpie()


os.chdir(rootDir)
os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA -mx9 .\\ALL.zip .\\ALL')
os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA -mx9 .\\ALL.zip .\\ALL')

0 comments on commit 6029b91

Please sign in to comment.