Comments (18)
Yep, the .h version isn't going anywhere :)
from tomlplusplus.
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.
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.
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.
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.
[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.
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.
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.
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.
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.
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.
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.
(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.
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.
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.
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.
Would you say it's safer to include the .h
also for 3.4.0 until the wrap is updated?
from tomlplusplus.
Thanks for the clarifications @eli-schwartz 😃
from tomlplusplus.
Related Issues (20)
- Crashes when trying to parse file with scientific notation numbers (e-numbers) HOT 1
- vs2022 cannot be used HOT 9
- Shared lib not being installed? HOT 6
- Cannot build with Intel MKL include dirs. HOT 9
- Make key::str() to return std::string instead of std::string_view? HOT 4
- Tomplusplus 3.3.0 build failed on android HOT 4
- File generated can't be parsed. HOT 1
- File that was written with toml++ can't be parsed HOT 6
- OSS-Fuzz Integration HOT 1
- vcpkg is now difficult to use. HOT 4
- How to convert toml::date_time to std::chrono::time_point? HOT 2
- Explicit / Non-lexicographical sorting when serializing? HOT 5
- Indendation customization? HOT 1
- Lambda function error using nvcc HOT 2
- Get toml/yaml/json string without using streams HOT 6
- Store single string value from node view array into string variable HOT 4
- Iterate over nested Tables (Array of Tables) HOT 4
- Undefined references linker error on nvc++ HOT 17
- What is the proper way to parse top level arrays? Seems not working HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tomlplusplus.