Skip to content

Commit

Permalink
fix CI build
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Dukhovnikov <[email protected]>
  • Loading branch information
antond-weta committed Aug 6, 2024
1 parent 9d3eb69 commit 4c4d450
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 67 deletions.
31 changes: 19 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,46 @@ 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
- title: ubuntu
os: ubuntu-24.04
cpp_compiler: clang++
install_deps: install_deps_linux
- os: macos-latest
- title: macos
os: macos-latest
c_compiler: clang
cpp_compiler: clang++
install_deps: install_deps_mac
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 +147,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
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 include/rawtoaces/acesrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ void usage( const char *prog );
class LibRawAces : virtual public LibRaw
{
public:
LibRawAces() {};
~LibRawAces() {};
LibRawAces(){};
~LibRawAces(){};

void show() { printf( "I am here with LibRawAces.\n" ); }
};
Expand Down
4 changes: 2 additions & 2 deletions include/rawtoaces/define.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,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
8 changes: 4 additions & 4 deletions include/rawtoaces/rta.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ namespace rta
{
struct CIEXYZ
{
CIEXYZ() {};
CIEXYZ( double X, double Y, double Z ) : _Xt( X ), _Yt( Y ), _Zt( Z ) {};
CIEXYZ(){};
CIEXYZ( double X, double Y, double Z ) : _Xt( X ), _Yt( Y ), _Zt( Z ){};
double _Xt;
double _Yt;
double _Zt;
Expand All @@ -92,9 +92,9 @@ struct CMF

struct RGBSen
{
RGBSen() {};
RGBSen(){};
RGBSen( double R, double G, double B )
: _RSen( R ), _GSen( G ), _BSen( B ) {};
: _RSen( R ), _GSen( G ), _BSen( B ){};

double _RSen;
double _GSen;
Expand Down
2 changes: 1 addition & 1 deletion src/rawtoaces2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ add_executable( rawtoaces2
main.cpp
)

set_property(TARGET rawtoaces2 PROPERTY CXX_STANDARD 14)
set_property(TARGET rawtoaces2 PROPERTY CXX_STANDARD 17)

target_include_directories( rawtoaces2
PUBLIC
Expand Down
4 changes: 3 additions & 1 deletion src/rawtoaces2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include <rawtoaces/rawtoaces_util.h>

#include <filesystem>

using namespace rta;

int main( int argc, const char *argv[] )
Expand Down Expand Up @@ -39,7 +41,7 @@ int main( int argc, const char *argv[] )
if ( std::filesystem::is_regular_file( filename ) ||
std::filesystem::is_symlink( filename ) )
{
files_to_convert.push_back( filename2.path() );
files_to_convert.push_back( filename2.path().string() );
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/rawtoaces_util2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ add_library ( rawtoaces_util2 ${DO_SHARED}
${PROJECT_SOURCE_DIR}/include/rawtoaces/rawtoaces_util.h
)

set_property(TARGET rawtoaces_util2 PROPERTY CXX_STANDARD 17)

if ( OIIO_FOUND )
target_include_directories ( rawtoaces_util2 PRIVATE ${OIIO_INCLUDE_DIRS} )
target_link_directories ( rawtoaces_util2 PUBLIC ${OIIO_LIBRARY_DIRS} )
Expand Down
46 changes: 28 additions & 18 deletions src/rawtoaces_util2/rawtoaces_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <OpenImageIO/imagebuf.h>
#include <OpenImageIO/imagebufalgo.h>

#define _HAS_CXX17 1
#include <filesystem>

namespace rta
{

Expand Down Expand Up @@ -42,7 +45,7 @@ std::vector<std::string> collectDataFiles( const std::string &type )
auto p = filename2.path();
if ( filename2.path().extension() == ".json" )
{
result.push_back( filename2.path() );
result.push_back( filename2.path().string() );
}
}
}
Expand Down Expand Up @@ -221,27 +224,30 @@ bool check_param(
on_success();
return true;
}

if ( ( param_value.size() == 0 ) ||
( ( param_value.size() == 1 ) && ( param_value[0] == 0 ) ) )
else
{
std::cerr << "Warning: " << mode_name << " was set to \""
<< mode_value << "\", but no \"--" << param_name
<< "\" parameter provided. " << default_value_message
<< " will be used." << std::endl;
if ( ( param_value.size() == 0 ) ||
( ( param_value.size() == 1 ) && ( param_value[0] == 0 ) ) )
{
std::cerr << "Warning: " << mode_name << " was set to \""
<< mode_value << "\", but no \"--" << param_name
<< "\" parameter provided. " << default_value_message
<< " will be used." << std::endl;

on_failure();
return false;
}
on_failure();
return false;
}

if ( param_value.size() != correct_size )
{
std::cerr << "Warning: The parameter \"" << param_name
<< "\" must have " << correct_size << " values. "
<< default_value_message << " will be used." << std::endl;
if ( param_value.size() != correct_size )
{
std::cerr << "Warning: The parameter \"" << param_name
<< "\" must have " << correct_size << " values. "
<< default_value_message << " will be used."
<< std::endl;

on_failure();
return false;
on_failure();
return false;
}
}
}
else
Expand All @@ -257,6 +263,10 @@ bool check_param(
on_failure();
return false;
}
else
{
return true;
}
}
}

Expand Down
58 changes: 34 additions & 24 deletions unittest/testDNGIdt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ BOOST_AUTO_TEST_CASE( TestIDT_RobertsonLength )
BOOST_CHECK_CLOSE( rLength, 0.060234937, 1e-5 );
};

