Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to SPI custom build scripts, versioning/disting policy changes #2313

Merged
merged 1 commit into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cmake_minimum_required (VERSION 3.2.2)
cmake_policy (SET CMP0048 NEW) # Allow VERSION specifier in project()
project (OpenImageIO VERSION 2.1.3
project (OpenImageIO VERSION 2.1.3.0
LANGUAGES CXX C)
set (PROJ_NAME OIIO) # short name, caps
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower case
set (PROJECT_VERSION_RELEASE_TYPE "dev") # "dev", "betaX", "RCY", ""
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
set (PROJECT_AUTHORS "Contributors to the OpenImageIO project")
set (PROJECT_URL "http://openimageio.org")
set (PROJECT_URL "https://openimageio.org")

message (STATUS "CMake version is ${CMAKE_VERSION}")
cmake_policy (SET CMP0017 NEW) # Prefer files from the CMake module directory when including from there.
Expand All @@ -16,9 +16,10 @@ cmake_policy (SET CMP0046 OLD) # Don't error on non-existent dependency in add_
set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)

# Alternate names
set (OIIO_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set (OIIO_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (OIIO_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (OIIO_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (OIIO_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set (OIIO_VERSION_TWEAK ${PROJECT_VERSION_TWEAK})
set (OIIO_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})

# N.B./FIXME - after CMake 3.0 is our minimum, we should change many of the
Expand Down Expand Up @@ -63,6 +64,7 @@ include (compiler) # All the C++ and compiler related options live here
option (VERBOSE "Print lots of messages while compiling" OFF)
set (${PROJ_NAME}_NAMESPACE ${PROJECT_NAME} CACHE STRING
"Customized outer namespace base name (version will be added)")
option (OIIO_NAMESPACE_INCLUDE_PATCH "Should the inner namespace include the patch number" OFF)
option (EMBEDPLUGINS "Embed format plugins in libOpenImageIO" ON)
option (OIIO_BUILD_TOOLS "Build the command-line tools" ON)
option (OIIO_BUILD_TESTS "Build the unit tests" ON)
Expand Down Expand Up @@ -130,6 +132,9 @@ endif ()
# Set the default namespace
set (PROJ_NAMESPACE "${${PROJ_NAME}_NAMESPACE}")
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE}_v${PROJECT_VERSION_MAJOR}_${PROJECT_VERSION_MINOR}")
if (OIIO_NAMESPACE_INCLUDE_PATCH)
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE_V}_${PROJECT_VERSION_PATCH}")
endif ()
message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}")


Expand Down Expand Up @@ -215,6 +220,11 @@ endif ()
add_subdirectory (src/fonts)
add_subdirectory (src/nuke)

# Last minute site-specific instructions, if they exist
if (OIIO_SITE AND EXISTS "${PROJECT_SOURCE_DIR}/site/${OIIO_SITE}/cmake/sitecustom.cmake")
include ("${PROJECT_SOURCE_DIR}/site/${OIIO_SITE}/cmake/sitecustom.cmake")
endif ()

# install pkgconfig file
IF ( NOT MSVC )
configure_file(src/build-scripts/OpenImageIO.pc.in "${CMAKE_BINARY_DIR}/OpenImageIO.pc" @ONLY)
Expand Down
109 changes: 84 additions & 25 deletions site/spi/Makefile-bits
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@ ifneq (${VERBOSE},)
$(info Including spi/Makefile-bits)
endif

# For SpComp2 builds, set env OIIO_SPCOMP2=1, and either
# For SpComp2 builds, do:
#
# make OIIO_SPCOMP2=1 spcomp2_install
# or
# make OIIO_SPCOMP2=1 SPCOMP2_LOCAL_PATH=/test/path spcomp2_install_local
#
# For Arnold builds, set env OIIO_ARNOLD=1 and just do a regular
# "make". We make this the default, so if you want neither an Arnold nor
# a SpComp2, you have to set OIIO_ARNOLD=0. If both are set, SpComp2
# takes precedence.
# For Arnold builds, do:
#
# make OIIO_ARNOLD=1
#
# For a Rez-bound build, do:
#
# make OIIO_SPIREZ=1
#
# (Options: OIIO_REZ_NAME=blah REZ_PACKAGE_ROOT=path)
#
# Otherwise a default 'make' will make a fully generic OIIO build.
OIIO_SPCOMP2 ?= 0
OIIO_ARNOLD ?= 1
OPENIMAGEIO_SPCOMP2_VERSION ?= 49
OIIO_ARNOLD ?= 0
OIIO_SPIREZ ?= 0
OIIO_REZ_NAME ?= OpenImageIO
OIIO_VERS = $(shell grep "OpenImageIO VERSION" CMakeLists.txt | egrep -o "[0-9.]+")
ONEVERS = $(shell site/spi/format_version.py ${OIIO_VERS})
OPENIMAGEIO_SPCOMP2_VERSION ?= ${ONEVERS}
ifeq (${OIIO_SPCOMP2},1)
$(info Building for SpComp2)
OIIO_ARNOLD := 0
Expand All @@ -27,15 +39,21 @@ else ifeq (${OIIO_ARNOLD},1)
NAMESPACE ?= 'OpenImageIO_Arnold'
PYLIB_LIB_PREFIX ?= 0
PYLIB_INCLUDE_SONAME ?= 0
else ifeq (${OIIO_SPIREZ},1)
$(info Building OpenImageIO for Rez distribution)
NAMESPACE ?= 'OpenImageIO'
PYLIB_LIB_PREFIX ?= 0
PYLIB_INCLUDE_SONAME ?= 0
MY_CMAKE_FLAGS += -DOIIO_SPIREZ=1 -DOIIO_REZ_PACKAGE_NAME=${OIIO_REZ_NAME}
else
$(info Building generic OpenImageIO)
NAMESPACE ?= 'OpenImageIO'
PYLIB_LIB_PREFIX ?= 0
PYLIB_INCLUDE_SONAME ?= 0
endif
#$(info MAKECMDGOALS = $(MAKECMDGOALS))


MY_CMAKE_FLAGS += -DEXTRA_CPP_ARGS:STRING="-DOIIO_SPI=1" -DOIIO_SITE:STRING=SPI
MY_CMAKE_FLAGS += -DSPI_TESTS=1
SPCOMP2_ROOT ?= /shots/spi/home/lib/SpComp2


## Detect which SPI platform and set $platform, $COMPILER, $SPCOMP2_COMPILER,
## and PYTHON_VERSION. Lots of other decisions are based on these.
ifeq (${SP_OS}, rhel7)
Expand All @@ -47,11 +65,20 @@ else ifeq (${platform}, macosx)
COMPILER ?= clang
SPCOMP2_COMPILER ?= clang
PYTHON_VERSION ?= 2.6
SP_OS ?= macosx
else
$(error Unknown SP_OS=${SP_OS} platform=${platform})
endif # endif ${SP_OS}

PYTHON_VERSION ?= 2.7
SPI_COMPILER_PLATFORM ?= gcc-4.8
MY_CMAKE_FLAGS += -DSP_OS=${SP_OS}
MY_CMAKE_FLAGS += -DSPI_COMPILER_PLATFORM=${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DEXTRA_CPP_ARGS:STRING="-DOIIO_SPI=1" -DOIIO_SITE:STRING=spi
MY_CMAKE_FLAGS += -DSPI_TESTS=1
MY_CMAKE_FLAGS += -DOIIO_NAMESPACE_INCLUDE_PATCH=1
SPCOMP2_ROOT ?= /shots/spi/home/lib/SpComp2
REZ_PACKAGE_ROOT ?= /shots/spi/home/software/packages
lgritz marked this conversation as resolved.
Show resolved Hide resolved


## Rhel7 (current)
Expand All @@ -69,6 +96,8 @@ ifeq (${SP_OS}, rhel7)
MY_CMAKE_FLAGS += -DCMAKE_INSTALL_LIBDIR="${INSTALL_PREFIX}/lib"
ifeq (${OIIO_SPCOMP2},1)
MY_CMAKE_FLAGS += -DPYTHON_SITE_DIR="${INSTALL_PREFIX}/python"
else ifeq (${OIIO_SPIREZ},1)
MY_CMAKE_FLAGS += -DPYTHON_SITE_DIR="${INSTALL_PREFIX}/python"
else ifeq (${OIIO_ARNOLD},1)
OIIO_LIBNAME_SUFFIX=_Arnold
endif
Expand Down Expand Up @@ -114,6 +143,7 @@ ifeq (${SP_OS}, rhel7)
BOOSTVERS ?= 1.55
BOOSTSPSUFFIX ?=
BOOSTVERSSP=${BOOSTVERS}${BOOSTSPSUFFIX}
MY_CMAKE_FLAGS += -DBOOST_VERS_SP=${BOOSTVERSSP}
# $(info BOOSTVERSSP ${BOOSTVERSSP})
ifeq (${BOOSTVERS},1.55)
SPBOOST_INC_DIR ?= /usr/include/boost_${BOOSTVERSSP}
Expand Down Expand Up @@ -156,8 +186,7 @@ ifeq (${SP_OS}, rhel7)
-DPYTHON_VERSION_MINOR=6 \
-DPYTHON_VERSION_PATCH=3 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
endif
ifeq (${PYTHON_VERSION},3.7)
else ifeq (${PYTHON_VERSION},3.7)
# Special sauce for Python 3.7
PYTHON_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}m
PYTHON_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}m.so
Expand All @@ -168,6 +197,17 @@ ifeq (${SP_OS}, rhel7)
-DPYTHON_VERSION_MINOR=7 \
-DPYTHON_VERSION_PATCH=3 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
else ifeq (${PYTHON_VERSION},2.7)
# Special sauce for Python 2.7
PYTHON_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}
PYTHON_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}.so
MY_CMAKE_FLAGS += \
-DPYTHONINTERP_FOUND=1 \
-DPYTHON_VERSION_STRING=2.7.5 \
-DPYTHON_VERSION_MAJOR=2 \
-DPYTHON_VERSION_MINOR=7 \
-DPYTHON_VERSION_PATCH=5 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
endif
MY_CMAKE_FLAGS += \
-DPYTHON_INCLUDE_DIR:STRING=${PYTHON_INCLUDE_DIR} \
Expand Down Expand Up @@ -271,45 +311,58 @@ endif # endif ${SP_OS}



