Coder Social home page Coder Social logo

cpp-pm / hunter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ruslo/hunter

584.0 24.0 176.0 13.7 MB

CMake driven cross-platform package manager for C/C++.

License: BSD 2-Clause "Simplified" License

CMake 91.98% Shell 1.78% Python 2.50% Batchfile 0.05% C++ 3.69% C 0.01%

hunter's Introduction

Hunter

Gitter public chat room Documentation status LICENSE

CMake driven cross-platform package manager for C/C++. Linux, Windows, macOS, iOS, Android, Raspberry Pi, etc.

hunter's People

Contributors

aadityakalsi avatar alamaison avatar bjoe avatar caseymcc avatar chfast avatar craffael avatar cyberunner23 avatar daminetreg avatar dan-42 avatar drodin avatar dvirtz avatar elisemorysc avatar headupinclouds avatar hjmallon avatar isaachier avatar jhs67 avatar kgeorgiev93 avatar knitschi avatar lsolanka avatar mean-ui-thread avatar neroburner avatar oliverdaniell avatar pretyman avatar rbsheth avatar riegl-gc avatar ruslo avatar tatraian avatar ubiquite avatar wheybags avatar xsacha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hunter's Issues

pip_numpy building tests do not pass

  • I've read Brief overview section and do understand basic concepts. [Yes]
  • I've read F.A.Q. section and there is no solution to my problem there. [Yes]
  • I've read Code of Conduct, I promise to be polite and will do my best at being constructive. [Yes]
  • I've read Reporting bugs section carefully. [Yes]
  • I've checked that all the hunter_add_package/find_package API used by me in the example is the same as in documentation. [Yes]
  • I'm using latest Hunter URL/SHA1. [No - from master branch]

UPDATED A LOT:

I tests pip_numpy by pushing the pkg.pip_numpy branch up to Appveyor and Travis. I got the following results:

MSYS and macOS builds are not working. The macOS ones are because Travis do not guarantee a Python version and have updated the old images with a new Python, PR here #117 . I am not sure why the MSYS ones say /usr/bin/python3.7.exe: No module named pip yet.

How to update Boost to v1.71

Hi,

I'd like to update boost to the latest version, also containing the new lib variant2.

Previous versions have been stored here:
https://github.com/hunter-packages/boost
with a branch for each release removing docs, examples, and tests.
And if needed patches are applied.

If we keep this, could you (@bkotzz @rbsheth ) give me access to it?
So I could also take care of future version.

Or what would your preferred way to update boost?

Latest yaml-cpp version has an uppercase SHA1

yaml-cpp package has in hunter-v0.23.229.tar\hunter-0.23.229\cmake\projects\yaml-cpp\hunter.cmake the following code:

hunter_add_version(
  PACKAGE_NAME
  yaml-cpp
  VERSION
  "0.6.2-0f9a586-p1"
  URL
  "https://github.com/hunter-packages/yaml-cpp/archive/v0.6.2-0f9a586-p1.zip"
  SHA1
  956C2B5FBF5AA0EB8EF5EF890C0328B3AA357A13
  )

which works on Windows, but not that much on Linux.

The previous versions have lowercase SHA1s.

Not needing forks to "hunterify" packages

Current state:
When adding a new package to hunter, many times we need to fork that package to make modifications to it. These commonly are:

  • The package does not use CMake
  • The package use CMake, but forces certain build settings (ie. sets the CXX version to 11), when we want to leave these up to the toolchain
  • The package has dependencies that need to be installed through hunter (ie. hunter_add_package in addition to the usual find_package)
  • The package doesn't have a CMake install step, which hunter uses to make the package available to consumers
  • The package does not have a config file

Needing to make forks to add a package creates an extra overhead that would be nice to avoid. However, we probably can't get away with needing to make changes to packages to use them, because we rely on "CMake best practices" that upstream maintainers either haven't added or aren't interested in adding.

A more lightweight version:

Here is an example of a PR to a fork, to hunterize a package hunter-packages/Bento4#1, at version 1.5.1-628-e6ee435-p0. Instead of making a fork, and pushing a commit to it, we could generate a patch, with git diff HEAD~1 HEAD > 1.5.1-628-e6ee435-p0.patch. We could then take that patch, and when making the PR against hunter too add the package, like ruslo#1797, we would include the patch file. So we would have cmake/projects/bento4/1.5.1-628-e6ee435-p0.patch. Then, our hunter config would look like this, using the upstream release tar:

 hunter_add_version(
    PACKAGE_NAME
    bento4
    VERSION
    "1.5.1-628-e6ee435-p0"
    URL
    "https://github.com/hunter-packages/Bento4/archive/v1.5.1-628-e6ee435-p0.tar.gz"
    SHA1
    f296f38004cd6523eed12ce15cbbfaa8ce6fa050
    LOCAL_PATCH
    ON
)