DNGIdt * openFile(std::string path, LibRaw & rawProcessor)
DNGIdt *openFile( std::string path, LibRaw &rawProcessor )
{
boost::filesystem::path pathToRaw = boost::filesystem::absolute(
"../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng" );
int ret = rawProcessor.open_file( ( pathToRaw.string() ).c_str() );
ret = rawProcessor.unpack();

#define R rawProcessor.imgdata.rawdata

Metadata metadata;
metadata.neutralRGB.resize( 3 );
metadata.xyz2rgbMatrix1.resize( 9 );
Expand Down Expand Up @@ -133,8 +133,8 @@ DNGIdt * openFile(std::string path, LibRaw & rawProcessor)
metadata.cameraCalibration2[i * 3 + j] =
static_cast<double>( ( R.color.dng_color[1].calibration )[i][j] );
}
return new DNGIdt(metadata);

return new DNGIdt( metadata );
}

BOOST_AUTO_TEST_CASE( TestIDT_LightSourceToColorTemp )
Expand All @@ -149,8 +149,10 @@ BOOST_AUTO_TEST_CASE( TestIDT_LightSourceToColorTemp )

BOOST_AUTO_TEST_CASE( TestIDT_XYZToColorTemperature )
{
LibRaw rawProcessor;
DNGIdt *di = openFile("../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng", rawProcessor);
LibRaw rawProcessor;
DNGIdt *di = openFile(
"../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng",
rawProcessor );
double XYZ[3] = { 0.9731171910, 1.0174927152, 0.9498565880 };
vector<double> XYZVector( XYZ, XYZ + 3 );
double cct = di->XYZToColorTemperature( XYZVector );
Expand All @@ -163,9 +165,11 @@ BOOST_AUTO_TEST_CASE( TestIDT_XYZToColorTemperature )

BOOST_AUTO_TEST_CASE( TestIDT_XYZtoCameraWeightedMatrix )
{
LibRaw rawProcessor;
DNGIdt *di = openFile("../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng", rawProcessor);

LibRaw rawProcessor;
DNGIdt *di = openFile(
"../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng",
rawProcessor );

double mirs[3] = { 158.8461538462, 350.1400560224, 153.8461538462 };
double matrix[9] = { 1.0165710542, -0.2791973987, -0.0801820653,
-0.4881171650, 1.3469051835, 0.1100471308,
Expand All @@ -181,9 +185,11 @@ BOOST_AUTO_TEST_CASE( TestIDT_XYZtoCameraWeightedMatrix )

BOOST_AUTO_TEST_CASE( TestIDT_FindXYZtoCameraMtx )
{
LibRaw rawProcessor;
DNGIdt *di = openFile("../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng", rawProcessor);

LibRaw rawProcessor;
DNGIdt *di = openFile(
"../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng",
rawProcessor );

double neutralRGB[3] = { 0.6289999865, 1.0000000000, 0.7904000305 };
double matrix[9] = { 1.0616656923, -0.3124143737, -0.0661770211,
-0.4772957633, 1.3614785395, 0.1001599918,
Expand Down Expand Up @@ -227,12 +233,14 @@ BOOST_AUTO_TEST_CASE( TestIDT_MatrixRGBtoXYZ )

BOOST_AUTO_TEST_CASE( TestIDT_GetDNGCATMatrix )
{
LibRaw rawProcessor;
DNGIdt *di = openFile("../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng", rawProcessor);

double matrix[3][3] = { { 0.9907763427, -0.0022862289, 0.0209908807 },
{ -0.0017882434, 0.9941341374, 0.0083008330 },
{ 0.0003777587, 0.0015609315, 1.1063201101 } };
LibRaw rawProcessor;
DNGIdt *di = openFile(
"../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng",
rawProcessor );

double matrix[3][3] = { { 0.9907763427, -0.0022862289, 0.0209908807 },
{ -0.0017882434, 0.9941341374, 0.0083008330 },
{ 0.0003777587, 0.0015609315, 1.1063201101 } };
vector<vector<double>> result = di->getDNGCATMatrix();

rawProcessor.recycle();
Expand All @@ -244,12 +252,14 @@ BOOST_AUTO_TEST_CASE( TestIDT_GetDNGCATMatrix )

BOOST_AUTO_TEST_CASE( TestIDT_GetDNGIDTMatrix )
{
LibRaw rawProcessor;
DNGIdt *di = openFile("../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng", rawProcessor);

double matrix[3][3] = { { 1.0536466144, 0.0039044182, 0.0049084502 },
{ -0.4899562165, 1.3614787986, 0.1020844728 },
{ -0.0024498461, 0.0060497128, 1.0139159537 } };
LibRaw rawProcessor;
DNGIdt *di = openFile(
"../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng",
rawProcessor );

double matrix[3][3] = { { 1.0536466144, 0.0039044182, 0.0049084502 },
{ -0.4899562165, 1.3614787986, 0.1020844728 },
{ -0.0024498461, 0.0060497128, 1.0139159537 } };
vector<vector<double>> result = di->getDNGIDTMatrix();

rawProcessor.recycle();
Expand Down

0 comments on commit 4c4d450

Please sign in to comment.