ifeq (${OIIO_SPIREZ},1)
# Rpath touch-ups
# NOTE: This MUST match the order and naming of the Rez variants
# set in rez/package.py.in
REZ_INSTALL_PATH := ${REZ_PACKAGE_ROOT}/${OIIO_REZ_NAME}/${OIIO_VERS}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERSSP}
MY_CMAKE_FLAGS += -DOIIO_REZ_INSTALL_PATH=${REZ_INSTALL_PATH}
MY_CMAKE_FLAGS += -DCMAKE_INSTALL_RPATH=${REZ_INSTALL_PATH}/lib
endif



############################################################################
# SpComp2 magic incantations follow. Here be dragons.
############################################################################


CPPSTDSUFFIX=
SPCOMP2_INSTALL_ROOT ?= $(SPCOMP2_ROOT)
BOOSTVERSSP?=${BOOSTVERS}${BOOSTSPSUFFIX}
SPARCH=${SP_OS}-$(SPCOMP2_COMPILER)$(CPPSTDSUFFIX)-boost$(subst .,,$(BOOSTVERSSP))
OIIO_SPCOMP2_PATH := ${SPCOMP2_INSTALL_ROOT}/OpenImageIO/${SPARCH}/v${OPENIMAGEIO_SPCOMP2_VERSION}
# $(info New rhel7 OIIO_SPCOMP2_PATH is ${OIIO_SPCOMP2_PATH})

