Skip to content
Snippets Groups Projects
Commit d04dab5a authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Require Python3

parent 962340c3
No related branches found
No related tags found
No related merge requests found
Showing with 44 additions and 44 deletions
......@@ -53,7 +53,7 @@ if(BORNAGAIN_PYTHON)
add_custom_command(
OUTPUT ${AUTO_DIR}/libBornAgainCore.py
COMMAND ${Python_EXECUTABLE} ${WRAP_DIR}/swig/tweaks.py
COMMAND ${Python3_EXECUTABLE} ${WRAP_DIR}/swig/tweaks.py
${TMP_DIR}/libBornAgainCore.py
${AUTO_DIR}/libBornAgainCore.py
DEPENDS ${TMP_DIR}/libBornAgainCore.py
......@@ -165,8 +165,8 @@ endif()
if(BORNAGAIN_PYTHON)
target_compile_definitions(${library_name} PUBLIC -DBORNAGAIN_PYTHON)
include_directories(${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS})
target_link_libraries(${library_name} ${Python_LIBRARIES})
include_directories(${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS})
target_link_libraries(${library_name} ${Python3_LIBRARIES})
endif()
if(APPLE AND BORNAGAIN_APPLE_BUNDLE)
......@@ -236,9 +236,9 @@ if(WIN32)
endforeach()
set(win_python_lib
"${Python_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.lib")
"${Python3_LIBRARY_DIRS}/python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}.lib")
get_filename_component(UTF_BASE_NAME ${win_python_lib} NAME_WE)
get_filename_component(UTF_PATH ${Python_EXECUTABLE} PATH)
get_filename_component(UTF_PATH ${Python3_EXECUTABLE} PATH)
message(STATUS "Python dll: ${UTF_PATH}/${UTF_BASE_NAME}.dll")
install(FILES ${UTF_PATH}/${UTF_BASE_NAME}.dll
DESTINATION ${destination_lib} COMPONENT Libraries)
......
......@@ -41,7 +41,7 @@ if(BORNAGAIN_PYTHON)
add_custom_command(
OUTPUT ${AUTO_DIR}/libBornAgainFit.py
COMMAND ${Python_EXECUTABLE} ${WRAP_DIR}/swig/tweaks.py
COMMAND ${Python3_EXECUTABLE} ${WRAP_DIR}/swig/tweaks.py
${TMP_DIR}/libBornAgainFit.py
${AUTO_DIR}/libBornAgainFit.py
DEPENDS ${TMP_DIR}/libBornAgainFit.py
......@@ -102,8 +102,8 @@ target_link_libraries(${lib} ${RootMinimizers_LIBRARY} ${Boost_LIBRARIES})
if(BORNAGAIN_PYTHON)
target_include_directories(${lib}
PUBLIC ${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS})
target_link_libraries(${lib} ${Python_LIBRARIES})
PUBLIC ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS})
target_link_libraries(${lib} ${Python3_LIBRARIES})
endif()
# --- custom actions
......
......@@ -21,5 +21,5 @@ set(tests ${sources})
list(REMOVE_ITEM tests utils.py)
foreach(_test ${tests})
add_test(PyCore/${_test} ${Python_EXECUTABLE} ${OUTPUT_DIR}/${_test})
add_test(PyCore/${_test} ${Python3_EXECUTABLE} ${OUTPUT_DIR}/${_test})
endforeach()
......@@ -8,8 +8,8 @@ add_executable(${test} ${source_files} ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/Te
target_include_directories(${test}
PUBLIC
${CMAKE_SOURCE_DIR}/ThirdParty/common/gtest/gtest-1.8.0/include
${Python_INCLUDE_DIRS}
${Python_NumPy_INCLUDE_DIRS}
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/auto/Wrap
)
......
......@@ -24,6 +24,6 @@ foreach(example ${examples})
get_filename_component(script_name ${script_path} NAME_WE)
set(test_name PyExamples/${script_name})
add_test(${test_name} ${Python_EXECUTABLE} ${test_script} ${script_path})
add_test(${test_name} ${Python3_EXECUTABLE} ${test_script} ${script_path})
set_tests_properties(${test_name} PROPERTIES LABELS "Fullcheck")
endforeach()
......@@ -18,5 +18,5 @@ set(tests
)
foreach(_test ${tests})
add_test(PyFit/${_test} ${Python_EXECUTABLE} ${output_dir}/${_test})
add_test(PyFit/${_test} ${Python3_EXECUTABLE} ${output_dir}/${_test})
endforeach()
......@@ -21,7 +21,7 @@ function(test_example example tolerance)
set(example_mod ${OUTPUT_DIR}/${EXAMPLE_NAME}_mod.py)
configure_file(example_template.py ${example_mod} @ONLY)
add_test(${test_name} ${Python_EXECUTABLE} "-B" "${example_mod}")
add_test(${test_name} ${Python3_EXECUTABLE} "-B" "${example_mod}")
endfunction()
test_example("simulation/ex01_BasicParticles/CylindersAndPrisms" 2e-10)
......
......@@ -7,7 +7,7 @@ if(NOT MSVC)
file(GLOB_RECURSE src1 ${dir}/*.cpp)
file(GLOB_RECURSE src2 ${dir}/*.h)
add_test(NAME "LineLength_Cpp_${dir}"
COMMAND ${Python_EXECUTABLE}
COMMAND ${Python3_EXECUTABLE}
${CMAKE_SOURCE_DIR}/devtools/analyze/check-line-length.py ${SRC_LEN_LIM}
${src1} ${src2})
endforeach()
......@@ -15,13 +15,13 @@ if(NOT MSVC)
foreach(dir "Core" "Fit" "GUI")
file(GLOB_RECURSE src1 ${dir}/*CMakeLists.txt)
add_test(NAME "LineLength_CMake_${dir}"
COMMAND ${Python_EXECUTABLE}
COMMAND ${Python3_EXECUTABLE}
${CMAKE_SOURCE_DIR}/devtools/analyze/check-line-length.py ${SRC_LEN_LIM}
${src1})
endforeach()
file(GLOB sources "${PY_EXAMPLES_DIR}/*/ex*/*.py")
add_test(NAME "LineLength_PyExamples" COMMAND ${Python_EXECUTABLE}
add_test(NAME "LineLength_PyExamples" COMMAND ${Python3_EXECUTABLE}
${CMAKE_SOURCE_DIR}/devtools/analyze/check-line-length.py ${WEB_LEN_LIM} ${sources})
endif()
......@@ -111,12 +111,12 @@ configure_file(${CONFIGURABLES_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTe
if (WIN32)
# Necessary to provide correct slashes in BABuild.h
file(TO_CMAKE_PATH ${Python_EXECUTABLE} Python_EXECUTABLE)
file(TO_CMAKE_PATH ${Python_STDLIB} Python_STDLIB)
file(TO_CMAKE_PATH ${Python_STDLIB} Python_STDLIB)
file(TO_CMAKE_PATH ${Python_INCLUDE_DIRS} Python_INCLUDE_DIRS)
file(TO_CMAKE_PATH ${Python_NumPy_INCLUDE_DIRS} Python_NumPy_INCLUDE_DIRS)
file(TO_CMAKE_PATH ${Python_SITELIB} Python_SITELIB)
file(TO_CMAKE_PATH ${Python3_EXECUTABLE} Python3_EXECUTABLE)
file(TO_CMAKE_PATH ${Python3_STDLIB} Python3_STDLIB)
file(TO_CMAKE_PATH ${Python3_STDLIB} Python3_STDLIB)
file(TO_CMAKE_PATH ${Python3_INCLUDE_DIRS} Python3_INCLUDE_DIRS)
file(TO_CMAKE_PATH ${Python3_NumPy_INCLUDE_DIRS} Python3_NumPy_INCLUDE_DIRS)
file(TO_CMAKE_PATH ${Python3_SITELIB} Python3_SITELIB)
endif()
configure_file(${CONFIGURABLES_DIR}/BAVersion.h.in ${BUILD_INC_DIR}/BAVersion.h @ONLY)
......
# BornAgain Mac packaging
set(SELECTED_PYTHON_VERSION "python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}")
set(SELECTED_PYTHON_VERSION "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(CPACK_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${SELECTED_PYTHON_VERSION}-${BORNAGAIN_ARCHITECTURE}-10.13+")
......
# BornAgain Windows packaging
set(SELECTED_PYTHON_VERSION "python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}")
set(SELECTED_PYTHON_VERSION "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(CPACK_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${SELECTED_PYTHON_VERSION}-${BORNAGAIN_ARCHITECTURE}")
......
......@@ -12,7 +12,7 @@ function(GeneratePythonDocs PD_TARGET SWIG_DIR)
)
add_custom_command(
OUTPUT ${PD_TARGET}
COMMAND ${Python_EXECUTABLE} ${SWIG_DIR}/doxy2swig.py
COMMAND ${Python3_EXECUTABLE} ${SWIG_DIR}/doxy2swig.py
${TMP_DIR}/xml/index.xml ${PD_TARGET}
DEPENDS ${TMP_DIR}/xml/index.xml
)
......
......@@ -55,36 +55,36 @@ if(BORNAGAIN_TIFF_SUPPORT)
endif()
# --- Python ---
if (BORNAGAIN_GENERATE_BINDINGS AND BORNAGAIN_GENERATE_PYTHON_DOCS)
if(BORNAGAIN_GENERATE_BINDINGS AND BORNAGAIN_GENERATE_PYTHON_DOCS)
find_package(Doxygen REQUIRED)
endif()
if(BORNAGAIN_PYTHON OR BORNAGAIN_GUI)
find_package (Python COMPONENTS Interpreter Development NumPy)
find_package(Python3 COMPONENTS Interpreter Development NumPy)
message(STATUS " Python_VERSION : ${Python_VERSION}")
message(STATUS " Python_INTERPRETER_ID : ${Python_INTERPRETER_ID}")
message(STATUS " Python_EXECUTABLE : ${Python_EXECUTABLE}")
message(STATUS " Python_STDLIB : ${Python_STDLIB} Python_STDARCH: ${Python_STDARCH}")
message(STATUS " Python_SITELIB : ${Python_SITELIB} Python_SITEARCH: ${Python_SITEARCH}")
message(STATUS " Python_INCLUDE_DIRS : ${Python_INCLUDE_DIRS}")
message(STATUS " Python_LIBRARIES : ${Python_LIBRARIES}")
message(STATUS " Python_LIBRARY_DIRS : ${Python_LIBRARY_DIRS}")
message(STATUS " Python_NumPy_VERSION : ${Python_NumPy_VERSION}")
message(STATUS " Python_NumPy_INCLUDE_DIRS : ${Python_NumPy_INCLUDE_DIRS}")
message(STATUS " Python3_VERSION : ${Python3_VERSION}")
message(STATUS " Python3_INTERPRETER_ID : ${Python3_INTERPRETER_ID}")
message(STATUS " Python3_EXECUTABLE : ${Python3_EXECUTABLE}")
message(STATUS " Python3_STDLIB : ${Python3_STDLIB} Python3_STDARCH: ${Python3_STDARCH}")
message(STATUS " Python3_SITELIB : ${Python3_SITELIB} Python3_SITEARCH: ${Python3_SITEARCH}")
message(STATUS " Python3_INCLUDE_DIRS : ${Python3_INCLUDE_DIRS}")
message(STATUS " Python3_LIBRARIES : ${Python3_LIBRARIES}")
message(STATUS " Python3_LIBRARY_DIRS : ${Python3_LIBRARY_DIRS}")
message(STATUS " Python3_NumPy_VERSION : ${Python3_NumPy_VERSION}")
message(STATUS " Python3_NumPy_INCLUDE_DIRS : ${Python3_NumPy_INCLUDE_DIRS}")
if (NOT Python_FOUND)
if(NOT Python3_FOUND)
message(FATAL_ERROR "No Python requested components.")
endif ()
endif()
if (NOT Python_Development_FOUND)
if(NOT Python3_Development_FOUND)
message(FATAL_ERROR "No Python.h has been found.")
endif ()
endif()
if (NOT Python_NumPy_FOUND)
if(NOT Python3_NumPy_FOUND)
message(FATAL_ERROR "Numpy was not found.")
endif ()
endif()
endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment