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

OIIO #143

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

OIIO #143

34 changes: 22 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
CC: ${{matrix.cc_compiler}}
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
OPENEXR_VERSION: ${{matrix.openexr_ver}}
CMAKE_CXX_FLAGS: "-lstdc++fs"
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -83,40 +84,49 @@ jobs:
fail-fast: false

matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
title: [ubuntu, windows, macos]
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
- title: windows
os: windows-latest
c_compiler: cl
cpp_compiler: cl
install_deps: install_deps_windows
toolchain_file: "C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
build_shared_libs: OFF
- os: ubuntu-latest
- title: ubuntu
os: ubuntu-24.04
c_compiler: gcc
cpp_compiler: g++
install_deps: install_deps_linux
- os: ubuntu-latest
c_compiler: clang
build_shared_libs: ON
- title: ubuntu
os: ubuntu-24.04
cpp_compiler: clang++
install_deps: install_deps_linux
- os: macos-latest
build_shared_libs: ON
- title: macos
os: macos-latest
c_compiler: clang
cpp_compiler: clang++
install_deps: install_deps_mac
build_shared_libs: ON
exclude:
- os: windows-latest
- title: windows
c_compiler: gcc
- os: windows-latest
- title: windows
c_compiler: clang
- os: ubuntu-latest
- title: ubuntu
c_compiler: cl
- os: macos-latest
- title: macos
c_compiler: cl
- os: macos-latest
- title: macos
c_compiler: gcc

env:
CMAKE_CXX_FLAGS: "-lstdc++fs"

steps:
- uses: actions/checkout@v4

Expand All @@ -140,7 +150,7 @@ jobs:
cmake
-B ${{ steps.strings.outputs.build-output-dir }}
-S ${{ github.workspace }}
-DCXX_STANDARD=C++14
-DCXX_STANDARD=C++17
-DCMAKE_TOOLCHAIN_FILE="${{ matrix.toolchain_file }}"
-DENABLE_SHARED="${{ matrix.build_shared_libs }}"

Expand Down
65 changes: 34 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10)
project( RAWTOACES )

set( RAWTOACES_MAJOR_VERSION 1 )
Expand All @@ -12,9 +12,9 @@ set(RAWTOACESLIB "rawtoaces_util")
set( CMAKE_MACOSX_RPATH 1 )

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# set(warnings "/W4 /WX /EHsc")
add_compile_options ( /W0 )
add_compile_definitions( NOMINMAX )
add_compile_options ( $<$<COMPILE_LANGUAGE:CXX>:/utf-8> )
endif()

if (NOT CONFIGURED_ONCE)
Expand Down Expand Up @@ -74,8 +74,10 @@ include_directories( "${PROJECT_SOURCE_DIR}/include" )
add_definitions( -DPACKAGE="RAWTOACES" -DVERSION="${RAWTOACES_VERSION}" )
add_subdirectory("src/${RAWTOACESIDTLIB}")
add_subdirectory("src/${RAWTOACESLIB}")
add_subdirectory("src/rawtoaces")


add_subdirectory("src/rawtoaces_util2")
add_subdirectory("src/rawtoaces2")

