open-obfuscator / o-mvll

:electron: O-MVLL is a LLVM-based obfuscator for native code (Android & iOS)
https://obfuscator.re/omvll
Apache License 2.0
574 stars 62 forks source link

Find Python3 package before pybind11 #8

Closed weliveindetail closed 1 year ago

weliveindetail commented 1 year ago

Without passing PYTHON_EXECUTABLE and PYTHON_LIBRARIES on-top of the documented CMake invocation, all my configurations get screwed like this:

-- Found PythonInterp: /usr/bin/python3.10 (found version "3.10.6")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.10.so
...
-- Found pybind11: /usr/include (found version "2.9.1")
-- Found Python3: /path/to/Python-3.10.7/install/include/python3.10 (found version "3.10.7") found components: Development Development.Module Development.Embed
-- Python version: 3.10.7
-- Python lib:     /path/to/Python-3.10.7/install/lib/libpython3.10.a
-- Python include: /path/to/Python-3.10.7/install/include/python3.10
-- Python interpreter:
-- Found LLVM 14.0.6git

This patch changes the order of events. First, we find Python3 following our CMake parameters. Then we find pybind11, which will just reuse it. Now, passing an extra PYTHON_EXECUTABLE parameter has no effect anymore:

CMake Warning:
  Manually-specified variables were not used by the project:

    PYTHON_EXECUTABLE