Skip to content

Commit a8bad07

Browse files
authored
replace boost::filesystem with std::filesystem (#161)
* replace boost::filesystem with std::filesystem Signed-off-by: Anton Dukhovnikov <[email protected]> * small fixes Signed-off-by: Anton Dukhovnikov <[email protected]> --------- Signed-off-by: Anton Dukhovnikov <[email protected]>
1 parent 3896445 commit a8bad07

File tree

20 files changed

+104
-97
lines changed

20 files changed

+104
-97
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
env:
4242
CXX: ${{matrix.cxx_compiler}}
4343
CC: ${{matrix.cc_compiler}}
44-
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
4544
OPENEXR_VERSION: ${{matrix.openexr_ver}}
4645

4746
steps:
@@ -74,6 +73,7 @@ jobs:
7473
-B build
7574
-S .
7675
-D RTA_CENTOS7_CERES_HACK=ON
76+
-D CMAKE_CXX_STANDARD=${{matrix.cxx_std}}
7777
7878
- name: Build
7979
run: |
@@ -128,7 +128,6 @@ jobs:
128128
env:
129129
CXX: ${{matrix.cxx_compiler}}
130130
CC: ${{matrix.cc_compiler}}
131-
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
132131

133132
steps:
134133
- uses: actions/checkout@v4
@@ -152,6 +151,7 @@ jobs:
152151
run: >
153152
cmake -B build -S .
154153
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
154+
-D CMAKE_CXX_STANDARD=${{matrix.cxx_std}}
155155
156156
- name: Build
157157
run: |
@@ -168,6 +168,7 @@ jobs:
168168
-B build_config_test
169169
-S ./unittest/config_tests
170170
-D RAWTOACES_DIR=${{ github.workspace }}/install/lib/cmake/RAWTOACES
171+
-D CMAKE_CXX_STANDARD=${{matrix.cxx_std}}
171172
172173
- name: Build config_tests
173174
run: >
@@ -246,7 +247,7 @@ jobs:
246247
-B build
247248
-S ${{ github.workspace }}
248249
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
249-
-D CXX_STANDARD=C++17
250+
-D CMAKE_CXX_STANDARD=17
250251
-D CMAKE_TOOLCHAIN_FILE="${{ matrix.toolchain_file }}"
251252
-D ENABLE_SHARED="${{ matrix.build_shared_libs }}"
252253
@@ -268,6 +269,7 @@ jobs:
268269
-S ${{ github.workspace }}/unittest/config_tests
269270
-D RAWTOACES_DIR=${{ github.workspace }}/install/lib/cmake/RAWTOACES
270271
-D CMAKE_TOOLCHAIN_FILE="${{ matrix.toolchain_file }}"
272+
-D CMAKE_CXX_STANDARD=17
271273
272274
- name: Build config_tests
273275
run: >

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.11)
22
project( RAWTOACES )
33

4+
if( NOT DEFINED CMAKE_CXX_STANDARD )
5+
set(CMAKE_CXX_STANDARD 17)
6+
endif()
7+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
49
set( RAWTOACES_MAJOR_VERSION 1 )
510
set( RAWTOACES_MINOR_VERSION 1 )
611
set( RAWTOACES_PATCH_VERSION 0 )
@@ -18,8 +23,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
1823
endif()
1924

2025
if (NOT CONFIGURED_ONCE)
21-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warnings}")
22-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${warnings}")
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warnings}")
27+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${warnings}")
2328
endif()
2429

2530
## Make install directories overridable

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ $ sudo apt-get -f cmake
6464
$ build_scripts/install_aces_container.bash
6565
$ sudo apt-get -f install \
6666
libimath-dev \
67-
libboost-dev libboost-filesystem-dev \
67+
libboost-dev \
68+
libboost-system-dev \
6869
libboost-test-dev \
6970
libraw-dev libceres-dev
7071
```
@@ -93,7 +94,6 @@ $ vcpkg install \
9394
imath:x64-windows \
9495
boost-system:x64-windows \
9596
boost-foreach:x64-windows \
96-
boost-filesystem:x64-windows \
9797
boost-test:x64-windows \
9898
boost-property-tree:x64-windows
9999
```

