Skip to content

Commit 7b40e5d

Browse files
committed
Revert "Remove Make build from setup.py"
This reverts commit 03641ab.
1 parent aafb191 commit 7b40e5d

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

bindings/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
2-
requires = ["setuptools", "cmake"]
2+
requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"

bindings/python/setup.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,14 @@ def copy_sources():
9292
shutil.copytree(os.path.join(BUILD_DIR, "include"), os.path.join(SRC_DIR, "include"))
9393

9494
src.extend(glob.glob(os.path.join(BUILD_DIR, "*.[ch]")))
95+
src.extend(glob.glob(os.path.join(BUILD_DIR, "*.mk")))
9596

97+
src.extend(glob.glob(os.path.join(BUILD_DIR, "Makefile")))
9698
src.extend(glob.glob(os.path.join(BUILD_DIR, "LICENSE*")))
9799
src.extend(glob.glob(os.path.join(BUILD_DIR, "README")))
98100
src.extend(glob.glob(os.path.join(BUILD_DIR, "*.TXT")))
99101
src.extend(glob.glob(os.path.join(BUILD_DIR, "RELEASE_NOTES")))
102+
src.extend(glob.glob(os.path.join(BUILD_DIR, "make.sh")))
100103
src.extend(glob.glob(os.path.join(BUILD_DIR, "CMakeLists.txt")))
101104
src.extend(glob.glob(os.path.join(BUILD_DIR, "pkgconfig.mk")))
102105

@@ -131,19 +134,22 @@ def build_libraries():
131134

132135
os.chdir(BUILD_DIR)
133136

134-
# platform description refers at https://docs.python.org/2/library/sys.html#sys.platform
135-
# Use cmake for both Darwin and Windows since it can generate fat binaries
136-
# Windows build: this process requires few things:
137-
# - MSVC installed
138-
# - Run this command in an environment setup for MSVC
139-
if not os.path.exists("build"): os.mkdir("build")
140-
os.chdir("build")
141-
print("Build Directory: {}\n".format(os.getcwd()))
142-
if SYSTEM == "win32":
143-
os.system('cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCAPSTONE_BUILD_TESTS=OFF -DCAPSTONE_BUILD_CSTOOL=OFF -G "NMake Makefiles" ..')
144-
else:
145-
os.system('cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCAPSTONE_BUILD_TESTS=OFF -DCAPSTONE_BUILD_CSTOOL=OFF -G "Unix Makefiles" ..')
146-
os.system("cmake --build .")
137+
# platform description refers at https://docs.python.org/3/library/sys.html#sys.platform
138+
if SYSTEM == "win32" or SYSTEM == 'darwin':
139+
# Windows build: this process requires few things:
140+
# - CMake + MSVC installed
141+
# - Run this command in an environment setup for MSVC
142+
if not os.path.exists("build"): os.mkdir("build")
143+
os.chdir("build")
144+
print("Build Directory: {}\n".format(os.getcwd()))
145+
# Only build capstone.dll / libcapstone.dylib
146+
if SYSTEM == "win32":
147+
os.system('cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCAPSTONE_BUILD_TESTS=OFF -DCAPSTONE_BUILD_CSTOOL=OFF -G "NMake Makefiles" ..')
148+
else:
149+
os.system('cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCAPSTONE_BUILD_TESTS=OFF -DCAPSTONE_BUILD_CSTOOL=OFF -G "Unix Makefiles" ..')
150+
os.system("cmake --build .")
151+
else: # Unix incl. cygwin
152+
os.system("CAPSTONE_BUILD_CORE_ONLY=yes bash ./make.sh")
147153

148154
shutil.copy(VERSIONED_LIBRARY_FILE, os.path.join(LIBS_DIR, LIBRARY_FILE))
149155

0 commit comments

Comments
 (0)