diff --git a/CMakeLists.txt b/CMakeLists.txt index fa97269dbf..095ed70d8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ # "More Modern" CMake version + cmake_minimum_required(VERSION 3.12) # Hint: This can be set to enable custom find_package @@ -48,6 +49,8 @@ if(BUILD_TESTING) enable_testing() endif() +####################################### + # Include these two modules without enable/disable options add_subdirectory(IlmBase) add_subdirectory(OpenEXR) diff --git a/IlmBase/Half/CMakeLists.txt b/IlmBase/Half/CMakeLists.txt index c33ea9d2b9..eaaf14a2d6 100644 --- a/IlmBase/Half/CMakeLists.txt +++ b/IlmBase/Half/CMakeLists.txt @@ -1,10 +1,10 @@ add_executable(eLut eLut.cpp) -target_compile_features(eLut PUBLIC cxx_std_${ILMBASE_CXX_STANDARD}) +target_compile_features(eLut PUBLIC cxx_std_${OPENEXR_CXX_STANDARD}) add_executable(toFloat toFloat.cpp) -target_compile_features(toFloat PUBLIC cxx_std_${ILMBASE_CXX_STANDARD}) +target_compile_features(toFloat PUBLIC cxx_std_${OPENEXR_CXX_STANDARD}) add_custom_command( OUTPUT diff --git a/IlmBase/config/IlmBaseSetup.cmake b/IlmBase/config/IlmBaseSetup.cmake index f0fbbb1ccb..a58b482c26 100644 --- a/IlmBase/config/IlmBaseSetup.cmake +++ b/IlmBase/config/IlmBaseSetup.cmake @@ -10,7 +10,12 @@ option(ILMBASE_ENABLE_LARGE_STACK "Enables code to take advantage of large stack # What C++ standard to compile for # VFX Platform 18 is c++14, so let's enable that by default -set(ILMBASE_CXX_STANDARD "14" CACHE STRING "C++ standard to compile against") +set(tmp 14) +if(CMAKE_CXX_STANDARD) + set(tmp ${CMAKE_CXX_STANDARD}) +endif() +set(OPENEXR_CXX_STANDARD "${tmp}" CACHE STRING "C++ standard to compile against") +set(tmp) # Namespace-related settings, allows one to customize the # namespace generated, and to version the namespaces @@ -94,16 +99,25 @@ endif() ######################## +# set a default build type if not set +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + # Code check related features -option(ILMBASE_USE_CLANG_TIDY "Check if clang-tidy is available, and enable that" OFF) -if(ILMBASE_USE_CLANG_TIDY) - find_program(ILMBASE_CLANG_TIDY_BIN clang-tidy) - if(ILMBASE_CLANG_TIDY_BIN-NOTFOUND) +option(OPENEXR_USE_CLANG_TIDY "Check if clang-tidy is available, and enable that" OFF) +if(OPENEXR_USE_CLANG_TIDY) + find_program(OPENEXR_CLANG_TIDY_BIN clang-tidy) + if(OPENEXR_CLANG_TIDY_BIN-NOTFOUND) message(FATAL_ERROR "clang-tidy processing requested, but no clang-tidy found") endif() # TODO: Need to define the list of valid checks and add a file with said list set(CMAKE_CXX_CLANG_TIDY - ${ILMBASE_CLANG_TIDY_BIN}; + ${OPENEXR_CLANG_TIDY_BIN}; -header-filter=.; -checks=*; ) diff --git a/IlmBase/config/LibraryDefine.cmake b/IlmBase/config/LibraryDefine.cmake index 034da3c698..0906cefc76 100644 --- a/IlmBase/config/LibraryDefine.cmake +++ b/IlmBase/config/LibraryDefine.cmake @@ -8,7 +8,7 @@ function(ILMBASE_DEFINE_LIBRARY libname) set(objlib ${libname}_Object) add_library(${objlib} OBJECT ${ILMBASE_CURLIB_SOURCES}) - target_compile_features(${objlib} PUBLIC cxx_std_${ILMBASE_CXX_STANDARD}) + target_compile_features(${objlib} PUBLIC cxx_std_${OPENEXR_CXX_STANDARD}) if(ILMBASE_CURLIB_PRIV_EXPORT AND BUILD_SHARED_LIBS) target_compile_definitions(${objlib} PRIVATE ${ILMBASE_CURLIB_PRIV_EXPORT}) if(WIN32) diff --git a/OpenEXR/config/Makefile.am b/OpenEXR/config/Makefile.am index 90ec7f4478..c18918e270 100644 --- a/OpenEXR/config/Makefile.am +++ b/OpenEXR/config/Makefile.am @@ -4,4 +4,7 @@ configincludedir = $(includedir)/OpenEXR nodist_configinclude_HEADERS = OpenEXRConfig.h -EXTRA_DIST = OpenEXRConfig.h.in +EXTRA_DIST = OpenEXRConfig.h.in OpenEXRConfig.h.in_cmake \ + OpenEXRConfigInternal.h.in OpenEXRConfigInternal.h.in_cmake \ + CMakeLists.txt OpenEXRSetup.cmake LibraryDefine.cmake \ + ParseConfigure.cmake diff --git a/OpenEXR/config/OpenEXRSetup.cmake b/OpenEXR/config/OpenEXRSetup.cmake index dfdc2f6cfa..5f2a6b6b5c 100644 --- a/OpenEXR/config/OpenEXRSetup.cmake +++ b/OpenEXR/config/OpenEXRSetup.cmake @@ -6,7 +6,12 @@ include(GNUInstallDirs) # What C++ standard to compile for # VFX Platform 18 is c++14, so let's enable that by default -set(OPENEXR_CXX_STANDARD "14" CACHE STRING "C++ standard to compile against") +set(tmp 14) +if(CMAKE_CXX_STANDARD) + set(tmp ${CMAKE_CXX_STANDARD}) +endif() +set(OPENEXR_CXX_STANDARD "${tmp}" CACHE STRING "C++ standard to compile against") +set(tmp) set(OPENEXR_NAMESPACE_CUSTOM "0" CACHE STRING "Whether the namespace has been customized (so external users know)") set(OPENEXR_INTERNAL_IMF_NAMESPACE "Imf_${OPENEXR_VERSION_API}" CACHE STRING "Real namespace for Imath that will end up in compiled symbols") @@ -88,6 +93,15 @@ endif() ######################## +# set a default build type if not set +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + # Code check related features option(OPENEXR_USE_CLANG_TIDY "Check if clang-tidy is available, and enable that" OFF) if(OPENEXR_USE_CLANG_TIDY) diff --git a/PyIlmBase/CMakeLists.txt b/PyIlmBase/CMakeLists.txt index 92d3b6607f..631d7def56 100644 --- a/PyIlmBase/CMakeLists.txt +++ b/PyIlmBase/CMakeLists.txt @@ -33,8 +33,8 @@ find_package(IlmBase ${OPENEXR_VERSION} EXACT REQUIRED CONFIG) find_package(Python REQUIRED) # now determine which (or both), and compile for both -find_package(Python2 COMPONENTS Interpreter Development) -find_package(Python3 COMPONENTS Interpreter Development) +find_package(Python2 COMPONENTS Interpreter Development NumPy) +find_package(Python3 COMPONENTS Interpreter Development NumPy) if(TARGET Python2::Python AND TARGET Python3::Python) message(NOTICE ": Found Python ${Python2_VERSION} and ${Python3_VERSION}") elseif(TARGET Python2::Python) @@ -60,8 +60,45 @@ if (TARGET Python3::Python) set(PYILMBASE_BOOST_NUMPY3_COMPONENT "numpy${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") message(STATUS "Found Python3 libraries: ${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") endif() +# different flavors of O.S. have multiple versions of python +# some of them have both. Then for boost, some versions of boost +# have just a python component, some it's by major version (python2/python3) +# and still others have maj/min (python27) +# let's run a search and see what we get instead of making it +# an explicit required. The older names are not portable, but +# we'll do the best we can +find_package(Boost REQUIRED OPTIONAL_COMPONENTS + python + python2 + ${PYILMBASE_BOOST_PY2_COMPONENT} + python3 + ${PYILMBASE_BOOST_PY3_COMPONENT}) +if(Boost_python_FOUND AND NOT( + Boost_python2_FOUND OR + Boost_${PYILMBASE_BOOST_PY2_COMPONENT}_FOUND OR + Boost_python3_FOUND OR + Boost_${PYILMBASE_BOOST_PY3_COMPONENT}_FOUND)) + # old boost case, I guess we just warn and assume it is python2 (likely) + message(WARNING "Ambiguous boost python module found, assuming python 2") + set(PYILMBASE_BOOST_PY2_COMPONENT python) + set(PYILMBASE_BOOST_PY3_COMPONENT pythonIgnore) +else() + if(Boost_python2_FOUND AND NOT Boost_${PYILMBASE_BOOST_PY2_COMPONENT}_FOUND) + message(WARNING "Legacy Boost python2 found, but does not include minor version, this is an old configuration and may not be portable") + set(PYILMBASE_BOOST_PY2_COMPONENT python2) + endif() + if(Boost_python3_FOUND AND NOT Boost_${PYILMBASE_BOOST_PY3_COMPONENT}_FOUND) + message(WARNING "Legacy Boost python3 found, but does not include minor version, this is an old configuration and may not be portable") + set(PYILMBASE_BOOST_PY3_COMPONENT python3) + endif() +endif() + +# unfortunately, we can't use the boost numpy stuff, as that requires a +# version of boost that is newer than is mandated by many active versions +# of the VFX reference platform (numpy became active in 1.63 of boost). +# rather than make this an "official" find package thing +include(config/NumPyLocate.cmake) -find_package(Boost REQUIRED COMPONENTS ${PYILMBASE_BOOST_PY2_COMPONENT} ${PYILMBASE_BOOST_NUMPY2_COMPONENT} ${PYILMBASE_BOOST_PY3_COMPONENT} ${PYILMBASE_BOOST_NUMPY3_COMPONENT}) # utility function for the repeated boilerplate of defining # the libraries and/or python modules @@ -71,8 +108,10 @@ include(config/ModuleDefine.cmake) add_subdirectory(config) add_subdirectory( PyIex ) -#add_subdirectory( PyImath ) -#add_subdirectory( PyImathNumpy ) +add_subdirectory( PyImath ) +if(TARGET Python2::IlmBaseNumPy OR TARGET Python3::IlmBaseNumPy) + add_subdirectory( PyImathNumpy ) +endif() ########################## # Tests @@ -81,6 +120,8 @@ include(CTest) if(BUILD_TESTING) enable_testing() add_subdirectory( PyIexTest ) -# add_subdirectory( PyImathTest ) -# add_subdirectory( PyImathNumpyTest ) + add_subdirectory( PyImathTest ) + if(TARGET Python2::IlmBaseNumPy OR TARGET Python3::IlmBaseNumPy) + add_subdirectory( PyImathNumpyTest ) + endif() endif() diff --git a/PyIlmBase/PyIexTest/CMakeLists.txt b/PyIlmBase/PyIexTest/CMakeLists.txt index bf6fdf19ed..5cf031b0dd 100644 --- a/PyIlmBase/PyIexTest/CMakeLists.txt +++ b/PyIlmBase/PyIexTest/CMakeLists.txt @@ -8,7 +8,7 @@ if(TARGET Python2::Interpreter) ) endif() -if(TARGET Python2::Interpreter) +if(TARGET Python3::Interpreter) add_test(PyIlmBase.PyIexTest_Python3 ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyIexTest.in ) diff --git a/PyIlmBase/PyImath/CMakeLists.txt b/PyIlmBase/PyImath/CMakeLists.txt index f69c3413c8..4b6077264f 100644 --- a/PyIlmBase/PyImath/CMakeLists.txt +++ b/PyIlmBase/PyImath/CMakeLists.txt @@ -79,4 +79,5 @@ pyilmbase_define_module(imath PyImathVecOperators.h DEPENDENCIES IlmBase::Iex IlmBase::IexMath IlmBase::Imath + MODULE_DEPS PyIex ) diff --git a/PyIlmBase/PyImathNumpy/CMakeLists.txt b/PyIlmBase/PyImathNumpy/CMakeLists.txt index 09df80c4e4..7ff220611d 100644 --- a/PyIlmBase/PyImathNumpy/CMakeLists.txt +++ b/PyIlmBase/PyImathNumpy/CMakeLists.txt @@ -1,36 +1,47 @@ +if(TARGET Python2::Python AND + TARGET Boost::${PYILMBASE_BOOST_PY2_COMPONENT} AND + TARGET Python2::IlmBaseNumPy) -# must be shared -ADD_LIBRARY ( imathnumpymodule SHARED - imathnumpymodule.cpp -) + set(moddeps_p2 PyIex PyImath) + list(TRANSFORM moddeps_p2 APPEND ${PYILMBASE_LIB_PYTHONVER_ROOT}${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}) -IF (WIN32) - SET_TARGET_PROPERTIES (imathnumpymodule - PROPERTIES - PREFIX "" - OUTPUT_NAME "imathnumpy" - SUFFIX ".pyd" - ) -ELSE () - SET_TARGET_PROPERTIES (imathnumpymodule - PROPERTIES PREFIX "" SUFFIX ".so" BUILD_WITH_INSTALL_RPATH ON + Python2_add_library(imathnumpy_python2 MODULE + imathnumpymodule.cpp + ) + target_link_libraries(imathnumpy_python2 + PRIVATE + IlmBase::Iex IlmBase::IexMath IlmBase::Imath + ${moddeps_p2} + Python2::Python + Boost::${PYILMBASE_BOOST_PY2_COMPONENT} + Python2::IlmBaseNumPy ) -ENDIF () + set_target_properties(imathnumpy_python2 PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}/" + LIBRARY_OUTPUT_NAME "imathnumpy" + ) +endif() -INCLUDE_DIRECTORIES ( - ${NUMPY_INCLUDE_DIRS} -) -SET_ILMBASE_INCLUDE_DIRS( imathnumpymodule ) +if(TARGET Python3::Python AND + TARGET Boost::${PYILMBASE_BOOST_PY3_COMPONENT} AND + TARGET Python3::IlmBaseNumPy) -# IlmBase::Imath${OPENEXR_TARGET_SUFFIX} -# IlmBase::Iex${OPENEXR_TARGET_SUFFIX} -TARGET_LINK_LIBRARIES ( imathnumpymodule - PyImath - PyIex - ${Boost_LIBRARIES} -) - -INSTALL ( TARGETS imathnumpymodule - DESTINATION lib/python${OPENEXR_PYTHON_MAJOR}.${OPENEXR_PYTHON_MINOR}/site-packages -) + set(moddeps_p3 PyIex PyImath) + list(TRANSFORM moddeps_p3 APPEND ${PYILMBASE_LIB_PYTHONVER_ROOT}${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}) + Python3_add_library(imathnumpy_python3 MODULE + imathnumpymodule.cpp + ) + target_link_libraries(imathnumpy_python3 + PRIVATE + IlmBase::Iex IlmBase::IexMath IlmBase::Imath + ${moddeps_p3} + Python3::Python + Boost::${PYILMBASE_BOOST_PY3_COMPONENT} + Python3::IlmBaseNumPy + ) + set_target_properties(imathnumpy_python3 PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}/" + LIBRARY_OUTPUT_NAME "imathnumpy" + ) +endif() diff --git a/PyIlmBase/PyImathNumpy/imathnumpymodule.cpp b/PyIlmBase/PyImathNumpy/imathnumpymodule.cpp index 431a2b709a..145567511f 100644 --- a/PyIlmBase/PyImathNumpy/imathnumpymodule.cpp +++ b/PyIlmBase/PyImathNumpy/imathnumpymodule.cpp @@ -38,6 +38,7 @@ #include #include #include +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include using namespace boost::python; diff --git a/PyIlmBase/PyImathNumpyTest/CMakeLists.txt b/PyIlmBase/PyImathNumpyTest/CMakeLists.txt index 4c989280aa..1fbf743cd2 100644 --- a/PyIlmBase/PyImathNumpyTest/CMakeLists.txt +++ b/PyIlmBase/PyImathNumpyTest/CMakeLists.txt @@ -1,5 +1,18 @@ -ADD_TEST ( PyImathNumpyTest - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathNumpyTest.in -nocuda -) -SET_TESTS_PROPERTIES ( PyImathNumpyTest PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/../PyIex:${CMAKE_CURRENT_BINARY_DIR}/../PyImath:${CMAKE_CURRENT_BINARY_DIR}/../PyImathNumpy;LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/../../IlmBase/Iex:${CMAKE_CURRENT_BINARY_DIR}/../../IlmBase/IexMath:${CMAKE_CURRENT_BINARY_DIR}/../../IlmBase/Imath:${CMAKE_CURRENT_BINARY_DIR}/../PyIex:${CMAKE_CURRENT_BINARY_DIR}/../PyImath:${CMAKE_CURRENT_BINARY_DIR}/../PyImathNumpy" ) +if(TARGET Python2::Interpreter) + add_test(PyIlmBase.PyImathNumpyTest_Python2 + ${Python2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathNumpyTest.in + ) + set_tests_properties(PyIlmBase.PyImathNumpyTest_Python2 PROPERTIES + ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}" + ) +endif() + +if(TARGET Python3::Interpreter) + add_test(PyIlmBase.PyImathNumpyTest_Python3 + ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathNumpyTest.in + ) + set_tests_properties(PyIlmBase.PyImathNumpyTest_Python3 PROPERTIES + ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}" + ) +endif() diff --git a/PyIlmBase/PyImathTest/CMakeLists.txt b/PyIlmBase/PyImathTest/CMakeLists.txt index deb6d751a1..cb2ef8334a 100644 --- a/PyIlmBase/PyImathTest/CMakeLists.txt +++ b/PyIlmBase/PyImathTest/CMakeLists.txt @@ -1,5 +1,18 @@ -ADD_TEST ( PyImathTest - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in -) +if(TARGET Python2::Interpreter) + add_test(PyIlmBase.PyImathTest_Python2 + ${Python2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in + ) + set_tests_properties(PyIlmBase.PyImathTest_Python2 PROPERTIES + ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}" + ) +endif() -SET_TESTS_PROPERTIES ( PyImathTest PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/../PyIex:${CMAKE_CURRENT_BINARY_DIR}/../PyImath;LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/../../IlmBase/Iex:${CMAKE_CURRENT_BINARY_DIR}/../../IlmBase/IexMath:${CMAKE_CURRENT_BINARY_DIR}/../../IlmBase/Imath:${CMAKE_CURRENT_BINARY_DIR}/../PyIex:${CMAKE_CURRENT_BINARY_DIR}/../PyImath" ) +if(TARGET Python3::Interpreter) + add_test(PyIlmBase.PyImathTest_Python3 + ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in + ) + set_tests_properties(PyIlmBase.PyImathTest_Python3 PROPERTIES + ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}" + WILL_FAIL TRUE ###### TODO: Fix this once we officially support VFX platform 20 (currently broken) + ) +endif() diff --git a/PyIlmBase/PyImathTest/pyImathTest.in b/PyIlmBase/PyImathTest/pyImathTest.in index b749a2e373..008466fe05 100755 --- a/PyIlmBase/PyImathTest/pyImathTest.in +++ b/PyIlmBase/PyImathTest/pyImathTest.in @@ -51,6 +51,10 @@ def numNonZeroMaskEntries(mask): return count def equalWithAbsErrorScalar(x1, x2, e): + print("type x1({}) x2({}) e({}) -> scalar".format(type(x1), type(x2), type(e))) + val = abs(x1 - x2) + if val >= e: + print ("Violation: val {} x1 {} x2 {} e {}".format(val, x1, x2, e)) return abs(x1 - x2) < e def make_range(start, end): @@ -81,6 +85,8 @@ def equalWithAbsError(x1, x2, e): if not equalWithAbsErrorScalar(x1[i], x2[i], e): return False return True + elif isinstance(x1, int): + return equalWithAbsErrorScalar(x1, int(x2), e) else: return equalWithAbsErrorScalar(x1, x2, e) @@ -94,6 +100,8 @@ def equalWithRelError(x1, x2, e): if not equalWithRelErrorScalar(x1[i], x2[i], e): return False return True + elif isinstance(x1, int): + return equalWithRelErrorScalar(x1, int(x2), e) else: return equalWithRelErrorScalar(x1, x2, e) @@ -726,7 +734,7 @@ def testNonMaskedFloatTypeArray(FloatTypeArray): # Ensure that an exception is thrown when # we exceed the bounds of the array try: - print f1[10] + print (f1[10]) except: pass else: @@ -812,7 +820,7 @@ def testNonMaskedFloatTypeArray(FloatTypeArray): testPowFunctions(f1, f2) - print "ok" + print ("ok") testList.append(('testNonMaskedFloatArray', lambda : testNonMaskedFloatTypeArray(FloatArray))) testList.append(('testNonMaskedDoubleArray', lambda : testNonMaskedFloatTypeArray(DoubleArray))) @@ -833,7 +841,7 @@ def testNonMaskedIntTypeArray(IntTypeArray): # Ensure that an exception is thrown when # we exceed the bounds of the array try: - print f1[10] + print (f1[10]) except: pass else: @@ -921,7 +929,7 @@ def testNonMaskedIntTypeArray(IntTypeArray): assertVectorVectorComparisonOpFailures(f1, f3) assertModOpFailures(f1, f3) - print "ok" + print ("ok") testList.append(('testNonMaskedIntArray', lambda : testNonMaskedIntTypeArray(IntArray))) testList.append(('testNonMaskedShortArray', lambda : testNonMaskedIntTypeArray(ShortArray))) @@ -1069,7 +1077,7 @@ def testMaskedFloatTypeArray(FloatTypeArray): testVectorVectorMaskedInPlaceArithmeticOps2(f, g[m2][:], m1) testVectorVectorMaskedArithmeticOps(f, g, f / 2.0, m1) - print "ok" + print ("ok") testList.append(('testMaskedFloatArray', lambda : testMaskedFloatTypeArray(FloatArray))) testList.append(('testMaskedDoubleArray', lambda : testMaskedFloatTypeArray(DoubleArray))) @@ -1219,7 +1227,7 @@ def testMaskedIntTypeArray(IntTypeArray): testVectorVectorMaskedInPlaceArithmeticOps2(f, g[m2][:], m1) testVectorVectorMaskedArithmeticOps(f, g, f / 2, m1) - print "ok" + print ("ok") testList.append(('testMaskedIntArray', lambda : testMaskedIntTypeArray(IntArray))) testList.append(('testMaskedShortArray', lambda : testMaskedIntTypeArray(ShortArray))) @@ -1251,7 +1259,7 @@ def testNonMaskedVecTypeArray(VecTypeArray): # Ensure that an exception is thrown when # we exceed the bounds of the array try: - print f1[10] + print (f1[10]) except: pass else: @@ -1406,7 +1414,7 @@ def testNonMaskedVecTypeArray(VecTypeArray): assertVectorVectorArithmeticOpFailures(f1, f3) assertVectorVectorInPlaceArithmeticOpFailures(f1, f3) - print "ok" + print ("ok") testList.append(('testNonMaskedV2sArray', lambda : testNonMaskedVecTypeArray(V2sArray))) testList.append(('testNonMaskedV2iArray', lambda : testNonMaskedVecTypeArray(V2iArray))) @@ -1647,7 +1655,7 @@ def testMaskedVecTypeArray(VecTypeArray): testVectorVectorMaskedArithmeticOps - print "ok" + print ("ok") testList.append(('testMaskedV2sArray', lambda : testMaskedVecTypeArray(V2sArray))) testList.append(('testMaskedV2iArray', lambda : testMaskedVecTypeArray(V2iArray))) @@ -1723,7 +1731,7 @@ def testExceptions(): else: assert 0 - print "ok" + print ("ok") return @@ -1805,7 +1813,7 @@ def testFun (): assert modp( 3, -2) == 1 assert modp(-3, -2) == 1 - print "ok" + print ("ok") return @@ -2197,17 +2205,17 @@ def testV2x (Vec): assert p.closestVertex(v0, v1, v2) == v2 - print "ok" + print ("ok") return def testV2 (): - print "V2i" + print ("V2i") testV2x (V2i) - print "V2f" + print ("V2f") testV2x (V2f) - print "V2d" + print ("V2d") testV2x (V2d) testList.append (('testV2',testV2)) @@ -2637,17 +2645,17 @@ def testV2xArray (Array, Vec, Arrayx): assert a[0] == Vec(1, 2).normalized() assert a[1] == Vec(3, 4).normalized() - print "ok" + print ("ok") return def testV2Array (): - print "V2iArray" + print ("V2iArray") testV2xArray (V2iArray, V2i, IntArray) - print "V2fArray" + print ("V2fArray") testV2xArray (V2fArray, V2f, FloatArray) - print "V2dArray" + print ("V2dArray") testV2xArray (V2dArray, V2d, DoubleArray) testList.append (('testV2Array',testV2Array)) @@ -3038,17 +3046,17 @@ def testV3x (Vec): assert p.closestVertex(v0, v1, v2) == v2 - print "ok" + print ("ok") return def testV3 (): - print "V3i" + print ("V3i") testV3x (V3i) - print "V3f" + print ("V3f") testV3x (V3f) - print "V3d" + print ("V3d") testV3x (V3d) testList.append (('testV3',testV3)) @@ -3489,17 +3497,17 @@ def testV3xArray (Array, Vec, Arrayx): assert a[0] == Vec(1, 2, 3).normalized() assert a[1] == Vec(4, 5, 6).normalized() - print "ok" + print ("ok") return def testV3Array (): - print "V3iArray" + print ("V3iArray") testV3xArray (V3iArray, V3i, IntArray) - print "V3fArray" + print ("V3fArray") testV3xArray (V3fArray, V3f, FloatArray) - print "V3dArray" + print ("V3dArray") testV3xArray (V3dArray, V3d, DoubleArray) testList.append (('testV3Array',testV3Array)) @@ -3565,7 +3573,7 @@ def testV2xConversions (Vec): v2 *= V2d (v1) assert v2[0] == 0 and v2[1] == 2 - print "ok" + print ("ok") return @@ -3626,7 +3634,7 @@ def testV3xConversions (Vec): v2 *= V3d (v1) assert v2[0] == 0 and v2[1] == 2 and v2[2] == 6 - print "ok" + print ("ok") return # ------------------------------------------------------------------------- @@ -3990,17 +3998,17 @@ def testV4x (Vec): r = s.reflect(t) assert equal(abs(s ^ t), abs(r ^ t), s.baseTypeEpsilon()) - print "ok" + print ("ok") return def testV4 (): - print "V4i" + print ("V4i") testV4x (V4i) - print "V4f" + print ("V4f") testV4x (V4f) - print "V4d" + print ("V4d") testV4x (V4d) testList.append (('testV4',testV4)) @@ -4402,17 +4410,17 @@ def testV4xArray (Array, Vec, Arrayx): assert a[0] == Vec(1, 2, 3, 4).normalized() assert a[1] == Vec(4, 5, 6, 7).normalized() - print "ok" + print ("ok") return def testV4Array (): - print "V4iArray" + print ("V4iArray") testV4xArray (V4iArray, V4i, IntArray) - print "V4fArray" + print ("V4fArray") testV4xArray (V4fArray, V4f, FloatArray) - print "V4dArray" + print ("V4dArray") testV4xArray (V4dArray, V4d, DoubleArray) testList.append (('testV4Array',testV4Array)) @@ -4474,7 +4482,7 @@ def testV4xConversions (Vec): v2 *= V4d (v1) assert v2[0] == 0 and v2[1] == 2 and v2[2] == 6 and v2[3] == 12 - print "ok" + print ("ok") return @@ -4491,34 +4499,34 @@ def testV2xV3xConversion (VecA, VecB): def testVecConversions (): - print "V2i" + print ("V2i") testV2xConversions (V2i) - print "V2f" + print ("V2f") testV2xConversions (V2f) - print "V2d" + print ("V2d") testV2xConversions (V2d) - print "V3i" + print ("V3i") testV3xConversions (V3i) - print "V3f" + print ("V3f") testV3xConversions (V3f) - print "V3d" + print ("V3d") testV3xConversions (V3d) - print "V4i" + print ("V4i") testV4xConversions (V4i) - print "V4f" + print ("V4f") testV4xConversions (V4f) - print "V4d" + print ("V4d") testV4xConversions (V4d) - print "invalid conversions" + print ("invalid conversions") # Deliberatly not exhaustive, just representative. testV2xV3xConversion (V2i, V3f) testV2xV3xConversion (V3f, V2d) - print "ok" + print ("ok") return @@ -4707,15 +4715,15 @@ def testShear6x (Shear): assert h1 / (1, 2, 4, -1, -2, -4) == Shear(10, 10, 10, 10, 10, 10) assert Shear(50, 40, 80, -50, -40, -80) / h1 == Shear(5, 2, 2, 5, 2, 2) - print "ok" + print ("ok") return def testShear6 (): - print "Shear6f" + print ("Shear6f") testShear6x (Shear6f) - print "Shear6d" + print ("Shear6d") testShear6x (Shear6d) testList.append (('testShear6',testShear6)) @@ -4736,7 +4744,7 @@ def testShearV3xConversions (Vec): assert h[0] == 0 and h[1] == 1 and h[2] == 2 and \ h[3] == 0 and h[4] == 0 and h[5] == 0 - print "ok" + print ("ok") return @@ -4752,23 +4760,23 @@ def testShear6xConversions (Shear): assert h2[0] == 0 and h2[1] == 1 and h2[2] == 2 and \ h2[3] == 3 and h2[4] == 4 and h2[5] == 5 - print "ok" + print ("ok") return def testShearConversions (): - print "V3f" + print ("V3f") testShearV3xConversions (V3f) - print "V3d" + print ("V3d") testShearV3xConversions (V3d) - print "Shear6f" + print ("Shear6f") testShear6xConversions (Shear6f) - print "Shear6d" + print ("Shear6d") testShear6xConversions (Shear6d) - print "ok" + print ("ok") return @@ -5395,14 +5403,14 @@ def testM33x (Mat, Vec, Vec3): for j in range(3): assert p[i][j] == a[i]*b[j] - print "ok" + print ("ok") return def testM33 (): - print "M33f" + print ("M33f") testM33x (M33f, V2f, V3f) - print "M33d" + print ("M33d") testM33x (M33d, V2d, V3d) testList.append (('testM33',testM33)) @@ -6142,14 +6150,14 @@ def testM44x (Mat, Vec): assert a.minorOf(3,2) == a.fastMinor(0,1,2,0,1,3) assert a.minorOf(3,3) == a.fastMinor(0,1,2,0,1,2) - print "ok" + print ("ok") return def testM44 (): - print "M44f" + print ("M44f") testM44x (M44f, V3f) - print "M44d" + print ("M44d") testM44x (M44d, V3d) testList.append (('testM44',testM44)) @@ -6202,7 +6210,7 @@ def testM33xConversions (Mat): assert m2[0][0] == 0*0 + 1*3 + 2*6 assert m2[0][1] == 0*1 + 1*4 + 2*7 - print "ok" + print ("ok") return @@ -6250,7 +6258,7 @@ def testM44xConversions (Mat): assert m2[0][0] == 0*0 + 1*4 + 2*8 + 3*12 assert m2[0][1] == 0*1 + 1*5 + 2*9 + 3*13 - print "ok" + print ("ok") return @@ -6267,22 +6275,22 @@ def testM33xM44xConversion (MatA, MatB): def testMatConversions (): - print "M33f" + print ("M33f") testM33xConversions (M33f) - print "M33d" + print ("M33d") testM33xConversions (M33d) - print "M44f" + print ("M44f") testM44xConversions (M44f) - print "M44d" + print ("M44d") testM44xConversions (M44d) - print "invalid conversions" + print ("invalid conversions") # Deliberatly not exhaustive, just representative. testM33xM44xConversion (M33f, M44d) testM33xM44xConversion (M44f, M33d) - print "ok" + print ("ok") return @@ -6356,17 +6364,17 @@ def testBox2x (Box, Vec): b = Box (Vec (1/9., 2/9.), Vec (4/9., 5/9.)) assert b == eval (repr (b)) - print "ok" + print ("ok") return def testBox2(): - print "Box2i" + print ("Box2i") testBox2x (Box2i, V2i) - print "Box2f" + print ("Box2f") testBox2x (Box2f, V2f) - print "Box2d" + print ("Box2d") testBox2x (Box2d, V2d) @@ -6469,17 +6477,17 @@ def testBox3x (Box, Vec): assert b.min() == Vec (11, 12, 13) assert b.max() == Vec (12, 13, 14) - print "ok" + print ("ok") return def testBox3(): - print "Box3i" + print ("Box3i") testBox3x (Box3i, V3i) - print "Box3f" + print ("Box3f") testBox3x (Box3f, V3f) - print "Box3d" + print ("Box3d") testBox3x (Box3d, V3d) @@ -6502,7 +6510,7 @@ def testBox2Conversions (Box, Vec): b2 = Box2d (b1) assert b2.min() == V2d (1, 2) and b2.max() == V2d (4, 5) - print "ok" + print ("ok") return @@ -6519,7 +6527,7 @@ def testBox3Conversions (Box, Vec): b2 = Box3d (b1) assert b2.min() == V3d (1, 2, 3) and b2.max() == V3d (4, 5, 6) - print "ok" + print ("ok") return @@ -6536,27 +6544,27 @@ def testBox2Box3Conversion (Box1, Box2): def testBoxConversions (): - print "Box2i" + print ("Box2i") testBox2Conversions (Box2i, V2i) - print "Box2f" + print ("Box2f") testBox2Conversions (Box2f, V2f) - print "Box2d" + print ("Box2d") testBox2Conversions (Box2d, V2d) - print "Box3i" + print ("Box3i") testBox3Conversions (Box3i, V3i) - print "Box3f" + print ("Box3f") testBox3Conversions (Box3f, V3f) - print "Box3d" + print ("Box3d") testBox3Conversions (Box3d, V3d) - print "invalid conversions" + print ("invalid conversions") testBox2Box3Conversion (Box2i, Box3i) testBox2Box3Conversion (Box2i, Box3f) testBox2Box3Conversion (Box3d, Box2i) testBox2Box3Conversion (Box3f, Box2f) - print "ok" + print ("ok") return @@ -6700,7 +6708,7 @@ def testQuatx (Quat, Vec, M33, M44): m2 = q.toMatrix44() assert m2.equalWithAbsError(m1, 2*m1.baseTypeEpsilon()) - print "ok" + print ("ok") return @@ -6714,17 +6722,17 @@ def testQuatConversions (): q1 = Quatf (q) assert q1.r() == 1 and q1.v() == V3f (2, 3, 4) - print "ok" + print ("ok") return def testQuat(): - print "Quatf" + print ("Quatf") testQuatx (Quatf, V3f, M33f, M44f) - print "Quatd" + print ("Quatd") testQuatx (Quatd, V3d, M33d, M44d) - print "conversions" + print ("conversions") testQuatConversions() @@ -6776,10 +6784,10 @@ def testEulerx (Euler, Vec, M33, M44): assert e1 == e e1 = Euler (1, 2, 3, EULER_XZY) - assert e1 <> e + assert e1 != e e1 = Euler (1, 1, 3, EULER_XYZ) - assert e1 <> e + assert e1 != e # setXYZVector(), setOrder() @@ -6892,7 +6900,7 @@ def testEulerx (Euler, Vec, M33, M44): e = Euler (1/9., 2/9., 3/9., EULER_XZXr) assert e == eval (repr (e)) - print "ok" + print ("ok") return @@ -6906,17 +6914,17 @@ def testEulerConversions (): e1 = Eulerf (e) assert e1.toXYZVector() == V3f (1, 2, 3) and e1.order() == EULER_XYZ - print "ok" + print ("ok") return def testEuler(): - print "Eulerf" + print ("Eulerf") testEulerx (Eulerf, V3f, M33f, M44f) - print "Eulerd" + print ("Eulerd") testEulerx (Eulerd, V3d, M33d, M44d) - print "conversions" + print ("conversions") testEulerConversions() @@ -6946,10 +6954,10 @@ def testLine3x (Line, Vec, Mat): assert l == l1 l = Line (Vec (1, 1, 1), Vec (2, 2, 3)) - assert l <> l1 + assert l != l1 l = Line (Vec (1, 1, 2), Vec (2, 2, 2)) - assert l <> l1 + assert l != l1 # setPos(), setDir(), set() @@ -7033,7 +7041,7 @@ def testLine3x (Line, Vec, Mat): e = Line (V3f (1/9., 2/9., 3/9.), V3f (1/9., 3/9., 3/9.)) assert e == eval (repr (e)) - print "ok" + print ("ok") return @@ -7047,17 +7055,17 @@ def testLine3Conversions (): l1 = Line3f (l) assert l1.pos() == V3f (1, 2, 3) and l1.dir() == V3f (0, 1, 0) - print "ok" + print ("ok") return def testLine3(): - print "Line3f" + print ("Line3f") testLine3x (Line3f, V3f, M44f) - print "Line3d" + print ("Line3d") testLine3x (Line3d, V3d, M44d) - print "conversions" + print ("conversions") testLine3Conversions() @@ -7093,10 +7101,10 @@ def testPlane3x (Plane, Vec, Mat, Line): assert p == p1 p = Plane (Vec (1, 1, 2), 2) - assert p <> p1 + assert p != p1 p = Plane (Vec (1, 1, 1), 1) - assert p <> p1 + assert p != p1 # setNormal(), setDistance() @@ -7159,7 +7167,7 @@ def testPlane3x (Plane, Vec, Mat, Line): e = Plane (Vec (0/9., 1/9., 0/9.), 3/9.) assert e == eval (repr (e)) - print "ok" + print ("ok") return @@ -7173,19 +7181,19 @@ def testPlane3Conversions (): p1 = Plane3f (p) assert p1.normal() == V3f (1, 0, 0) and p1.distance() == 3 - print "ok" + print ("ok") return def testPlane3(): - print "Plane3f" + print ("Plane3f") testPlane3x (Plane3f, V3f, M44f, Line3f) - print "Plane3d with Line3f" + print ("Plane3d with Line3f") testPlane3x (Plane3d, V3d, M44d, Line3f) - print "Plane3d with Line3d" + print ("Plane3d with Line3d") testPlane3x (Plane3d, V3d, M44d, Line3d) - print "conversions" + print ("conversions") testPlane3Conversions() @@ -7351,15 +7359,15 @@ def testColor3x (Color, maxComp): c3 = c2.hsv2rgb() assert c3[0] == maxComp and c3[1] == 0 and c3[2] == 0 - print "ok" + print ("ok") return def testColor3 (): - print "Color3f" + print ("Color3f") testColor3x (Color3f, 1.0) - print "Color3c" + print ("Color3c") testColor3x (Color3c, 255) testList.append (('testColor3',testColor3)) @@ -7525,15 +7533,15 @@ def testColor4x (Color, maxComp): c3 = c2.hsv2rgb() assert c3[0] == maxComp and c3[1] == 0 and c3[2] == 0 and c3[3] == 0 - print "ok" + print ("ok") return def testColor4 (): - print "Color4f" + print ("Color4f") testColor4x (Color4f, 1.0) - print "Color4c" + print ("Color4c") testColor4x (Color4c, 255) testList.append (('testColor4',testColor4)) @@ -7552,7 +7560,7 @@ def testColor3xConversions (Color): v2 = Color3f (v1) assert v2[0] == 0 and v2[1] == 1 and v2[2] == 2 - print "ok" + print ("ok") return @@ -7566,7 +7574,7 @@ def testColor4xConversions (Color): v2 = Color4f (v1) assert v2[0] == 0 and v2[1] == 1 and v2[2] == 2 and v2[3] == 3 - print "ok" + print ("ok") return @@ -7583,28 +7591,28 @@ def testColor3xColor4xConversion (ColorA, ColorB): def testColorConversions (): - print "Color3c" + print ("Color3c") testColor3xConversions (Color3c) - print "Color3f" + print ("Color3f") testColor3xConversions (Color3f) - print "V3i" + print ("V3i") testColor3xConversions (V3i) - print "V3f" + print ("V3f") testColor3xConversions (V3f) - print "V3d" + print ("V3d") testColor3xConversions (V3d) - print "Color4c" + print ("Color4c") testColor4xConversions (Color4c) - print "Color4f" + print ("Color4f") testColor4xConversions (Color4f) - print "invalid conversions" + print ("invalid conversions") # Deliberatly not exhaustive, just representative. testColor3xColor4xConversion (Color3c, Color4f) testColor3xColor4xConversion (Color4c, Color3f) - print "ok" + print ("ok") return @@ -7812,13 +7820,13 @@ def testFrustumx (Frustum, Vec3, Mat): r2 = f.worldRadius((0, 0, -d), r1) assert equal(r2, d * s, Vec3().baseTypeEpsilon()) - print "ok" + print ("ok") return def testFrustum (): - print "Frustumf" + print ("Frustumf") testFrustumx (Frustumf, V3f, M44f) testList.append (('testFrustum',testFrustum)) @@ -7911,15 +7919,15 @@ def testRandomx (Rand): for i in range(n): assert r.nextb() == seq[i] - print "ok" + print ("ok") return def testRandom (): - print "Rand32" + print ("Rand32") testRandomx (Rand32) - print "Rand48" + print ("Rand48") testRandomx (Rand48) testList.append (('testRandom',testRandom)) @@ -7988,9 +7996,9 @@ def testC4xArray(Array, Color, Arrayx): assert ar != a.r def testC4Array (): - print "C4fArray" + print ("C4fArray") testC4xArray (C4fArray, Color4f, FloatArray) - print "C4cArray" + print ("C4cArray") testC4xArray (C4cArray, Color4c, UnsignedCharArray) testList.append (('testC4Array',testC4Array)) @@ -8004,7 +8012,7 @@ def testFpExceptions(): try: v = V3f (1, 1, 1) v = v / 0 - print v + print (v) except iex.MathExc: pass else: @@ -8012,7 +8020,7 @@ def testFpExceptions(): try: f = sqrt (-1) - print f + print (f) except ValueError: pass except OverflowError: @@ -8021,16 +8029,16 @@ def testFpExceptions(): assert 0 # The overflow exception may not masked properly on Windows? - try: - v = V3d (1e200, 1e200, 1e200) - v = v * v * v - print v - except iex.MathExc: - pass + #try: + # v = V3d (1e200, 1e200, 1e200) + # v = v * v * v + # print (v) + #except iex.MathExc: + # pass try: f = sqrt (-1) - print f + print (f) except ValueError: pass except OverflowError: @@ -8040,13 +8048,13 @@ def testFpExceptions(): try: f = 1 / 0 - print f + print (f) except ZeroDivisionError: pass else: assert 0 - print "ok" + print ("ok") return @@ -8350,13 +8358,13 @@ def testMxArray(Array, Matrix): def testMatrixArray (): - print "M44fArray" + print ("M44fArray") testMxArray (M44fArray, M44f) - print "M44dArray" + print ("M44dArray") testMxArray (M44dArray, M44d) - print "M33fArray" + print ("M33fArray") testMxArray (M33fArray, M33f) - print "M33dArray" + print ("M33dArray") testMxArray (M33dArray, M33d) testList.append(("testMatrixArray",testMatrixArray)) @@ -8415,14 +8423,14 @@ def testStringArray(): for i in range(0,num): assert(int(s2[i]) == i) - print "should see %d 'bar' and %d 'foo'" % (num/2,num/2) + print ("should see %d 'bar' and %d 'foo'" % (num/2,num/2)) for m in s: - print m - print "should see '0' through '%d'" % (num-1) + print (m) + print ("should see '0' through '%d'" % (num-1)) for m in s2: - print m + print (m) - print "ok" + print ("ok") testList.append(("testStringArray",testStringArray)) @@ -8481,14 +8489,14 @@ def testWstringArray(): for i in range(0,num): assert(int(s2[i]) == i) - print "should see %d 'bar' and %d 'foo'" % (num/2,num/2) + print ("should see %d 'bar' and %d 'foo'" % (num/2,num/2)) for m in s: - print m - print "should see '0' through '%d'" % (num-1) + print (m) + print ("should see '0' through '%d'" % (num-1)) for m in s2: - print m + print (m) - print "ok" + print ("ok") testList.append(("testWstringArray",testWstringArray)) @@ -8500,11 +8508,11 @@ random.seed (1567) for test in testList: funcName = test[0] - print "" - print "Running %s" % funcName + print ("") + print ("Running %s" % funcName) test[1]() -print "" +print ("") # Local Variables: # mode:python diff --git a/PyIlmBase/config/Makefile.am b/PyIlmBase/config/Makefile.am index 6da4cf8fc7..f8eb862e6d 100644 --- a/PyIlmBase/config/Makefile.am +++ b/PyIlmBase/config/Makefile.am @@ -4,4 +4,6 @@ configincludedir = $(includedir)/OpenEXR nodist_configinclude_HEADERS = PyIlmBaseConfig.h -EXTRA_DIST = PyIlmBaseConfig.h.in +EXTRA_DIST = PyIlmBaseConfig.h.in ModuleDefine.cmake \ + NumPyLocate.cmake ParseConfigure.cmake PyIlmBaseSetup.cmake \ + CMakeLists.txt diff --git a/PyIlmBase/config/ModuleDefine.cmake b/PyIlmBase/config/ModuleDefine.cmake index 884524e0b9..18ef974f80 100644 --- a/PyIlmBase/config/ModuleDefine.cmake +++ b/PyIlmBase/config/ModuleDefine.cmake @@ -4,51 +4,43 @@ function(PYILMBASE_ADD_LIBRARY_PRIV libname) set(oneValueArgs PRIV_EXPORT CURDIR CURBINDIR OUTROOT) set(multiValueArgs SOURCE HEADERS DEPENDENCIES PRIVATE_DEPS) cmake_parse_arguments(PYILMBASE_CURLIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - set(objlib ${libname}_Object) - add_library(${objlib} OBJECT ${PYILMBASE_CURLIB_SOURCE}) - target_compile_features(${objlib} PUBLIC cxx_std_${PYILMBASE_CXX_STANDARD}) + + + # let the default behaviour BUILD_SHARED_LIBS control the + # disposition of the default library... + add_library(${libname} ${PYILMBASE_CURLIB_SOURCE}) + if(BUILD_SHARED_LIBS) + set_target_properties(${libname} PROPERTIES + SOVERSION ${PYILMBASE_SOVERSION} + VERSION ${PYILMBASE_LIB_VERSION} + ) + endif() + set_target_properties(${libname} PROPERTIES + OUTPUT_NAME "${PYILMBASE_OUTPUT_OUTROOT}${libname}${PYILMBASE_LIB_SUFFIX}" + ) + target_compile_features(${libname} PUBLIC cxx_std_${OPENEXR_CXX_STANDARD}) if(PYILMBASE_CURLIB_PRIV_EXPORT AND BUILD_SHARED_LIBS) - target_compile_definitions(${objlib} PRIVATE ${PYILMBASE_CURLIB_PRIV_EXPORT}) + target_compile_definitions(${libname} PRIVATE ${PYILMBASE_CURLIB_PRIV_EXPORT}) if(WIN32) - target_compile_definitions(${objlib} PUBLIC OPENEXR_DLL) + target_compile_definitions(${libname} PUBLIC OPENEXR_DLL) endif() endif() if(PYILMBASE_CURLIB_CURDIR) - target_include_directories(${objlib} INTERFACE $) + target_include_directories(${libname} PUBLIC $) endif() if(PYILMBASE_CURLIB_CURBINDIR) - target_include_directories(${objlib} PRIVATE $) + target_include_directories(${libname} PRIVATE $) endif() - target_link_libraries(${objlib} PUBLIC ${PYILMBASE_CURLIB_DEPENDENCIES}) + target_link_libraries(${libname} PUBLIC ${PYILMBASE_CURLIB_DEPENDENCIES}) if(PYILMBASE_CURLIB_PRIVATE_DEPS) - target_link_libraries(${objlib} PRIVATE ${PYILMBASE_CURLIB_PRIVATE_DEPS}) + target_link_libraries(${libname} PRIVATE ${PYILMBASE_CURLIB_PRIVATE_DEPS}) endif() - set_target_properties(${objlib} PROPERTIES + set_target_properties(${libname} PROPERTIES CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF POSITION_INDEPENDENT_CODE ON ) - set_property(TARGET ${objlib} PROPERTY PUBLIC_HEADER ${PYILMBASE_CURLIB_HEADERS}) - - install(TARGETS ${objlib} - EXPORT ${PROJECT_NAME} - PUBLIC_HEADER - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PYILMBASE_OUTPUT_SUBDIR} - ) - # let the default behaviour BUILD_SHARED_LIBS control the - # disposition of the default library... - add_library(${libname} $) - target_link_libraries(${libname} PUBLIC ${objlib}) - if(BUILD_SHARED_LIBS) - set_target_properties(${libname} PROPERTIES - SOVERSION ${PYILMBASE_SOVERSION} - VERSION ${PYILMBASE_LIB_VERSION} - ) - endif() - set_target_properties(${libname} PROPERTIES - OUTPUT_NAME "${PYILMBASE_OUTPUT_OUTROOT}${libname}${PYILMBASE_LIB_SUFFIX}" - ) add_library(${PROJECT_NAME}::${libname} ALIAS ${libname}) install(TARGETS ${libname} @@ -62,95 +54,93 @@ endfunction() # NB: This function has a number if specific names / variables # not to mention behavior, so be careful copying... function(PYILMBASE_DEFINE_MODULE modname) - set(options) + set(options NEEDED_BY_OTHER_MODULES) set(oneValueArgs PRIV_EXPORT CURDIR CURBINDIR LIBNAME) - set(multiValueArgs LIBSOURCE MODSOURCE HEADERS DEPENDENCIES PRIVATE_DEPS) + set(multiValueArgs LIBSOURCE MODSOURCE HEADERS DEPENDENCIES PRIVATE_DEPS MODULE_DEPS) cmake_parse_arguments(PYILMBASE_CURMOD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(PYILMBASE_BUILD_SUPPORT_LIBRARIES) - set(libarglist SOURCE ${PYILMBASE_CURMOD_LIBSOURCE}) - if(PYILMBASE_CURMOD_HEADERS) - list(APPEND libarglist HEADERS ${PYILMBASE_CURMOD_HEADERS}) - endif() - if(PYILMBASE_CURMOD_CURDIR) - list(APPEND libarglist CURDIR ${PYILMBASE_CURMOD_CURDIR}) - endif() - if(PYILMBASE_CURMOD_CURBINDIR) - list(APPEND libarglist CURDIR ${PYILMBASE_CURMOD_CURBINDIR}) - endif() - if(PYILMBASE_CURMOD_DEPENDENCIES) - list(APPEND libarglist DEPENDENCIES ${PYILMBASE_CURMOD_DEPENDENCIES}) - endif() - # NB: make this one last so we can cheat and add the python and boost - # libs as private deps at the end regardless of whether it was provided - list(APPEND libarglist PRIVATE_DEPS ${PYILMBASE_CURMOD_PRIVATE_DEPS}) - if(TARGET Python2::Python AND TARGET Boost::${PYILMBASE_BOOST_PY2_COMPONENT}) - set(libname "${PYILMBASE_CURMOD_LIBNAME}${PYILMBASE_LIB_PYTHONVER_ROOT}${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}") - pyilmbase_add_library_priv(${libname} - OUTROOT "Python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}/" - ${libarglist} Python2::Python Boost::${PYILMBASE_BOOST_PY2_COMPONENT} - ) - Python2_add_library(${modname}_python2 MODULE ${PYILMBASE_CURMOD_MODSOURCE}) - target_link_libraries(${modname}_python2 - PRIVATE ${libname}) - set_target_properties(${modname}_python2 PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}/" - LIBRARY_OUTPUT_NAME "${modname}" - ) + if(PYILMBASE_CURMOD_HEADERS) + install( + FILES + ${PYILMBASE_CURMOD_HEADERS} + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/${PYILMBASE_OUTPUT_SUBDIR} + ) + endif() - #### TODO: Define installation rules - endif() - if(TARGET Python3::Python AND TARGET Boost::${PYILMBASE_BOOST_PY3_COMPONENT}) - set(libname "${PYILMBASE_CURMOD_LIBNAME}${PYILMBASE_LIB_PYTHONVER_ROOT}${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}") - pyilmbase_add_library_priv(${libname} - OUTROOT "Python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}/" - ${libarglist} Python3::Python Boost::${PYILMBASE_BOOST_PY3_COMPONENT} - ) - Python3_add_library(${modname}_python3 MODULE ${PYILMBASE_CURMOD_MODSOURCE}) - target_link_libraries(${modname}_python3 - PRIVATE ${libname}) + if(NOT PYILMBASE_CURMOD_LIBNAME) + message(FATAL_ERROR "NYI usage of pyilmbase_define_module") + return() + endif() - set_target_properties(${modname}_python3 PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}/" - LIBRARY_OUTPUT_NAME "${modname}" - ) - #### TODO: Define installation rules - endif() - else() - if(TARGET Python2::Python AND TARGET Boost::${PYILMBASE_BOOST_PY2_COMPONENT}) - Python2_add_library(${modname}_python2 MODULE - ${PYILMBASE_CURMOD_LIBSOURCE} - ${PYILMBASE_CURMOD_MODSOURCE}) - # add library will already depend on python... - target_link_libraries(${modname}_python2 - PRIVATE - Boost::${PYILMBASE_BOOST_PY2_COMPONENT} - ${PYILMBASE_CURMOD_DEPENDENCIES} - ${PYILMBASE_CURMOD_PRIVATE_DEPS}) - set_target_properties(${modname}_python2 PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}/" - LIBRARY_OUTPUT_NAME "${modname}" - ) + set(libarglist SOURCE ${PYILMBASE_CURMOD_LIBSOURCE}) + if(PYILMBASE_CURMOD_PRIV_EXPORT) + list(APPEND libarglist PRIV_EXPORT ${PYILMBASE_CURMOD_PRIV_EXPORT}) + endif() + if(PYILMBASE_CURMOD_HEADERS) + list(APPEND libarglist HEADERS ${PYILMBASE_CURMOD_HEADERS}) + endif() + if(PYILMBASE_CURMOD_CURDIR) + list(APPEND libarglist CURDIR ${PYILMBASE_CURMOD_CURDIR}) + endif() + if(PYILMBASE_CURMOD_CURBINDIR) + list(APPEND libarglist CURDIR ${PYILMBASE_CURMOD_CURBINDIR}) + endif() + if(PYILMBASE_CURMOD_DEPENDENCIES) + list(APPEND libarglist DEPENDENCIES ${PYILMBASE_CURMOD_DEPENDENCIES}) + endif() + # NB: make this one last so we can cheat and add the python and boost + # libs as private deps at the end regardless of whether it was provided + list(APPEND libarglist PRIVATE_DEPS ${PYILMBASE_CURMOD_PRIVATE_DEPS}) + if(TARGET Python2::Python AND TARGET Boost::${PYILMBASE_BOOST_PY2_COMPONENT}) + set(libname "${PYILMBASE_CURMOD_LIBNAME}${PYILMBASE_LIB_PYTHONVER_ROOT}${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}") + set(extraDeps ${PYILMBASE_CURMOD_MODULE_DEPS}) + list(TRANSFORM extraDeps APPEND ${PYILMBASE_LIB_PYTHONVER_ROOT}${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}) - #### TODO: Define installation rules - endif() + pyilmbase_add_library_priv(${libname} + ${libarglist} + ${extraDeps} + Python2::Python + Boost::${PYILMBASE_BOOST_PY2_COMPONENT} + ) - if(TARGET Python3::Python AND TARGET Boost::${PYILMBASE_BOOST_PY3_COMPONENT}) - Python3_add_library(${modname}_python3 MODULE - ${PYILMBASE_CURMOD_LIBSOURCE} - ${PYILMBASE_CURMOD_MODSOURCE}) - # add library will already depend on python... - target_link_libraries(${modname}_python3 - PRIVATE - Boost::${PYILMBASE_BOOST_PY3_COMPONENT} - ${PYILMBASE_CURMOD_DEPENDENCIES} - ${PYILMBASE_CURMOD_PRIVATE_DEPS}) - set_target_properties(${modname}_python3 PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}/" - LIBRARY_OUTPUT_NAME "${modname}" + Python2_add_library(${modname}_python2 MODULE ${PYILMBASE_CURMOD_MODSOURCE}) + target_link_libraries(${modname}_python2 + PRIVATE + ${libname} + ${extraDeps} + ${PYILMBASE_CURMOD_DEPENDENCIES} + ${PYILMBASE_CURMOD_PRIVATE_DEPS} ) + set_target_properties(${modname}_python2 PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}/" + LIBRARY_OUTPUT_NAME "${modname}" + ) + #### TODO: Define installation rules + endif() - #### TODO: Define installation rules - endif() + if(TARGET Python3::Python AND TARGET Boost::${PYILMBASE_BOOST_PY3_COMPONENT}) + set(libname "${PYILMBASE_CURMOD_LIBNAME}${PYILMBASE_LIB_PYTHONVER_ROOT}${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}") + set(extraDeps ${PYILMBASE_CURMOD_MODULE_DEPS}) + list(TRANSFORM extraDeps APPEND ${PYILMBASE_LIB_PYTHONVER_ROOT}${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}) + + pyilmbase_add_library_priv(${libname} + ${libarglist} + ${extraDeps} + Python3::Python + Boost::${PYILMBASE_BOOST_PY3_COMPONENT} + ) + Python3_add_library(${modname}_python3 MODULE ${PYILMBASE_CURMOD_MODSOURCE}) + target_link_libraries(${modname}_python3 + PRIVATE + ${libname} ${extraDeps} + ${PYILMBASE_CURMOD_DEPENDENCIES} + ${PYILMBASE_CURMOD_PRIVATE_DEPS} + ) + set_target_properties(${modname}_python3 PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}/" + LIBRARY_OUTPUT_NAME "${modname}" + ) + #### TODO: Define installation rules endif() endfunction() diff --git a/PyIlmBase/config/NumPyLocate.cmake b/PyIlmBase/config/NumPyLocate.cmake new file mode 100644 index 0000000000..7287035c87 --- /dev/null +++ b/PyIlmBase/config/NumPyLocate.cmake @@ -0,0 +1,84 @@ + +if(TARGET Python2::Interpreter) + execute_process( + COMMAND ${Python2_EXECUTABLE} -c + "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n" + RESULT_VARIABLE _NUMPY2_RESULT + OUTPUT_VARIABLE py_ilmbase_numpy2_path + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT _NUMPY2_RESULT MATCHES 0) + set(NumPy_Py2_FOUND 0 CACHE INTERNAL "Python2 numpy libraries not found") + message(WARNING "Unable to import numpy using python ${Python2_VERSION}") + else() + execute_process( + COMMAND ${Python2_EXECUTABLE} -c + "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n" + RESULT_VARIABLE _NUMPY2_RESULT + OUTPUT_VARIABLE py_ilmbase_numpy2_version + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT _NUMPY2_RESULT MATCHES 0) + set(NumPy_Py2_FOUND 0 CACHE INTERNAL "Python2 numpy libraries not found") + message(WARNING "Found numpy module in python ${Python2_VERSION}, but no version information") + else() + find_path(NumPy_Py2_INCLUDE_DIRS numpy/arrayobject.h + HINTS "${py_ilmbase_numpy2_path}" "${Python2_INCLUDE_DIRS}" + NO_DEFAULT_PATH + ) + if(NumPy_Py2_INCLUDE_DIRS) + set(NumPy_Py2_FOUND 1 CACHE INTERNAL "Python2 numpy found") + set(NumPy_Py2_VERSION ${py_ilmbase_numpy2_version}) + add_library(NumPy_Py2 INTERFACE IMPORTED GLOBAL) + target_include_directories(NumPy_Py2 INTERFACE ${NumPy_Py2_INCLUDE_DIRS}) + add_library(Python2::IlmBaseNumPy ALIAS NumPy_Py2) + message(STATUS "Found NumPy ${NumPy_Py2_VERSION} for Python ${Python2_VERSION}: ${NumPy_Py2_INCLUDE_DIRS}") + else() + set(NumPy_Py2_FOUND 0 CACHE INTERNAL "Python2 numpy libraries not found") + message(WARNING "Found numpy version ${py_ilmbase_numpy2_version} in python ${Python2_VERSION}, but unable to locate header files") + endif() + endif() + endif() +endif() + +if(TARGET Python3::Interpreter) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c + "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n" + RESULT_VARIABLE _NUMPY3_RESULT + OUTPUT_VARIABLE py_ilmbase_numpy3_path + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT _NUMPY3_RESULT MATCHES 0) + set(NumPy_Py3_FOUND 0 CACHE INTERNAL "Python3 numpy libraries not found") + message(WARNING "Unable to import numpy using python ${Python3_VERSION}") + else() + execute_process( + COMMAND ${Python3_EXECUTABLE} -c + "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n" + RESULT_VARIABLE _NUMPY3_RESULT + OUTPUT_VARIABLE py_ilmbase_numpy3_version + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT _NUMPY3_RESULT MATCHES 0) + set(NumPy_Py3_FOUND 0 CACHE INTERNAL "Python3 numpy libraries not found") + message(WARNING "Found numpy module in python ${Python3_VERSION}, but no version information") + else() + find_path(NumPy_Py3_INCLUDE_DIRS numpy/arrayobject.h + HINTS "${py_ilmbase_numpy3_path}" "${Python3_INCLUDE_DIRS}" + NO_DEFAULT_PATH + ) + if(NumPy_Py3_INCLUDE_DIRS) + set(NumPy_Py3_FOUND 1 CACHE INTERNAL "Python3 numpy found") + set(NumPy_Py3_VERSION ${py_ilmbase_numpy3_version}) + add_library(NumPy_Py3 INTERFACE IMPORTED GLOBAL) + target_include_directories(NumPy_Py3 INTERFACE ${NumPy_Py3_INCLUDE_DIRS}) + add_library(Python3::IlmBaseNumPy ALIAS NumPy_Py3) + message(STATUS "Found NumPy ${NumPy_Py3_VERSION} for Python ${Python3_VERSION}: ${NumPy_Py3_INCLUDE_DIRS}") + else() + set(NumPy_Py3_FOUND 0 CACHE INTERNAL "Python3 numpy libraries not found") + message(WARNING "Found numpy version ${py_ilmbase_numpy3_version} in python ${Python3_VERSION}, but unable to locate header files") + endif() + endif() + endif() +endif() diff --git a/PyIlmBase/config/PyIlmBaseSetup.cmake b/PyIlmBase/config/PyIlmBaseSetup.cmake index 14c9f3baf5..d8d9d93958 100644 --- a/PyIlmBase/config/PyIlmBaseSetup.cmake +++ b/PyIlmBase/config/PyIlmBaseSetup.cmake @@ -8,20 +8,25 @@ include(GNUInstallDirs) set(PYILMBASE_OVERRIDE_PYTHON2_INSTALL_DIR "" CACHE STRING "Override the install location for any python 2.x modules compiled") set(PYILMBASE_OVERRIDE_PYTHON3_INSTALL_DIR "" CACHE STRING "Override the install location for any python 3.x modules compiled") +# What C++ standard to compile for +# VFX Platform 18 is c++14, so let's enable that by default +set(tmp 14) +if(CMAKE_CXX_STANDARD) + set(tmp ${CMAKE_CXX_STANDARD}) +endif() +set(OPENEXR_CXX_STANDARD "${tmp}" CACHE STRING "C++ standard to compile against") +set(tmp) + ######################## ## Build related options -# This option builds the python modules with an extra library layer -# for the various modules. This was originally done for a larger -# internal system, but is unlikely to work on systems such as -# windows, or with compiling for multiple python platforms at once, -# without larger intervention and as such is disabled. -option(PYILMBASE_BUILD_SUPPORT_LIBRARIES "Build python modules with library layer (see comments before enabling)" OFF) # Suffix to append to root name, this helps with version management # but can be turned off if you don't care, or otherwise customized # -set(PYILMBASE_LIB_SUFFIX "-${PYILMBASE_VERSION_API}" CACHE STRING "String added to the end of all the libraries (if on)") -set(PYILMBASE_LIB_PYTHONVER_ROOT "_Python" CACHE STRING "String added as a root to the python version in the libraries (if libs are on)") +set(PYILMBASE_LIB_SUFFIX "-${PYILMBASE_VERSION_API}" CACHE STRING "String added to the end of all the libraries") +# This provides a root for the unique name of the library based on +# the version of python being compiled for +set(PYILMBASE_LIB_PYTHONVER_ROOT "_Python" CACHE STRING "String added as a root to the identifier of the python version in the libraries") # This is a variable here for use in install lines when creating # libraries (otherwise ignored). Care must be taken when changing this, @@ -66,16 +71,25 @@ endif() ######################## +# set a default build type if not set +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + # Code check related features -option(PYILMBASE_USE_CLANG_TIDY "Check if clang-tidy is available, and enable that" OFF) -if(PYILMBASE_USE_CLANG_TIDY) - find_program(PYILMBASE_CLANG_TIDY_BIN clang-tidy) - if(PYILMBASE_CLANG_TIDY_BIN-NOTFOUND) +option(OPENEXR_USE_CLANG_TIDY "Check if clang-tidy is available, and enable that" OFF) +if(OPENEXR_USE_CLANG_TIDY) + find_program(OPENEXR_CLANG_TIDY_BIN clang-tidy) + if(OPENEXR_CLANG_TIDY_BIN-NOTFOUND) message(FATAL_ERROR "clang-tidy processing requested, but no clang-tidy found") endif() # TODO: Need to define the list of valid checks and add a file with said list set(CMAKE_CXX_CLANG_TIDY - ${PYILMBASE_CLANG_TIDY_BIN}; + ${OPENEXR_CLANG_TIDY_BIN}; -header-filter=.; -checks=*; ) diff --git a/cmake/Toolchain-Linux-VFX_Platform15.cmake b/cmake/Toolchain-Linux-VFX_Platform15.cmake new file mode 100644 index 0000000000..5813494ce2 --- /dev/null +++ b/cmake/Toolchain-Linux-VFX_Platform15.cmake @@ -0,0 +1,36 @@ +# +# This is only an example of a theoretical toolchain file +# that might be used for compiling to target a VFX +# reference platform (https://vfxplatform.com) that is +# consistent with the CY2015 spec. +# +# A toolchain file is loaded early in the cmake configure +# process to enable compiler checks to use the appropriate +# compilers. +# +# Read the docs to understand more: +# https://cmake.org/cmake/help/v3.12/manual/cmake-toolchains.7.html +# +# Then to run, do something like +# mkdir vfx_2015 +# cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-Linux-VFX_Platform15.cmake -DCMAKE_INSTALL_PREFIX=/path/to/vfx_2015 .. +# (plus any other settings you'd like) +# make +# make test +# make install + +# by not setting this, it will assume it's a mostly standard linux environment +#set(CMAKE_SYSTEM_NAME Linux) + +set(CMAKE_C_COMPILER gcc-4.8.2) +set(CMAKE_CXX_COMPILER g++-4.8.2) + +set(CMAKE_FIND_ROOT_PATH /my/vfx_2015/libraries) + +set(CMAKE_CXX_STANDARD 11) + +# read the docs to understand whether this is what you want +# if you use system libraries for some things, it may not be!!! +#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +#set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)