build milepost directly into build/bin

This commit is contained in:
Martin Fouilleul 2023-08-09 15:49:05 +02:00
parent 778048e415
commit b4b8755d74
2 changed files with 18 additions and 28 deletions

View File

@ -69,8 +69,8 @@ def macos_make_app(args):
#----------------------------------------------------------- #-----------------------------------------------------------
orca_exe = os.path.join(args.orca_dir, 'build/bin/orca') orca_exe = os.path.join(args.orca_dir, 'build/bin/orca')
milepost_lib = os.path.join(args.orca_dir, 'build/bin/libmilepost.dylib') milepost_lib = os.path.join(args.orca_dir, 'build/bin/libmilepost.dylib')
gles_lib = os.path.join(args.orca_dir, 'build/bin/libGLESv2.dylib') gles_lib = os.path.join(args.orca_dir, 'ext/angle/bin/libGLESv2.dylib')
egl_lib = os.path.join(args.orca_dir, 'build/bin/libEGL.dylib') egl_lib = os.path.join(args.orca_dir, 'ext/angle/bin/libEGL.dylib')
renderer_lib = os.path.join(args.orca_dir, 'build/bin/mtl_renderer.metallib') renderer_lib = os.path.join(args.orca_dir, 'build/bin/mtl_renderer.metallib')
shutil.copy(orca_exe, exe_dir) shutil.copy(orca_exe, exe_dir)
@ -104,7 +104,6 @@ def macos_make_app(args):
shutil.copy(os.path.join(args.orca_dir, 'resources/OpenSansLatinSubset.ttf'), res_dir) shutil.copy(os.path.join(args.orca_dir, 'resources/OpenSansLatinSubset.ttf'), res_dir)
shutil.copy(os.path.join(args.orca_dir, 'resources/Menlo.ttf'), res_dir) shutil.copy(os.path.join(args.orca_dir, 'resources/Menlo.ttf'), res_dir)
shutil.copy(os.path.join(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(os.path.join(args.orca_dir, 'resources/Menlo Italics.ttf'), res_dir)
#----------------------------------------------------------- #-----------------------------------------------------------
#NOTE make icon #NOTE make icon
@ -207,8 +206,8 @@ def windows_make_app(args):
#----------------------------------------------------------- #-----------------------------------------------------------
orca_exe = os.path.join(args.orca_dir, 'build/bin/orca.exe') orca_exe = os.path.join(args.orca_dir, 'build/bin/orca.exe')
milepost_lib = os.path.join(args.orca_dir, 'build/bin/milepost.dll') milepost_lib = os.path.join(args.orca_dir, 'build/bin/milepost.dll')
gles_lib = os.path.join(args.orca_dir, 'milepost/build/bin/libGLESv2.dll') gles_lib = os.path.join(args.orca_dir, 'ext/angle/bin/libGLESv2.dll')
egl_lib = os.path.join(args.orca_dir, 'milepost/build/bin/libEGL.dll') egl_lib = os.path.join(args.orca_dir, 'ext/angle/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)

View File

@ -76,9 +76,8 @@ def clean(args):
def build_milepost(target, release): def build_milepost(target, release):
print("Building milepost...") print("Building milepost...")
with pushd("milepost"): with pushd("milepost"):
os.makedirs("build/bin", exist_ok=True) os.makedirs("../build/bin", exist_ok=True)
os.makedirs("build/lib", exist_ok=True) os.makedirs("../build/lib", exist_ok=True)
os.makedirs("resources", exist_ok=True)
if target == "lib": if target == "lib":
if platform.system() == "Windows": if platform.system() == "Windows":
@ -149,8 +148,8 @@ def build_milepost_lib_win(release):
"/LD", "/link", "/LD", "/link",
"/MANIFEST:EMBED", "/MANIFESTINPUT:src/win32_manifest.xml", "/MANIFEST:EMBED", "/MANIFESTINPUT:src/win32_manifest.xml",
*libs, *libs,
"/OUT:build/bin/milepost.dll", "/OUT:../build/bin/milepost.dll",
"/IMPLIB:build/bin/milepost.dll.lib", "/IMPLIB:../build/bin/milepost.dll.lib",
], check=True) ], check=True)
@ -168,13 +167,13 @@ def build_milepost_lib_mac(release):
"xcrun", "-sdk", "macosx", "metal", "xcrun", "-sdk", "macosx", "metal",
# TODO: shaderFlagParam # TODO: shaderFlagParam
"-fno-fast-math", "-c", "-fno-fast-math", "-c",
"-o", "build/mtl_renderer.air", "-o", "../build/mtl_renderer.air",
"src/mtl_renderer.metal", "src/mtl_renderer.metal",
], check=True) ], check=True)
subprocess.run([ subprocess.run([
"xcrun", "-sdk", "macosx", "metallib", "xcrun", "-sdk", "macosx", "metallib",
"-o", "build/bin/mtl_renderer.metallib", "-o", "../build/bin/mtl_renderer.metallib",
"build/mtl_renderer.air", "../build/mtl_renderer.air",
], check=True) ], check=True)
# compile milepost. We use one compilation unit for all C code, and one # compile milepost. We use one compilation unit for all C code, and one
@ -182,14 +181,14 @@ def build_milepost_lib_mac(release):
subprocess.run([ subprocess.run([
"clang", "clang",
*debug_flags, "-c", *debug_flags, "-c",
"-o", "build/milepost_c.o", "-o", "../build/milepost_c.o",
*cflags, *flags, *includes, *cflags, *flags, *includes,
"src/milepost.c" "src/milepost.c"
], check=True) ], check=True)
subprocess.run([ subprocess.run([
"clang", "clang",
*debug_flags, "-c", *debug_flags, "-c",
"-o", "build/milepost_objc.o", "-o", "../build/milepost_objc.o",
*flags, *includes, *flags, *includes,
"src/milepost.m" "src/milepost.m"
], check=True) ], check=True)
@ -198,8 +197,8 @@ def build_milepost_lib_mac(release):
subprocess.run([ subprocess.run([
"ld", "ld",
*ldflags, "-dylib", *ldflags, "-dylib",
"-o", "build/bin/libmilepost.dylib", "-o", "../build/bin/libmilepost.dylib",
"build/milepost_c.o", "build/milepost_objc.o", "../build/milepost_c.o", "../build/milepost_objc.o",
"-L../ext/angle/bin", "-lc", "-L../ext/angle/bin", "-lc",
"-framework", "Carbon", "-framework", "Cocoa", "-framework", "Metal", "-framework", "QuartzCore", "-framework", "Carbon", "-framework", "Cocoa", "-framework", "Metal", "-framework", "QuartzCore",
"-weak-lEGL", "-weak-lGLESv2", "-weak-lEGL", "-weak-lGLESv2",
@ -209,12 +208,12 @@ def build_milepost_lib_mac(release):
subprocess.run([ subprocess.run([
"install_name_tool", "install_name_tool",
"-change", "./libEGL.dylib", "@rpath/libEGL.dylib", "-change", "./libEGL.dylib", "@rpath/libEGL.dylib",
"build/bin/libmilepost.dylib", "../build/bin/libmilepost.dylib",
], check=True) ], check=True)
subprocess.run([ subprocess.run([
"install_name_tool", "install_name_tool",
"-change", "./libGLESv2.dylib", "@rpath/libGLESv2.dylib", "-change", "./libGLESv2.dylib", "@rpath/libGLESv2.dylib",
"build/bin/libmilepost.dylib", "../build/bin/libmilepost.dylib",
], check=True) ], check=True)
# add executable path to rpath. Client executable can still add its own # add executable path to rpath. Client executable can still add its own
@ -222,7 +221,7 @@ def build_milepost_lib_mac(release):
subprocess.run([ subprocess.run([
"install_name_tool", "install_name_tool",
"-id", "@rpath/libmilepost.dylib", "-id", "@rpath/libmilepost.dylib",
"build/bin/libmilepost.dylib", "../build/bin/libmilepost.dylib",
], check=True) ], check=True)
@ -296,9 +295,6 @@ def build_orca(release):
def build_orca_win(release): def build_orca_win(release):
# copy libraries
shutil.copy("milepost/build/bin/milepost.dll", "build/bin")
shutil.copy("milepost/build/bin/milepost.dll.lib", "build/bin")
gen_all_bindings() gen_all_bindings()
@ -328,11 +324,6 @@ def build_orca_win(release):
def build_orca_mac(release): def build_orca_mac(release):
# copy libraries
shutil.copy("milepost/build/bin/mtl_renderer.metallib", "build/bin/")
shutil.copy("milepost/build/bin/libmilepost.dylib", "build/bin/")
shutil.copy("ext/angle/bin/libGLESv2.dylib", "build/bin/")
shutil.copy("ext/angle/bin/libEGL.dylib", "build/bin/")
includes = [ includes = [
"-Isrc", "-Isrc",