Skip to content
Closed

OIIO #143

Show file tree
Hide file tree
Changes from 16 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
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" )
Copy link
Contributor

@soswow soswow Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another commented out line not to forget about (unless, it's a special syntax in c++, which I don't know. sry if so)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such file in the repo, whoever wrote it has forgotten to push the file, I assume.


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
95 changes: 95 additions & 0 deletions include/rawtoaces/cache_base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Copyright Contributors to the rawtoaces project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/AcademySoftwareFoundation/rawtoaces

#include <iostream>
#include <filesystem>

#include <string>
#include <list>
#include <variant>

#include <rawtoaces/metadata.h>

namespace rta
{
namespace cache
{

template <class CacheEntryData> class CacheEntryDescriptor
{
public:
virtual size_t map_index() const = 0;
virtual bool fetch( CacheEntryData &data, int verbosity = 0 ) const = 0;
virtual bool operator==( const CacheEntryDescriptor &other ) const = 0;

// Each subclass must also implement the folowing 2 methods.
// Not sure how to declare them here.

// friend std::ostream& operator<< (std::ostream& stream, const DescriptorBase& descriptor);
// std::tuple<Types && ...> construct_entry() const
};

template <class Descriptor, class CacheEntryData, size_t size> class CacheBase
{
public:
const CacheEntryData &fetch( const Descriptor &descriptor )
{
size_t map_index = descriptor.map_index();

std::list<std::pair<Descriptor, CacheEntryData>> &map =
_maps[map_index];

if ( verbosity > 0 )
{
std::cerr << name << ": searching for a " << descriptor;
}

for ( auto iter = map.begin(); iter != map.end(); ++iter )
{
if ( iter->first == descriptor )
{
if ( iter != map.begin() )
{
map.splice( map.begin(), map, iter, std::next( iter ) );
}

if ( verbosity > 0 )
{
std::cerr << name << ": found in cache!" << std::endl;
}
return map.front().second;
}
}

if ( map.size() == capacity )
{
map.pop_back();
}

if ( verbosity > 0 )
{
std::cerr << name << ": not found. Calculating a new entry."
<< std::endl;
}

map.emplace_front(
std::piecewise_construct,
std::forward_as_tuple( descriptor ),
descriptor.construct_entry() );

CacheEntryData &data = map.front().second;
descriptor.fetch( data, verbosity );
return data;
};

int capacity = 10;
int verbosity = 0;
std::string name = "Cache";

private:
std::list<std::pair<Descriptor, CacheEntryData>> _maps[size];
};

} // namespace cache
} // namespace rta
Loading