hyperrealm / libconfig

C/C++ library for processing configuration files
https://hyperrealm.github.io/libconfig/
GNU Lesser General Public License v2.1
1.1k stars 360 forks source link

Conan package build #181

Closed Lukas-Heiligenbrunner closed 2 years ago

Lukas-Heiligenbrunner commented 3 years ago

Hey,

Conan is a great package manager for C/C++ Code. (see here) So I thought, why not make Libconfig available as a package. This PR adds the required config files to build the conan package with a simple conan create . It's up to you if you want to upload the package to a registry or not but it is not absolutely necessary.

I couldn't figure out how you handle a 'how to build' documentation or sth. So do i need to document this?

Kind regards Lukas

Lukas-Heiligenbrunner commented 3 years ago

Does this need testing on ci? github actions would be perfect for that.

I've created a github build action without uploading the package somewhere. I think @hyperrealm should create a bintray account by himself to deploy the package somewhere.

madebr commented 3 years ago

I've created a github build action without uploading the package somewhere. I think @hyperrealm should create a bintray account by himself to deploy the package somewhere.

conan has a central package repo: conan-center. If you want libconfig included, you can submit a recipe at https://github.com/conan-io/conan-center-index. I think that is easier for @hyperrealm . All @hyperrealm needs to do is create a github release, which would be nice since the last one was 2 years ago.

184 and #185 would also be helpful.

Lukas-Heiligenbrunner commented 3 years ago

I've created a github build action without uploading the package somewhere. I think @hyperrealm should create a bintray account by himself to deploy the package somewhere.

conan has a central package repo: conan-center. If you want libconfig included, you can submit a recipe at https://github.com/conan-io/conan-center-index. I think that is easier for @hyperrealm . All @hyperrealm needs to do is create a github release, which would be nice since the last one was 2 years ago.

184 and #185 would also be helpful.

Hey @madebr, I requested access and forked the repo and migrated the conan buildscript.

see --> LibConfig

After trying to build it with conan create . libconfig/1.7.2@ there are lots of c++ type errors such as:

In file included from /usr/include/c++/10/ext/string_conversions.h:41,
                 from /usr/include/c++/10/bits/basic_string.h:6545,
                 from /usr/include/c++/10/string:55,
                 from /home/lukas/.conan/data/libconfig/1.7.2/_/_/source/source_subfolder/lib/libconfig.h++:28,
                 from /home/lukas/.conan/data/libconfig/1.7.2/_/_/source/source_subfolder/lib/libconfigcpp.c++:23,
                 from /home/lukas/.conan/data/libconfig/1.7.2/_/_/source/source_subfolder/lib/libconfigcpp.cc:23:
/usr/include/c++/10/cstdlib:127:11: error: 'div_t' has not been declared in '::'
  127 |   using ::div_t;
      |           ^~~~~
/usr/include/c++/10/cstdlib:128:11: error: 'ldiv_t' has not been declared in '::'
  128 |   using ::ldiv_t;
      |           ^~~~~~
/usr/include/c++/10/cstdlib:130:11: error: 'abort' has not been declared in '::'
  130 |   using ::abort;
      |           ^~~~~

Any suggestions what's going wrong here? ~Lukas

madebr commented 3 years ago

The 1.7.2 release is already 2 years old. I think it is more focused on autotools then on cmake. I have the same errors when creating a conan recipe for 1.7.2.

Lukas-Heiligenbrunner commented 3 years ago

The 1.7.2 release is already 2 years old. I think it is more focused on autotools then on cmake. I have the same errors when creating a conan recipe for 1.7.2.

ok, then we have to wait for release 1.7.3 anyway.

vmiheer commented 3 years ago

Can non-authors not upload conan package? @Lukas-Heiligenbrunner can you upload the package?

Lukas-Heiligenbrunner commented 3 years ago

Can non-authors not upload conan package? @Lukas-Heiligenbrunner can you upload the package?

@vmiheer: Yess I can upload the package within a PR to Conan Index, but the package won't build with version 1.7.2 because of outdated cmake scripts. We need a new release to publish correctly to Conan index.

(You could try to build the darft by yourself Here. -- but it won't compile)

vmiheer commented 3 years ago

Thanks Lukas, does conan not support "Trunk"/"master" version?

Lukas-Heiligenbrunner commented 3 years ago

I don't know, but I don't think it's really common and makes much sense (; Then there may occur unstable release builds...

madebr commented 3 years ago

@vmiheer conan on itself is able to work with master versions. The project at https://github.com/conan-io/conan-center-index does only accept versioned releases or, if those are not available, git hashes (e.g. cci.20201231 for a commit on the last day of last year). They want to provide traceable packages.

brandonros commented 2 years ago

Any idea why CI/CD is failing with

libconfig++.lib(libconfigcpp.obj) : error LNK2019: unresolved external symbol __imp_config_lookup referenced in function "public: bool __cdecl libconfig::Config::exists(char const *)const " (?exists@Config@libconfig@@QEBA_NPEBD@Z) [C:\Users\runneradmin\.conan\data\libconfig\1.7.3\_\_\build\3fb49604f9c2f729b85ba3115852006824e72cab\libconfig\examples\c++\c++_example4.vcxproj]

https://github.com/hyperrealm/libconfig/runs/3763376955

brandonros commented 2 years ago

I think the examples need to do #define LIBCONFIG_STATIC inside of themselves.

madebr commented 2 years ago

@brandonros See #208 for a fix. I just rebased it on top of current master.