summaryrefslogtreecommitdiff
path: root/stubs
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2025-10-13 10:27:49 -0700
committerMark Rowe <mark@vector35.com>2025-10-13 11:37:24 -0700
commit866f24225b49eef51589d379f35d892bd57821af (patch)
treeb9373b413ea591a6d0bf1d36bf85773d2218849b /stubs
parent253fd4ad2d8095cc3c640c99d75ab3fd1cb7282e (diff)
Fix generating core API stubs on Windows
"py -3" was being incorrectly quoted, preventing the stub generation script from running on Windows. Instead of changing the quoting, I've opted to switch this to using `find_package(Python3)` to find the Python installation. This sets `Python3_EXECUTABLE` to point at the executable to run.
Diffstat (limited to 'stubs')
-rw-r--r--stubs/CMakeLists.txt8
1 files changed, 2 insertions, 6 deletions
diff --git a/stubs/CMakeLists.txt b/stubs/CMakeLists.txt
index a3cdda47..d877bcd0 100644
--- a/stubs/CMakeLists.txt
+++ b/stubs/CMakeLists.txt
@@ -1,18 +1,14 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
project(binaryninjacore_stubs)
-if(WIN32)
- set(PYTHON_COMMAND "py -3")
-else()
- set(PYTHON_COMMAND "python3")
-endif()
+find_package(Python3 COMPONENTS Interpreter REQUIRED)
file(REAL_PATH "${PROJECT_SOURCE_DIR}/../" ABSOLUTE_API_PATH)
# Generate stubs.cpp with implementations of all the BNAPI functions
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/stubs.cpp
- COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/generate_stubs.py ${ABSOLUTE_API_PATH}/binaryninjacore.h ${PROJECT_BINARY_DIR}
+ COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/generate_stubs.py ${ABSOLUTE_API_PATH}/binaryninjacore.h ${PROJECT_BINARY_DIR}
DEPENDS ${PROJECT_SOURCE_DIR}/generate_stubs.py ${ABSOLUTE_API_PATH}/binaryninjacore.h
COMMENT "Generating stubs.cpp from binaryninjacore.h"
)