After downloading the source, and before building it, we would have an extra step:

> download https://github.com/hunter-packages/Bento4/archive/v1.5.1-628-e6ee435-p0.tar.gz
> extract v1.5.1-628-e6ee435-p0.tar.gz
> cd v1.5.1-628-e6ee435-p0
> git apply ${HUNTER_ROOT}/cmake/projects/bento4/1.5.1-628-e6ee435-p0.patch, if it exists

To support packages with multiple versions in hunter, we could keep multiple patch files in the project folder in hunter.

Benefits:

  • No more forks
  • Hunterizing a package, and adding it to hunter happen in one PR - the plain-text patch can be reviewed when adding it

Disadvantages:

  • We are then restricted to using released archive from upstream repos. Some repos don't release frequently, and the fork model has allowed us to use unreleased code in hunter
  • The size of the hunter repo increases. The example patch I referenced was very simple, and still is 3.6KB. Having more complex patches, and patches per version for all packages in hunter would easily add 10s of megabytes to the repo
  • Reviewing patches becomes visually harder, compared to a PR against the fork. For example, we need to read
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f08b2f..c7170c3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 # cmake -DCMAKE_BUILD_TYPE=Debug ..
 # cmake -DCMAKE_BUILD_TYPE=Release ..
-cmake_minimum_required(VERSION 2.8)
-project(bento4)
+cmake_minimum_required(VERSION 3.0.2)
+project(bento4 LANGUAGES CXX VERSION "0.0.0")

Instead of
image
Likely we can support both the fork and patch models, and only use the patch models on small changes. However, small patches cover the overwhelming majority of package forks in hunter.

Summary:

  • Tracking versioned patches in hunter for each package that requires "hunterization" to use means we can remove the need to fork packages, and can quickly make small modifications to a project's source in a single PR

make Hunter silent by default


set HUNTER_STATUS_PRINT by default to OFF

The Hunter messages are only interesting in the case of errors, otherwise they are just cluttering up the CI build jobs

Machine-specific code in cached packages

As mentioned in #62, machine-specific instructions in tuned code (ex. AVX2 instructions) could be cached and saved in Hunter, then distributed to end users that may not have AVX2 capabilities. Perhaps the correct thing to do is add architecture capabilities to the toolchain hash, but that would cause many other packages to be duplicated in cache.

Upgrade Qt (also fix)

Qt is currently at 5.11, which is no longer supported (and thus the download link hunter tries returns a 404). This needs to be fixed by pointing at the "archival" download location or updating Qt to a supported version.

Add "OpenEXR" package

Here is the package request from old hunter https://github.com/ruslo/hunter/issues/361


I have already got this working in a test branch (thanks to the great work done upstream in improving their CMake build system recently). I have 3 PRs open upstream taken from my hunterize-2 branch.

I will need a fork in hunter-packages to add the hunter_add_package and HunterGate on top of those commits (which hopefully will be absorbed upstream).

DOWNLOAD_SERVER doesn't work with scheme url_sha1_download

  • I've read Brief overview section and do understand basic concepts. [Yes]
  • I've read F.A.Q. section and there is no solution to my problem there. [Yes]
  • I've read Code of Conduct, I promise to be polite and will do my best at being constructive. [Yes]
  • I've read Reporting bugs section carefully. [Yes]
  • I've checked that all the hunter_add_package/find_package API used by me in the example is the same as in documentation. [Yes]
  • I'm using latest Hunter URL/SHA1. [Yes]

the functionality of HUNTER_DOWNLOAD_SERVER (Documentation) does not work with the scheme url_sha1_download

url_sha1_download uses file(DOWNLOAD ) command, which doesn't support multiple URLs to download.
https://github.com/cpp-pm/hunter/blob/master/cmake/schemes/url_sha1_download.cmake.in#L52-L58

url_sha1_cmake on the other hand uses ExternalProject_Add which supports multiple URLs since cmake v3.7
https://github.com/cpp-pm/hunter/blob/master/cmake/schemes/url_sha1_cmake.cmake.in#L152

We could use ExternalProject_Add instead of file(DOWNLOAD) in url_sha1_download

  • I've created SSCCE reproducing the issue:
# CMakeLists.txt
set(HUNTER_DOWNLOAD_SERVER "http://internal-download-server.domain/hunter/projects;http://allowed-source1.domain;http://allowed-source2.domain;http://allowed-source3.domain")

cmake_minimum_required(VERSION 3.2)

include("cmake/HunterGate.cmake")
HunterGate(
    URL "..."
    SHA1 "..."
)

project(download-ippicv)

