From 4be8b7d88c8640897cad1aa39c904139908a812d Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Mon, 29 Jan 2024 18:47:29 -0800 Subject: [PATCH] update win-dist Signed-off-by: Nikolaj Bjorner --- scripts/mk_win_dist_cmake.py | 164 +++++++++++++++++++---------------- scripts/nightly.yaml | 12 +-- 2 files changed, 93 insertions(+), 83 deletions(-) diff --git a/scripts/mk_win_dist_cmake.py b/scripts/mk_win_dist_cmake.py index 54d4bfd0f32..146656f52aa 100644 --- a/scripts/mk_win_dist_cmake.py +++ b/scripts/mk_win_dist_cmake.py @@ -24,25 +24,24 @@ def getenv(name, default): return default BUILD_DIR = 'build-dist' -BUILD_X64_DIR = os.path.join('build-dist', 'x64') -BUILD_X86_DIR = os.path.join('build-dist', 'x86') -BUILD_ARM64_DIR = os.path.join('build-dist', 'arm64') # ARM64 build directory -VERBOSE = True DIST_DIR = 'dist' +BUILD_X64_DIR = os.path.join(BUILD_DIR, 'x64') +BUILD_X86_DIR = os.path.join(BUILD_DIR, 'x86') +BUILD_ARM64_DIR = os.path.join(BUILD_DIR, 'arm64') +VERBOSE = True FORCE_MK = False ASSEMBLY_VERSION = None DOTNET_CORE_ENABLED = True DOTNET_KEY_FILE = None JAVA_ENABLED = True +JULIA_ENABLED = False ZIP_BUILD_OUTPUTS = False GIT_HASH = False PYTHON_ENABLED = True X86ONLY = False X64ONLY = False -ARM64ONLY = False # ARM64 flag -MAKEJOBS = getenv("MAKEJOBS", "24") - -ARCHS = [] +ARM64ONLY = False +ARCHITECTURES = [] def set_verbose(flag): global VERBOSE @@ -53,15 +52,40 @@ def is_verbose(): def mk_dir(d): if not os.path.exists(d): + if is_verbose(): + print("Make directory", d) os.makedirs(d) +def get_z3_name(arch): + version = "4" + if ASSEMBLY_VERSION: + version = ASSEMBLY_VERSION + print("Assembly version:", version) + if GIT_HASH: + return 'z3-%s.%s-%s-win' % (version, get_git_hash(), arch) + else: + return 'z3-%s-%s-win' % (version, arch) + +def get_build_dir(arch): + return ARCHITECTURES[arch] + +def get_build_dist_path(arch): + return os.path.join(get_build_dir(arch), DIST_DIR) + +def get_bin_path(arch): + return os.path.join(get_build_dist_path(arch), "bin") + +def get_dist_path(arch): + return os.path.join(DIST_DIR, arch) + + def set_build_dir(path): - global BUILD_DIR, BUILD_X86_DIR, BUILD_X64_DIR, BUILD_ARM64_DIR, ARCHS + global BUILD_DIR, BUILD_X86_DIR, BUILD_X64_DIR, BUILD_ARM64_DIR, ARCHITECTURES BUILD_DIR = os.path.expanduser(os.path.normpath(path)) BUILD_X86_DIR = os.path.join(path, 'x86') BUILD_X64_DIR = os.path.join(path, 'x64') BUILD_ARM64_DIR = os.path.join(path, 'arm64') # Set ARM64 build directory - ARCHS = {'x64': BUILD_X64_DIR, 'x86':BUILD_X86_DIR, 'arm64':BUILD_ARM64_DIR} + ARCHITECTURES = {'x64': BUILD_X64_DIR, 'x86':BUILD_X86_DIR, 'arm64':BUILD_ARM64_DIR} mk_dir(BUILD_X86_DIR) mk_dir(BUILD_X64_DIR) mk_dir(BUILD_ARM64_DIR) @@ -81,6 +105,7 @@ def display_help(): print(" --dotnet-key= strongname sign the .NET assembly with the private key in .") print(" --nojava do not include Java bindings in the binary distribution files.") print(" --nopython do not include Python bindings in the binary distribution files.") + print(" --julia build Julia bindings.") print(" --zip package build outputs in zip file.") print(" --githash include git hash in the Zip file.") print(" --x86-only x86 dist only.") @@ -90,7 +115,7 @@ def display_help(): # Parse configuration option for mk_make script def parse_options(): - global FORCE_MK, JAVA_ENABLED, ZIP_BUILD_OUTPUTS, GIT_HASH, DOTNET_CORE_ENABLED, DOTNET_KEY_FILE, ASSEMBLY_VERSION, PYTHON_ENABLED, X86ONLY, X64ONLY, ARM64ONLY + global FORCE_MK, JAVA_ENABLED, JULIA_ENABLED, ZIP_BUILD_OUTPUTS, GIT_HASH, DOTNET_CORE_ENABLED, DOTNET_KEY_FILE, ASSEMBLY_VERSION, PYTHON_ENABLED, X86ONLY, X64ONLY, ARM64ONLY path = BUILD_DIR options, remainder = getopt.gnu_getopt(sys.argv[1:], 'b:hsf', ['build=', 'help', @@ -103,6 +128,7 @@ def parse_options(): 'zip', 'githash', 'nopython', + 'julia', 'x86-only', 'x64-only', 'arm64-only' @@ -128,6 +154,8 @@ def parse_options(): DOTNET_KEY_FILE = arg elif opt == '--nojava': JAVA_ENABLED = False + elif opt == '--julia': + JULIA_ENABLED = True elif opt == '--zip': ZIP_BUILD_OUTPUTS = True elif opt == '--githash': @@ -170,18 +198,19 @@ def get_git_hash(): # Create a build directory using mk_make.py def mk_build_dir(arch): - global ARCHS - build_path = ARCHS[arch] - install_path = DIST_DIR + build_path = get_build_dir(arch) if not check_build_dir(build_path) or FORCE_MK: mk_dir(build_path) - if arch == "arm64": arch = "amd64_arm64" cmds = [] + if JULIA_ENABLED: + cmds.append('julia -e "using Pkg; Pkg.add(PackageSpec(name=\"libcxxwrap_julia_jll\"))"') + cmds.append('julia -e "using libcxxwrap_julia_jll; print(dirname(libcxxwrap_julia_jll.libcxxwrap_julia_path))" > tmp.env') + cmds.append('set /P JlCxxDir=