Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++17] Check whether the output directory exists. #12080

Merged
merged 1 commit into from Jul 4, 2023

Conversation

bangerth
Copy link
Member

Fixes #10281 . We can only apply this once we support C++17, but I had this ready so I'll post for whenever the time comes.

@bangerth bangerth added this to the Release 10.0 milestone Apr 22, 2021
@bangerth bangerth added the C++17 label Apr 22, 2021
@masterleinad masterleinad marked this pull request as draft April 22, 2021 19:43
@@ -144,6 +144,7 @@ namespace LA
#endif

#include <cmath>
#include <filesystem>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'll be some fun - For libstdc++ we will have to figure out a sane way to decide whether we have to link against libstdc++fs as well or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't -std=c++17 imply that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bangerth gcc version 9 onwards should just require -std=c++17, gcc version 8 and older require manual linking with libstdc++fs. At least if I recall correctly 😸

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember that I had similar issues with gcc8. I solved this by substitution with boost libraries:

#ifdef __cpp_lib_filesystem
#  include <filesystem>
namespace filesystem
{
  using namespace std::filesystem;
}
#else
#  include <boost/filesystem.hpp>
namespace filesystem
{
  using namespace boost::filesystem;
}
#endif

I'm not sure if the __cpp_lib_filesystem flag only exists for gcc.

We could move this code snippet into the std_cxx17 namespace. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that we don't include the boost filesystem parts in the bundled/ directory :-( There is also the issue that this is a tutorial and I really didn't want to introduce some complicated workaround in tutorials -- I'd rather just leave things as they are if we can't do it right....

@bangerth
Copy link
Member Author

bangerth commented Jul 3, 2023

This is now open for merge :-)

@tamiko
Copy link
Member

tamiko commented Jul 4, 2023

The minimal version we test and thus meaningfully support now is gcc-9 so this can go in as is.

@tamiko tamiko merged commit b357a1f into dealii:master Jul 4, 2023
20 of 23 checks passed
@bangerth bangerth deleted the check-for-directory branch July 4, 2023 23:50
@masterleinad
Copy link
Member

The minimal version we test and thus meaningfully support now is gcc-9 so this can go in as is.

tester-ng still uses gcc-7.5, though, see https://cdash.dealii.org/viewSite.php?siteid=3&project=1&currenttime=1688518800.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[C++17] step-70: Create output directory if necessary
5 participants