Skip to content

Commit

Permalink
FIX: support boost 1.81
Browse files Browse the repository at this point in the history
https://www.boost.org/users/history/version_1_79_0.html

boost 1.79 deprecated boost/filesystem/string_file.hpp and
with boost 1.81 boost::filesystem::ofstream or so is no longer
available.

Replace these with boost::nowide in boost/nowide/fstream.hpp .

Fixes LuxCoreRender#610 .
  • Loading branch information
mtasaka committed Mar 9, 2023
1 parent 131032f commit 2babe4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions src/luxrays/utils/cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/nowide/fstream.hpp>

#include "luxrays/luxrays.h"
#include "luxrays/utils/utils.h"
Expand Down Expand Up @@ -174,10 +175,10 @@ bool cudaKernelPersistentCache::CompilePTX(const vector<string> &kernelsParamete

// The use of boost::filesystem::path is required for UNICODE support: fileName
// is supposed to be UTF-8 encoded.
boost::filesystem::ofstream file(boost::filesystem::path(fileName),
boost::filesystem::ofstream::out |
boost::filesystem::ofstream::binary |
boost::filesystem::ofstream::trunc);
boost::nowide::ofstream file(boost::filesystem::path(fileName),
boost::nowide::ofstream::out |
boost::nowide::ofstream::binary |
boost::nowide::ofstream::trunc);

// Write the binary hash
const u_int hashBin = oclKernelPersistentCache::HashBin(*ptx, *ptxSize);
Expand Down Expand Up @@ -206,8 +207,8 @@ bool cudaKernelPersistentCache::CompilePTX(const vector<string> &kernelsParamete

// The use of boost::filesystem::path is required for UNICODE support: fileName
// is supposed to be UTF-8 encoded.
boost::filesystem::ifstream file(boost::filesystem::path(fileName),
boost::filesystem::ifstream::in | boost::filesystem::ifstream::binary);
boost::nowide::ifstream file(boost::filesystem::path(fileName),
boost::nowide::ifstream::in | boost::nowide::ifstream::binary);

// Read the binary hash
u_int hashBin;
Expand Down
13 changes: 7 additions & 6 deletions src/luxrays/utils/ocl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/nowide/fstream.hpp>

#include "luxrays/luxrays.h"
#include "luxrays/utils/utils.h"
Expand Down Expand Up @@ -303,10 +304,10 @@ cl_program oclKernelPersistentCache::Compile(cl_context context, cl_device_id de

// The use of boost::filesystem::path is required for UNICODE support: fileName
// is supposed to be UTF-8 encoded.
boost::filesystem::ofstream file(boost::filesystem::path(fileName),
boost::filesystem::ofstream::out |
boost::filesystem::ofstream::binary |
boost::filesystem::ofstream::trunc);
boost::nowide::ofstream file(boost::filesystem::path(fileName),
boost::nowide::ofstream::out |
boost::nowide::ofstream::binary |
boost::nowide::ofstream::trunc);

// Write the binary hash
const u_int hashBin = HashBin(bins, binsSizes[0]);
Expand Down Expand Up @@ -337,8 +338,8 @@ cl_program oclKernelPersistentCache::Compile(cl_context context, cl_device_id de

// The use of boost::filesystem::path is required for UNICODE support: fileName
// is supposed to be UTF-8 encoded.
boost::filesystem::ifstream file(boost::filesystem::path(fileName),
boost::filesystem::ifstream::in | boost::filesystem::ifstream::binary);
boost::nowide::ifstream file(boost::filesystem::path(fileName),
boost::nowide::ifstream::in | boost::nowide::ifstream::binary);

// Read the binary hash
u_int hashBin;
Expand Down

0 comments on commit 2babe4d

Please sign in to comment.