build_scripts/install_deps_linux.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ time sudo apt-get update
66

77
time sudo apt-get -q -f install -y \
88
libimath-dev \
9-
libboost-dev libboost-filesystem-dev \
9+
libboost-dev \
10+
libboost-system-dev \
1011
libboost-test-dev \
1112
libraw-dev libceres-dev

build_scripts/install_deps_windows.bash

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ vcpkg install \
88
imath:x64-windows \
99
boost-system:x64-windows \
1010
boost-foreach:x64-windows \
11-
boost-filesystem:x64-windows \
1211
boost-test:x64-windows \
1312
boost-property-tree:x64-windows

config/RAWTOACESConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ find_dependency ( Eigen3 )
1313
find_dependency ( Ceres )
1414
find_dependency ( libraw )
1515
find_dependency ( Imath )
16-
find_dependency ( Boost COMPONENTS system filesystem )
16+
find_dependency ( Boost COMPONENTS system )
1717

1818
check_required_components(rawtoaces)

configure.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_INSTALL_PREFIX}/share/CMake"
66
find_package ( AcesContainer CONFIG REQUIRED )
77
find_package ( Eigen3 CONFIG REQUIRED )
88
find_package ( Imath CONFIG REQUIRED )
9-
find_package ( Boost REQUIRED
9+
find_package ( Boost CONFIG REQUIRED
1010
COMPONENTS
1111
system
12-
filesystem
1312
unit_test_framework
1413
)
1514

include/rawtoaces/define.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@
5656

5757
#include <string>
5858
#include <algorithm>
59-
#include <boost/filesystem.hpp>
59+
#include <filesystem>
6060
#include <iostream>
61+
#include <vector>
6162

6263
#ifndef WIN32
6364
# include <sys/stat.h>
@@ -344,13 +345,18 @@ inline vector<string> openDir( string path = "." )
344345
{
345346
vector<string> paths;
346347

347-
if ( boost::filesystem::exists( path ) )
348+
if ( std::filesystem::exists( path ) )
348349
{
349-
for ( auto &i: boost::filesystem::directory_iterator( path ) )
350+
if ( std::filesystem::is_directory( path ) )
350351
{
351-
if ( i.status().type() !=
352-
boost::filesystem::file_type::directory_file )
353-
paths.push_back( i.path().string() );
352+
auto it = std::filesystem::directory_iterator( path );
353+
for ( auto filename: it )
354+
{
355+
if ( !std::filesystem::is_directory( filename ) )
356+
{
357+
paths.push_back( filename.path().string() );
358+
}
359+
}
354360
}
355361
}
356362

src/rawtoaces_idt/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ target_link_libraries(
1919
PUBLIC
2020
Boost::boost
2121
Boost::system
22-
Boost::filesystem
2322
Imath::Imath
2423
Imath::ImathConfig
2524
Eigen3::Eigen

src/rawtoaces_util/acesrender.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include <aces/aces_Writer.h>
1313

14+
#include <mutex>
15+
1416
#ifndef WIN32
1517
# include <fcntl.h>
1618
# include <sys/mman.h>
@@ -19,8 +21,6 @@
1921
using namespace std;
2022
using namespace boost::property_tree;
2123

22-
#include <boost/filesystem.hpp>
23-
2424
// =====================================================================
2525
// Prepare the matching between string flags and single character flag
2626
//
@@ -954,7 +954,7 @@ vector<string> findFiles( string filePath, vector<string> searchPaths )
954954
{
955955
string path = i + "/" + filePath;
956956

957-
if ( boost::filesystem::exists( path ) )
957+
if ( std::filesystem::exists( path ) )
958958
foundFiles.push_back( path );
959959
}
960960

0 commit comments

Comments
 (0)