# Create a RAWTOACESBuildTreeSettings.cmake file for the use from the build tree
file(RELATIVE_PATH CONF_REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}")
Expand All @@ -93,45 +95,46 @@ install( FILES
"${PROJECT_BINARY_DIR}/RAWTOACESConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)







if ( WIN32 AND NOT CYGWIN )
install( FILES "${PROJECT_BINARY_DIR}/RAWTOACESLibraryDepends.cmake" DESTINATION
"${INSTALL_CMAKE_DIR}" COMPONENT dev )
endif( )

if ( APPLE OR UNIX )
install (DIRECTORY data DESTINATION include/rawtoaces)
include ( GNUInstallDirs )

install(
TARGETS rawtoaces_idt rawtoaces_util rawtoaces_util2 rawtoaces
EXPORT RawToAcesConfig
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

export(
TARGETS rawtoaces_idt rawtoaces_util rawtoaces_util2 rawtoaces
NAMESPACE RawToAces::
FILE "${CMAKE_CURRENT_BINARY_DIR}/RawToAcesConfig.cmake"
)

install(
EXPORT RawToAcesConfig
DESTINATION "${CMAKE_INSTALL_LIBDIR}/CMake/RawToAces"
NAMESPACE RawToAces::
)

install (DIRECTORY data DESTINATION ${CMAKE_INSTALL_DATADIR}/rawtoaces)
endif()

### to build rawtoaces ###

add_executable( rawtoaces
main.cpp
)

target_include_directories( rawtoaces
PUBLIC
${AcesContainer_INCLUDE_DIRS}
)

target_link_libraries ( rawtoaces
PUBLIC
${RAWTOACESLIB}
INTERFACE
Boost::headers
)

if ( LIBRAW_CONFIG_FOUND )
target_link_libraries ( rawtoaces PUBLIC libraw::raw )
else ()
target_link_directories(rawtoaces PUBLIC ${libraw_LIBRARY_DIRS} )
target_link_libraries(rawtoaces PUBLIC ${libraw_LIBRARIES} ${libraw_LDFLAGS_OTHER} )
endif ()

enable_testing()
add_subdirectory(unittest)

install( TARGETS rawtoaces DESTINATION bin )

# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
Expand Down
20 changes: 10 additions & 10 deletions build_scripts/install_aces_container.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

set -ex

git clone https://github.com/ampas/aces_container.git aces_container
git clone https://github.com/ampas/aces_container.git ../aces_container

if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "darwin"* ]]; then
cmake \
-S aces_container \
-B aces_container/build \
-S ../aces_container \
-B ../aces_container/build \
-DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing"
cmake --build aces_container/build
sudo cmake --install aces_container/build
cmake --build ../aces_container/build
sudo cmake --install ../aces_container/build
else
cmake \
-S aces_container \
-B aces_container/build \
-DCMAKE_INSTALL_PREFIX="." \
-S ../aces_container \
-B ../aces_container/build \
-DCMAKE_INSTALL_PREFIX="../AcesContainer" \
-DBUILD_SHARED_LIBS=OFF
cmake --build aces_container/build --config Release
cmake --install aces_container/build --config Release
cmake --build ../aces_container/build --config Release
cmake --install ../aces_container/build --config Release
fi

cd ../..
1 change: 1 addition & 0 deletions build_scripts/install_deps.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ time sudo apt-get update

time sudo apt-get -q -f install -y \
libunwind-dev libilmbase-dev libopenexr-dev \
libopenimageio-dev \
libboost-dev libboost-thread-dev libboost-filesystem-dev \
libboost-test-dev \
libraw-dev libceres-dev
8 changes: 6 additions & 2 deletions build_scripts/install_deps_linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ set -ex
time sudo apt-get update

time sudo apt-get -q -f install -y \
libunwind-dev libimath-dev \
libunwind-dev \
libimath-dev libopenexr-dev \
libboost-dev libboost-filesystem-dev \
libboost-test-dev \
libraw-dev libceres-dev
libraw-dev libceres-dev \
libopencv-dev \
openimageio-tools \
libopenimageio-dev
2 changes: 1 addition & 1 deletion build_scripts/install_deps_mac.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -ex

brew install ceres-solver imath openexr libraw boost
brew install ceres-solver imath openexr libraw boost openimageio
1 change: 1 addition & 0 deletions build_scripts/install_deps_windows.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vcpkg install \
libraw:x64-windows \
ceres:x64-windows \
imath:x64-windows \
openimageio:x64-windows \
boost-system:x64-windows \
boost-foreach:x64-windows \
boost-filesystem:x64-windows \
Expand Down
4 changes: 2 additions & 2 deletions config/RAWTOACESConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ if( EXISTS "${RAWTOACES_CMAKE_DIR}/CMakeCache.txt" )
include( "${RAWTOACES_CMAKE_DIR}/RAWTOACESBuildTreeSettings.cmake" )
else()
set( RAWTOACES_INCLUDE_DIRS "${RAWTOACES_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@" )
endif
endif()

# setup our library dependencies (i.e. ilmbase)
include( "${RAWTOACES_CMAKE_DIR}/RAWTOACESLibraryDepends.cmake" )
# include( "${RAWTOACES_CMAKE_DIR}/RAWTOACESLibraryDepends.cmake" )

