Code Monkey home page Code Monkey logo

Comments (8)

baconpaul avatar baconpaul commented on June 11, 2024 1

Let me try that! Will report back

from pegtl.

ColinH avatar ColinH commented on June 11, 2024

Hi, sorry for the wait, we had to ponder a couple of possibilities, especially since the drive towards a PEGTL 4.0.0 is also driving us towards cleaning out support for older compilers and non-standard libraries.

If you can prepare and test a PR that adds support for this additional filesystem library to the PEGTL 3.x branch we would merge the PR, tag a new PEGTL 3.x version, update the PEGTL in taoJSON to that new version, and tag a new taoJSON beta release.

That still gives us the possibility to go the other way in the PEGTL development branch, e.g. remove support for std::experimental::filesystem and boost::filesystem from the PEGTL 4.0 to end up with only std::filesystem.

This will eventually be used in taoJSON, too, but you can use the taoJSON version with the new 3.x PEGTL for as long as you need.

Does this work for you?

from pegtl.

baconpaul avatar baconpaul commented on June 11, 2024

That works for me thank you! Let me get to it next few weeks.

Iā€™m also happy to maintain a branch and realize audio is probably unique in this osx regard

another option I considered: why does taojson even have a file system dependency? I am using it entirely for in memory communication and not for any file handling. I wonder if a build of the suite with zero file system support as an option may be a more tolerable approach for your forward plans? Happy to consider that also

Thanks for these super libraries also

from pegtl.

ColinH avatar ColinH commented on June 11, 2024

In that case, have you tried selectively including only the parts of taoJSON that you need, rather than tao/json.hpp which pulls in everything but the kitchen sink? That way it should be possible to completely omit the file handling parts.

from pegtl.

baconpaul avatar baconpaul commented on June 11, 2024

OK this strategy works remarkably well with one and only one change required.

Your CMakeList in pegtl assumes you are using a filesystem implementation. That is, it checks std::fs then std::exp::fs then boost and if none of those work, it fails cmake.

I made the following change to your CMakeLists

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2ee336f..b3eaee82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,7 +82,9 @@ function(check_filesystem_impl FILESYSTEM_HEADER FILESYSTEM_NAMESPACE OPTIONAL_L
   set(${OUT_RESULT} ${TEST_RESULT} PARENT_SCOPE)
 endfunction()
 
-if(PEGTL_USE_BOOST_FILESYSTEM)
+if (PEGTL_NO_STD_FILESYSTEM)
+  target_compile_definitions(${PROJECT_NAME} INTERFACE TAO_PEGTL_NO_STD_FILESYSTEM)
+elseif (PEGTL_USE_BOOST_FILESYSTEM)
   # Force the use of Boost.Filesystem: #include <boost/filesystem.hpp> // boost::filesystem
   find_package(Boost REQUIRED COMPONENTS filesystem)
   target_link_libraries(${PROJECT_NAME} INTERFACE Boost::filesystem)

and then cache set PEGTL_NO_STD_FILESYSTEM and was able to do a 10.13 build. (There's other 10.13 C++17 APIs which will then stop me going back to 10.9 but really 10.14 is the target I'm aiming for).

Would you consider merging such a change? I don't want to maintain a fork for just this, but I also don't want to install boost just so I can not use it and have cmake work :) Oh and presumably you would add an option above (I was sloppy). I can prep that as a PR if you like also.

from pegtl.

baconpaul avatar baconpaul commented on June 11, 2024
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2ee336f..718b69ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,7 @@ target_include_directories(pegtl INTERFACE
 target_compile_features(pegtl INTERFACE cxx_std_17)
 
 option(PEGTL_USE_BOOST_FILESYSTEM "Override the auto-detection of std::filesystem and use Boost.Filesystem" OFF)
+option(PEGTL_NO_STD_FILESYSTEM "Don't link to any std::filesystem; file operations will not work" OFF)
 
 # Try compiling a test program with std::filesystem or one of its alternatives
 function(check_filesystem_impl FILESYSTEM_HEADER FILESYSTEM_NAMESPACE OPTIONAL_LIBS OUT_RESULT)
@@ -82,7 +83,10 @@ function(check_filesystem_impl FILESYSTEM_HEADER FILESYSTEM_NAMESPACE OPTIONAL_L
   set(${OUT_RESULT} ${TEST_RESULT} PARENT_SCOPE)
 endfunction()
 
-if(PEGTL_USE_BOOST_FILESYSTEM)
+if (PEGTL_NO_STD_FILESYSTEM)
+  target_compile_definitions(${PROJECT_NAME} INTERFACE TAO_PEGTL_NO_STD_FILESYSTEM)
+  message(STATUS "Skipping std::filesystem in PEGTL; File operations will not work or compile.")
+elseif (PEGTL_USE_BOOST_FILESYSTEM)
   # Force the use of Boost.Filesystem: #include <boost/filesystem.hpp> // boost::filesystem
   find_package(Boost REQUIRED COMPONENTS filesystem)
   target_link_libraries(${PROJECT_NAME} INTERFACE Boost::filesystem)

there's the complete diff I ended up using with a message and also with an option.

Look forward to your feedback! Thanks so much.

from pegtl.

baconpaul avatar baconpaul commented on June 11, 2024

If you like this approach and it makes your life easier, I submitted the diff as #350 but feel free to close or ignore that of course! Thanks

from pegtl.

ColinH avatar ColinH commented on June 11, 2024

Continued in #350.

from pegtl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.