Skip to content

Commit 866f242

Browse files
committed
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.
1 parent 253fd4a commit 866f242

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

stubs/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
22
project(binaryninjacore_stubs)
33

4-
if(WIN32)
5-
set(PYTHON_COMMAND "py -3")
6-
else()
7-
set(PYTHON_COMMAND "python3")
8-
endif()
4+
find_package(Python3 COMPONENTS Interpreter REQUIRED)
95

106
file(REAL_PATH "${PROJECT_SOURCE_DIR}/../" ABSOLUTE_API_PATH)
117

128
# Generate stubs.cpp with implementations of all the BNAPI functions
139
add_custom_command(
1410
OUTPUT ${PROJECT_BINARY_DIR}/stubs.cpp
15-
COMMAND ${PYTHON_COMMAND} ${PROJECT_SOURCE_DIR}/generate_stubs.py ${ABSOLUTE_API_PATH}/binaryninjacore.h ${PROJECT_BINARY_DIR}
11+
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/generate_stubs.py ${ABSOLUTE_API_PATH}/binaryninjacore.h ${PROJECT_BINARY_DIR}
1612
DEPENDS ${PROJECT_SOURCE_DIR}/generate_stubs.py ${ABSOLUTE_API_PATH}/binaryninjacore.h
1713
COMMENT "Generating stubs.cpp from binaryninjacore.h"
1814
)

0 commit comments

Comments
 (0)