set( RAWTOACES_LIBRARIES RAWTOACES )
set( RAWTOACES_EXECUTABLE rawtoaces )
3 changes: 2 additions & 1 deletion configure.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Until we get some of these modules into the upstream packages, put them here
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_INSTALL_PREFIX}/share/CMake")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${CMAKE_SOURCE_DIR}/../")


find_package ( OpenImageIO CONFIG REQUIRED )
find_package ( AcesContainer CONFIG REQUIRED )
find_package ( Eigen3 CONFIG REQUIRED )
find_package ( Imath CONFIG REQUIRED )
Expand Down
3 changes: 2 additions & 1 deletion include/rawtoaces/acesrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
#define _ACESRENDER_h__

#include <rawtoaces/rta.h>

#include <rawtoaces/define.h>
#include <libraw/libraw.h>
#include <unordered_map>

using namespace rta;
Expand Down
64 changes: 48 additions & 16 deletions include/rawtoaces/define.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@
#define _DEFINE_h__

#include <string>
#include <vector>
#include <algorithm>
#include <boost/filesystem.hpp>
#include <filesystem>
#include <limits>

#ifndef WIN32
# include <sys/stat.h>
Expand Down Expand Up @@ -266,6 +268,20 @@ static const double XYZ_acesrgb_4[4][4] = {
{ 0.0, 0.0, 0.0, 1.0 }
};

static const float XYZ_acesrgb_float_4[4][4] = {
{ 1.0498110175, 0.0000000000, -0.0000974845, 0.0 },
{ -0.4959030231, 1.3733130458, 0.0982400361, 0.0 },
{ 0.0000000000, 0.0000000000, 0.9912520182, 0.0 },
{ 0.0, 0.0, 0.0, 1.0 }
};

static const float XYZ_acesrgb_transposed_4[4][4] = {
{ 1.0498110175, -0.4959030231, 0.0000000000, 0.0 },
{ 0.0000000000, 1.3733130458, 0.0000000000, 0.0 },
{ -0.0000974845, 0.0982400361, 0.9912520182, 0.0 },
{ 0.0000000000, 0.0000000000, 0.0000000000, 1.0 }
};

static const double acesrgb_XYZ_3[3][3] = {
{ 0.952552395938186, 0.0, 9.36786316604686e-05 },
{ 0.343966449765075, 0.728166096613485, -0.0721325463785608 },
Expand Down Expand Up @@ -343,9 +359,9 @@ inline vector<string> openDir( string path = "." )
{
vector<string> paths;

for ( auto &i: boost::filesystem::directory_iterator( path ) )
for ( auto &i: filesystem::directory_iterator( path ) )
{
if ( i.status().type() != boost::filesystem::file_type::directory_file )
if ( i.status().type() != filesystem::file_type::directory )
paths.push_back( i.path().string() );
}

Expand Down Expand Up @@ -390,8 +406,8 @@ inline bool isCTLetterDigit( const char c )
// to represent color temperature(s) (e.g., D60, 3200K)
inline bool isValidCT( string str )
{
int i = 0;
int length = str.length();
int i = 0;
size_t length = str.length();

if ( length == 0 )
return false;
Expand Down Expand Up @@ -444,16 +460,36 @@ inline dataPath &pathsFinder()

if ( firstTime )
{
string path;
const char *env;
#if defined( WIN32 ) || defined( WIN64 )
char separator = ';';
#else
char separator = ':';
#endif

string path;
vector<string> &PATHs = cdp.paths;
env = getenv( "AMPAS_DATA_PATH" );

if ( env )
path = env;
{
const char *env = getenv( "AMPAS_DATA_PATH" );
if ( env != nullptr )
{
if ( !path.empty() )
path += separator;
path += env;
}
}

if ( path == "" )
{
const char *env = getenv( "RAWTOACES_DATA_PATH" );
if ( env != nullptr )
{
if ( !path.empty() )
path += separator;
path += env;
}
}

if ( path.empty() )
{
#if defined( WIN32 ) || defined( WIN64 )
path = ".";
Expand All @@ -470,11 +506,7 @@ inline dataPath &pathsFinder()

while ( pos < path.size() )
{
#if defined( WIN32 ) || defined( WIN64 )
size_t end = path.find( ';', pos );
#else
size_t end = path.find( ':', pos );
#endif
size_t end = path.find( separator, pos );

if ( end == string::npos )
end = path.size();
Expand Down
Loading