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

View File

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