Skip to content

Commit

Permalink
Update setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed May 22, 2021
1 parent 3d4799a commit ce1d02d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 208 deletions.
15 changes: 8 additions & 7 deletions api/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ macro(ADD_FLAG_IF_SUPPORTED flag name)
endif()
endmacro()

set(PYTHON_VERSION "3.5" CACHE STRING "Python Version to use")
find_package(PythonLibsNew EXACT ${PYTHON_VERSION} MODULE REQUIRED)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)

message(STATUS "Python version: ${PYTHON_VERSION}")
message(STATUS "Python lib: ${PYTHON_LIBRARY}")
message(STATUS "Python include: ${PYTHON_INCLUDE_DIR}")
message(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}")
message(STATUS "Python version: ${Python3_VERSION}")
message(STATUS "Python lib: ${Python3_LIBRARIES}")
message(STATUS "Python include: ${Python3_INCLUDE_DIRS}")
message(STATUS "Python interpreter: ${Python3_EXECUTABLE}")

set(PYBIND11_VERSION 2.6.1)
set(PYBIND11_SHA256 SHA256=e3f9408fca4e8ebf2d22229d5256adb49098073832aad87f3f6078d91a6942b2)
Expand Down Expand Up @@ -75,7 +74,9 @@ set(LIEF_PYTHON_HDR

source_group("Header Files" FILES ${LIEF_PYTHON_BASIC_HDR})

add_library(pyLIEF SHARED ${LIEF_PYTHON_SRC} ${LIEF_PYTHON_HDR})
Python3_add_library(pyLIEF MODULE
${LIEF_PYTHON_SRC} ${LIEF_PYTHON_HDR}
)

target_include_directories(pyLIEF PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/"
Expand Down
198 changes: 0 additions & 198 deletions cmake/FindPythonLibsNew.cmake

This file was deleted.

6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def build_extension(self, ext):

cmake_args += [
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}'.format(cmake_library_output_directory),
'-DPYTHON_EXECUTABLE={}'.format(sys.executable),
'-DPython3_ROOT_DIR={}'.format(sys.prefix),
'-DPython3_FIND_STRATEGY=LOCATION',
'-DLIEF_PYTHON_API=on',
]

Expand Down Expand Up @@ -260,7 +261,6 @@ def build_extension(self, ext):

if platform.system() == "Windows":
build_cmd = ['cmake', '--build', '.', '--target', "lief_samples"] + build_args
#log.info(" ".join(build_cmd))

if self.distribution.lief_test:
subprocess.check_call(['cmake', '--build', '.', '--target', "lief_samples"] + build_args, cwd=self.build_temp, env=env)
Expand All @@ -284,7 +284,7 @@ def build_extension(self, ext):
subprocess.check_call(['ninja'], cwd=self.build_temp)
subprocess.check_call(['ninja', "check-lief"], cwd=self.build_temp)
else:
subprocess.check_call(['ninja', "-v", targets['python_bindings']], cwd=self.build_temp, env=env)
subprocess.check_call(['ninja', targets['python_bindings']], cwd=self.build_temp, env=env)

if 'sdk' in targets:
subprocess.check_call(['ninja', targets['sdk']], cwd=self.build_temp, env=env)
Expand Down

0 comments on commit ce1d02d

Please sign in to comment.