Commit 1cf82e4a authored by Jun Liu's avatar Jun Liu
Browse files

fix build issues

parent 9ecff383
...@@ -44,6 +44,9 @@ else() ...@@ -44,6 +44,9 @@ else()
find_package(Python3 3.8 COMPONENTS Interpreter REQUIRED) find_package(Python3 3.8 COMPONENTS Interpreter REQUIRED)
endif() endif()
option(CK_WORKAROUND_USE_BOOST_FILESYSTEM "Workaround: Use boost::filesystem instead of std::filesystem" OFF)
message(STATUS "CK_WORKAROUND_USE_BOOST_FILESYSTEM ${CK_WORKAROUND_USE_BOOST_FILESYSTEM}")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if (DTYPES) if (DTYPES)
......
...@@ -9,7 +9,7 @@ namespace rtc { ...@@ -9,7 +9,7 @@ namespace rtc {
struct src_file struct src_file
{ {
fs::path path; CK::fs::path path;
std::string_view content; std::string_view content;
}; };
......
...@@ -8,7 +8,7 @@ namespace rtc { ...@@ -8,7 +8,7 @@ namespace rtc {
struct tmp_dir struct tmp_dir
{ {
fs::path path; CK::fs::path path;
tmp_dir(const std::string& prefix = ""); tmp_dir(const std::string& prefix = "");
void execute(const std::string& cmd) const; void execute(const std::string& cmd) const;
......
...@@ -70,9 +70,9 @@ kernel compile_kernel(const std::vector<src_file>& srcs, compile_options options ...@@ -70,9 +70,9 @@ kernel compile_kernel(const std::vector<src_file>& srcs, compile_options options
for(const auto& src : srcs) for(const auto& src : srcs)
{ {
fs::path full_path = td.path / src.path; CK::fs::path full_path = td.path / src.path;
fs::path parent_path = full_path.parent_path(); CK::fs::path parent_path = full_path.parent_path();
fs::create_directories(parent_path); CK::fs::create_directories(parent_path);
write_string(full_path.string(), src.content); write_string(full_path.string(), src.content);
if(src.path.extension().string() == ".cpp") if(src.path.extension().string() == ".cpp")
{ {
...@@ -86,7 +86,7 @@ kernel compile_kernel(const std::vector<src_file>& srcs, compile_options options ...@@ -86,7 +86,7 @@ kernel compile_kernel(const std::vector<src_file>& srcs, compile_options options
td.execute(compiler() + options.flags); td.execute(compiler() + options.flags);
auto out_path = td.path / out; auto out_path = td.path / out;
if(not fs::exists(out_path)) if(not CK::fs::exists(out_path))
throw std::runtime_error("Output file missing: " + out); throw std::runtime_error("Output file missing: " + out);
auto obj = read_buffer(out_path.string()); auto obj = read_buffer(out_path.string());
......
...@@ -31,10 +31,10 @@ std::string unique_string(const std::string& prefix) ...@@ -31,10 +31,10 @@ std::string unique_string(const std::string& prefix)
} }
tmp_dir::tmp_dir(const std::string& prefix) tmp_dir::tmp_dir(const std::string& prefix)
: path(fs::temp_directory_path() / : path(CK::fs::temp_directory_path() /
unique_string(prefix.empty() ? "ck-rtc" : "ck-rtc-" + prefix)) unique_string(prefix.empty() ? "ck-rtc" : "ck-rtc-" + prefix))
{ {
fs::create_directories(this->path); CK::fs::create_directories(this->path);
} }
void tmp_dir::execute(const std::string& cmd) const void tmp_dir::execute(const std::string& cmd) const
...@@ -43,6 +43,6 @@ void tmp_dir::execute(const std::string& cmd) const ...@@ -43,6 +43,6 @@ void tmp_dir::execute(const std::string& cmd) const
std::system(s.c_str()); std::system(s.c_str());
} }
tmp_dir::~tmp_dir() { fs::remove_all(this->path); } tmp_dir::~tmp_dir() { CK::fs::remove_all(this->path); }
} // namespace rtc } // namespace rtc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment