diff --git a/src/cmake/pythonutils.cmake b/src/cmake/pythonutils.cmake index c5f4720400..187155c927 100644 --- a/src/cmake/pythonutils.cmake +++ b/src/cmake/pythonutils.cmake @@ -133,14 +133,20 @@ macro (setup_python_module) # non-python libraries of the same name (which aren't prefixed by "lib" # on Windows). set_target_properties (${target_name} PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/python/site-packages - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/python/site-packages + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/python${PYTHON_VERSION}/site-packages/$/OpenImageIO + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/python${PYTHON_VERSION}/site-packages/$/OpenImageIO ) install (TARGETS ${target_name} RUNTIME DESTINATION ${PYTHON_SITE_DIR} COMPONENT user LIBRARY DESTINATION ${PYTHON_SITE_DIR} COMPONENT user) + add_custom_command ( + TARGET ${target_name} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py + ${CMAKE_BINARY_DIR}/lib/python${PYTHON_VERSION}/site-packages/$/OpenImageIO/__init__.py) + install(FILES __init__.py DESTINATION ${PYTHON_SITE_DIR}) endmacro () diff --git a/src/cmake/testing.cmake b/src/cmake/testing.cmake index bedf2faf48..379ce0b08d 100644 --- a/src/cmake/testing.cmake +++ b/src/cmake/testing.cmake @@ -111,6 +111,20 @@ macro (oiio_add_tests) "OIIO_TESTSUITE_SRC=${_testsrcdir}" "OIIO_TESTSUITE_CUR=${_testdir}" ${_ats_ENVIRONMENT}) + if (NOT DEFINED ENV{GITHUB_ACTIONS}) + # the github actions run all the tests from the dist tree + # and do an install prior to running the tests so skip + # setting these here + if (NOT DEFINED ENV{OpenImageIO_ROOT}) + # this will ensure the appropriate fonts are found + set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT + "OpenImageIO_ROOT=${CMAKE_SOURCE_DIR}/src") + endif() + if (USE_PYTHON) + set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT + "PYTHONPATH=$;$ENV{PYTHONPATH}>") + endif() + endif() if (NOT ${_ats_testdir} STREQUAL "") set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT "OIIO_TESTSUITE_IMAGEDIR=${_ats_testdir}")