From 9ec3bb49e9f6fc5aac6fbcf99cbfd300e3ae0fee Mon Sep 17 00:00:00 2001 From: Owen Thompson Date: Tue, 23 Jun 2020 15:25:52 -0400 Subject: [PATCH] Reconfigure CMake to build Imath and PyImath optionally. Signed-off-by: Owen Thompson --- CMakeLists.txt | 76 ++++--- Half/CMakeLists.txt | 2 +- Half/Makefile.am | 40 ---- HalfTest/CMakeLists.txt | 7 +- HalfTest/Makefile.am | 25 --- Imath/CMakeLists.txt | 9 +- Imath/ImathExc.cpp | 15 -- Imath/ImathExc.h | 73 ------ Imath/Makefile.am | 49 ---- ImathTest/CMakeLists.txt | 7 +- ImathTest/Makefile.am | 36 --- config/CMakeLists.txt | 80 +++---- config/ImathConfig.h.in | 39 ++-- config/ImathConfigInternal.h.in | 4 +- config/ImathSetup.cmake | 48 ++-- config/LibraryDefine.cmake | 100 +++++---- config/version.cmake | 28 +-- python/CMakeLists.txt | 96 ++++---- python/Makefile.am | 39 ---- python/PyImath/CMakeLists.txt | 5 +- python/PyImath/Makefile.am | 99 -------- python/PyImathNumpy/CMakeLists.txt | 30 ++- python/PyImathNumpy/Makefile.am | 20 -- python/PyImathNumpyTest/CMakeLists.txt | 8 +- python/PyImathNumpyTest/Makefile.am | 8 - python/PyImathTest/CMakeLists.txt | 8 +- python/PyImathTest/Makefile.am | 8 - python/config/CMakeLists.txt | 20 +- python/config/Makefile.am | 19 -- python/config/ModuleDefine.cmake | 112 ++++----- python/config/NumPyLocate.cmake | 24 +- python/config/ParseConfigure.cmake | 20 -- python/config/PyIlmBaseConfigInternal.h.in | 11 - python/config/PyImathSetup.cmake | 16 +- python/config/version.cmake | 14 ++ python/configure.ac | 250 --------------------- 36 files changed, 353 insertions(+), 1092 deletions(-) delete mode 100644 Half/Makefile.am delete mode 100644 HalfTest/Makefile.am delete mode 100644 Imath/ImathExc.cpp delete mode 100644 Imath/ImathExc.h delete mode 100644 Imath/Makefile.am delete mode 100644 ImathTest/Makefile.am delete mode 100644 python/Makefile.am delete mode 100644 python/PyImath/Makefile.am delete mode 100644 python/PyImathNumpy/Makefile.am delete mode 100644 python/PyImathNumpyTest/Makefile.am delete mode 100644 python/PyImathTest/Makefile.am delete mode 100644 python/config/Makefile.am delete mode 100644 python/config/ParseConfigure.cmake delete mode 100644 python/config/PyIlmBaseConfigInternal.h.in create mode 100644 python/config/version.cmake delete mode 100644 python/configure.ac diff --git a/CMakeLists.txt b/CMakeLists.txt index 111a6034..b520ad35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenEXR Project. -# We require this to get object library link library support and -# combined python 2 + 3 support -if(OPENEXR_BUILD_BOTH_STATIC_SHARED OR ILMBASE_BUILD_BOTH_STATIC_SHARED) +if(IMATH_BUILD_BOTH_STATIC_SHARED OR IMATH_BUILD_BOTH_STATIC_SHARED) if (${CMAKE_VERSION} VERSION_LESS "3.12.0") message(FATAL_ERROR "CMake 3.12 or newer is required for object library support when building both static and shared libraries") endif() @@ -16,25 +14,47 @@ if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() -# Hint: This can be set to enable custom find_package -# search paths, probably best to set it when configuring -# on the command line to cmake instead of setting it -# here. -###set(CMAKE_PREFIX_PATH "/prefix") +# we include this first to obtain version numbers from version.cmake +include(config/version.cmake) -project(OpenEXRMetaProject) +#set up our project +project(Imath VERSION ${IMATH_VERSION} LANGUAGES C CXX) +####################################### +####################################### +# This declares all the configuration variables visible +# in cmake-gui or similar and the rest of the global +# project setup +# +# Please look at this file to see what is configurable +####################################### +####################################### +include(config/ImathSetup.cmake) -# An "official" way to make this a super-project -# basically overrides the find_package to not find anything -# for stuff we're including locally -set(as_subproject IlmBase OpenEXR) -macro(find_package) - if(NOT "${ARGV0}" IN_LIST as_subproject) - _find_package(${ARGV}) - endif() -endmacro() +# generates config headers, package config files +add_subdirectory(config) + +# utility function for the repeated boilerplate of defining +# the libraries +include(config/LibraryDefine.cmake) + +####################################### +# Include these modules without enable/disable options +add_subdirectory(Half) +add_subdirectory(Imath) +# Tell CMake where to find the ImathConfig.cmake file. Makes it posible to call +# find_package(Imath) in downstream projects +set(Imath_DIR "${CMAKE_CURRENT_BINARY_DIR}/config" CACHE PATH "" FORCE) +# Add an empty ImathTargets.cmake file for the config to use. +# Can be empty since we already defined the targets in add_subdirectory +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config/ImathTargets.cmake" "# Dummy file") + + +option(PYTHON "Set ON to compile PyImath bindings") +if (PYTHON) + add_subdirectory(python) +endif() # If you want to use ctest to configure, build and # upload the results, cmake has builtin support for @@ -52,7 +72,7 @@ endmacro() # # [or whatever you name the file you edit] # -#set(CTEST_PROJECT_NAME "OpenEXR") +#set(CTEST_PROJECT_NAME "Imath") #set(CTEST_NIGHTLY_START_TIME "01:01:01 UTC") #set(CTEST_DROP_METHOD "http") # there are others... #set(CTEST_DROP_SITE "open.cdash.org") @@ -62,23 +82,9 @@ endmacro() include(CTest) if(BUILD_TESTING) enable_testing() -endif() -####################################### - -# Include these two modules without enable/disable options -add_subdirectory(IlmBase) -add_subdirectory(OpenEXR) - -# should this just be always on and we conditionally compile what -# is found and warn otherwise? or error out? -option(PYILMBASE_ENABLE "Enables configuration of the PyIlmBase module" ON) -if(PYILMBASE_ENABLE) - if (${CMAKE_VERSION} VERSION_LESS "3.12.0") - message(WARNING ": CMake version ${CMAKE_VERSION} detected, PyIlmBase uses newer features of cmake (>= 3.12), disabling") - else() - add_subdirectory(PyIlmBase) - endif() + add_subdirectory(HalfTest) + add_subdirectory(ImathTest) endif() # Including this module will add a `clang-format` target to the build if diff --git a/Half/CMakeLists.txt b/Half/CMakeLists.txt index 47317d79..5e0406dc 100644 --- a/Half/CMakeLists.txt +++ b/Half/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenEXR Project. -ilmbase_define_library(Half +imath_define_library(Half PRIV_EXPORT HALF_EXPORTS CURDIR ${CMAKE_CURRENT_SOURCE_DIR} SOURCES diff --git a/Half/Makefile.am b/Half/Makefile.am deleted file mode 100644 index 08f62fa4..00000000 --- a/Half/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/config - -lib_LTLIBRARIES = libHalf.la - -libHalf_la_SOURCES = half.cpp half.h halfFunction.h halfLimits.h - -libHalf_la_LDFLAGS = -version-info @LIBTOOL_VERSION@ -no-undefined -if LIB_SUFFIX_EXISTS -libHalf_la_LDFLAGS += -release @LIB_SUFFIX@ -endif - -libHalfincludedir = $(includedir)/OpenEXR - -libHalfinclude_HEADERS = half.h halfFunction.h halfLimits.h halfExport.h - -# these are used to build eLut.h and toFloat.h dynamically -EXTRA_DIST = eLut.cpp toFloat.cpp CMakeLists.txt - -CLEANFILES = eLut eLut.h toFloat toFloat.h - -eLut_SOURCES = eLut.cpp - -toFloat_SOURCES = toFloat.cpp - -eLut.h: eLut - ./eLut > eLut.h - -toFloat.h: toFloat - ./toFloat > toFloat.h - -BUILT_SOURCES = eLut.h toFloat.h - -noinst_PROGRAMS = eLut toFloat diff --git a/HalfTest/CMakeLists.txt b/HalfTest/CMakeLists.txt index e71dc35f..001d5774 100644 --- a/HalfTest/CMakeLists.txt +++ b/HalfTest/CMakeLists.txt @@ -13,11 +13,8 @@ add_executable(HalfTest testToFloat.cpp ) -target_link_libraries(HalfTest IlmBase::Half) +target_link_libraries(HalfTest Half) set_target_properties(HalfTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" ) -if(WIN32 AND (BUILD_SHARED_LIBS OR OPENEXR_BUILD_BOTH_STATIC_SHARED)) - target_compile_definitions(HalfTest PRIVATE OPENEXR_DLL) -endif() -add_test(NAME IlmBase.Half COMMAND $) +add_test(NAME Half COMMAND $) diff --git a/HalfTest/Makefile.am b/HalfTest/Makefile.am deleted file mode 100644 index 3c10ce4d..00000000 --- a/HalfTest/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -check_PROGRAMS = HalfTest - -HalfTest_SOURCES = main.cpp testArithmetic.cpp testArithmetic.h \ - testBitPatterns.cpp testBitPatterns.h \ - testClassification.cpp testClassification.h \ - testError.cpp testError.h testFunction.cpp \ - testFunction.h testLimits.cpp testLimits.h testSize.cpp \ - testToFloat.cpp testToFloat.h \ - testSize.h - -AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/Half -I$(top_srcdir)/config - -LDADD = -L$(top_builddir)/Half -lHalf - -TESTS = HalfTest - -EXTRA_DIST = CMakeLists.txt - diff --git a/Imath/CMakeLists.txt b/Imath/CMakeLists.txt index 06ac2dd8..8e5dc0db 100644 --- a/Imath/CMakeLists.txt +++ b/Imath/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenEXR Project. -ilmbase_define_library(Imath +imath_define_library(Imath PRIV_EXPORT IMATH_EXPORTS CURDIR ${CMAKE_CURRENT_SOURCE_DIR} SOURCES @@ -9,7 +9,6 @@ ilmbase_define_library(Imath ImathColorAlgo.cpp ImathFun.cpp ImathVec.cpp - ImathExc.cpp ImathMatrixAlgo.cpp HEADERS ImathBoxAlgo.h @@ -17,7 +16,6 @@ ilmbase_define_library(Imath ImathColorAlgo.h ImathColor.h ImathEuler.h - ImathExc.h ImathExport.h ImathForward.h ImathFrame.h @@ -46,5 +44,6 @@ ilmbase_define_library(Imath ImathVecAlgo.h ImathVec.h DEPENDENCIES - IlmBase::Half IlmBase::IexMath -) + Half IexMath + ) + diff --git a/Imath/ImathExc.cpp b/Imath/ImathExc.cpp deleted file mode 100644 index 6f145969..00000000 --- a/Imath/ImathExc.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright Contributors to the OpenEXR Project. - -#include "ImathExc.h" - -IMATH_INTERNAL_NAMESPACE_SOURCE_ENTER - -DEFINE_EXC_EXP_IMPL (IMATH_EXPORT, NullVecExc, ::IEX_NAMESPACE::MathExc) -DEFINE_EXC_EXP_IMPL (IMATH_EXPORT, InfPointExc, ::IEX_NAMESPACE::MathExc) -DEFINE_EXC_EXP_IMPL (IMATH_EXPORT, NullQuatExc, ::IEX_NAMESPACE::MathExc) -DEFINE_EXC_EXP_IMPL (IMATH_EXPORT, SingMatrixExc, ::IEX_NAMESPACE::MathExc) -DEFINE_EXC_EXP_IMPL (IMATH_EXPORT, ZeroScaleExc, ::IEX_NAMESPACE::MathExc) -DEFINE_EXC_EXP_IMPL (IMATH_EXPORT, IntVecNormalizeExc, ::IEX_NAMESPACE::MathExc) - -IMATH_INTERNAL_NAMESPACE_SOURCE_EXIT diff --git a/Imath/ImathExc.h b/Imath/ImathExc.h deleted file mode 100644 index 65af3b55..00000000 --- a/Imath/ImathExc.h +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMATHEXC_H -#define INCLUDED_IMATHEXC_H - - -//----------------------------------------------- -// -// Imath library-specific exceptions -// -//----------------------------------------------- - -#include "ImathNamespace.h" -#include "IexBaseExc.h" -#include "ImathExport.h" - -IMATH_INTERNAL_NAMESPACE_HEADER_ENTER - -// Attempt to normalize null vector -DEFINE_EXC_EXP (IMATH_EXPORT, NullVecExc, ::IEX_NAMESPACE::MathExc) - -// Attempt to normalize a point at infinity -DEFINE_EXC_EXP (IMATH_EXPORT, InfPointExc, ::IEX_NAMESPACE::MathExc) - -// Attempt to normalize null quaternion -DEFINE_EXC_EXP (IMATH_EXPORT, NullQuatExc, ::IEX_NAMESPACE::MathExc) - -// Attempt to invert singular matrix -DEFINE_EXC_EXP (IMATH_EXPORT, SingMatrixExc, ::IEX_NAMESPACE::MathExc) - -// Attempt to remove zero scaling from matrix -DEFINE_EXC_EXP (IMATH_EXPORT, ZeroScaleExc, ::IEX_NAMESPACE::MathExc) - -// Attempt to normalize a vector of whose elementsare an integer type -DEFINE_EXC_EXP (IMATH_EXPORT, IntVecNormalizeExc, ::IEX_NAMESPACE::MathExc) - - -IMATH_INTERNAL_NAMESPACE_HEADER_EXIT - -#endif // INCLUDED_IMATHEXC_H diff --git a/Imath/Makefile.am b/Imath/Makefile.am deleted file mode 100644 index da4f1c9a..00000000 --- a/Imath/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -lib_LTLIBRARIES = libImath.la - -libImath_la_SOURCES = ImathMatrixAlgo.cpp ImathVec.cpp \ - ImathColorAlgo.cpp ImathExc.cpp ImathFun.cpp \ - ImathColorAlgo.h ImathMatrixAlgo.h ImathVec.h \ - ImathShear.h ImathFun.h ImathBox.h ImathBoxAlgo.h \ - ImathEuler.h ImathExc.h ImathLimits.h ImathLine.h \ - ImathLineAlgo.h ImathMatrix.h ImathPlane.h \ - ImathSphere.h ImathVecAlgo.h ImathQuat.h \ - ImathFrustum.h ImathMath.h ImathGL.h \ - ImathColor.h ImathRandom.h ImathRoots.h \ - ImathHalfLimits.h ImathInterval.h ImathGLU.h \ - ImathFrame.h ImathPlatform.h \ - ImathRandom.cpp ImathInt64.h \ - ImathFrustumTest.h - -libImath_la_LDFLAGS = -version-info @LIBTOOL_VERSION@ -no-undefined -if LIB_SUFFIX_EXISTS -libImath_la_LDFLAGS += -release @LIB_SUFFIX@ -endif - - -libImath_la_LIBADD = ../Iex/libIex.la - -libImathincludedir = $(includedir)/OpenEXR - -libImathinclude_HEADERS = ImathColorAlgo.h ImathMatrixAlgo.h ImathVec.h \ - ImathShear.h ImathFun.h ImathBox.h ImathBoxAlgo.h \ - ImathEuler.h ImathExc.h ImathLimits.h ImathLine.h \ - ImathLineAlgo.h ImathMatrix.h ImathPlane.h \ - ImathSphere.h ImathVecAlgo.h ImathQuat.h \ - ImathFrustum.h ImathMath.h ImathGL.h \ - ImathColor.h ImathRandom.h ImathRoots.h \ - ImathHalfLimits.h ImathInterval.h ImathGLU.h \ - ImathFrame.h ImathPlatform.h ImathInt64.h \ - ImathNamespace.h ImathForward.h ImathExport.h \ - ImathFrustumTest.h - -AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/Iex -I$(top_srcdir)/Half \ - -I$(top_srcdir)/config - -EXTRA_DIST = CMakeLists.txt diff --git a/ImathTest/CMakeLists.txt b/ImathTest/CMakeLists.txt index 996cb05d..d0b3f0b2 100644 --- a/ImathTest/CMakeLists.txt +++ b/ImathTest/CMakeLists.txt @@ -27,11 +27,8 @@ add_executable(ImathTest testVec.cpp ) -target_link_libraries(ImathTest IlmBase::Imath) +target_link_libraries(ImathTest Imath) set_target_properties(ImathTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" ) -if(WIN32 AND (BUILD_SHARED_LIBS OR OPENEXR_BUILD_BOTH_STATIC_SHARED)) - target_compile_definitions(ImathTest PRIVATE OPENEXR_DLL) -endif() -add_test(NAME IlmBase.Imath COMMAND $) +add_test(NAME Imath COMMAND $) diff --git a/ImathTest/Makefile.am b/ImathTest/Makefile.am deleted file mode 100644 index ff371e25..00000000 --- a/ImathTest/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -check_PROGRAMS = ImathTest - -ImathTest_SOURCES = main.cpp testExtractEuler.cpp testExtractSHRT.cpp \ - testFrustum.cpp testFun.cpp testInvert.cpp \ - testMatrix.cpp testRandom.cpp testRoots.cpp \ - testShear.cpp testColor.cpp testColor.h \ - testExtractEuler.h testExtractSHRT.h testFrustum.h \ - testFun.h testInvert.h testMatrix.h testRandom.h \ - testRoots.h testShear.h testQuatSetRotation.cpp \ - testQuatSetRotation.h testLineAlgo.cpp testLineAlgo.h \ - testQuatSlerp.cpp testQuatSlerp.h testQuat.cpp \ - testQuat.h testBoxAlgo.cpp testBoxAlgo.h \ - testVec.cpp testVec.h testBox.cpp testBox.h \ - testMiscMatrixAlgo.cpp testMiscMatrixAlgo.h \ - testProcrustes.cpp testProcrustes.h \ - testTinySVD.cpp testTinySVD.h \ - testJacobiEigenSolver.cpp testJacobiEigenSolver.h \ - testFrustumTest.cpp testFrustumTest.h - -AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/Imath -I$(top_srcdir)/Iex -I$(top_srcdir)/Half \ - -I$(top_srcdir)/config - -LDADD = -L$(top_builddir)/Imath -L$(top_builddir)/Iex -L$(top_builddir)/Half \ - -lImath -lIex -lHalf - -TESTS = ImathTest - -EXTRA_DIST = CMakeLists.txt - diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index d9c5ae44..3828cbd6 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -6,79 +6,49 @@ include(CheckSymbolExists) include(CheckLibraryExists) include(CheckStructHasMember) -check_include_files(ucontext.h ILMBASE_HAVE_UCONTEXT_H) -if(ILMBASE_HAVE_UCONTEXT_H) - # TODO: remove this once we cleanly have ILMBASE_ prefix on all #defines +check_include_files(ucontext.h IMATH_HAVE_UCONTEXT_H) +if(IMATH_HAVE_UCONTEXT_H) + # TODO: remove this once we cleanly have IMATH_ prefix on all #defines set(HAVE_UCONTEXT_H ON) - check_struct_has_member("struct _libc_fpstate" mxcsr ucontext.h ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT) - if(NOT ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT) - check_include_files(asm/sigcontext.h ILMBASE_HAVE_SIGCONTEXT_H) - if(ILMBASE_HAVE_SIGCONTEXT_H) - check_struct_has_member("struct _fpstate" mxcsr asm/sigcontext.h ILMBASE_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT) + check_struct_has_member("struct _libc_fpstate" mxcsr ucontext.h IMATH_HAVE_CONTROL_REGISTER_SUPPORT) + if(NOT IMATH_HAVE_CONTROL_REGISTER_SUPPORT) + check_include_files(asm/sigcontext.h IMATH_HAVE_SIGCONTEXT_H) + if(IMATH_HAVE_SIGCONTEXT_H) + check_struct_has_member("struct _fpstate" mxcsr asm/sigcontext.h IMATH_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT) endif() endif() endif() -###check_include_files(pthread.h ILMBASE_HAVE_PTHREAD) -if(Threads_FOUND) - if(CMAKE_HAVE_PTHREAD_H OR CMAKE_USE_PTHREADS_INIT OR CMAKE_HP_PTHREAD_INIT) - set(ILMBASE_HAVE_PTHREAD ON) - # TODO: remove this once we cleanly have ILMBASE_ prefix on all #defines - set(HAVE_PTHREAD ON) - endif() - - # we have threads, but do we have posix semaphores for sem_init? - # should be in pthreads - if(NOT (APPLE OR (WIN32 AND (NOT MINGW)))) - if(MINGW) - check_include_files("pthread_unistd.h;semaphore.h" ILMBASE_HAVE_SEMAPHORE_H) - else() - check_include_files(semaphore.h ILMBASE_HAVE_SEMAPHORE_H) - endif() - if(ILMBASE_HAVE_SEMAPHORE_H AND ILMBASE_HAVE_PTHREAD) - # should just be in libc, so no need for check_library_exists - set(CMAKE_REQUIRED_FLAGS ${CMAKE_THREAD_LIBS_INIT}) - check_library_exists(pthread sem_init "" ILMBASE_HAVE_POSIX_SEMAPHORES) - # TODO: remove this once we cleanly have ILMBASE_ prefix on all #defines - if(ILMBASE_HAVE_POSIX_SEMAPHORES) - set(HAVE_POSIX_SEMAPHORES ON) - endif() - set(CMAKE_REQUIRED_FLAGS) - endif() - endif() -endif() - -if (ILMBASE_ENABLE_LARGE_STACK) - set(ILMBASE_HAVE_LARGE_STACK ON) +if (IMATH_ENABLE_LARGE_STACK) + set(IMATH_HAVE_LARGE_STACK ON) endif() +configure_file(ImathConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/ImathConfig.h) +configure_file(ImathConfigInternal.h.in ${CMAKE_CURRENT_BINARY_DIR}/ImathConfigInternal.h) -configure_file(IlmBaseConfig.h.in_cmake ${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfig.h) -configure_file(IlmBaseConfigInternal.h.in_cmake ${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfigInternal.h) - -add_library(IlmBaseConfig INTERFACE) -target_include_directories(IlmBaseConfig INTERFACE +add_library(ImathConfig INTERFACE) +target_include_directories(ImathConfig INTERFACE $ $ - $) + $) install( FILES - ${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfig.h + ${CMAKE_CURRENT_BINARY_DIR}/ImathConfig.h DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/${ILMBASE_OUTPUT_SUBDIR} + ${CMAKE_INSTALL_INCLUDEDIR}/${IMATH_OUTPUT_SUBDIR} ) -install(TARGETS IlmBaseConfig EXPORT ${PROJECT_NAME}) -add_library(IlmBase::Config ALIAS IlmBaseConfig) +install(TARGETS ImathConfig EXPORT ${PROJECT_NAME}) +add_library(Imath::Config ALIAS ImathConfig) -if(ILMBASE_INSTALL_PKG_CONFIG) +if(IMATH_INSTALL_PKG_CONFIG) # use a helper function to avoid variable pollution, but pretty simple - function(ilmbase_pkg_config_help pcinfile) + function(imath_pkg_config_help pcinfile) set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix "\${prefix}") set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") - set(LIB_SUFFIX_DASH ${ILMBASE_LIB_SUFFIX}) + set(LIB_SUFFIX_DASH ${IMATH_LIB_SUFFIX}) if(TARGET Threads::Threads) # hrm, can't use properties as they end up as generator expressions # which don't seem to evaluate @@ -94,7 +64,7 @@ if(ILMBASE_INSTALL_PKG_CONFIG) DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) endfunction() - ilmbase_pkg_config_help(../IlmBase.pc.in) + imath_pkg_config_help(../Imath.pc.in) else() message(NOTICE "-- WARNING pkg-config generation disabled") endif() @@ -103,12 +73,12 @@ endif() # moral equivalent of a pkg-config file for cmake # and replaces the Find*.cmake of the "old" cmake include(CMakePackageConfigHelpers) -configure_package_config_file(IlmBaseConfig.cmake.in +configure_package_config_file(ImathConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake" - VERSION ${ILMBASE_VERSION} + VERSION ${IMATH_VERSION} COMPATIBILITY SameMajorVersion ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake diff --git a/config/ImathConfig.h.in b/config/ImathConfig.h.in index bd4759fb..e9097d06 100644 --- a/config/ImathConfig.h.in +++ b/config/ImathConfig.h.in @@ -3,8 +3,8 @@ // This file is auto-generated by the cmake configure step -#ifndef INCLUDED_ILMBASE_CONFIG_H -#define INCLUDED_ILMBASE_CONFIG_H 1 +#ifndef INCLUDED_IMATH_CONFIG_H +#define INCLUDED_IMATH_CONFIG_H 1 #pragma once @@ -15,11 +15,12 @@ #cmakedefine HAVE_PTHREAD 1 #cmakedefine HAVE_POSIX_SEMAPHORES 1 + // // Define and set to 1 if the target system has support for large // stack sizes. // -#cmakedefine ILMBASE_HAVE_LARGE_STACK +#cmakedefine IMATH_HAVE_LARGE_STACK ////////////////////// // @@ -27,28 +28,26 @@ // Current (internal) library namepace name and corresponding public // client namespaces. -#define ILMBASE_INTERNAL_NAMESPACE_CUSTOM @ILMBASE_NAMESPACE_CUSTOM@ -#define IMATH_INTERNAL_NAMESPACE @ILMBASE_INTERNAL_IMATH_NAMESPACE@ -#define IEX_INTERNAL_NAMESPACE @ILMBASE_INTERNAL_IEX_NAMESPACE@ -#define ILMTHREAD_INTERNAL_NAMESPACE @ILMBASE_INTERNAL_ILMTHREAD_NAMESPACE@ +#define IMATH_INTERNAL_NAMESPACE_CUSTOM @IMATH_NAMESPACE_CUSTOM@ +#define IMATH_INTERNAL_NAMESPACE @IMATH_INTERNAL_IMATH_NAMESPACE@ + + +#define IMATH_NAMESPACE_CUSTOM @IMATH_NAMESPACE_CUSTOM@ +#define IMATH_NAMESPACE @IMATH_IMATH_NAMESPACE@ -#define ILMBASE_NAMESPACE_CUSTOM @ILMBASE_NAMESPACE_CUSTOM@ -#define IMATH_NAMESPACE @ILMBASE_IMATH_NAMESPACE@ -#define IEX_NAMESPACE @ILMBASE_IEX_NAMESPACE@ -#define ILMTHREAD_NAMESPACE @ILMBASE_ILMTHREAD_NAMESPACE@ // // Version information // -#define ILMBASE_VERSION_STRING "@ILMBASE_VERSION@" -#define ILMBASE_PACKAGE_STRING "@ILMBASE_PACKAGE_NAME@" +#define IMATH_VERSION_STRING "@IMATH_VERSION@" +#define IMATH_PACKAGE_STRING "@IMATH_PACKAGE_NAME@" -#define ILMBASE_VERSION_MAJOR @ILMBASE_VERSION_MAJOR@ -#define ILMBASE_VERSION_MINOR @ILMBASE_VERSION_MINOR@ -#define ILMBASE_VERSION_PATCH @ILMBASE_VERSION_PATCH@ +#define IMATH_VERSION_MAJOR @IMATH_VERSION_MAJOR@ +#define IMATH_VERSION_MINOR @IMATH_VERSION_MINOR@ +#define IMATH_VERSION_PATCH @IMATH_VERSION_PATCH@ -#define ILMBASE_VERSION_HEX ((uint32_t(ILMBASE_VERSION_MAJOR) << 24) | \ - (uint32_t(ILMBASE_VERSION_MINOR) << 16) | \ - (uint32_t(ILMBASE_VERSION_PATCH) << 8)) +#define IMATH_VERSION_HEX ((uint32_t(IMATH_VERSION_MAJOR) << 24) | \ + (uint32_t(IMATH_VERSION_MINOR) << 16) | \ + (uint32_t(IMATH_VERSION_PATCH) << 8)) -#endif // INCLUDED_ILMBASE_CONFIG_H +#endif // INCLUDED_IMATH_CONFIG_H diff --git a/config/ImathConfigInternal.h.in b/config/ImathConfigInternal.h.in index 49b88916..8643d637 100644 --- a/config/ImathConfigInternal.h.in +++ b/config/ImathConfigInternal.h.in @@ -7,5 +7,5 @@ // Dealing with FPEs // #cmakedefine HAVE_UCONTEXT_H 1 -#cmakedefine ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT 1 -#cmakedefine ILMBASE_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT 1 +#cmakedefine IMATH_HAVE_CONTROL_REGISTER_SUPPORT 1 +#cmakedefine IMATH_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT 1 diff --git a/config/ImathSetup.cmake b/config/ImathSetup.cmake index 49002fb7..f28a6e79 100644 --- a/config/ImathSetup.cmake +++ b/config/ImathSetup.cmake @@ -8,7 +8,7 @@ include(GNUInstallDirs) # This is primarily for the halfFunction code that enables a stack # object (if you enable this) that contains a LUT of the function -option(ILMBASE_ENABLE_LARGE_STACK "Enables code to take advantage of large stack support" OFF) +option(IMATH_ENABLE_LARGE_STACK "Enables code to take advantage of large stack support" OFF) # What C++ standard to compile for # VFX Platform 18 is c++14, so let's enable that by default @@ -16,33 +16,29 @@ 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(IMATH_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 -set(ILMBASE_NAMESPACE_CUSTOM "0" CACHE STRING "Whether the namespace has been customized (so external users know)") -set(ILMBASE_INTERNAL_IMATH_NAMESPACE "Imath_${ILMBASE_VERSION_API}" CACHE STRING "Real namespace for Imath that will end up in compiled symbols") -set(ILMBASE_INTERNAL_IEX_NAMESPACE "Iex_${ILMBASE_VERSION_API}" CACHE STRING "Real namespace for Iex that will end up in compiled symbols") -set(ILMBASE_INTERNAL_ILMTHREAD_NAMESPACE "IlmThread_${ILMBASE_VERSION_API}" CACHE STRING "Real namespace for IlmThread that will end up in compiled symbols") -set(ILMBASE_IMATH_NAMESPACE "Imath" CACHE STRING "Public namespace alias for Imath") -set(ILMBASE_IEX_NAMESPACE "Iex" CACHE STRING "Public namespace alias for Iex") -set(ILMBASE_ILMTHREAD_NAMESPACE "IlmThread" CACHE STRING "Public namespace alias for IlmThread") -set(ILMBASE_PACKAGE_NAME "IlmBase ${ILMBASE_VERSION}" CACHE STRING "Public string / label for displaying package") - -# Whether to generate and install a pkg-config file IlmBase.pc on +set(IMATH_NAMESPACE_CUSTOM "0" CACHE STRING "Whether the namespace has been customized (so external users know)") +set(IMATH_INTERNAL_IMATH_NAMESPACE "Imath_${IMATH_VERSION_API}" CACHE STRING "Real namespace for Imath that will end up in compiled symbols") +set(IMATH_IMATH_NAMESPACE "Imath" CACHE STRING "Public namespace alias for Imath") +set(IMATH_PACKAGE_NAME "Imath ${IMATH_VERSION}" CACHE STRING "Public string / label for displaying package") + +# Whether to generate and install a pkg-config file Imath.pc on if(WIN32) -option(ILMBASE_INSTALL_PKG_CONFIG "Install IlmBase.pc file" OFF) +option(IMATH_INSTALL_PKG_CONFIG "Install Imath.pc file" OFF) else() -option(ILMBASE_INSTALL_PKG_CONFIG "Install IlmBase.pc file" ON) +option(IMATH_INSTALL_PKG_CONFIG "Install Imath.pc file" ON) endif() ######################## ## Build related options # This is a variable here for use in install lines. Care must be taken -# when changing this, as many things assume this is OpenEXR -set(ILMBASE_OUTPUT_SUBDIR OpenEXR CACHE STRING "Destination sub-folder of the include path for install") +# when changing this, as many things assume this is Imath +set(IMATH_OUTPUT_SUBDIR Imath CACHE STRING "Destination sub-folder of the include path for install") # This does not seem to be available as a per-target property, # but is pretty harmless to set globally @@ -56,17 +52,17 @@ set(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Suffix for debug builds") option(BUILD_SHARED_LIBS "Build shared library" ON) # This allows a "double library" setup, where we compile both # a dynamic and shared library -option(ILMBASE_BUILD_BOTH_STATIC_SHARED "Build both static and shared libraries in one step (otherwise follows BUILD_SHARED_LIBS)" OFF) -if (ILMBASE_BUILD_BOTH_STATIC_SHARED) +option(IMATH_BUILD_BOTH_STATIC_SHARED "Build both static and shared libraries in one step (otherwise follows BUILD_SHARED_LIBS)" OFF) +if (IMATH_BUILD_BOTH_STATIC_SHARED) set(BUILD_SHARED_LIBS ON) endif() # 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(ILMBASE_LIB_SUFFIX "-${ILMBASE_VERSION_API}" CACHE STRING "string added to the end of all the libraries") +set(IMATH_LIB_SUFFIX "-${IMATH_VERSION_API}" CACHE STRING "string added to the end of all the libraries") # when building both dynamic and static, the additional string to # add to the library name, such that to get static linkage, you -# would use -lImath_static (or target_link_libraries(xxx IlmBase::Imath_static)) -set(ILMBASE_STATIC_LIB_SUFFIX "_static" CACHE STRING "When building both static and shared, name to append to static library (in addition to normal suffix)") +# would use -lImath_static (or target_link_libraries(xxx Imath::Imath_static)) +set(IMATH_STATIC_LIB_SUFFIX "_static" CACHE STRING "When building both static and shared, name to append to static library (in addition to normal suffix)") # rpath related setup # make sure we force an rpath to the rpath we're compiling @@ -111,15 +107,15 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 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) - find_program(OPENEXR_CLANG_TIDY_BIN clang-tidy) - if(OPENEXR_CLANG_TIDY_BIN-NOTFOUND) +option(IMATH_USE_CLANG_TIDY "Check if clang-tidy is available, and enable that" OFF) +if(IMATH_USE_CLANG_TIDY) + find_program(IMATH_CLANG_TIDY_BIN clang-tidy) + if(IMATH_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 - ${OPENEXR_CLANG_TIDY_BIN}; + ${IMATH_CLANG_TIDY_BIN}; -header-filter=.; -checks=*; ) diff --git a/config/LibraryDefine.cmake b/config/LibraryDefine.cmake index 2e3a0527..86903100 100644 --- a/config/LibraryDefine.cmake +++ b/config/LibraryDefine.cmake @@ -1,71 +1,73 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenEXR Project. -# NB: This function has a number if IlmBase specific names / variables +# NB: This function has a number if Imath specific names / variables # in it, so be careful copying... -function(ILMBASE_DEFINE_LIBRARY libname) +function(IMATH_DEFINE_LIBRARY libname) set(options) set(oneValueArgs PRIV_EXPORT CURDIR CURBINDIR) set(multiValueArgs SOURCES HEADERS DEPENDENCIES PRIVATE_DEPS) - cmake_parse_arguments(ILMBASE_CURLIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(IMATH_CURLIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) # only do the object library mechanism in a few cases: # - xcode doesn't handle "empty" targets (i.e. add_library with # an object lib only) + # - under windows, we don't want the static library targets to + # have the export tags # - if we're not compiling both, don't add the extra layer to prevent # extra compiles since we aren't doing that anyway - if(ILMBASE_BUILD_BOTH_STATIC_SHARED AND NOT (APPLE OR WIN32)) + if(IMATH_BUILD_BOTH_STATIC_SHARED AND NOT (APPLE OR WIN32)) set(use_objlib TRUE) else() set(use_objlib) endif() if (MSVC) - set(_ilmbase_extra_flags "/EHsc") + set(_imath_extra_flags "/EHsc") endif() if(use_objlib) set(objlib ${libname}_Object) add_library(${objlib} OBJECT - ${ILMBASE_CURLIB_HEADERS} - ${ILMBASE_CURLIB_SOURCES}) + ${IMATH_CURLIB_HEADERS} + ${IMATH_CURLIB_SOURCES}) else() set(objlib ${libname}) add_library(${objlib} - ${ILMBASE_CURLIB_HEADERS} - ${ILMBASE_CURLIB_SOURCES}) + ${IMATH_CURLIB_HEADERS} + ${IMATH_CURLIB_SOURCES}) endif() - 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 AND NOT ILMBASE_BUILD_BOTH_STATIC_SHARED) - target_compile_definitions(${objlib} PUBLIC OPENEXR_DLL) + target_compile_features(${objlib} PUBLIC cxx_std_${IMATH_CXX_STANDARD}) + if(IMATH_CURLIB_PRIV_EXPORT AND BUILD_SHARED_LIBS) + target_compile_definitions(${objlib} PRIVATE ${IMATH_CURLIB_PRIV_EXPORT}) + if(WIN32) + target_compile_definitions(${objlib} PUBLIC IMATH_DLL) endif() endif() - if(ILMBASE_CURLIB_CURDIR) - target_include_directories(${objlib} INTERFACE $) + if(IMATH_CURLIB_CURDIR) + target_include_directories(${objlib} INTERFACE $) endif() - if(ILMBASE_CURLIB_CURBINDIR) - target_include_directories(${objlib} PRIVATE $) + if(IMATH_CURLIB_CURBINDIR) + target_include_directories(${objlib} PRIVATE $) endif() - target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${ILMBASE_CURLIB_DEPENDENCIES}) - if(ILMBASE_CURLIB_PRIVATE_DEPS) - target_link_libraries(${objlib} PRIVATE ${ILMBASE_CURLIB_PRIVATE_DEPS}) + target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${IMATH_CURLIB_DEPENDENCIES}) + if(IMATH_CURLIB_PRIVATE_DEPS) + target_link_libraries(${objlib} PRIVATE ${IMATH_CURLIB_PRIVATE_DEPS}) endif() set_target_properties(${objlib} PROPERTIES CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF POSITION_INDEPENDENT_CODE ON ) - if (_ilmbase_extra_flags) - target_compile_options(${objlib} PUBLIC ${_ilmbase_extra_flags}) + if (_imath_extra_flags) + target_compile_options(${objlib} PUBLIC ${_imath_extra_flags}) endif() - set_property(TARGET ${objlib} PROPERTY PUBLIC_HEADER ${ILMBASE_CURLIB_HEADERS}) + set_property(TARGET ${objlib} PROPERTY PUBLIC_HEADER ${IMATH_CURLIB_HEADERS}) if(use_objlib) install(TARGETS ${objlib} EXPORT ${PROJECT_NAME} PUBLIC_HEADER - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ILMBASE_OUTPUT_SUBDIR} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${IMATH_OUTPUT_SUBDIR} ) endif() @@ -77,12 +79,12 @@ function(ILMBASE_DEFINE_LIBRARY libname) endif() if(BUILD_SHARED_LIBS) set_target_properties(${libname} PROPERTIES - SOVERSION ${ILMBASE_SOVERSION} - VERSION ${ILMBASE_LIB_VERSION} + SOVERSION ${IMATH_SOVERSION} + VERSION ${IMATH_LIB_VERSION} ) endif() set_target_properties(${libname} PROPERTIES - OUTPUT_NAME "${libname}${ILMBASE_LIB_SUFFIX}" + OUTPUT_NAME "${libname}${IMATH_LIB_SUFFIX}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" ) add_library(${PROJECT_NAME}::${libname} ALIAS ${libname}) @@ -94,36 +96,40 @@ function(ILMBASE_DEFINE_LIBRARY libname) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} PUBLIC_HEADER - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ILMBASE_OUTPUT_SUBDIR} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${IMATH_OUTPUT_SUBDIR} ) - if(BUILD_SHARED_LIBS AND (NOT "${ILMBASE_LIB_SUFFIX}" STREQUAL "") AND NOT WIN32) - set(verlibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${ILMBASE_LIB_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) + if(BUILD_SHARED_LIBS AND (NOT "${IMATH_LIB_SUFFIX}" STREQUAL "")) + set(verlibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${IMATH_LIB_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) set(baselibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${CMAKE_SHARED_LIBRARY_SUFFIX}) - install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E chdir \"\$ENV\{DESTDIR\}${CMAKE_INSTALL_FULL_LIBDIR}\" ${CMAKE_COMMAND} -E create_symlink ${verlibname} ${baselibname})") - install(CODE "message(\"-- Creating symlink in ${CMAKE_INSTALL_FULL_LIBDIR} ${baselibname} -> ${verlibname}\")") + if(WIN32) + install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E chdir \"\$ENV\{DESTDIR\}${CMAKE_INSTALL_FULL_BINDIR}\" ${CMAKE_COMMAND} -E create_symlink ${verlibname} ${baselibname})") + install(CODE "message(\"-- Creating symlink in ${CMAKE_INSTALL_FULL_BINDIR} ${baselibname} -> ${verlibname}\")") + else() + install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E chdir \"\$ENV\{DESTDIR\}${CMAKE_INSTALL_FULL_LIBDIR}\" ${CMAKE_COMMAND} -E create_symlink ${verlibname} ${baselibname})") + install(CODE "message(\"-- Creating symlink in ${CMAKE_INSTALL_FULL_LIBDIR} ${baselibname} -> ${verlibname}\")") + endif() set(verlibname) set(baselibname) endif() - if(ILMBASE_BUILD_BOTH_STATIC_SHARED) + if(IMATH_BUILD_BOTH_STATIC_SHARED) if(use_objlib) add_library(${libname}_static STATIC $) target_link_libraries(${libname}_static INTERFACE ${objlib}) else() # have to build multiple times... but have different flags anyway (i.e. no dll) - target_compile_definitions(${libname} PRIVATE OPENEXR_DLL) set(curlib ${libname}_static) - add_library(${curlib} STATIC ${ILMBASE_CURLIB_SOURCES}) - target_compile_features(${curlib} PUBLIC cxx_std_${OPENEXR_CXX_STANDARD}) - if(ILMBASE_CURLIB_CURDIR) - target_include_directories(${curlib} INTERFACE $) + add_library(${curlib} STATIC ${IMATH_CURLIB_SOURCES}) + target_compile_features(${curlib} PUBLIC cxx_std_${IMATH_CXX_STANDARD}) + if(IMATH_CURLIB_CURDIR) + target_include_directories(${curlib} INTERFACE $) endif() - if(ILMBASE_CURLIB_CURBINDIR) - target_include_directories(${curlib} PRIVATE $) + if(IMATH_CURLIB_CURBINDIR) + target_include_directories(${curlib} PRIVATE $) endif() - target_link_libraries(${curlib} PUBLIC ${PROJECT_NAME}::Config ${ILMBASE_CURLIB_DEPENDENCIES}) - if(ILMBASE_CURLIB_PRIVATE_DEPS) - target_link_libraries(${curlib} PRIVATE ${ILMBASE_CURLIB_PRIVATE_DEPS}) + target_link_libraries(${curlib} PUBLIC ${PROJECT_NAME}::Config ${IMATH_CURLIB_DEPENDENCIES}) + if(IMATH_CURLIB_PRIVATE_DEPS) + target_link_libraries(${curlib} PRIVATE ${IMATH_CURLIB_PRIVATE_DEPS}) endif() set(curlib) endif() @@ -132,9 +138,9 @@ function(ILMBASE_DEFINE_LIBRARY libname) CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF POSITION_INDEPENDENT_CODE ON - SOVERSION ${ILMBASE_SOVERSION} - VERSION ${ILMBASE_LIB_VERSION} - OUTPUT_NAME "${libname}${ILMBASE_LIB_SUFFIX}${ILMBASE_STATIC_LIB_SUFFIX}" + SOVERSION ${IMATH_SOVERSION} + VERSION ${IMATH_LIB_VERSION} + OUTPUT_NAME "${libname}${IMATH_LIB_SUFFIX}${IMATH_STATIC_LIB_SUFFIX}" ) add_library(${PROJECT_NAME}::${libname}_static ALIAS ${libname}_static) diff --git a/config/version.cmake b/config/version.cmake index 9e12041f..bdd0b8b7 100644 --- a/config/version.cmake +++ b/config/version.cmake @@ -1,20 +1,14 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenEXR Project. -file(READ configure.ac CONFIGURE_AC_CONTENTS) -string(REGEX MATCH "AC_INIT\\(IlmBase,[ ]*([0-9]+).([0-9]+).([0-9]+)" DUMMY ${CONFIGURE_AC_CONTENTS}) -set(ILMBASE_VERSION_MAJOR ${CMAKE_MATCH_1}) -set(ILMBASE_VERSION_MINOR ${CMAKE_MATCH_2}) -set(ILMBASE_VERSION_PATCH ${CMAKE_MATCH_3}) -set(ILMBASE_VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH}) -set(ILMBASE_VERSION_API ${ILMBASE_VERSION_MAJOR}_${ILMBASE_VERSION_MINOR}) -string(REGEX MATCH "LIBTOOL_CURRENT=([0-9]+)" DUMMY ${CONFIGURE_AC_CONTENTS}) -set(ILMBASE_SOCURRENT ${CMAKE_MATCH_1}) -string(REGEX MATCH "LIBTOOL_REVISION=([0-9]+)" DUMMY ${CONFIGURE_AC_CONTENTS}) -set(ILMBASE_SOREVISION ${CMAKE_MATCH_1}) -string(REGEX MATCH "LIBTOOL_AGE=([0-9]+)" DUMMY ${CONFIGURE_AC_CONTENTS}) -set(ILMBASE_SOAGE ${CMAKE_MATCH_1}) -math(EXPR ILMBASE_SOVERSION "${ILMBASE_SOCURRENT} - ${ILMBASE_SOAGE}") -set(ILMBASE_LIB_VERSION "${ILMBASE_SOVERSION}.${ILMBASE_SOAGE}.${ILMBASE_SOREVISION}") -message(STATUS "Configure ILMBASE Version: ${ILMBASE_VERSION} Lib API: ${ILMBASE_LIB_VERSION}") -unset(CONFIGURE_AC_CONTENTS) +set(IMATH_VERSION_MAJOR 2) +set(IMATH_VERSION_MINOR 5) +set(IMATH_VERSION_PATCH 0) +set(IMATH_VERSION ${IMATH_VERSION_MAJOR}.${IMATH_VERSION_MINOR}.${IMATH_VERSION_PATCH}) +set(IMATH_VERSION_API ${IMATH_VERSION_MAJOR}_${IMATH_VERSION_MINOR}) +set(IMATH_SOCURRENT 25) +set(IMATH_SOREVISION 0) +set(IMATH_SOAGE 0) +math(EXPR IMATH_SOVERSION "${IMATH_SOCURRENT} - ${IMATH_SOAGE}") +set(IMATH_LIB_VERSION "${IMATH_SOVERSION}.${IMATH_SOAGE}.${IMATH_SOREVISION}") +message(STATUS "Configure Imath Version: ${IMATH_VERSION} Lib API: ${IMATH_LIB_VERSION}") diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 291b96e7..36cdf43b 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -11,9 +11,9 @@ endif() # we include this first to parse configure.ac and extract the version # numbers -include(config/ParseConfigure.cmake) +include(config/version.cmake) -project(PyIlmBase VERSION ${PYILMBASE_VERSION} LANGUAGES C CXX) +project(PyImath VERSION ${PYIMATH_VERSION} LANGUAGES C CXX) ####################################### ####################################### @@ -24,10 +24,10 @@ project(PyIlmBase VERSION ${PYILMBASE_VERSION} LANGUAGES C CXX) # Please look at this file to see what is configurable ####################################### ####################################### -include(config/PyIlmBaseSetup.cmake) +include(config/PyImathSetup.cmake) -# we have a strong dependence on IlmBase being an exact match -find_package(IlmBase ${PYILMBASE_VERSION} EXACT REQUIRED CONFIG) +# we have a strong dependence on Imath being an exact match +find_package(Imath ${PYIMATH_VERSION} EXACT REQUIRED CONFIG) # we are building a python extension, so of course we depend on # python as well. Except we don't know which version... @@ -37,7 +37,7 @@ find_package(IlmBase ${PYILMBASE_VERSION} EXACT REQUIRED CONFIG) # first make sure we find *some* python find_package(Python COMPONENTS Interpreter Development) if(NOT TARGET Python::Interpreter AND NOT TARGET Python::Python) - message(WARNING ": Unable to find any python interpreter or libraries, disabling PyIlmBase") + message(WARNING ": Unable to find any python interpreter or libraries, disabling PyImath") return() endif() @@ -63,7 +63,7 @@ else() message(WARNING ": Unable to find Python3 interpreter or development libraries") endif() if (NOT Python2_FOUND AND NOT Python3_FOUND) - message(WARNING ": Disabling PyIlmBase") + message(WARNING ": Disabling PyImath") return() endif() @@ -71,7 +71,7 @@ endif() # for our other dependency - boost. # Boost Python has some .. annoyances in that the python module # has version names attached to it -function(PYILMBASE_EXTRACT_REL_SITEARCH varname pyver pyexe pysitearch) +function(PYIMATH_EXTRACT_REL_SITEARCH varname pyver pyexe pysitearch) get_filename_component(_exedir ${pyexe} DIRECTORY) # we do this such that cmake will canonicalize the slashes # so the directory search will work under windows and unix @@ -110,18 +110,18 @@ function(PYILMBASE_EXTRACT_REL_SITEARCH varname pyver pyexe pysitearch) endfunction() if(Python2_FOUND) - set(PYILMBASE_BOOST_PY2_COMPONENT "python${Python2_VERSION_MAJOR}${Python2_VERSION_MINOR}") + set(PYIMATH_BOOST_PY2_COMPONENT "python${Python2_VERSION_MAJOR}${Python2_VERSION_MINOR}") message(STATUS "Found Python2 libraries: ${Python2_VERSION_MAJOR}${Python2_VERSION_MINOR}") # we can't just use the Python2_SITEARCH variable as that then will # ignore CMAKE_INSTALL_PREFIX. Could extract this to a function somewhere # if it is generally useful - pyilmbase_extract_rel_sitearch(PyIlmBase_Python2_SITEARCH_REL 2 ${Python2_EXECUTABLE} ${Python2_SITEARCH}) + pyimath_extract_rel_sitearch(PyImath_Python2_SITEARCH_REL 2 ${Python2_EXECUTABLE} ${Python2_SITEARCH}) endif() if(Python3_FOUND) - set(PYILMBASE_BOOST_PY3_COMPONENT "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") + set(PYIMATH_BOOST_PY3_COMPONENT "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") message(STATUS "Found Python3 libraries: ${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") # and figure out the install root here - pyilmbase_extract_rel_sitearch(PyIlmBase_Python3_SITEARCH_REL 3 ${Python3_EXECUTABLE} ${Python3_SITEARCH}) + pyimath_extract_rel_sitearch(PyImath_Python3_SITEARCH_REL 3 ${Python3_EXECUTABLE} ${Python3_SITEARCH}) endif() # different flavors of O.S. have multiple versions of python @@ -143,63 +143,63 @@ endif() find_package(Boost OPTIONAL_COMPONENTS python python2 - ${PYILMBASE_BOOST_PY2_COMPONENT} + ${PYIMATH_BOOST_PY2_COMPONENT} python3 - ${PYILMBASE_BOOST_PY3_COMPONENT}) -set(_pyilmbase_have_perver_boost) -if(PYILMBASE_BOOST_PY2_COMPONENT) - string(TOUPPER ${PYILMBASE_BOOST_PY2_COMPONENT} PYILMBASE_PY2_UPPER) + ${PYIMATH_BOOST_PY3_COMPONENT}) +set(_pyimath_have_perver_boost) +if(PYIMATH_BOOST_PY2_COMPONENT) + string(TOUPPER ${PYIMATH_BOOST_PY2_COMPONENT} PYIMATH_PY2_UPPER) else() - set(PYILMBASE_BOOST_PY2_COMPONENT python2x_NOTFOUND) - set(PYILMBASE_PY2_UPPER PYTHON2X_NOTFOUND) + set(PYIMATH_BOOST_PY2_COMPONENT python2x_NOTFOUND) + set(PYIMATH_PY2_UPPER PYTHON2X_NOTFOUND) endif() -if(PYILMBASE_BOOST_PY3_COMPONENT) - string(TOUPPER ${PYILMBASE_BOOST_PY3_COMPONENT} PYILMBASE_PY3_UPPER) +if(PYIMATH_BOOST_PY3_COMPONENT) + string(TOUPPER ${PYIMATH_BOOST_PY3_COMPONENT} PYIMATH_PY3_UPPER) else() - set(PYILMBASE_BOOST_PY3_COMPONENT python3x_NOTFOUND) - set(PYILMBASE_PY3_UPPER PYTHON3X_NOTFOUND) + set(PYIMATH_BOOST_PY3_COMPONENT python3x_NOTFOUND) + set(PYIMATH_PY3_UPPER PYTHON3X_NOTFOUND) endif() -if(Boost_PYTHON2_FOUND OR Boost_${PYILMBASE_PY2_UPPER}_FOUND) - set(_pyilmbase_have_perver_boost TRUE) - if(NOT Boost_${PYILMBASE_PY2_UPPER}_FOUND) +if(Boost_PYTHON2_FOUND OR Boost_${PYIMATH_PY2_UPPER}_FOUND) + set(_pyimath_have_perver_boost TRUE) + if(NOT Boost_${PYIMATH_PY2_UPPER}_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) + set(PYIMATH_BOOST_PY2_COMPONENT python2) endif() endif() -if(Boost_PYTHON3_FOUND OR Boost_${PYILMBASE_PY3_UPPER}_FOUND) - set(_pyilmbase_have_perver_boost TRUE) - if(NOT Boost_${PYILMBASE_PY3_UPPER}_FOUND) +if(Boost_PYTHON3_FOUND OR Boost_${PYIMATH_PY3_UPPER}_FOUND) + set(_pyimath_have_perver_boost TRUE) + if(NOT Boost_${PYIMATH_PY3_UPPER}_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) + set(PYIMATH_BOOST_PY3_COMPONENT python3) endif() endif() -if(Boost_PYTHON_FOUND AND NOT _pyilmbase_have_perver_boost) +if(Boost_PYTHON_FOUND AND NOT _pyimath_have_perver_boost) # old boost case, I guess we just warn and assume it is python2 (likely) message(WARNING "Ambiguous boost python module found, assuming python 2. If you have a new boost library, try cleaning the cmake cache and reconfigure with -DBoost_NO_BOOST_CMAKE=ON") - set(PYILMBASE_BOOST_PY2_COMPONENT python) + set(PYIMATH_BOOST_PY2_COMPONENT python) # set it to a bogus string but not empty so later we don't test against a namespace only target - set(PYILMBASE_BOOST_PY3_COMPONENT pythonIgnore) -elseif(NOT _pyilmbase_have_perver_boost) - message(WARNING "Unable to find boost::python library, disabling PyIlmBase. If you believe this is wrong, check the cmake documentation and see if you need to set Boost_ROOT or Boost_NO_BOOST_CMAKE") + set(PYIMATH_BOOST_PY3_COMPONENT pythonIgnore) +elseif(NOT _pyimath_have_perver_boost) + message(WARNING "Unable to find boost::python library, disabling PyImath. If you believe this is wrong, check the cmake documentation and see if you need to set Boost_ROOT or Boost_NO_BOOST_CMAKE") return() else() - if(TARGET Boost::${PYILMBASE_BOOST_PY2_COMPONENT}) - message(STATUS " -> Found Python 2 boost: Boost::${PYILMBASE_BOOST_PY2_COMPONENT}") - elseif(Boost_PYTHON2_FOUND OR Boost_${PYILMBASE_PY2_UPPER}_FOUND) + if(TARGET Boost::${PYIMATH_BOOST_PY2_COMPONENT}) + message(STATUS " -> Found Python 2 boost: Boost::${PYIMATH_BOOST_PY2_COMPONENT}") + elseif(Boost_PYTHON2_FOUND OR Boost_${PYIMATH_PY2_UPPER}_FOUND) message(WARNING "Found boost for python 2, but FindBoost did not create an import library. If you believe this is wrong, check the cmake documentation and see if you need to set Boost_ROOT or Boost_NO_BOOST_CMAKE") return() endif() - if(TARGET Boost::${PYILMBASE_BOOST_PY3_COMPONENT}) - message(STATUS " -> Found Python 3 boost: Boost::${PYILMBASE_BOOST_PY3_COMPONENT}") - elseif(Boost_PYTHON3_FOUND OR Boost_${PYILMBASE_PY3_UPPER}_FOUND) + if(TARGET Boost::${PYIMATH_BOOST_PY3_COMPONENT}) + message(STATUS " -> Found Python 3 boost: Boost::${PYIMATH_BOOST_PY3_COMPONENT}") + elseif(Boost_PYTHON3_FOUND OR Boost_${PYIMATH_PY3_UPPER}_FOUND) message(WARNING "Found boost for python 3, but FindBoost did not create an import library. If you believe this is wrong, check the cmake documentation and see if you need to set Boost_ROOT or Boost_NO_BOOST_CMAKE") return() endif() endif() -unset(PYILMBASE_PY2_UPPER) -unset(PYILMBASE_PY3_UPPER) -unset(_pyilmbase_have_perver_boost) +unset(PYIMATH_PY2_UPPER) +unset(PYIMATH_PY3_UPPER) +unset(_pyimath_have_perver_boost) # 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 @@ -219,9 +219,8 @@ if(NOT BUILD_SHARED_LIBS) message(WARNING "Forcing python bindings to be built with dynamic libraries") endif() -add_subdirectory( PyIex ) add_subdirectory( PyImath ) -if(TARGET Python2::IlmBaseNumPy OR TARGET Python3::IlmBaseNumPy) +if(TARGET Python2::ImathNumPy OR TARGET Python3::ImathNumPy) add_subdirectory( PyImathNumpy ) endif() @@ -231,9 +230,8 @@ endif() include(CTest) if(BUILD_TESTING) enable_testing() - add_subdirectory( PyIexTest ) add_subdirectory( PyImathTest ) - if(TARGET Python2::IlmBaseNumPy OR TARGET Python3::IlmBaseNumPy) + if(TARGET Python2::ImathNumPy OR TARGET Python3::ImathNumPy) add_subdirectory( PyImathNumpyTest ) endif() endif() diff --git a/python/Makefile.am b/python/Makefile.am deleted file mode 100644 index 2737f0be..00000000 --- a/python/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -# tell autoconf to include the m4 macros in the /m4 directory -# (an alternative to the acinclude.m4 mechanism) -ACLOCAL_AMFLAGS = -I m4 - -PYIMATH_SUBDIRS = config PyIex PyImath PyIexTest PyImathTest PyImathNumpyTest -PYIMATHNUMPY_SUBDIRS = PyImathNumpy - -if BUILD_PYIMATHNUMPY - MAYBE_PYIMATHNUMPY_SUBDIRS = $(PYIMATHNUMPY_SUBDIRS) -endif - -SUBDIRS = $(PYIMATH_SUBDIRS) $(MAYBE_PYIMATHNUMPY_SUBDIRS) - -DIST_SUBDIRS = \ - $(PYIMATH_SUBDIRS) \ - $(PYIMATHNUMPY_SUBDIRS) - -EXTRA_DIST = \ - LICENSE README.md \ - ChangeLog \ - bootstrap \ - CMakeLists.txt - -dist-hook: - cp -fpR $(abspath $(srcdir)/..)/cmake $(distdir) - find $(distdir)/cmake -type d ! -perm -700 -exec chmod u+rwx {} \; - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = PyIlmBase.pc - -m4datadir = $(datadir)/aclocal - diff --git a/python/PyImath/CMakeLists.txt b/python/PyImath/CMakeLists.txt index 55c3a2a0..fc9e3d5c 100644 --- a/python/PyImath/CMakeLists.txt +++ b/python/PyImath/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenEXR Project. -pyilmbase_define_module(imath +pyimath_define_module(imath LIBNAME PyImath PRIV_EXPORT PYIMATH_BUILD CURDIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -82,6 +82,5 @@ pyilmbase_define_module(imath PyImathVec4Impl.h PyImathVecOperators.h DEPENDENCIES - IlmBase::Iex IlmBase::IexMath IlmBase::Imath PyIlmBase::Config - MODULE_DEPS PyIex + Imath ) diff --git a/python/PyImath/Makefile.am b/python/PyImath/Makefile.am deleted file mode 100644 index d3bdaa0c..00000000 --- a/python/PyImath/Makefile.am +++ /dev/null @@ -1,99 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -pyexec_LTLIBRARIES = imath.la -lib_LTLIBRARIES = libPyImath.la - -libPyImath_la_SOURCES = PyImath.cpp \ - PyImathAutovectorize.cpp \ - PyImathBox2Array.cpp \ - PyImathBox3Array.cpp \ - PyImathBox.cpp \ - PyImathColor3.cpp \ - PyImathColor4.cpp \ - PyImathEuler.cpp \ - PyImathFixedArray.cpp \ - PyImathFrustum.cpp \ - PyImathLine.cpp \ - PyImathMatrix22.cpp \ - PyImathMatrix33.cpp \ - PyImathMatrix44.cpp \ - PyImathPlane.cpp \ - PyImathQuat.cpp \ - PyImathRandom.cpp \ - PyImathShear.cpp \ - PyImathStringArray.cpp \ - PyImathStringTable.cpp \ - PyImathTask.cpp \ - PyImathUtil.cpp \ - PyImathFixedVArray.cpp \ - PyImathVec2fd.cpp \ - PyImathVec2si.cpp \ - PyImathVec3fd.cpp \ - PyImathVec3siArray.cpp \ - PyImathVec3si.cpp \ - PyImathVec4fd.cpp \ - PyImathVec4siArray.cpp \ - PyImathVec4si.cpp - -libPyImathinclude_HEADERS = PyImath.h \ - PyImathAutovectorize.h \ - PyImathBoxArrayImpl.h \ - PyImathBox.h \ - PyImathColor3ArrayImpl.h \ - PyImathColor4Array2DImpl.h \ - PyImathColor4ArrayImpl.h \ - PyImathColor.h \ - PyImathDecorators.h \ - PyImathEuler.h \ - PyImathExport.h \ - PyImathFixedArray2D.h \ - PyImathFixedArray.h \ - PyImathFixedMatrix.h \ - PyImathFrustum.h \ - PyImathLine.h \ - PyImathMathExc.h \ - PyImathMatrix.h \ - PyImathOperators.h \ - PyImathPlane.h \ - PyImathQuat.h \ - PyImathRandom.h \ - PyImathShear.h \ - PyImathStringArray.h \ - PyImathStringArrayRegister.h \ - PyImathStringTable.h \ - PyImathTask.h \ - PyImathUtil.h \ - PyImathFixedVArray.h \ - PyImathVec2Impl.h \ - PyImathVec3ArrayImpl.h \ - PyImathVec3Impl.h \ - PyImathVec4ArrayImpl.h \ - PyImathVec4Impl.h \ - PyImathVec.h \ - PyImathVecOperators.h - -libPyImath_la_LDFLAGS = -version-info @LIBTOOL_VERSION@ \ - -no-undefined -libPyImath_la_LIBADD = -lz $(top_builddir)/PyIex/libPyIex.la \ - @ILMBASE_LIBS@ @BOOST_PYTHON_LIBS@ -libPyImathincludedir = $(includedir)/OpenEXR - -imath_la_SOURCES = imathmodule.cpp \ - PyImathFun.cpp \ - PyImathBasicTypes.cpp - -imath_la_LDFLAGS = -avoid-version -module -imath_la_LIBADD = -lPyImath @BOOST_PYTHON_LIBS@ - -noinst_HEADERS = PyImathFun.h \ - PyImathBasicTypes.h - -AM_CPPFLAGS = @ILMBASE_CXXFLAGS@ \ - -I$(top_builddir) \ - -I$(top_srcdir)/PyIex \ - -I$(top_srcdir)/config diff --git a/python/PyImathNumpy/CMakeLists.txt b/python/PyImathNumpy/CMakeLists.txt index 7a70f069..f4d08f31 100644 --- a/python/PyImathNumpy/CMakeLists.txt +++ b/python/PyImathNumpy/CMakeLists.txt @@ -2,22 +2,20 @@ # Copyright Contributors to the OpenEXR Project. if(TARGET Python2::Python AND - TARGET Boost::${PYILMBASE_BOOST_PY2_COMPONENT} AND - TARGET Python2::IlmBaseNumPy) - - set(moddeps_p2 PyIex PyImath) - list(TRANSFORM moddeps_p2 APPEND ${PYILMBASE_LIB_PYTHONVER_ROOT}${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}) - + TARGET Boost::${PYIMATH_BOOST_PY2_COMPONENT} AND + TARGET Python2::ImathNumPy) + set(moddeps_p2 PyImath) + list(TRANSFORM moddeps_p2 APPEND ${PYIMATH_LIB_PYTHONVER_ROOT}${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}) Python2_add_library(imathnumpy_python2 MODULE imathnumpymodule.cpp ) target_link_libraries(imathnumpy_python2 PRIVATE - IlmBase::Iex IlmBase::IexMath IlmBase::Imath + Imath ${moddeps_p2} Python2::Python - Boost::${PYILMBASE_BOOST_PY2_COMPONENT} - Python2::IlmBaseNumPy + Boost::${PYIMATH_BOOST_PY2_COMPONENT} + Python2::ImathNumPy ) set_target_properties(imathnumpy_python2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}/" @@ -27,22 +25,22 @@ if(TARGET Python2::Python AND endif() if(TARGET Python3::Python AND - TARGET Boost::${PYILMBASE_BOOST_PY3_COMPONENT} AND - TARGET Python3::IlmBaseNumPy) + TARGET Boost::${PYIMATH_BOOST_PY3_COMPONENT} AND + TARGET Python3::ImathNumPy) - set(moddeps_p3 PyIex PyImath) - list(TRANSFORM moddeps_p3 APPEND ${PYILMBASE_LIB_PYTHONVER_ROOT}${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}) + set(moddeps_p3 PyImath) + list(TRANSFORM moddeps_p3 APPEND ${PYIMATH_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 + Imath ${moddeps_p3} Python3::Python - Boost::${PYILMBASE_BOOST_PY3_COMPONENT} - Python3::IlmBaseNumPy + Boost::${PYIMATH_BOOST_PY3_COMPONENT} + Python3::ImathNumPy ) set_target_properties(imathnumpy_python3 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}/" diff --git a/python/PyImathNumpy/Makefile.am b/python/PyImathNumpy/Makefile.am deleted file mode 100644 index 76467cd1..00000000 --- a/python/PyImathNumpy/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -pyexec_LTLIBRARIES = imathnumpy.la - -imathnumpy_la_SOURCES = imathnumpymodule.cpp -imathnumpy_la_LDFLAGS = -avoid-version -module -imathnumpy_la_LIBADD = $(top_builddir)/PyImath/libPyImath.la @BOOST_PYTHON_LIBS@ - -noinst_HEADERS = - -AM_CPPFLAGS = @ILMBASE_CXXFLAGS@ \ - @NUMPY_CXXFLAGS@ \ - -I$(top_srcdir)/PyImath \ - -I$(top_builddir) \ - -I$(top_srcdir)/config diff --git a/python/PyImathNumpyTest/CMakeLists.txt b/python/PyImathNumpyTest/CMakeLists.txt index 695828d2..44f65253 100644 --- a/python/PyImathNumpyTest/CMakeLists.txt +++ b/python/PyImathNumpyTest/CMakeLists.txt @@ -2,19 +2,19 @@ # Copyright Contributors to the OpenEXR Project. if(TARGET Python2::Interpreter) - add_test(PyIlmBase.PyImathNumpyTest_Python2 + add_test(PyImath.PyImathNumpyTest_Python2 ${Python2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathNumpyTest.in ) - set_tests_properties(PyIlmBase.PyImathNumpyTest_Python2 PROPERTIES + set_tests_properties(PyImath.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 + add_test(PyImath.PyImathNumpyTest_Python3 ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathNumpyTest.in ) - set_tests_properties(PyIlmBase.PyImathNumpyTest_Python3 PROPERTIES + set_tests_properties(PyImath.PyImathNumpyTest_Python3 PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}" ) endif() diff --git a/python/PyImathNumpyTest/Makefile.am b/python/PyImathNumpyTest/Makefile.am deleted file mode 100644 index 8d02dc1f..00000000 --- a/python/PyImathNumpyTest/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -TESTS = pyImathNumpyTest diff --git a/python/PyImathTest/CMakeLists.txt b/python/PyImathTest/CMakeLists.txt index 200a689f..9ef27d49 100644 --- a/python/PyImathTest/CMakeLists.txt +++ b/python/PyImathTest/CMakeLists.txt @@ -2,19 +2,19 @@ # Copyright Contributors to the OpenEXR Project. if(TARGET Python2::Interpreter) - add_test(PyIlmBase.PyImathTest_Python2 + add_test(PyImath.PyImathTest_Python2 ${Python2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in ) - set_tests_properties(PyIlmBase.PyImathTest_Python2 PROPERTIES + set_tests_properties(PyImath.PyImathTest_Python2 PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}" ) endif() if(TARGET Python3::Interpreter) - add_test(PyIlmBase.PyImathTest_Python3 + add_test(PyImath.PyImathTest_Python3 ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in ) - set_tests_properties(PyIlmBase.PyImathTest_Python3 PROPERTIES + set_tests_properties(PyImath.PyImathTest_Python3 PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}" ) endif() diff --git a/python/PyImathTest/Makefile.am b/python/PyImathTest/Makefile.am deleted file mode 100644 index 1f4b802e..00000000 --- a/python/PyImathTest/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -TESTS = pyImathTest diff --git a/python/config/CMakeLists.txt b/python/config/CMakeLists.txt index 1872c89e..d5827ec9 100644 --- a/python/config/CMakeLists.txt +++ b/python/config/CMakeLists.txt @@ -1,19 +1,19 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenEXR Project. -### The autoconf setup for this folder generates a PyIlmBaseConfig.h file +### The autoconf setup for this folder generates a PyImathConfig.h file ### but no source actually uses that, so let's elide that for now -configure_file(PyIlmBaseConfigInternal.h.in_cmake ${CMAKE_CURRENT_BINARY_DIR}/PyIlmBaseConfigInternal.h) -add_library(PyIlmBaseConfig INTERFACE) -target_include_directories(PyIlmBaseConfig INTERFACE +configure_file(PyImathConfigInternal.h.in ${CMAKE_CURRENT_BINARY_DIR}/../PyImath/PyImathConfigInternal.h) +add_library(PyImathConfig INTERFACE) +target_include_directories(PyImathConfig INTERFACE $) -install(TARGETS PyIlmBaseConfig EXPORT ${PROJECT_NAME}) -add_library(PyIlmBase::Config ALIAS PyIlmBaseConfig) +install(TARGETS PyImathConfig EXPORT ${PROJECT_NAME}) +add_library(PyImath::Config ALIAS PyImathConfig) -if(PYILMBASE_INSTALL_PKG_CONFIG) +if(PYIMATH_INSTALL_PKG_CONFIG) # use a helper function to avoid variable pollution, but pretty simple - function(pyilmbase_pkg_config_help pcinfile) + function(pyimath_pkg_config_help pcinfile) set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_BINDIR}) set(libdir ${CMAKE_INSTALL_LIBDIR}) @@ -26,7 +26,7 @@ if(PYILMBASE_INSTALL_PKG_CONFIG) DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) endfunction() - pyilmbase_pkg_config_help(../PyIlmBase.pc.in) + pyimath_pkg_config_help(../PyImath.pc.in) endif() # The main export of the configuration - This is the @@ -35,7 +35,7 @@ endif() include(CMakePackageConfigHelpers) write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake" - VERSION ${PYILMBASE_VERSION} + VERSION ${PYIMATH_VERSION} COMPATIBILITY SameMajorVersion ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake diff --git a/python/config/Makefile.am b/python/config/Makefile.am deleted file mode 100644 index 6d0b063a..00000000 --- a/python/config/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -## -## SPDX-License-Identifier: BSD-3-Clause -## Copyright Contributors to the OpenEXR Project. -## - -## Process this file with automake to produce Makefile.in - -configincludedir = $(includedir)/OpenEXR - -nodist_configinclude_HEADERS = PyIlmBaseConfig.h PyIlmBaseConfigInternal.h - -EXTRA_DIST = PyIlmBaseConfig.h.in \ - PyIlmBaseConfigInternal.h.in \ - PyIlmBaseConfigInternal.h.in_cmake \ - PyIlmBaseSetup.cmake \ - NumPyLocate.cmake \ - ModuleDefine.cmake \ - ParseConfigure.cmake \ - CMakeLists.txt diff --git a/python/config/ModuleDefine.cmake b/python/config/ModuleDefine.cmake index 7c60315c..b73740d5 100644 --- a/python/config/ModuleDefine.cmake +++ b/python/config/ModuleDefine.cmake @@ -1,47 +1,47 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright Contributors to the OpenEXR Project. -function(PYILMBASE_ADD_LIBRARY_PRIV libname) +function(PYIMATH_ADD_LIBRARY_PRIV libname) set(options) set(oneValueArgs PRIV_EXPORT CURDIR CURBINDIR OUTROOT) set(multiValueArgs SOURCE HEADERS DEPENDENCIES PRIVATE_DEPS) - cmake_parse_arguments(PYILMBASE_CURLIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(PYIMATH_CURLIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) # Currently, the python bindings REQUIRE a shared library for # the Iex stuff to be initialized correctly. As such, force that # here # TODO Change this back when these bindings are refactored - add_library(${libname} SHARED ${PYILMBASE_CURLIB_SOURCE}) + add_library(${libname} SHARED ${PYIMATH_CURLIB_SOURCE}) #if(BUILD_SHARED_LIBS) set_target_properties(${libname} PROPERTIES - SOVERSION ${PYILMBASE_SOVERSION} - VERSION ${PYILMBASE_LIB_VERSION} + SOVERSION ${PYIMATH_SOVERSION} + VERSION ${PYIMATH_LIB_VERSION} ) #endif() set_target_properties(${libname} PROPERTIES - OUTPUT_NAME "${PYILMBASE_CURLIB_OUTROOT}${libname}${PYILMBASE_LIB_SUFFIX}" + OUTPUT_NAME "${PYIMATH_CURLIB_OUTROOT}${libname}${PYIMATH_LIB_SUFFIX}" ) target_compile_features(${libname} PUBLIC cxx_std_${OPENEXR_CXX_STANDARD}) # we are always building shared, so don't check for that - if(PYILMBASE_CURLIB_PRIV_EXPORT) - target_compile_definitions(${libname} PRIVATE ${PYILMBASE_CURLIB_PRIV_EXPORT}) + if(PYIMATH_CURLIB_PRIV_EXPORT) + target_compile_definitions(${libname} PRIVATE ${PYIMATH_CURLIB_PRIV_EXPORT}) endif() if(WIN32) target_compile_definitions(${libname} PUBLIC OPENEXR_DLL) endif() - if(PYILMBASE_CURLIB_CURDIR) - target_include_directories(${libname} PUBLIC $) + if(PYIMATH_CURLIB_CURDIR) + target_include_directories(${libname} PUBLIC $) endif() - if(PYILMBASE_CURLIB_CURBINDIR) - target_include_directories(${libname} PRIVATE $) + if(PYIMATH_CURLIB_CURBINDIR) + target_include_directories(${libname} PRIVATE $) endif() if(Boost_INCLUDE_DIR) target_include_directories(${libname} PUBLIC ${Boost_INCLUDE_DIR}) endif() - target_link_libraries(${libname} PUBLIC ${PYILMBASE_CURLIB_DEPENDENCIES}) - if(PYILMBASE_CURLIB_PRIVATE_DEPS) - target_link_libraries(${libname} PRIVATE ${PYILMBASE_CURLIB_PRIVATE_DEPS}) + target_link_libraries(${libname} PUBLIC ${PYIMATH_CURLIB_DEPENDENCIES}) + if(PYIMATH_CURLIB_PRIVATE_DEPS) + target_link_libraries(${libname} PRIVATE ${PYIMATH_CURLIB_PRIVATE_DEPS}) endif() set_target_properties(${libname} PROPERTIES CXX_STANDARD_REQUIRED ON @@ -61,98 +61,98 @@ endfunction() # NB: This function has a number if specific names / variables # not to mention behavior, so be careful copying... -function(PYILMBASE_DEFINE_MODULE modname) +function(PYIMATH_DEFINE_MODULE modname) set(options NEEDED_BY_OTHER_MODULES) set(oneValueArgs PRIV_EXPORT CURDIR CURBINDIR LIBNAME) set(multiValueArgs LIBSOURCE MODSOURCE HEADERS DEPENDENCIES PRIVATE_DEPS MODULE_DEPS) - cmake_parse_arguments(PYILMBASE_CURMOD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(PYIMATH_CURMOD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(PYILMBASE_CURMOD_HEADERS) + if(PYIMATH_CURMOD_HEADERS) install( FILES - ${PYILMBASE_CURMOD_HEADERS} + ${PYIMATH_CURMOD_HEADERS} DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/${PYILMBASE_OUTPUT_SUBDIR} + ${CMAKE_INSTALL_INCLUDEDIR}/${PYIMATH_OUTPUT_SUBDIR} ) endif() - if(NOT PYILMBASE_CURMOD_LIBNAME) - message(FATAL_ERROR "NYI usage of pyilmbase_define_module") + if(NOT PYIMATH_CURMOD_LIBNAME) + message(FATAL_ERROR "NYI usage of pyimath_define_module") return() endif() - set(libarglist SOURCE ${PYILMBASE_CURMOD_LIBSOURCE}) - if(PYILMBASE_CURMOD_PRIV_EXPORT) - list(APPEND libarglist PRIV_EXPORT ${PYILMBASE_CURMOD_PRIV_EXPORT}) + set(libarglist SOURCE ${PYIMATH_CURMOD_LIBSOURCE}) + if(PYIMATH_CURMOD_PRIV_EXPORT) + list(APPEND libarglist PRIV_EXPORT ${PYIMATH_CURMOD_PRIV_EXPORT}) endif() - if(PYILMBASE_CURMOD_HEADERS) - list(APPEND libarglist HEADERS ${PYILMBASE_CURMOD_HEADERS}) + if(PYIMATH_CURMOD_HEADERS) + list(APPEND libarglist HEADERS ${PYIMATH_CURMOD_HEADERS}) endif() - if(PYILMBASE_CURMOD_CURDIR) - list(APPEND libarglist CURDIR ${PYILMBASE_CURMOD_CURDIR}) + if(PYIMATH_CURMOD_CURDIR) + list(APPEND libarglist CURDIR ${PYIMATH_CURMOD_CURDIR}) endif() - if(PYILMBASE_CURMOD_CURBINDIR) - list(APPEND libarglist CURBINDIR ${PYILMBASE_CURMOD_CURBINDIR}) + if(PYIMATH_CURMOD_CURBINDIR) + list(APPEND libarglist CURBINDIR ${PYIMATH_CURMOD_CURBINDIR}) endif() - if(PYILMBASE_CURMOD_DEPENDENCIES) - list(APPEND libarglist DEPENDENCIES ${PYILMBASE_CURMOD_DEPENDENCIES}) + if(PYIMATH_CURMOD_DEPENDENCIES) + list(APPEND libarglist DEPENDENCIES ${PYIMATH_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}) + list(APPEND libarglist PRIVATE_DEPS ${PYIMATH_CURMOD_PRIVATE_DEPS}) + if(TARGET Python2::Python AND TARGET Boost::${PYIMATH_BOOST_PY2_COMPONENT}) + set(libname "${PYIMATH_CURMOD_LIBNAME}${PYIMATH_LIB_PYTHONVER_ROOT}${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}") + set(extraDeps ${PYIMATH_CURMOD_MODULE_DEPS}) + list(TRANSFORM extraDeps APPEND ${PYIMATH_LIB_PYTHONVER_ROOT}${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}) - pyilmbase_add_library_priv(${libname} + pyimath_add_library_priv(${libname} ${libarglist} ${extraDeps} Python2::Python - Boost::${PYILMBASE_BOOST_PY2_COMPONENT} + Boost::${PYIMATH_BOOST_PY2_COMPONENT} ) - Python2_add_library(${modname}_python2 MODULE ${PYILMBASE_CURMOD_MODSOURCE}) + Python2_add_library(${modname}_python2 MODULE ${PYIMATH_CURMOD_MODSOURCE}) target_link_libraries(${modname}_python2 PRIVATE ${libname} ${extraDeps} - ${PYILMBASE_CURMOD_DEPENDENCIES} - ${PYILMBASE_CURMOD_PRIVATE_DEPS} - Boost::${PYILMBASE_BOOST_PY2_COMPONENT} + ${PYIMATH_CURMOD_DEPENDENCIES} + ${PYIMATH_CURMOD_PRIVATE_DEPS} + Boost::${PYIMATH_BOOST_PY2_COMPONENT} ) set_target_properties(${modname}_python2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}/" LIBRARY_OUTPUT_NAME "${modname}" DEBUG_POSTFIX "" ) - install(TARGETS ${modname}_python2 DESTINATION ${PyIlmBase_Python2_SITEARCH_REL}) + install(TARGETS ${modname}_python2 DESTINATION ${PyImath_Python2_SITEARCH_REL}) 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}) + if(TARGET Python3::Python AND TARGET Boost::${PYIMATH_BOOST_PY3_COMPONENT}) + set(libname "${PYIMATH_CURMOD_LIBNAME}${PYIMATH_LIB_PYTHONVER_ROOT}${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}") + set(extraDeps ${PYIMATH_CURMOD_MODULE_DEPS}) + list(TRANSFORM extraDeps APPEND ${PYIMATH_LIB_PYTHONVER_ROOT}${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}) - pyilmbase_add_library_priv(${libname} + pyimath_add_library_priv(${libname} ${libarglist} ${extraDeps} Python3::Python - Boost::${PYILMBASE_BOOST_PY3_COMPONENT} + Boost::${PYIMATH_BOOST_PY3_COMPONENT} ) - Python3_add_library(${modname}_python3 MODULE ${PYILMBASE_CURMOD_MODSOURCE}) + Python3_add_library(${modname}_python3 MODULE ${PYIMATH_CURMOD_MODSOURCE}) target_link_libraries(${modname}_python3 PRIVATE ${libname} ${extraDeps} - ${PYILMBASE_CURMOD_DEPENDENCIES} - ${PYILMBASE_CURMOD_PRIVATE_DEPS} - Boost::${PYILMBASE_BOOST_PY3_COMPONENT} + ${PYIMATH_CURMOD_DEPENDENCIES} + ${PYIMATH_CURMOD_PRIVATE_DEPS} + Boost::${PYIMATH_BOOST_PY3_COMPONENT} ) set_target_properties(${modname}_python3 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}/" LIBRARY_OUTPUT_NAME "${modname}" DEBUG_POSTFIX "" ) - install(TARGETS ${modname}_python3 DESTINATION ${PyIlmBase_Python3_SITEARCH_REL}) + install(TARGETS ${modname}_python3 DESTINATION ${PyImath_Python3_SITEARCH_REL}) endif() endfunction() diff --git a/python/config/NumPyLocate.cmake b/python/config/NumPyLocate.cmake index 97f72803..77cf8cf9 100644 --- a/python/config/NumPyLocate.cmake +++ b/python/config/NumPyLocate.cmake @@ -6,7 +6,7 @@ if(TARGET Python2::Interpreter) COMMAND ${Python2_EXECUTABLE} -c "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept: import sys; sys.exit(1)\n" RESULT_VARIABLE _NUMPY2_RESULT - OUTPUT_VARIABLE py_ilmbase_numpy2_path + OUTPUT_VARIABLE py_imath_numpy2_path OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT _NUMPY2_RESULT MATCHES 0) @@ -17,7 +17,7 @@ if(TARGET Python2::Interpreter) COMMAND ${Python2_EXECUTABLE} -c "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept: import sys; sys.exit(1)\n" RESULT_VARIABLE _NUMPY2_RESULT - OUTPUT_VARIABLE py_ilmbase_numpy2_version + OUTPUT_VARIABLE py_imath_numpy2_version OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT _NUMPY2_RESULT MATCHES 0) @@ -25,19 +25,19 @@ if(TARGET Python2::Interpreter) 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}" + HINTS "${py_imath_numpy2_path}" "${Python2_INCLUDE_DIRS}" NO_DEFAULT_PATH ) if(NumPy_Py2_INCLUDE_DIRS) set(NumPy_Py2_FOUND TRUE CACHE INTERNAL "Python2 numpy found") - set(NumPy_Py2_VERSION ${py_ilmbase_numpy2_version}) + set(NumPy_Py2_VERSION ${py_imath_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) + add_library(Python2::ImathNumPy ALIAS NumPy_Py2) message(STATUS "Found NumPy ${NumPy_Py2_VERSION} for Python ${Python2_VERSION}: ${NumPy_Py2_INCLUDE_DIRS}") else() set(NumPy_Py2_FOUND FALSE 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") + message(WARNING "Found numpy version ${py_imath_numpy2_version} in python ${Python2_VERSION}, but unable to locate header files") endif() endif() endif() @@ -48,7 +48,7 @@ if(TARGET Python3::Interpreter) COMMAND ${Python3_EXECUTABLE} -c "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept: import sys; sys.exit(1)\n" RESULT_VARIABLE _NUMPY3_RESULT - OUTPUT_VARIABLE py_ilmbase_numpy3_path + OUTPUT_VARIABLE py_imath_numpy3_path OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT _NUMPY3_RESULT MATCHES 0) @@ -59,7 +59,7 @@ if(TARGET Python3::Interpreter) COMMAND ${Python3_EXECUTABLE} -c "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept: import sys; sys.exit(1)\n" RESULT_VARIABLE _NUMPY3_RESULT - OUTPUT_VARIABLE py_ilmbase_numpy3_version + OUTPUT_VARIABLE py_imath_numpy3_version OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT _NUMPY3_RESULT MATCHES 0) @@ -67,19 +67,19 @@ if(TARGET Python3::Interpreter) 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}" + HINTS "${py_imath_numpy3_path}" "${Python3_INCLUDE_DIRS}" NO_DEFAULT_PATH ) if(NumPy_Py3_INCLUDE_DIRS) set(NumPy_Py3_FOUND TRUE CACHE INTERNAL "Python3 numpy found") - set(NumPy_Py3_VERSION ${py_ilmbase_numpy3_version}) + set(NumPy_Py3_VERSION ${py_imath_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) + add_library(Python3::ImathNumPy ALIAS NumPy_Py3) message(STATUS "Found NumPy ${NumPy_Py3_VERSION} for Python ${Python3_VERSION}: ${NumPy_Py3_INCLUDE_DIRS}") else() set(NumPy_Py3_FOUND FALSE 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") + message(WARNING "Found numpy version ${py_imath_numpy3_version} in python ${Python3_VERSION}, but unable to locate header files") endif() endif() endif() diff --git a/python/config/ParseConfigure.cmake b/python/config/ParseConfigure.cmake deleted file mode 100644 index 08707d8e..00000000 --- a/python/config/ParseConfigure.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright Contributors to the OpenEXR Project. - -file(READ configure.ac CONFIGURE_AC_CONTENTS) -string(REGEX MATCH "AC_INIT\\(PyIlmBase,[ ]*([0-9]+).([0-9]+).([0-9]+)" DUMMY ${CONFIGURE_AC_CONTENTS}) -set(PYILMBASE_VERSION_MAJOR ${CMAKE_MATCH_1}) -set(PYILMBASE_VERSION_MINOR ${CMAKE_MATCH_2}) -set(PYILMBASE_VERSION_PATCH ${CMAKE_MATCH_3}) -set(PYILMBASE_VERSION ${PYILMBASE_VERSION_MAJOR}.${PYILMBASE_VERSION_MINOR}.${PYILMBASE_VERSION_PATCH}) -set(PYILMBASE_VERSION_API ${PYILMBASE_VERSION_MAJOR}_${PYILMBASE_VERSION_MINOR}) -string(REGEX MATCH "LIBTOOL_CURRENT=([0-9]+)" DUMMY ${CONFIGURE_AC_CONTENTS}) -set(PYILMBASE_SOCURRENT ${CMAKE_MATCH_1}) -string(REGEX MATCH "LIBTOOL_REVISION=([0-9]+)" DUMMY ${CONFIGURE_AC_CONTENTS}) -set(PYILMBASE_SOREVISION ${CMAKE_MATCH_1}) -string(REGEX MATCH "LIBTOOL_AGE=([0-9]+)" DUMMY ${CONFIGURE_AC_CONTENTS}) -set(PYILMBASE_SOAGE ${CMAKE_MATCH_1}) -math(EXPR PYILMBASE_SOVERSION "${PYILMBASE_SOCURRENT} - ${PYILMBASE_SOAGE}") -set(PYILMBASE_LIB_VERSION "${PYILMBASE_SOVERSION}.${PYILMBASE_SOAGE}.${PYILMBASE_SOREVISION}") -message(STATUS "Configure PyIlmBase Version: ${PYILMBASE_VERSION} Lib API: ${PYILMBASE_LIB_VERSION}") -unset(CONFIGURE_AC_CONTENTS) diff --git a/python/config/PyIlmBaseConfigInternal.h.in b/python/config/PyIlmBaseConfigInternal.h.in deleted file mode 100644 index 52c54218..00000000 --- a/python/config/PyIlmBaseConfigInternal.h.in +++ /dev/null @@ -1,11 +0,0 @@ -// -// SPDX-License-Identifier: BSD-3-Clause -// Copyright Contributors to the OpenEXR Project. -// - -#pragma once - -// -// Dealing with FPEs -// -#undef PYIMATH_ENABLE_EXCEPTIONS diff --git a/python/config/PyImathSetup.cmake b/python/config/PyImathSetup.cmake index 52d9fd33..83fe0fa6 100644 --- a/python/config/PyImathSetup.cmake +++ b/python/config/PyImathSetup.cmake @@ -7,8 +7,8 @@ include(GNUInstallDirs) ## Target configuration # TODO: Right now, we support compiling for multiple pythons at once -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") +set(PYIMATH_OVERRIDE_PYTHON2_INSTALL_DIR "" CACHE STRING "Override the install location for any python 2.x modules compiled") +set(PYIMATH_OVERRIDE_PYTHON3_INSTALL_DIR "" CACHE STRING "Override the install location for any python 3.x modules compiled") # Enables tracking of floating point exceptions and throwing them # as the signals are received @@ -23,11 +23,11 @@ endif() set(OPENEXR_CXX_STANDARD "${tmp}" CACHE STRING "C++ standard to compile against") set(tmp) -# Whether to generate and install a pkg-config file PyIlmBase.pc +# Whether to generate and install a pkg-config file PyImath.pc if (WIN32) -option(PYILMBASE_INSTALL_PKG_CONFIG "Install PyIlmBase.pc file" OFF) +option(PYIMATH_INSTALL_PKG_CONFIG "Install PyImath.pc file" OFF) else() -option(PYILMBASE_INSTALL_PKG_CONFIG "Install PyIlmBase.pc file" ON) +option(PYIMATH_INSTALL_PKG_CONFIG "Install PyImath.pc file" ON) endif() ######################## @@ -36,15 +36,15 @@ endif() # 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") +set(PYIMATH_LIB_SUFFIX "-${PYIMATH_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") +set(PYIMATH_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, # as many things assume this is OpenEXR -set(PYILMBASE_OUTPUT_SUBDIR OpenEXR CACHE STRING "Destination sub-folder of the include path for install") +set(PYIMATH_OUTPUT_SUBDIR OpenEXR CACHE STRING "Destination sub-folder of the include path for install") # This does not seem to be available as a per-target property, # but is pretty harmless to set globally diff --git a/python/config/version.cmake b/python/config/version.cmake new file mode 100644 index 00000000..483974ac --- /dev/null +++ b/python/config/version.cmake @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright Contributors to the OpenEXR Project. + +set(PYIMATH_VERSION_MAJOR 2) +set(PYIMATH_VERSION_MINOR 5) +set(PYIMATH_VERSION_PATCH 0) +set(PYIMATH_VERSION ${PYIMATH_VERSION_MAJOR}.${PYIMATH_VERSION_MINOR}.${PYIMATH_VERSION_PATCH}) +set(PYIMATH_VERSION_API ${PYIMATH_VERSION_MAJOR}_${PYIMATH_VERSION_MINOR}) +set(PYIMATH_SOCURRENT 25) +set(PYIMATH_SOREVISION 0) +set(PYIMATH_SOAGE 0) +math(EXPR PYIMATH_SOVERSION "${PYIMATH_SOCURRENT} - ${PYIMATH_SOAGE}") +set(PYIMATH_LIB_VERSION "${PYIMATH_SOVERSION}.${PYIMATH_SOAGE}.${PYIMATH_SOREVISION}") +message(STATUS "Configure PyImath Version: ${PYIMATH_VERSION} Lib API: ${PYIMATH_LIB_VERSION}") diff --git a/python/configure.ac b/python/configure.ac deleted file mode 100644 index 28a6a02e..00000000 --- a/python/configure.ac +++ /dev/null @@ -1,250 +0,0 @@ -dnl -dnl SPDX-License-Identifier: BSD-3-Clause -dnl Copyright Contributors to the OpenEXR Project. -dnl - -dnl Process this file with autoconf to produce a configure script. -AC_INIT(PyIlmBase, 2.5.2) -AC_SUBST(PYILMBASE_VERSION, 2.5.2) -AC_CANONICAL_HOST -AC_CONFIG_SRCDIR(PyIex/iexmodule.cpp) -AC_CONFIG_HEADERS([config/PyIlmBaseConfig.h]) -AC_CONFIG_HEADERS([config/PyIlmBaseConfigInternal.h]) -AM_INIT_AUTOMAKE(1.6.3) dnl Require automake 1.6.3 or better -AM_MAINTAINER_MODE -dnl static python modules make no sense - disable static -AC_DISABLE_STATIC - - -LIBTOOL_CURRENT=25 -LIBTOOL_REVISION=1 -LIBTOOL_AGE=0 -LIBTOOL_VERSION=$LIBTOOL_CURRENT:$LIBTOOL_REVISION:$LIBTOOL_AGE -AC_SUBST(LIBTOOL_VERSION) - -dnl Checks for programs. -AC_PROG_CXX -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_LIBTOOL -AC_PROG_MAKE_SET - -dnl -dnl PKGCONFIG preparations -dnl - -if test -z "${PKG_CONFIG_PATH}"; then - PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig -fi - -export PKG_CONFIG_PATH - -dnl Enable and choose c++ standard -AC_ARG_ENABLE(cxxstd, - AC_HELP_STRING([--enable-cxxstd=14], - [enable ISO c++ standard 11/14 [[default=auto]]]), - [cxxstd="${enableval}"], [cxxstd=14]) - -if test "${cxxstd}" = 17 ; then - AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory]) - CXXFLAGS="$CXXFLAGS -std=c++17" -else - if test "${cxxstd}" = 14 ; then - AX_CXX_COMPILE_STDCXX([14], [noext], [mandatory]) - CXXFLAGS="$CXXFLAGS -std=c++14" - else - if test "${cxxstd}" = 11 ; then - AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory]) - CXXFLAGS="$CXXFLAGS -std=c++11" - else - if test "${cxxstd}" = 03 ; then - CXXFLAGS="$CXXFLAGS -std=c++03" - else - dnl automatically determine... - AX_CXX_COMPILE_STDCXX([11], [noext], [optional]) - AX_CXX_COMPILE_STDCXX([14], [noext], [optional]) - AX_CXX_COMPILE_STDCXX([17], [noext], [optional]) - if test "$HAVE_CXX14" = 1 ; then - CXXFLAGS="$CXXFLAGS -std=c++14" - cxxstd = 14 - else - if test "$HAVE_CXX11" = 1 ; then - CXXFLAGS="$CXXFLAGS -std=c++11" - cxxstd = 11 - fi - fi - fi - fi - fi -fi - -dnl -dnl get ccflags and libs from openexr packages, then check -dnl whether test programs compile -AM_PATH_PKGCONFIG( - [ILMBASE_CXXFLAGS], - [ILMBASE_LDFLAGS], - [ILMBASE_LIBS], - [ILMBASE_RPATH], - [IlmBase], - [OpenEXR], - [-L/usr/local/lib], - [-lImath -lHalf -lIex -lIexMath -lIlmThread -lpthread], - [ilmbase-prefix]) - -AM_COMPILELINKRUN( - [IlmBase], - [ilmbasetest], - [$ILMBASE_CXXFLAGS], - [$ILMBASE_LDFLAGS], - [$ILMBASE_LIBS], - [$ILMBASE_RPATH],[[ -#include -#include -#ifndef IMATH_NAMESPACE -#define IMATH_NAMESPACE Imath -#endif -]], - [[ - double d = IMATH_NAMESPACE::succd(.23); d+= .2; - ]], - AC_MSG_RESULT([Compiled and ran IlmBase test program.]), - AC_MSG_ERROR([Could not compile IlmBase test program.])) - -LDFLAGS="$LDFLAGS $ILMBASE_LDFLAGS" - - -dnl Checks for python and boost python -AM_PATH_PYTHON -PYTHON_INC_DIR=`$PYTHON -c 'from distutils.sysconfig import *; print (get_python_inc())'` -PYTHON_LIB_DIR=`$PYTHON -c 'from distutils.sysconfig import *; print (get_config_var("LIBDIR"))'` -PYTHON_VER_MAJ=`echo $PYTHON_VERSION|cut -d. -f1` -LIBS="$LIBS -lpython$PYTHON_VERSION" - -BOOST_PYTHON_CXXFLAGS="" -BOOST_PYTHON_LDFLAGS="" -BOOST_PYTHON_LIBS="" -if test "${PYTHON_VER_MAJ}" = 3 ; then - BOOST_PYTHON_LIBNAME="boost_python3" -else - BOOST_PYTHON_LIBNAME="boost_python" -fi - -AC_ARG_WITH( - [boost-include-dir], - [AS_HELP_STRING([--with-boost-include-dir],["boost include directory"])], - [BOOST_PYTHON_CXXFLAGS="-I$withval"]) - -AC_ARG_WITH( - [boost-lib-dir], - [AS_HELP_STRING([--with-boost-lib-dir],["boost library directory"])], - [BOOST_PYTHON_LDFLAGS="-L$withval"]) - -AC_ARG_WITH( - [boost-python-libname], - [AS_HELP_STRING([--with-boost-python-libname],["boost::python library name (default: boost_python)"])], - [BOOST_PYTHON_LIBNAME="$withval"]) - -CXXFLAGS="$CXXFLAGS $BOOST_PYTHON_CXXFLAGS -I$PYTHON_INC_DIR" -LDFLAGS="$LDFLAGS $BOOST_PYTHON_LDFLAGS -L$PYTHON_LIB_DIR" - -BOOST_PYTHON_LIBS="-l$BOOST_PYTHON_LIBNAME" - -AM_COMPILELINKRUN( - [boost::python], - [boostpythontest], - [$CXXFLAGS], - [$LDFLAGS], - [], - [$LIBS $BOOST_PYTHON_LIBS],[[ -#include -#include -]], - [[Py_Initialize(); boost::python::object obj;]], - AC_MSG_RESULT([Compiled and ran boost::python test program.]), - AC_MSG_ERROR([Could not compile boost::python test program.])) - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(limits.h unistd.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T - -AC_MSG_CHECKING(for gcc optimization flags) -old_cflags=$CFLAGS -CFLAGS="$CFLAGS -pipe" -AC_TRY_COMPILE([#include ], -[ printf ("hello, world"); ], -[ EXTRA_OPT_CFLAGS="-pipe"],[ EXTRA_OPT_CFLAGS=""]) -CFLAGS=$old_cflags -AC_MSG_RESULT([$EXTRA_OPT_CFLAGS]) - -dnl Platform-specific stuff -case "$host" in -*linux*) - AC_DEFINE(HAVE_LINUX_PROCFS) - ;; -*darwin*) - AC_DEFINE(HAVE_DARWIN) - ;; -esac - -NUMPY_CXXFLAGS=`$PYTHON -c 'from numpy.distutils.misc_util import *; import string; print (" ".join(@<:@"-I"+x for x in get_numpy_include_dirs()@:>@))'` - -AC_ARG_WITH([numpy], - [AS_HELP_STRING([--without-numpy], - [disable support for numpy])], - [], - [with_numpy=yes]) - -dnl header check not quite working yet -dnl AC_LANG(['C++']) -dnl AS_IF([test "x$with_numpy" != xno],[ -dnl CPPFLAGS="$CPPFLAGS -I$NUMPY_INC_DIR" -dnl AC_CHECK_HEADER([numpy/arrayobject.h], -dnl [], -dnl [AC_MSG_FAILURE([numpy test failed (--without-numpy to disable)])], -dnl []) -dnl ]) - -AM_CONDITIONAL([BUILD_PYIMATHNUMPY], [test "$with_numpy" = yes]) - -AM_CFLAGS="$EXTRA_OPT_CFLAGS" -AM_CXXFLAGS="$EXTRA_OPT_CFLAGS" -AM_LDFLAGS="$ILMBASE_LDFLAGS $PYTHON_LDFLAGS" - -AC_SUBST(AM_CFLAGS) -AC_SUBST(AM_CXXFLAGS) -AC_SUBST(AM_LDFLAGS) -AC_SUBST(BOOST_PYTHON_LIBS) -AC_SUBST(NUMPY_CXXFLAGS) - -AC_CONFIG_FILES([ -Makefile -PyIlmBase.pc -config/Makefile -PyIex/Makefile -PyIexTest/Makefile -PyImath/Makefile -PyImathTest/Makefile -PyImathNumpy/Makefile -PyImathNumpyTest/Makefile -]) - -AC_CONFIG_FILES([PyIexTest/pyIexTest], [chmod +x PyIexTest/pyIexTest]) -AC_CONFIG_FILES([PyImathTest/pyImathTest], [chmod +x PyImathTest/pyImathTest]) -AC_CONFIG_FILES([PyImathNumpyTest/pyImathNumpyTest], [chmod +x PyImathNumpyTest/pyImathNumpyTest]) - -AC_OUTPUT - -AC_MSG_RESULT([ ---------------------------------------------- -Summary for PyIlmBase features: - -Python version $PYTHON_VERSION -boost::python libname $BOOST_PYTHON_LIBNAME ---------------------------------------------- -])