hunter_add_package(ippicv)
file(GLOB ippicv_archive "${IPPICV_ROOT}/ippicv_*")
if(EXISTS "${ippicv_archive}")
  message("ippicv archive: ${ippicv_archive}")
else()
  message(FATAL_ERROR "Nothing found in `${IPPICV_ROOT}`")
endif()

Here is the log until first error reported by Hunter, option HUNTER_STATUS_DEBUG is ON:

-- [hunter] Error: downloading 'http://internal-download-server.domain/hunter/projects/ippicv/20151201/2252c08/ippicv_linux_20151201.tgz;http://allowed-source1.domain;http://allowed-source2.domain/ippicv/20151201/2252c08/ippicv_linux_20151201.tgz;http://allowed-source3.domain/ippicv/20151201/2252c08/ippicv_linux_20151201.tgz' failed
-- [hunter]   status_code: 22
-- [hunter]   status_string: "HTTP response code said error"
-- [hunter]   log:   Trying 192.168.2.245...
TCP_NODELAY set

hunter_default_version should be callable from user config

Do variables __HUNTER_LAST_DEFAULT_VERSION_NAME, __HUNTER_ALLOW_DEFAULT_VERSION_LOADING and checks related to them protect hunter users against doing anything wrong?
The only effect to these checks I've found is disabling hunter_default_version in user config, which allows you to add a new package without forking whole hunter. You can also change a version of an existing package, but you can do the same with hunter_config.

You can test it by setting this in local config

set(__HUNTER_LAST_DEFAULT_VERSION_NAME "" 
    "Disable alphabetic verification of hunter_default_version calls")
set(__HUNTER_ALLOW_DEFAULT_VERSION_LOADING YES 
    "Allow hunter_default_version calls outside Hunter")
hunter_default_version(some_package_added_to_HUNTER_SELF/cmake/projects VERSION ...)

I've used this for a while and didn't find any problem with it, so maybe those checks should be removed.

Boost not working with FetchContent_MakeAvailable(SetupHunter)

I have been using FetchContent_MakeAvailable(SetupHunter) with multiple different packages successfully already, but now I tried it with Boost and it failed with the following errors:

CMake Error at C:/.hunter/_Base/b67e11d/083dd95/9877faf/Install/lib/cmake/Boost/BoostConfig.cmake:4 (include):
  include could not find load file:

    hunter_check_toolchain_definition
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


CMake Error at C:/.hunter/_Base/b67e11d/083dd95/9877faf/Install/lib/cmake/Boost/BoostConfig.cmake:7 (include):
  include could not find load file:

    hunter_internal_error
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


CMake Error at C:/.hunter/_Base/b67e11d/083dd95/9877faf/Install/lib/cmake/Boost/BoostConfig.cmake:8 (include):
  include could not find load file:

    hunter_status_debug
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)



[hunter ** INTERNAL **] Unexpected empty string
[hunter ** INTERNAL **] [Directory:C:/.hunter/_Base/b67e11d/083dd95/9877faf/Install/lib/cmake/Boost]

------------------------------ ERROR -----------------------------
    /error.internal.html
------------------------------------------------------------------

CMake Error at C:/.hunter/_Base/Download/Hunter/0.23.234/b67e11d/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message):
Call Stack (most recent call first):
  C:/.hunter/_Base/Download/Hunter/0.23.234/b67e11d/Unpacked/cmake/modules/hunter_internal_error.cmake:13 (hunter_error_page)
  C:/.hunter/_Base/Download/Hunter/0.23.234/b67e11d/Unpacked/cmake/modules/hunter_assert_not_empty_string.cmake:9 (hunter_internal_error)
  C:/.hunter/_Base/Download/Hunter/0.23.234/b67e11d/Unpacked/cmake/modules/hunter_check_toolchain_definition.cmake:46 (hunter_assert_not_empty_string)
  C:/.hunter/_Base/b67e11d/083dd95/9877faf/Install/lib/cmake/Boost/BoostConfig.cmake:43 (hunter_check_toolchain_definition)
  CMakeLists.txt:15 (find_package)

The CMakeLists.txt looks like follows:

cmake_minimum_required(VERSION 3.2)

set(HUNTER_Boost_COMPONENTS chrono date_time)
set(HUNTER_PACKAGES Boost)
set(HUNTER_Boost_VERSION 1.71.0-p0)

# option(HUNTER_NO_TOOLCHAIN_ID_RECALCULATION "" ON)

