From 15ed1fb4b456037def3c94434a0f8cbe47acc2be Mon Sep 17 00:00:00 2001 From: Bertrand Bellenot <bertrand.bellenot@cern.ch> Date: Fri, 13 Jul 2018 11:21:36 +0200 Subject: [PATCH] Add support for Python 3 on Windows This fixes the issue reported on the forum at: https://root-forum.cern.ch/t/windows-10-source-installation-failing-due-to-python-3-bindings/29771 --- bindings/pyroot/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bindings/pyroot/CMakeLists.txt b/bindings/pyroot/CMakeLists.txt index e5ad19f8437..22d3ac8f260 100644 --- a/bindings/pyroot/CMakeLists.txt +++ b/bindings/pyroot/CMakeLists.txt @@ -21,8 +21,13 @@ ROOT_STANDARD_LIBRARY_PACKAGE(PyROOT ROOT_LINKER_LIBRARY(JupyROOT ../JupyROOT/src/*.cxx DEPENDENCIES Core CMAKENOEXPORT) if(MSVC) + if(${PYTHON_VERSION_MAJOR} GREATER_EQUAL 3) + set(init_symbol PyInit_libPyROOT) + else() + set(init_symbol initlibPyROOT) + endif() add_custom_command(TARGET PyROOT POST_BUILD - COMMAND link -dll -nologo -IGNORE:4001 -machine:ix86 -export:initlibPyROOT + COMMAND link -dll -nologo -IGNORE:4001 -machine:ix86 -export:${init_symbol} $<TARGET_LINKER_FILE:PyROOT> msvcrt.lib -out:$<TARGET_FILE_DIR:PyROOT>/libPyROOT.pyd) install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libPyROOT.pyd -- GitLab