Convert build scripts to Python #31
|
@ -0,0 +1,7 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
rem Get the directory of this batch script
|
||||||
|
set "script_dir=%~dp0"
|
||||||
|
|
||||||
|
python3 "%script_dir%orca" %*
|
||||||
|
exit /b %errorlevel%
|
|
@ -14,4 +14,4 @@ set wasmFlags=--target=wasm32^
|
||||||
|
|
||||||
clang %wasmFlags% -o .\module.wasm ..\..\sdk\orca.c ..\..\cstdlib\src\*.c src\main.c
|
clang %wasmFlags% -o .\module.wasm ..\..\sdk\orca.c ..\..\cstdlib\src\*.c src\main.c
|
||||||
|
|
||||||
python3 ..\..\scripts\mkapp.py --orca-dir ..\.. --name Pong --icon icon.png --resource-dir data module.wasm
|
orca bundle --orca-dir ..\.. --name Pong --icon icon.png --resource-dir data module.wasm
|
||||||
|
|
|
@ -14,4 +14,4 @@ set wasmFlags=--target=wasm32^
|
||||||
|
|
||||||
clang %wasmFlags% -o .\module.wasm ..\..\sdk\orca.c ..\..\cstdlib\src\*.c src\main.c
|
clang %wasmFlags% -o .\module.wasm ..\..\sdk\orca.c ..\..\cstdlib\src\*.c src\main.c
|
||||||
|
|
||||||
python3 ..\..\scripts\mkapp.py --orca-dir ..\.. --name UI --resource-dir data module.wasm
|
orca bundle --orca-dir ..\.. --name UI --resource-dir data module.wasm
|
||||||
|
|
|
@ -184,12 +184,12 @@ def windows_make_app(args):
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
app_name = args.name
|
app_name = args.name
|
||||||
bundle_name = app_name
|
bundle_name = app_name
|
||||||
bundle_dir = args.out_dir + '/' + bundle_name
|
bundle_dir = os.path.join(args.out_dir, bundle_name)
|
||||||
exe_dir = bundle_dir + '/bin'
|
exe_dir = os.path.join(bundle_dir, 'bin')
|
||||||
res_dir = bundle_dir + '/resources'
|
res_dir = os.path.join(bundle_dir, 'resources')
|
||||||
guest_dir = bundle_dir + '/app'
|
guest_dir = os.path.join(bundle_dir, 'app')
|
||||||
wasm_dir = guest_dir + '/wasm'
|
wasm_dir = os.path.join(guest_dir, 'wasm')
|
||||||
data_dir = guest_dir + '/data'
|
data_dir = os.path.join(guest_dir, 'data')
|
||||||
|
|
||||||
if os.path.exists(bundle_dir):
|
if os.path.exists(bundle_dir):
|
||||||
shutil.rmtree(bundle_dir)
|
shutil.rmtree(bundle_dir)
|
||||||
|
@ -203,10 +203,10 @@ def windows_make_app(args):
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
#NOTE: copy orca runtime executable and libraries
|
#NOTE: copy orca runtime executable and libraries
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
orca_exe = args.orca_dir + '/build/bin/orca.exe'
|
orca_exe = os.path.join(args.orca_dir, 'build/bin/orca.exe')
|
||||||
milepost_lib = args.orca_dir + '/build/bin/milepost.dll'
|
milepost_lib = os.path.join(args.orca_dir, 'build/bin/milepost.dll')
|
||||||
gles_lib = args.orca_dir + '/milepost/build/bin/libGLESv2.dll'
|
gles_lib = os.path.join(args.orca_dir, 'milepost/build/bin/libGLESv2.dll')
|
||||||
egl_lib = args.orca_dir + '/milepost/build/bin/libEGL.dll'
|
egl_lib = os.path.join(args.orca_dir, 'milepost/build/bin/libEGL.dll')
|
||||||
|
|
||||||
shutil.copy(orca_exe, exe_dir)
|
shutil.copy(orca_exe, exe_dir)
|
||||||
shutil.copy(milepost_lib, exe_dir)
|
shutil.copy(milepost_lib, exe_dir)
|
||||||
|
@ -236,10 +236,10 @@ def windows_make_app(args):
|
||||||
#NOTE: copy runtime resources
|
#NOTE: copy runtime resources
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
# default fonts
|
# default fonts
|
||||||
shutil.copy(args.orca_dir + '/resources/OpenSansLatinSubset.ttf', res_dir)
|
shutil.copy(os.path.join(args.orca_dir, 'resources/OpenSansLatinSubset.ttf'), res_dir)
|
||||||
shutil.copy(args.orca_dir + '/resources/Menlo.ttf', res_dir)
|
shutil.copy(os.path.join(args.orca_dir, 'resources/Menlo.ttf'), res_dir)
|
||||||
shutil.copy(args.orca_dir + '/resources/Menlo Bold.ttf', res_dir)
|
shutil.copy(os.path.join(args.orca_dir, 'resources/Menlo Bold.ttf'), res_dir)
|
||||||
shutil.copy(args.orca_dir + '/resources/Menlo Italics.ttf', res_dir)
|
shutil.copy(os.path.join(args.orca_dir, 'resources/Menlo Italics.ttf'), res_dir)
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
#NOTE make icon
|
#NOTE make icon
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"scripts/files/angle-windows-2019-2023-07-05.zip": "a333b5ccc8462151ee8df65c43cfacd70d9db2413f2e495da65670737b5b2d96",
|
"scripts/files/angle-windows-2019-2023-07-05.zip": "a333b5ccc8462151ee8df65c43cfacd70d9db2413f2e495da65670737b5b2d96",
|
||||||
"scripts/files/angle-macos-jank-2023-07-05.zip": "c234b8db179a24757ab9f46610a032123718dd9bed967d2bf8e27d0d17eb0aff",
|
"scripts/files/angle-macos-jank-2023-07-05.zip": "c234b8db179a24757ab9f46610a032123718dd9bed967d2bf8e27d0d17eb0aff",
|
||||||
"milepost/lib/libEGL.dll": "b7bf51f83e88129ddc20c0c2cb904ec04c89059a30a2cd29b9b1ea11c80388fb",
|
"milepost/build/bin/libEGL.dll": "b7bf51f83e88129ddc20c0c2cb904ec04c89059a30a2cd29b9b1ea11c80388fb",
|
||||||
"milepost/lib/libEGL.dll.lib": "4cec54c534136da413dea86bd271ccb9c5ae88e40aa91d1de7a01e701be8e1d7",
|
"milepost/build/bin/libEGL.dll.lib": "4cec54c534136da413dea86bd271ccb9c5ae88e40aa91d1de7a01e701be8e1d7",
|
||||||
"milepost/lib/libGLESv2.dll": "193b53b0a16b702eaa28a73e84527acf7aecfd665e3e3f54a8d9db9ae73111e1",
|
"milepost/build/bin/libGLESv2.dll": "193b53b0a16b702eaa28a73e84527acf7aecfd665e3e3f54a8d9db9ae73111e1",
|
||||||
"milepost/lib/libGLESv2.dll.lib": "ee87aac129efe8fe871825d181b85da1b1ea6626cb48be52c2e689f2804b953f",
|
"milepost/build/bin/libGLESv2.dll.lib": "ee87aac129efe8fe871825d181b85da1b1ea6626cb48be52c2e689f2804b953f",
|
||||||
"milepost/build/bin/libEGL.dylib": "96baea4b1c8578d30738764784d07b509d1153df694c094faba2ee8ccbfde2a9",
|
"milepost/build/bin/libEGL.dylib": "96baea4b1c8578d30738764784d07b509d1153df694c094faba2ee8ccbfde2a9",
|
||||||
"milepost/build/bin/libGLESv2.dylib": "98ce9f6248a6447ba9199e96b8f6d87df9548d43ce583a2615717aab168ecb71"
|
"milepost/build/bin/libGLESv2.dylib": "98ce9f6248a6447ba9199e96b8f6d87df9548d43ce583a2615717aab168ecb71"
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ def build_milepost_lib_win(release):
|
||||||
"ole32.lib",
|
"ole32.lib",
|
||||||
"shell32.lib",
|
"shell32.lib",
|
||||||
"shlwapi.lib",
|
"shlwapi.lib",
|
||||||
"/LIBPATH:./bin",
|
"/LIBPATH:./build/bin",
|
||||||
"libEGL.dll.lib",
|
"libEGL.dll.lib",
|
||||||
"libGLESv2.dll.lib",
|
"libGLESv2.dll.lib",
|
||||||
"/DELAYLOAD:libEGL.dll",
|
"/DELAYLOAD:libEGL.dll",
|
||||||
|
@ -137,17 +137,17 @@ def build_milepost_lib_win(release):
|
||||||
]
|
]
|
||||||
|
|
||||||
subprocess.run([
|
subprocess.run([
|
||||||
"cl",
|
"cl", "/nologo",
|
||||||
"/we4013", "/Zi", "/Zc:preprocessor",
|
"/we4013", "/Zi", "/Zc:preprocessor",
|
||||||
"/DMP_BUILD_DLL",
|
"/DMP_BUILD_DLL",
|
||||||
"/std:c11", "/experimental:c11atomics",
|
"/std:c11", "/experimental:c11atomics",
|
||||||
*includes,
|
*includes,
|
||||||
"src/milepost.c", "/Fo:bin/milepost.o",
|
"src/milepost.c", "/Fo:build/bin/milepost.o",
|
||||||
"/LD", "/link",
|
"/LD", "/link",
|
||||||
"/MANIFEST:EMBED", "/MANIFESTINPUT:src/win32_manifest.xml",
|
"/MANIFEST:EMBED", "/MANIFESTINPUT:src/win32_manifest.xml",
|
||||||
*libs,
|
*libs,
|
||||||
"/OUT:bin/milepost.dll",
|
"/OUT:build/bin/milepost.dll",
|
||||||
"/IMPLIB:bin/milepost.dll.lib",
|
"/IMPLIB:build/bin/milepost.dll.lib",
|
||||||
], check=True)
|
], check=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,19 +240,19 @@ def build_wasm3(release):
|
||||||
|
|
||||||
|
|
||||||
def build_wasm3_lib_win(release):
|
def build_wasm3_lib_win(release):
|
||||||
for f in glob.iglob(".\\ext\\wasm3\\source\\*.c"):
|
for f in glob.iglob("./ext/wasm3/source/*.c"):
|
||||||
name = os.path.splitext(os.path.basename(f))[0]
|
name = os.path.splitext(os.path.basename(f))[0]
|
||||||
subprocess.run([
|
subprocess.run([
|
||||||
"cl", "/nologo",
|
"cl", "/nologo",
|
||||||
"/Zi", "/Zc:preprocessor", "/c",
|
"/Zi", "/Zc:preprocessor", "/c",
|
||||||
*(["/O2"] if release else []),
|
"/O2",
|
||||||
f"/Fo:bin\\obj\\{name}.obj",
|
f"/Fo:build/obj/{name}.obj",
|
||||||
"/I", ".\\ext\\wasm3\\source",
|
"/I", "./ext/wasm3/source",
|
||||||
f,
|
f,
|
||||||
], check=True)
|
], check=True)
|
||||||
subprocess.run([
|
subprocess.run([
|
||||||
"lib", "/nologo", "/out:bin\\wasm3.lib",
|
"lib", "/nologo", "/out:build/bin/wasm3.lib",
|
||||||
"bin\\obj\\*.obj",
|
"build/obj/*.obj",
|
||||||
], check=True)
|
], check=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,8 +294,8 @@ def build_orca(release):
|
||||||
|
|
||||||
def build_orca_win(release):
|
def build_orca_win(release):
|
||||||
# copy libraries
|
# copy libraries
|
||||||
shutil.copy("milepost\\bin\\milepost.dll", "bin")
|
shutil.copy("milepost/build/bin/milepost.dll", "build/bin")
|
||||||
shutil.copy("milepost\\bin\\milepost.dll.lib", "bin")
|
shutil.copy("milepost/build/bin/milepost.dll.lib", "build/bin")
|
||||||
|
|
||||||
gen_all_bindings()
|
gen_all_bindings()
|
||||||
|
|
||||||
|
@ -303,12 +303,12 @@ def build_orca_win(release):
|
||||||
includes = [
|
includes = [
|
||||||
"/I", "src",
|
"/I", "src",
|
||||||
"/I", "sdk",
|
"/I", "sdk",
|
||||||
"/I", "ext\wasm3\source",
|
"/I", "ext/wasm3/source",
|
||||||
"/I", "milepost\src",
|
"/I", "milepost/src",
|
||||||
"/I", "milepost\ext",
|
"/I", "milepost/ext",
|
||||||
]
|
]
|
||||||
libs = [
|
libs = [
|
||||||
"/LIBPATH:bin",
|
"/LIBPATH:build/bin",
|
||||||
"milepost.dll.lib",
|
"milepost.dll.lib",
|
||||||
"wasm3.lib",
|
"wasm3.lib",
|
||||||
]
|
]
|
||||||
|
@ -318,9 +318,9 @@ def build_orca_win(release):
|
||||||
"/Zi", "/Zc:preprocessor",
|
"/Zi", "/Zc:preprocessor",
|
||||||
"/std:c11", "/experimental:c11atomics",
|
"/std:c11", "/experimental:c11atomics",
|
||||||
*includes,
|
*includes,
|
||||||
"src\\main.c",
|
"src/main.c",
|
||||||
"/link", *libs,
|
"/link", *libs,
|
||||||
"/out:bin\\orca.exe",
|
"/out:build/bin/orca.exe",
|
||||||
], check=True)
|
], check=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -433,10 +433,10 @@ def verify_angle():
|
||||||
checkfiles = None
|
checkfiles = None
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
checkfiles = [
|
checkfiles = [
|
||||||
"milepost/lib/libEGL.dll",
|
"milepost/build/bin/libEGL.dll",
|
||||||
"milepost/lib/libEGL.dll.lib",
|
"milepost/build/bin/libEGL.dll.lib",
|
||||||
"milepost/lib/libGLESv2.dll",
|
"milepost/build/bin/libGLESv2.dll",
|
||||||
"milepost/lib/libGLESv2.dll.lib",
|
"milepost/build/bin/libGLESv2.dll.lib",
|
||||||
]
|
]
|
||||||
elif platform.system() == "Darwin":
|
elif platform.system() == "Darwin":
|
||||||
checkfiles = [
|
checkfiles = [
|
||||||
|
@ -466,7 +466,7 @@ def download_angle():
|
||||||
build = "windows-2019"
|
build = "windows-2019"
|
||||||
extensions = [
|
extensions = [
|
||||||
("dll", "milepost/build/bin/"),
|
("dll", "milepost/build/bin/"),
|
||||||
("lib", "milepost/build/lib/"),
|
("lib", "milepost/build/bin/"),
|
||||||
]
|
]
|
||||||
elif platform.system() == "Darwin":
|
elif platform.system() == "Darwin":
|
||||||
build = "macos-jank"
|
build = "macos-jank"
|
||||||
|
@ -494,7 +494,6 @@ def download_angle():
|
||||||
anglezip.extractall(path="scripts/files")
|
anglezip.extractall(path="scripts/files")
|
||||||
|
|
||||||
os.makedirs("milepost/build/bin", exist_ok=True)
|
os.makedirs("milepost/build/bin", exist_ok=True)
|
||||||
os.makedirs("milepost/build/lib", exist_ok=True)
|
|
||||||
for angleDir in ["bin", "lib"]:
|
for angleDir in ["bin", "lib"]:
|
||||||
for (ext, dest) in extensions:
|
for (ext, dest) in extensions:
|
||||||
for filepath in glob.glob(f"scripts/files/angle/{angleDir}/*.{ext}"):
|
for filepath in glob.glob(f"scripts/files/angle/{angleDir}/*.{ext}"):
|
||||||
|
@ -543,10 +542,13 @@ def yeet(path):
|
||||||
|
|
||||||
|
|
||||||
def install(args):
|
def install(args):
|
||||||
dest = os.path.expanduser(os.path.join("~", ".orca"))
|
if platform.system() == "Windows":
|
||||||
|
dest = os.path.join(os.getenv("LOCALAPPDATA"), "orca")
|
||||||
|
else:
|
||||||
|
dest = os.path.expanduser(os.path.join("~", ".orca"))
|
||||||
|
|
||||||
if not args.no_confirm:
|
if not args.no_confirm:
|
||||||
print("The Orca command-line tools will be installed to your home directory in:")
|
print("The Orca command-line tools will be installed to:")
|
||||||
print(dest)
|
print(dest)
|
||||||
print()
|
print()
|
||||||
while True:
|
while True:
|
||||||
|
@ -562,11 +564,21 @@ def install(args):
|
||||||
yeet(bin_dir)
|
yeet(bin_dir)
|
||||||
shutil.copytree("scripts", os.path.join(bin_dir, "sys_scripts"))
|
shutil.copytree("scripts", os.path.join(bin_dir, "sys_scripts"))
|
||||||
shutil.copy("orca", bin_dir)
|
shutil.copy("orca", bin_dir)
|
||||||
|
if platform.system() == "Windows":
|
||||||
|
shutil.copy("orca.bat", bin_dir)
|
||||||
|
|
||||||
# TODO: Customize these instructions for Windows
|
# TODO: Customize these instructions for Windows
|
||||||
print()
|
print()
|
||||||
print("The Orca tools have been installed. Make sure the Orca tools are on your PATH by")
|
if platform.system() == "Windows":
|
||||||
print("adding the following to your shell config:")
|
print("The Orca tools have been installed. Make sure the Orca tools are on your PATH by")
|
||||||
print()
|
print("adding the following path to your system PATH variable:")
|
||||||
print(f"export PATH=\"{bin_dir}:$PATH\"")
|
print()
|
||||||
|
print(bin_dir)
|
||||||
|
print()
|
||||||
|
print("You can do this in the Windows settings by searching for \"environment variables\".")
|
||||||
|
else:
|
||||||
|
print("The Orca tools have been installed. Make sure the Orca tools are on your PATH by")
|
||||||
|
print("adding the following to your shell config:")
|
||||||
|
print()
|
||||||
|
print(f"export PATH=\"{bin_dir}:$PATH\"")
|
||||||
print()
|
print()
|
||||||
|
|
Loading…
Reference in New Issue