include(FetchContent)
FetchContent_Declare(SetupHunter GIT_REPOSITORY https://github.com/cpp-pm/gate)
FetchContent_MakeAvailable(SetupHunter)

project(use-pkg-components)

find_package(Boost CONFIG REQUIRED chrono date_time)

add_executable(use-pkg-components main.cpp)

target_link_libraries(use-pkg-components PRIVATE
    Boost::chrono
    Boost::date_time
)

Interestingly the same basic setup works fine when I manually download & set up HunterGate.cmake:

cmake_minimum_required(VERSION 3.2)

set(HUNTER_Boost_COMPONENTS chrono date_time)
set(HUNTER_PACKAGES Boost)
set(HUNTER_Boost_VERSION 1.71.0-p0)

# option(HUNTER_NO_TOOLCHAIN_ID_RECALCULATION "" ON)

include("cmake/HunterGate.cmake")
HunterGate(
    URL "https://github.com/cpp-pm/hunter/archive/v0.23.234.tar.gz"
    SHA1 "b67e11d7e9ee503e9f6e1b45eb1ef7bf2fb31279"
)

project(use-pkg-components)

hunter_add_package(Boost COMPONENTS chrono date_time)
find_package(Boost CONFIG REQUIRED chrono date_time)

add_executable(use-pkg-components main.cpp)

target_link_libraries(use-pkg-components PRIVATE
    Boost::chrono
    Boost::date_time
)

Any ideas what could be the issue ?
Thanks

support SOURCE_SUBDIR in cmake scheme


zstd has the CMakeLists.txt project file in the subdirectory build/cmake. Add support for the SOURCE_SUBDIR parameter of the ExternalProject_Add cmake command

I suggest to add two functions hunter_source_dir and hunter_get_source_dir() just like hunter_cmake_args and hunter_get_cmake_args

I've already created a dummy project and added it to the cmake_in_subdir branch of my fork

ref: #91

Add OpenCV 4.1.1

OpenCV 4.0.0 package is already there. It will be useful to also add support for 4.1.1.
Trying to figure out how to do it with help from @headupinclouds . Pls. assign the task to me

gate does not find HunterGate.cmake

gate is looking for HunterGate.cmake in the root of the build dir, but it is in _deps/setuphunter-src/cmake/HunterGate.cmake.

  • I've read Brief overview section and do understand basic concepts. Yes
  • I've read F.A.Q. section and there is no solution to my problem there. Yes
  • I've read Code of Conduct, I promise to be polite and will do my best at being constructive. Yes
  • I've read Reporting bugs section carefully. Yes
  • I've checked that all the hunter_add_package/find_package API used by me in the example is the same as in documentation. Did not use them
  • I'm using latest Hunter URL/SHA1. Yes
  • I've created SSCCE reproducing the issue:
# CMakeLists.txt
cmake_minimum_required(VERSION 3.14)

include(FetchContent)
FetchContent_Declare(SetupHunter GIT_REPOSITORY https://github.com/cpp-pm/gate)
FetchContent_MakeAvailable(SetupHunter)

project(foo)
add_executable(foo foo.cpp)

Here is the log until first error reported by Hunter, option HUNTER_STATUS_DEBUG is ON:

I've checked that the first error in logs IS NOT external.build.failed. Yes

  • I'm building on Linux.
  • I'm using system CMake
  • CMake version: <3.14.6>
  • I'm not using toolchain

I'm using the next command line on generate step:

cmake -DHUNTER_ENABLED=YES -DHUNTER_STATUS_DEBUG=ON

Boost 1.72.0-p0 fails on Boost::boost

Reported by @michaeldkroener on PR #113

Getting
Imported target "Boost::boost" includes non-existent path

"/root/.hunter/_Base/503b149/b014198/cbc5d16/Source"

in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

The path was deleted, renamed, or moved to another location.

An install or uninstall procedure did not complete successfully.

The installation package was faulty and references files it does not
provide.

hunter_config(... URL ... SHA1 ...) fails with transitive dependencies

  • I've created SSCCE reproducing the issue:
# CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
include("cmake/HunterGate.cmake")
HunterGate(
  URL "https://github.com/cpp-pm/hunter/archive/v0.23.217.tar.gz"
  SHA1 "4b36c0f8ffc8f3b5718d5e24629fb40c56c99b13"
  LOCAL
)

project(GettingStarted)
hunter_add_package(lehrfempp)
find_package(lehrfempp CONFIG REQUIRED)
add_executable(getting_started main.cc)
target_link_libraries(getting_started LF::lf.base)

# cmake/Hunter/config.cmake
hunter_config(lehrfempp
  URL "https://github.com/craffael/lehrfempp/archive/20bf18775ff80f227abea649a87683b1b3d62399.tar.gz"
  SHA1 "be08de982ad28a55f9512874f832e3718af684a3"
)

Here is the log until first error reported by Hunter, option HUNTER_STATUS_DEBUG is ON:

I've checked that the first error in logs IS NOT external.build.failed. Yes

  • I'm building on Linux

  • I'm using system CMake

  • CMake version: 3.10.2

  • I'm not using toolchain

I'm using the next command line on generate step:

cmake -H. -Bbin

In this testcase I'm including the package lehrfempp. The lehrfempp package in turn depends again on Boost::program_options . If I omit the hunter_config directive, everything works as expected but I don't get the version that I want. If I use the hunter_config directive, hunter seems to download the correct version of lehrfempp but then later on the find_package call fails.

Add python interface to Protobuf

I am in a position where I could do with the Python (as well as the C++) interface included in the hunter version of Protobuf. brew install protobuf includes the python bindings too for example, see here.

I am not an expert in Python so I am not clear on the exact stages to this but I think we have a few options:

  • Bind the url_sha1_cmake and url_sha1_pip generators together somehow to make a nasty Protobuf specific one
  • Patch the protobuf cmake to optionally build and install the python bindings
  • Have a separate pip_protobuf project (I tried this but the pip install needs to have a working directory in the SOURCE/python dir so changes would need to be made to url_sha1_pip.cmake).

I posted this on Gitter too (thought an issue might be better).

Update sqlite3

  • I've read Brief overview section and do understand basic concepts. Yes
  • I've read F.A.Q. section and haven't found an answer to my question. Yes
  • I've read Code of Conduct, I promise to be polite and will do my best at being constructive. Yes(, but the link from the template is dead)

I want to update sqlite to 3.30.1. I see that there is https://github.com/hunter-packages/sqlite3 with cmake additions. This repo has not been taken under the new cpp-pm umbrella as far as I can tell. Would this need to be migrated to the cpp-pm organization or should I create a new PR to the old repo for updating the code?

Moreover as there is an autotools scheme in hunter and sqlite is build using autotools AFAIK, I am wondering if I should attempt to switch this package to a different scheme and ditch the project fork repo for sqlite. I am not sure how to find and trace the original reasons for the fork.

Multiple versions of the same package in a cmake directory tree


Let's say I have the following cmake directory structure & hunter code:

- proj-root-dir/
  - CMakeLists.txt
      # initialize hunter-gate etc. here
      project(my-project)
      add_subdir(app-a)
      add_subdir(app-b)
  - app-a/
    - app-a.cpp
    - CMakeLists.txt
        # TODO: how get ZLIB 1.2.11-p1 via hunter
        ???

        find_package(ZLIB 1.2.11-p1 EXACT CONFIG REQUIRED)

        add_executable(app-a app-a.cpp)
        target_link_libraries(app-a PRIVATE ZLIB::zlib)
  - app-b/
    - app-b.cpp
    - CMakeLists.txt
        # TODO: how get ZLIB 1.2.8-hunter via hunter
        ???

        find_package(ZLIB 1.2.8-hunter EXACT CONFIG REQUIRED)

        add_executable(app-b app-b.cpp)
        target_link_libraries(app-b PRIVATE ZLIB::zlib)

There are two different versions of ZLIB used in the same cmake project, which is not possible with hunter ?! Am I getting this right ?
What are ways to do this, i.e. have different versions of the same package being used by multiple different cmake-targets under the same cmake-project ?

Thanks

Private package repositories & general package publishing workflow


Hi. I have started to experiment with hunter some days ago and I really like the general concept of it being implemented completely in CMake without any dependencies. Not having to introduce yet another tool/technology into someone's tool stack is always a big plus in my opinion 😊.

My current understanding is, that if someone wants to publish a new package or a new version of a package, this always requires modification of the hunter source code in cmake/projects/mypkg/hunter.cmake and cmake/configs/default.cmake (see: https://docs.hunter.sh/en/latest/creating-new/create/cmake.html)
Or in other words, the package repository manifest is currently baked into the package manager source code, so to publish a new/updated package always also requires all users to also update their package manager version (i.e. via HunterGate, SHA etc.)

While I can see in the documentation that there went some thought into this, I still find it odd that this is the default workflow for creating/updating packages. And also this might be one of the major factors that already might limit the adoption of hunter for more widespread use in the community.
If you compare this to other package management ecosystems this is a very heavily moderated and slow process, whereas in npm/nuget/etc. someone can just go ahead, register a new account and be publishing numerous packages within minutes.

The second, but closely related point that I'd like to bring up is hosting / using of private package collections. In a private workspace it is even more likely that the frequency in which packages are updated is even higher than for public ones. But also in this scenario an update to a single package always requires each of the consumers to download & cache the entire hunter-vX.Y.Z.tar.gz (currently ~4mb according to the latest release), and this is only for the build system to know that there actually ARE packages that have updates.

I am currently digging & hacking through the hunter / hunter-gate sources to try and find my own "clever" workarounds to make hunter more interactive / agile, but by posting this here I'd like to know thoughts of other hunter users / the maintainers on those topics.

I really love the idea of having just CMake and being able to use packages without any other tool (like conan, vcpkg, etc.) ... but for serious day-to-day use I think this general design needs some rethinking.

What are your thoughts ?

Use github actions for CI


Use github actions to integrate CI in this repo.
The benefits of doing this:

  1. path filters - CI will be triggered on changes to specific files/dirs, so push to PR-X triggers build for one package
  2. all major OS are supported - mac, linux, windows
  3. completely free for opensource repos
  4. no need to maintain a separate repo with branch-per-project-ci

Enabling Werror=dev for packages

I have set(CMAKE_CXX_VISIBILITY_PRESET hidden) set in my toolchain. The cmake policy CMP0063 governs a change around this property:

CMake Warning (dev) at src/CMakeLists.txt:15 (add_library):
  Policy CMP0063 is not set: Honor visibility properties for all target
  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "benchmark" of type "STATIC_LIBRARY" has the following visibility
  properties set for CXX:

    CXX_VISIBILITY_PRESET
    VISIBILITY_INLINES_HIDDEN

  For compatibility CMake is not honoring them for this target.
This warning is for project developers.  Use -Wno-dev to suppress it.

This can be seen when compiling some of my dependencies during the configuration phase. I have set the corresponding cmake policy in the toolchain now. Alas, whenever the main CMakeLists.txt of the dependency has cmake_minimum_required with version < 3.3, the change is not propagated out of the toolchain to the project.

Instead of just continuing the configuration, I would like to enable -Werror=dev to detect this early on. This works when the policy is warned for in the actual project. It does not propagate to the compiled dependencies in hunter, though.

Is there such an option available or would there by interest in having this available?

Improving CI for new packages and updates

The current state of the world for CI in Hunter is as follows:

  • PRs against the proper hunter repo only run CI related to the docs
  • Per-package CI exists, but is complicated. The instructions are detailed here, but the general idea is that there is a fork of hunter that has a branch per-package, and the only relevant files on each branch are the Travis/Appveyor files, to be able to run tests for that specific package on that branch
  • It is acceptable for packages to not build on certain platforms and still be accepted. The relevant builds in the build matrix for that package just end up getting commented out on the testing branch
  • Someone has to go and create the testing branch for new packages before they can run tests
  • For both new and existing packages, PRs against hunter proper must include links to passing Travis/Appveyor builds in the description, on a branch that has the testing branch merged into the feature branch, such that it runs the package's tests against the feature's changes. Someone then has to go and look at the builds to make sure the setup is correct, and that they passed

A new approach that should streamline how we test packages:

  • Every package has a testing table, that specifies which builds that package is blacklisted for. The set of all possible builds comes from the Travis and AppVeyor testing table. A package's blacklist can be empty, indicating it passes all builds. This blacklist can possibly be a YML file in the cmake/projects/ folder
  • For any pull request against hunter, in CI we identify the changed files in the PR. For any changes to cmake/projects/ or examples/, the package(s) being changed is noted. The list of packages being changed in a given PR can be empty (ie. changes to core Hunter only), but will generally be length 1.
  • For every Travis/AppVeyor build in the build matrix, for every package in the changed packages list, we build the package on that platform. If no packages are changed, we exit immediately.
  • To prevent builds that last for hours, we can possibly limit how many packages can be changed in a given PR - such that changes to large sets of packages need to be split into smaller PRs. However, the build times per package per platform are generally quite fast.

Summary:
We would no longer have to use ingenue/hunter, and instead would run CI for the packages being changed directly on the PR against hunter proper

Add hdf5 package

  • I'm interested in adding package hdf5 to hunter. It is a C++/Fortran/Java library to interact with hdf / h5 files. HDF5 is a standard hierarchical data file format commonly used to store raw sensor data as well as metadata.
  • Here is the official site of the lib: https://www.hdfgroup.org/solutions/hdf5/
  • Used build system: [CMake] (built it with polly)

Only two dependencies were required ZLIB & szip, both on hunter (hence the hunterisation):


Update protobuf to 3.10.0


I would like to update Protobuf to the latest. It had a hunter-package version so that will need rebasing. Please could someone fork the old one with a branch pointing to https://github.com/protocolbuffers/protobuf/releases/tag/v3.10.0 and I will rebase the hunterization patches and test them.

Make nlohmann_json use header only download


This was mentioned in a discussion somewhere. Maybe nlohmann_json, rather than downloading the whole repo, which is large, should download just the header (which is KBs) instead?

Update "mysql-client" help-wanted/needed

Some interesting links

Main problem:

  • Old version on package repository.
  • But also cannot be built on:
    Os Linux osboxes 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux
    GCC: 8.3.0 (Debian 8.3.0-6)
    cmake : 3.13.4

Error is :

[ 65%] Building C object mysys/CMakeFiles/mysys.dir/my_lib.c.o
/home/cybermomo/cmangos/hunter/_Base/e998928/688591e/4b09d2b/Build/MySQL-client/Source/mysys/my_lib.c: In function ‘my_dir’:
/home/cybermomo/cmangos/hunter/_Base/e998928/688591e/4b09d2b/Build/MySQL-client/Source/mysys/my_lib.c:127:3: error: ‘readdir_r’ is deprecated [-Werror=deprecated-declarations]
   while (!(READDIR(dirp,(struct dirent*) dirent_tmp,dp)))
   ^~~~~
In file included from /usr/include/features.h:424,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from /home/cybermomo/cmangos/hunter/_Base/e998928/688591e/4b09d2b/Build/MySQL-client/Source/include/my_global.h:41,
                 from /home/cybermomo/cmangos/hunter/_Base/e998928/688591e/4b09d2b/Build/MySQL-client/Source/mysys/mysys_priv.h:19,
                 from /home/cybermomo/cmangos/hunter/_Base/e998928/688591e/4b09d2b/Build/MySQL-client/Source/mysys/my_lib.c:19:
/usr/include/dirent.h:189:12: note: declared here
 extern int __REDIRECT (readdir_r,
            ^~~~~~~~~~
cc1: all warnings being treated as errors
  • Tested :
hunter_config(MySQL-client VERSION 6.1.9-p1 CMAKE_ARGS CMAKE_CXX_FLAGS=-Wno-error=deprecated-declarations)

without success (look like the flag is discarded somewhere)

Decouple download and build

I'd like to promote the original issue/feature request https://github.com/ruslo/hunter/issues/1807

from the original issue:


https://github.com/ruslo/hunter/blob/v0.23.151/cmake/schemes/url_sha1_cmake.cmake.in#L142-L163

Lock Download and /.../Install directories separately.

If this feature is implemented, it will be possible if you have multiple different local CMake projects:

# CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
include(cmake/HunterGate.cmake)
HunterGate(URL ... SHA1 ...)
project(downloader)
hunter_add_package(${REQUESTED_PACKAGE})

In different terminals:

> cmake -H. -B_builds/package-1 -DREQUESTED_PACKAGE=package-1
> cmake -H. -B_builds/package-2 -DREQUESTED_PACKAGE=package-2
> cmake -H. -B_builds/package-3 -DREQUESTED_PACKAGE=package-3
> cmake -H. -B_builds/package-4 -DREQUESTED_PACKAGE=package-4
> ...

CURL fails to build on macOS 10.15.2

  • I've read Brief overview section and do understand basic concepts. [Yes]
  • I've read F.A.Q. section and there is no solution to my problem there. [Yes]
  • I've read Code of Conduct, I promise to be polite and will do my best at being constructive. [Yes]
  • I've read Reporting bugs section carefully. [Yes]
  • I've checked that all the hunter_add_package/find_package API used by me in the example is the same as in documentation. [Yes]
  • I'm using latest Hunter URL/SHA1. [Yes]
  • I've created SSCCE reproducing the issue:
# CMakeLists.txt

cmake_minimum_required(VERSION 3.2)

include(cmake/HunterGate.cmake)
HunterGate(
    URL "https://github.com/cpp-pm/hunter/archive/v0.23.240.tar.gz"
    SHA1 "ca19f3769e6c80cfdd19d8b12ba5102c27b074e0"
    LOCAL
)

project(hunter-curl
    VERSION 1.0.0
    LANGUAGES CXX
)

hunter_add_package(CURL)
find_package(CURL CONFIG REQUIRED)

Here is the log until first error reported by Hunter, option HUNTER_STATUS_DEBUG is ON:

I've checked that the first error in logs IS NOT external.build.failed. [Yes]

  • I'm building on macOS 10.15.2 (Catalina).
  • I'm using cmake from homebrew
  • CMake version: 3.16.2
  • Xcode version: 11.3
  • I'm not using toolchain

I'm using the next command line on generate step:

cmake -H. -Bbuild -GXcode -DHUNTER_STATUS_DEBUG=true

Additional Information

  • I have been building CURL successfully on macOS 10.15 previously. After some while and a few updates on macOS, cmake & hunter the build has started failing. I can not say for sure what caused it.
  • I've been doing some research on the issue. During configuration cmake tries to link a test-library against -lsocket, which does not exist on macOS because socket-interfaces are part of libc. This might be a hint that the build is not configured correctly for macOS. Output from CMakeError.log: https://pastebin.com/41JAVN2V
  • It would be very helpful to have someone else reproduce the issue.
  • Rolling back to an older version of CURL (7.60.0-p0) does not help.
  • Rolling back to an older version of cmake (3.15.5) does not help.
  • Rolling back to an older version of macOS or XCode is not possible.
  • I've not yet tried to build CURL from the official upstream, to check if it is an issue with the CURL project. Let me know if that would be helpful.

Add "SPIRV-Tools" package

  • Used build system: CMake

Hunter instances wait for each other

I'm using a shared HUNTER_ROOT directory for concurrent CI builds. The configurations have the same hunter-version, but different compiler or compiler flags therefore a different generated hunter-toolchain file and sha1. They should be able to work concurrently, but only one of the concurrent cmake projects is actually compiling a hunter package, all other instances are waiting for the former

The build folder should be locked per toolchain, not per hunter-version

Version says 0.19 in hunter docs

  • I've read Brief overview section and do understand basic concepts. [Yes]
  • I've read F.A.Q. section and there is no solution to my problem there. [Yes]
  • I've read Code of Conduct, I promise to be polite and will do my best at being constructive. [Yes]
  • I've read Reporting bugs section carefully. [Yes]
  • I've checked that all the hunter_add_package/find_package API used by me in the example is the same as in documentation. [Yes]
  • I'm using latest Hunter URL/SHA1. [Yes]

The hunter docs say version 0.19 (e.g. in titlebar) see here.

The value is defined in docs/conf.py. Is there any way to get it to pick the version from the git tag or something?

hunter_venv changes CMAKE_FIND_FRAMEWORK unnecessarily

  • I've read Brief overview section and do understand basic concepts. [Yes]
  • I've read F.A.Q. section and there is no solution to my problem there. [Yes]
  • I've read Code of Conduct, I promise to be polite and will do my best at being constructive. [Yes]
  • I've read Reporting bugs section carefully. [Yes]
  • I've checked that all the hunter_add_package/find_package API used by me in the example is the same as in documentation. [Yes]
  • I'm using latest Hunter URL/SHA1. [Yes]
# CMakeLists.txt

cmake_minimum_required(VERSION 3.15)

include("cmake/HunterGate.cmake")
HunterGate(
    URL "..."
    SHA1 "..."
)

project(foo)

hunter_add_package(hunter_venv)
find_package(hunter_venv CONFIG REQUIRED)

# Fails as CMAKE_FIND_FRAMEWORK set to NEVER
find_library(ACCEL Accelerate)
  • I'm building on [OSX].
  • [I'm using official CMake release]
  • CMake version: <3.16.2>

Since cmake 3.15 a new option has been available Python_FIND_VIRTUALENV, which avoids the need to change the macOS global CMake setting CMAKE_FIND_FRAMEWORK and the Windows Python_FIND_REGISTRY (which is at least Python specific so probably OK).

I will need a hunter-packages for hunter_venv to make an update to it something like the following:

if (version is >= 3.15)
  set(Python_FIND_VIRTUALENV ONLY)
else()
  set(CMAKE_FIND_FRAMEWORK NEVER)
  set(Python_FIND_REGISTRY NEVER)
endif()

Unexpected empty string with FetchContent-method

I'm getting the error Unexpected empty string, originating from

hunter_assert_not_empty_string("${HUNTER_CONFIGURATION_TYPES}")
. It works when I set HUNTER_CONFIGURATION_TYPES manually.

I do not get an error if I use the manual method.

  • I've created SSCCE reproducing the issue:
# CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
set(HUNTER_PACKAGES PocoCpp)
include(FetchContent)
FetchContent_Declare(SetupHunter GIT_REPOSITORY https://github.com/cpp-pm/gate)
FetchContent_MakeAvailable(SetupHunter)

project(foo)
find_package(Poco REQUIRED Foundation CONFIG)

Here is the log until first error reported by Hunter, option HUNTER_STATUS_DEBUG is ON:

I've checked that the first error in logs IS NOT external.build.failed. Yes

  • I'm building on Linux.
  • I'm using system CMake
  • CMake version: <3.14.6>
  • I'm not using toolchain

I'm using the next command line on generate step:

cmake -DHUNTER_STATUS_DEBUG=ON

Add "shaderc" package

  • Used build system: CMake

Disable Hunter per default


set the default for HUNTER_ENABLED to OFF

when using Hunter in a project I always disable it. When I open the project in my IDE (QtCreator, vscode) the first time the default cmake-configurations are used, which also includes Hunter. So even if I don't want to use Hunter I have to wait for Hunter to provide me with all dependencies, just to say no thank you afterwards

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.