Back to home page

EIC code displayed by LXR

 
 

    


Warning, /jana2/src/python/externals/pybind11-2.10.3/tests/test_embed/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 possibly_uninitialized(PYTHON_MODULE_EXTENSION Python_INTERPRETER_ID)
0002 
0003 if("${PYTHON_MODULE_EXTENSION}" MATCHES "pypy" OR "${Python_INTERPRETER_ID}" STREQUAL "PyPy")
0004   message(STATUS "Skipping embed test on PyPy")
0005   add_custom_target(cpptest) # Dummy target on PyPy. Embedding is not supported.
0006   set(_suppress_unused_variable_warning "${DOWNLOAD_CATCH}")
0007   return()
0008 endif()
0009 
0010 find_package(Catch 2.13.9)
0011 
0012 if(CATCH_FOUND)
0013   message(STATUS "Building interpreter tests using Catch v${CATCH_VERSION}")
0014 else()
0015   message(STATUS "Catch not detected. Interpreter tests will be skipped. Install Catch headers"
0016                  " manually or use `cmake -DDOWNLOAD_CATCH=ON` to fetch them automatically.")
0017   return()
0018 endif()
0019 
0020 find_package(Threads REQUIRED)
0021 
0022 add_executable(test_embed catch.cpp test_interpreter.cpp)
0023 pybind11_enable_warnings(test_embed)
0024 
0025 target_link_libraries(test_embed PRIVATE pybind11::embed Catch2::Catch2 Threads::Threads)
0026 
0027 if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
0028   file(COPY test_interpreter.py test_trampoline.py DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
0029 endif()
0030 
0031 add_custom_target(
0032   cpptest
0033   COMMAND "$<TARGET_FILE:test_embed>"
0034   DEPENDS test_embed
0035   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
0036 
0037 pybind11_add_module(external_module THIN_LTO external_module.cpp)
0038 set_target_properties(external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY
0039                                                  "${CMAKE_CURRENT_BINARY_DIR}")
0040 foreach(config ${CMAKE_CONFIGURATION_TYPES})
0041   string(TOUPPER ${config} config)
0042   set_target_properties(external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config}
0043                                                    "${CMAKE_CURRENT_BINARY_DIR}")
0044 endforeach()
0045 add_dependencies(cpptest external_module)
0046 
0047 add_dependencies(check cpptest)