Skip to content

Commit 808b2e9

Browse files
committed
add RAWTOACES_DATA_PATH env var; clean up public headers
Signed-off-by: Anton Dukhovnikov <antond@wetafx.co.nz>
1 parent 4773a20 commit 808b2e9

File tree

13 files changed

+142
-67
lines changed

13 files changed

+142
-67
lines changed

CMakeLists.txt

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22
project( RAWTOACES )
33

44
set( RAWTOACES_MAJOR_VERSION 1 )
@@ -64,6 +64,7 @@ else ()
6464
set ( DO_SHARED STATIC )
6565
endif ()
6666

67+
include ( GNUInstallDirs )
6768
include ( configure.cmake )
6869

6970

@@ -95,13 +96,38 @@ install( FILES
9596
"${PROJECT_BINARY_DIR}/RAWTOACESConfigVersion.cmake"
9697
DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
9798

99+
100+
101+
install(
102+
TARGETS rawtoaces_idt rawtoaces_util rawtoaces_util2 rawtoaces
103+
EXPORT RawToAcesConfig
104+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
105+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
106+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
107+
)
108+
109+
export(
110+
TARGETS rawtoaces_idt rawtoaces_util rawtoaces_util2 rawtoaces
111+
NAMESPACE RawToAces::
112+
FILE "${CMAKE_CURRENT_BINARY_DIR}/RawToAcesConfig.cmake"
113+
)
114+
115+
install(
116+
EXPORT RawToAcesConfig
117+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/CMake/RawToAces"
118+
NAMESPACE RawToAces::
119+
)
120+
121+
122+
123+
98124
if ( WIN32 AND NOT CYGWIN )
99125
install( FILES "${PROJECT_BINARY_DIR}/RAWTOACESLibraryDepends.cmake" DESTINATION
100126
"${INSTALL_CMAKE_DIR}" COMPONENT dev )
101127
endif( )
102128

103129
if ( APPLE OR UNIX )
104-
install (DIRECTORY data DESTINATION include/rawtoaces)
130+
install (DIRECTORY data DESTINATION ${CMAKE_INSTALL_DATADIR}/rawtoaces)
105131
endif()
106132

107133
enable_testing()

include/rawtoaces/acesrender.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define _ACESRENDER_h__
5757

5858
#include <rawtoaces/rta.h>
59+
#include <rawtoaces/define.h>
5960
#include <libraw/libraw.h>
6061
#include <unordered_map>
6162

include/rawtoaces/define.h

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -460,16 +460,36 @@ inline dataPath &pathsFinder()
460460

461461
if ( firstTime )
462462
{
463-
string path;
464-
const char *env;
463+
#if defined( WIN32 ) || defined( WIN64 )
464+
char separator = ';';
465+
#else
466+
char separator = ':';
467+
#endif
465468

469+
string path;
466470
vector<string> &PATHs = cdp.paths;
467-
env = getenv( "AMPAS_DATA_PATH" );
468471

469-
if ( env )
470-
path = env;
472+
{
473+
const char *env = getenv( "AMPAS_DATA_PATH" );
474+
if ( env != nullptr )
475+
{
476+
if ( !path.empty() )
477+
path += separator;
478+
path += env;
479+
}
480+
}
471481

472-
if ( path == "" )
482+
{
483+
const char *env = getenv( "RAWTOACES_DATA_PATH" );
484+
if ( env != nullptr )
485+
{
486+
if ( !path.empty() )
487+
path += separator;
488+
path += env;
489+
}
490+
}
491+
492+
if ( path.empty() )
473493
{
474494
#if defined( WIN32 ) || defined( WIN64 )
475495
path = ".";
@@ -486,11 +506,7 @@ inline dataPath &pathsFinder()
486506

487507
while ( pos < path.size() )
488508
{
489-
#if defined( WIN32 ) || defined( WIN64 )
490-
size_t end = path.find( ';', pos );
491-
#else
492-
size_t end = path.find( ':', pos );
493-
#endif
509+
size_t end = path.find( separator, pos );
494510

495511
if ( end == string::npos )
496512
end = path.size();

include/rawtoaces/rta.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
#ifndef _RTA_h__
5656
#define _RTA_h__
5757

58-
#include "define.h"
59-
58+
#include <string>
59+
#include <vector>
6060
#include <stdint.h>
6161

6262
#include "metadata.h"

src/rawtoaces/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" )
33

44
add_executable( rawtoaces

src/rawtoaces2/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" )
33

44
add_executable( rawtoaces2

src/rawtoaces2/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ using namespace rta;
1010

1111
int main( int argc, const char *argv[] )
1212
{
13-
1413
OIIO::ArgParse argParse;
14+
argParse.arg( "filename" ).action( OIIO::ArgParse::append() ).hidden();
1515

1616
ImageConverter converter;
1717
converter.init_parser( argParse );

src/rawtoaces_idt/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" )
33

44
add_library( ${RAWTOACESIDTLIB} ${DO_SHARED}
@@ -8,13 +8,14 @@ add_library( ${RAWTOACESIDTLIB} ${DO_SHARED}
88
../../include/rawtoaces/define.h
99
../../include/rawtoaces/mathOps.h
1010
../../include/rawtoaces/rta.h
11+
../../include/rawtoaces/metadata.h
1112
)
1213

1314
set_property(TARGET ${RAWTOACESIDTLIB} PROPERTY CXX_STANDARD 17)
1415

1516
target_link_libraries(
1617
${RAWTOACESIDTLIB}
17-
PUBLIC
18+
PRIVATE
1819
Boost::boost
1920
Boost::system
2021
Imath::Imath

src/rawtoaces_util/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" )
33

44
add_library ( ${RAWTOACESLIB} ${DO_SHARED}
55
acesrender.cpp
6+
7+
# Make the headers visible in IDEs. This should not affect the builds.
8+
../../include/rawtoaces/acesrender.h
69
)
710

811
set_property(TARGET ${RAWTOACESLIB} PROPERTY CXX_STANDARD 17)
@@ -11,7 +14,7 @@ if ( AcesContainer_FOUND )
1114
target_include_directories ( ${RAWTOACESLIB} PRIVATE ${AcesContainer_INCLUDE_DIRS} )
1215
target_link_directories ( ${RAWTOACESLIB} PUBLIC ${AcesContainer_LIBRARY_DIRS} )
1316
target_link_libraries ( ${RAWTOACESLIB}
14-
PUBLIC
17+
PRIVATE
1518
${AcesContainer_LIBRARIES}
1619
${AcesContainer_LDFLAGS_OTHER}
1720
)

src/rawtoaces_util2/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}" )
33

44
add_library ( rawtoaces_util2 ${DO_SHARED}
@@ -19,8 +19,9 @@ if ( OIIO_FOUND )
1919
endif()
2020

2121
target_link_libraries ( rawtoaces_util2
22-
PUBLIC
22+
PRIVATE
2323
${RAWTOACESIDTLIB}
24+
PUBLIC
2425
OpenImageIO::OpenImageIO
2526
)
2627

0 commit comments

Comments
 (0)