Git Product home page Git Product logo

Comments (18)

marzer avatar marzer commented on June 2, 2024 1

Yep, the .h version isn't going anywhere :)

from tomlplusplus.

eli-schwartz avatar eli-schwartz commented on June 2, 2024 1

Just to be clear, are you trying to use it after installing it system-wide, or as a meson subproject? You mention both "installation" and "subproject" above, so I'm not sure.

If you're using it as a subproject it should work (that's how I use it myself in a few other projects), though it could be that the example snippet is incorrect. Try this instead:

tomlplusplus = subproject('tomlplusplus').get_variable('tomlplusplus_dep')

This is the old style, for when your wrap file doesn't support [provide].

alternatively this might also work:

tomlplusplus = dependency('tomlplusplus_dep')

This doesn't work at all, since tomlplusplus_dep is a meson.build script variable, not the name of a registered dependency.

...

The documentation suggests this:

tomlplusplus_dep = dependency('tomlplusplus')

which works fine, but could be improved a bit:

tomlplusplus_dep = dependency('tomlplusplus', version: '>=3.4.0')

since that will guarantee having "at least version 3.4.0", and that's something you want in order to provide consistency and reliability e.g. in terms of header include name. Plus, many of the examples for adding it to your project include minimum requirements like this.

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024 1

The header include has been fixed in the documentation, as now there's a version selector - it'll be the correct value if you switch it to v3.3.0 :)

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024

Just to be clear, are you trying to use it after installing it system-wide, or as a meson subproject? You mention both "installation" and "subproject" above, so I'm not sure.

If you're using it as a subproject it should work (that's how I use it myself in a few other projects), though it could be that the example snippet is incorrect. Try this instead:

tomlplusplus = subproject('tomlplusplus').get_variable('tomlplusplus_dep')

alternatively this might also work:

tomlplusplus = dependency('tomlplusplus_dep')

from tomlplusplus.

HealthyPear avatar HealthyPear commented on June 2, 2024

I just followed the instructions here
https://marzer.github.io/tomlplusplus/#mainpage-adding-lib-meson

so I have the wrap file and all seems to be in place under the subprojects folder

Unfortunately your updated snippet gives me the same error - it cannot find your library headers

from tomlplusplus.

HealthyPear avatar HealthyPear commented on June 2, 2024
[1/2] Compiling C++ object main.p/main.cxx.o
FAILED: main.p/main.cxx.o
c++ -Imain.p -I. -I.. -Isubprojects/tomlplusplus-3.3.0/include -I../subprojects/tomlplusplus-3.3.0/include -fdiagnostics-color=always -Wall -Winvalid-pch -O0 -g -DTOML_HEADER_ONLY=0 -DTOML_SHARED_LIB=1 -MD -MQ main.p/main.cxx.o -MF main.p/main.cxx.o.d -o main.p/main.cxx.o -c ../main.cxx
../main.cxx:2:10: fatal error: 'toml++/toml.hpp' file not found
#include <toml++/toml.hpp>
         ^~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.

from tomlplusplus.

HealthyPear avatar HealthyPear commented on June 2, 2024

I am using meson 1.3.1 always from Homebrew if it can be of any help

unfortunately I am quite ignorant about C++/CMake/Meson...

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024

I am quite ignorant about C++/CMake/Meson...

Yeah, me too 😅

Unfortunately your updated snippet gives me the same error

Hmmmn. Let me look into it.

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024

So I just did this:

shell:

meson wrap install tomlplusplus

meson.build:

project('test_tomlplusplus', 'cpp')

tomlplusplus = dependency('tomlplusplus')

executable('main', 'main.cxx', dependencies : tomlplusplus)

locally in a test project and it worked fine? I don't know where else to go from here.

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024

what is the output of meson wrap status? e.g.

> meson wrap status
Subproject status
 tomlplusplus up to date. Branch 3.3.0, revision 1.

from tomlplusplus.

HealthyPear avatar HealthyPear commented on June 2, 2024

Subproject status
tomlplusplus up to date. Branch 3.3.0, revision 1.

seems to be exactly the same

could you zip and share here your test project? maybe I made a mistake elsewhere?

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024

Ohhhh wait, I know what's happening. That's 3.3.0, which didn't have toml.hpp - I added that in 3.4.0. change your include to this:

#include <toml++/toml.h>

Totally my fault :) ideally the wrap should have been updated, but I haven't gotten around to it.

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024

(there's no difference between the two headers - one just includes the other. I added the .hpp version in v3.4.0 to be more idiomatic C++.)

from tomlplusplus.

HealthyPear avatar HealthyPear commented on June 2, 2024

Thanks that was indeed the issue here!

I suggest adding a note about this to the docs then.

Also, if it can be of any help, in my case (arch+compiler) I had to explicitly use 'cpp_std=c++17' as a default option otherwise a ton of other error pop out (but that might be only my setup)

from tomlplusplus.

HealthyPear avatar HealthyPear commented on June 2, 2024

To be fair, I now went into the subproject source and I see the .hpp file, it's just not in the include directory but rather the top-level, together with the README

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024

I suggest adding a note about this to the docs then.

Yep. I should flag this as a <= 3.3.0, >= 3.4.0 thing.

Also, if it can be of any help, in my case (arch+compiler) I had to explicitly use 'cpp_std=c++17' as a default option otherwise a ton of other error pop out (but that might be only my setup)

Well yeah, it's a C++17 project. Meson doesn't propagate the minimum C++ version up from dependencies (that I'm aware of, anyway) - it expects you to be explicit here. If you don't provide a value for cpp_std it'll just be whatever your compiler's default is (often C++14 these days). See Meson: Compiler options for detail.

To be fair, I now went into the subproject source and I see the .hpp file, it's just not in the include directory but rather the top-level, together with the README

Yeah, that's the single-include version, with the entire library in one file. That's always been there. In v3.4.0 I added a 'normal' version of toml.hpp in the same directory as toml.h. (having different file extensions for the two different ways of including the library was a dumb historical mistake on my part, so I fixed it in v3.4.0.)

from tomlplusplus.

HealthyPear avatar HealthyPear commented on June 2, 2024

Would you say it's safer to include the .h also for 3.4.0 until the wrap is updated?

from tomlplusplus.

marzer avatar marzer commented on June 2, 2024

Thanks for the clarifications @eli-schwartz 😃

from tomlplusplus.

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.