Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Nov 30, 2023
1 parent 993458d commit 9e88a1d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def run(self):
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14",
"-DCMAKE_OSX_ARCHITECTURES=arm64",
]
if platform.system() == "Windows":
target_cmake_config_args += [f"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE={TARGET_BUILD_DIR}"]
subprocess.check_call(["cmake", "-S", ".", "-B", TARGET_BUILD_DIR] + target_cmake_config_args, cwd=ROOT_DIR)
subprocess.check_call(
["cmake", "--build", TARGET_BUILD_DIR, "--parallel", "--verbose"] + cmake_build_args,
Expand All @@ -63,8 +61,6 @@ def run(self):
if CROSS_COMPILING:
# Also build a host version of sleigh to process .sla files
host_cmake_config_args = cmake_config_args[::]
if platform.system() == "Windows":
host_cmake_config_args += [f"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE={HOST_BUILD_DIR}"]
subprocess.check_call(["cmake", "-S", ".", "-B", HOST_BUILD_DIR] + host_cmake_config_args, cwd=ROOT_DIR)
subprocess.check_call(
["cmake", "--build", HOST_BUILD_DIR, "--parallel", "--verbose", "--target", "sleigh"]
Expand All @@ -74,13 +70,16 @@ def run(self):

bin_ext = ".exe" if platform.system() == "Windows" else ""
install_pkg_bin_dir = os.path.join(install_pkg_root, "bin")
os.makedirs(install_pkg_bin_dir, exist_ok=True)
sleigh_filename = "sleigh" + bin_ext

# Install extension and sleigh binary
ext_path = glob(TARGET_BUILD_DIR + "/pypcode_native.*")[0]
sleigh_filename = "sleigh" + bin_ext
shutil.copy(os.path.join(TARGET_BUILD_DIR, sleigh_filename), os.path.join(install_pkg_bin_dir, sleigh_filename))
shutil.copy(ext_path, os.path.join(install_pkg_root, os.path.basename(ext_path)))
if CROSS_COMPILING:
os.makedirs(install_pkg_bin_dir, exist_ok=True)
ext_path = glob(TARGET_BUILD_DIR + "/pypcode_native.*")[0]
shutil.copy(os.path.join(TARGET_BUILD_DIR, sleigh_filename), os.path.join(install_pkg_bin_dir, sleigh_filename))
shutil.copy(ext_path, os.path.join(install_pkg_root, os.path.basename(ext_path)))
else:
subprocess.check_call(["cmake", "--install", TARGET_BUILD_DIR], cwd=ROOT_DIR)

# Build sla files
host_bin_root = HOST_BUILD_DIR if CROSS_COMPILING else install_pkg_bin_dir
Expand Down

0 comments on commit 9e88a1d

Please sign in to comment.