PYVERNOSPACE=${shell echo ${PYTHON_VERSION} | sed "s/\\.//"}
SPPYARCH=$(SPARCH)-py$(PYVERNOSPACE)



all: dist

local: dist

.PHONY: spcomp2_install spcomp2_install_local clean all

comma:= ,
empty:=
space:= $(empty) $(empty)

INSTALL_BIN_LOCATION = /shots/spi/home/bin/${SP_OS}
SPCOMP2_INSTALL_ROOT ?= $(SPCOMP2_ROOT)
OIIO_SPCOMP2_PATH := ${SPCOMP2_INSTALL_ROOT}/OpenImageIO/$(SPARCH)/v${OPENIMAGEIO_SPCOMP2_VERSION}
INSTALL_SPCOMP2_CURRENT = $(SPCOMP2_INSTALL_ROOT)/OpenImageIO/$(SPARCH)/v$(OPENIMAGEIO_SPCOMP2_VERSION)
# $(info New rhel7 OIIO_SPCOMP2_PATH is ${OIIO_SPCOMP2_PATH})
INSTALL_BIN_LOCATION = $(INSTALL_SPCOMP2_CURRENT)/bin
SPCOMP2_LOCAL_PATH ?= /net/soft_scratch/users/$(USER)/SpComp2_test

spcomp2_install_local: SPCOMP2_INSTALL_ROOT = $(SPCOMP2_LOCAL_PATH)
spcomp2_install_local: INSTALL_BIN_LOCATION = $(INSTALL_SPCOMP2_CURRENT)/bin
spcomp2_install_local: spcomp2_install

SPCOMP2_RPATH_OPT ?= ${OCIO_PATH}/lib:${FIELD3D_HOME}/lib:/usr/lib64/libraw-0.18.11:${OPENVDB_ROOT_DIR}/lib:/shots/spi/home/lib/arnold/rhel7/libheif-1.3.2/lib:shots/spi/home/lib/arnold/rhel7/libde265-1.0.3/lib:/net/apps/rhel7/intel/tbb/lib/intel64/gcc4.7:${SPBOOST_LIB_DIR}
SPCOMP2_RPATH_DEBUG ?= ${OCIO_PATH}/lib/debug:${FIELD3D_HOME}/lib/debug:/usr/lib64/libraw-0.18.11:${OPENVDB_ROOT_DIR}/lib/debug:/shots/spi/home/lib/arnold/rhel7/libheif-1.3.2/lib:shots/spi/home/lib/arnold/rhel7/libde265-1.0.3/lib:/net/apps/rhel7/intel/tbb/lib/intel64/gcc4.7:${SPBOOST_LIB_DIR}
PYSPCOMP2_RPATH_OPT ?= ${SPCOMP2_RPATH_OPT}:${OIIO_SPCOMP2_PATH}/lib:${PYTHON_LIBRARY_DIR}
PYSPCOMP2_RPATH_DEBUG ?= ${SPCOMP2_RPATH_DEBUG}:${OIIO_SPCOMP2_PATH}/lib/debug:${PYTHON_LIBRARY_DIR}


spcomp2_install_local: SPCOMP2_INSTALL_ROOT = $(SPCOMP2_LOCAL_PATH)
spcomp2_install_local: INSTALL_BIN_LOCATION = $(INSTALL_SPCOMP2_CURRENT)/bin
spcomp2_install_local: spcomp2_install

local: dist

spcomp2: MY_CMAKE_FLAGS += \
-DCMAKE_SKIP_BUILD_RPATH:BOOL=ON \
-DCMAKE_INSTALL_RPATH=$(SPCOMP2_INSTALL_ROOT)/OpenImageIO/$(SPARCH)/v$(OPENIMAGEIO_SPCOMP2_VERSION)/lib \
Expand Down Expand Up @@ -338,6 +391,9 @@ spcomp2_install_fixup_rhel7: spcomp2 spcomp2_debug
patchelf --set-rpath ${SPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/lib/libOpenImageIO_Util$(OIIO_LIBNAME_SUFFIX).so
patchelf --set-rpath ${PYSPCOMP2_RPATH_OPT} ${dist_dir}/python/libPyOpenImageIO.so
patchelf --set-rpath ${PYSPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/python/libPyOpenImageIO.so
patchelf --set-rpath $(INSTALL_SPCOMP2_CURRENT)/lib:${SPCOMP2_RPATH_OPT} ${dist_dir}/bin/oiiotool
patchelf --set-rpath $(INSTALL_SPCOMP2_CURRENT)/lib:${SPCOMP2_RPATH_OPT} ${dist_dir}/bin/maketx
patchelf --set-rpath $(INSTALL_SPCOMP2_CURRENT)/lib:${SPCOMP2_RPATH_OPT} ${dist_dir}/bin/iv

# This goal can't start with 'install' because something elsewhere picks
# it up and starts doing bad things
Expand Down Expand Up @@ -374,4 +430,7 @@ spcomp2_install: spcomp2_install_fixup_${SP_OS}
--srcdir=${dist_dir}/python \
--builddir_o=${dist_dir}/python \
--builddir_d=${dist_dir}.debug/python

mkdir -p $(INSTALL_BIN_LOCATION)
cp ${dist_dir}/bin/oiiotool $(INSTALL_BIN_LOCATION)
cp ${dist_dir}/bin/maketx $(INSTALL_BIN_LOCATION)
cp ${dist_dir}/bin/iv $(INSTALL_BIN_LOCATION)
102 changes: 102 additions & 0 deletions site/spi/README-SPI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Build a variant for Rez/general use
-----------------------------------

Skip this section if you are instead building for SpComp2.

Note: For testing or to make your own local rez package, you can customize
either the rez package name, or the rez install location name, with make
flags `OIIO_REZ_NAME=blah REZ_PACKAGE_ROOT=/path/to/my/rez/pkgs` appended
to the `make` commands of any of the variants listed below. For example,

make OIIO_SPIREZ=1 OIIO_REZ_NAME=oiio_test REZ_PACKAGE_ROOT=/path/to/my/rez/pkgs


Variants:

# Python 2.7, Boost 1.55, C++11/gcc4.8 compat
make nuke
make OIIO_SPIREZ=1

# Python 2.7, Boost 1.55 sp namespaced, C++11/gcc4.8 compat
make nuke
make OIIO_SPIREZ=1 BOOSTVERS=1.55sp

# Python 3.7, Boost 1.66, C++11/gcc4.8 compat
make nuke
make OIIO_SPIREZ=1 BOOSTVERS=1.66 PYTHON_VERSION=3.7

# Python 3.6, Boost 1.55, C++11/gcc4.8 compat (for Jon Ware)
make nuke
make OIIO_SPIREZ=1 PYTHON_VERSION=3.6

You can do any of these on your local machine.


Rez/general release (do for each variant)
-----------------------------------------

This must be done from compile40 or compile42 (for correct write
permissions on certain shared directories), even if you did the build
itself locally.

First:

ss spi/home
cd /the/oiio/src/area
cd dist/rhel7

For any of the variants that you built above:

rez release --skip-repo-errors

That command will release the dist to the studio.


Appwrapper binary releases
--------------------------

This step is for the ONE general/rez variant that we believe is the
canonical source of command line oiiotool and maketx. After building and
releasing as above,

cp OpenImageIO_*.xml /shots/spi/home/lib/app_cfg/OpenImageIO

That will make appcfg aware of the release.

To also make this release the new facility default:

db-any spi/home/OpenImageIO.bin highest /shots/spi/home/lib/app_cfg/OpenImageIO_A.B.C.D.xml

where A.B.C.D is the version.


SpComp2 build and release
-------------------------

If you are trying to do an SpComp2 release, forget all the steps above, you
will need some different flags.

First, to make a TEST build and release to your local spcomp2 mock-up:

make OIIO_SPCOMP2=1 SPCOMP2_LOCAL_PATH=/test/path spcomp2_install_local

When you are ready for the real thing, you will want to build each of the
following variants:

# Python 2.7, Boost 1.55, C++11/gcc4.8 compat
make nuke
make OIIO_SPCOMP2=1 spcomp2_install

# Python 2.7, Boost 1.55 sp namespaced, C++11/gcc4.8 compat
make nuke
make OIIO_SPCOMP2=1 BOOSTVERS=1.55sp spcomp2_install

# Python 3.7, Boost 1.66, C++11/gcc4.8 compat
make nuke
make OIIO_SPCOMP2=1 BOOSTVERS=1.66 PYTHON_VERSION=3.7 spcomp2_install

# Python 3.6, Boost 1.55, C++11/gcc4.8 compat (for Jon Ware)
make nuke
make OIIO_SPCOMP2=1 PYTHON_VERSION=3.6 spcomp2_install

Nobody should do this but lg, except in extraordinary circumstances.
6 changes: 6 additions & 0 deletions site/spi/appcfg.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<cfg>
<version>@OIIO_VERSION_MAJOR@.@OIIO_VERSION_MINOR@.@OIIO_VERSION_PATCH@.@OIIO_VERSION_TWEAK@</version>
<appdir architecture="@SP_OS@">@OIIO_REZ_INSTALL_PATH@</appdir>
<launchprogram></launchprogram>
<setup></setup>
</cfg>
Loading