-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Provide a way to disable hunter. #219
Comments
This is definitely possible, but I think this is bad idea. How is going to maintain it? |
Well, I was in a try to create a gentoo ebuild for ethminer and hunter got into my way. |
You can disable Hunter with You probably will end up with code like:
|
I agree, it does sound that I'll have to previously patch the cmake files, would it be accepted upstream any cmake changes that turns up from the work on the ebuild? Portage can keep it side by side, but better if there is no patch at all in that side. Thanks! |
Since final result is executable and by default Hunter build static libraries there will be no "own built libraries". |
Well, if you consider the size of the binary and the build time, sorry, it's still not making it. |
Yes, it's true. I'm just saying that
Something like this at the end: if(HUNTER_ENABLED)
set(curl_config "CONFIG")
else()
set(curl_config "")
endif()
hunter_add_package(CURL)
find_package(CURL ${curl_config} REQUIRED)
if(HUNTER_ENABLED)
target_link_libraries(... PUBLIC CURL::libcurl)
else()
target_include_directories(... PUBLIC ${CURL_INCLUDE_DIRS})
target_link_libraries(... PUBLIC ${CURL_LIBRARIES})
endif() Related docs: |
That seems more accurate, I'll give it a try when I get some cycles. Thanks ruslo! |
I think I found a way to encapsulate it even more. When Hunter is disabled we add extra path to if(NOT HUNTER_ENABLED)
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Hunter/disabled-mode")
endif() Note: this one can be added as a part of HunterGate functionality And put fake # cmake/Hunter/disabled-mode/CURLConfig.cmake
if(TARGET CURL::libcurl)
return()
endif()
find_package(CURL MODULE REQUIRED)
add_library(CURL::libcurl UNKNOWN IMPORTED)
set_target_properties(
CURL::libcurl
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}"
IMPORTED_LOCATION "${CURL_LIBRARIES}"
) In this case CMakeLists.txt will not change at all: hunter_add_package(CURL)
find_package(CURL CONFIG REQUIRED)
targe_link_libraries(... PUBLIC CURL::libcurl) When
When
Since it may be useful for other projects I can create separate repository for |
Looks awesome. |
ruslo can correct me but I think from your side is fair enough to add the following snippet to
|
See hunter-packages/disabled-mode#1
There is no need to add them to Hunter release because they designed to be used without Hunter. In theory I guess they can be managed as Hunter package but it's sounds too hairy: I think user have to decide how
No, just a tiny submodule. In general if you're not Hunter developer you never should clone this repository. |
I see: |
HunterGate and CURL are ready: |
FYI sed -r -i \
-e '/hunter_add_package\(.*\)/d' \
-e 's/(find_package\(.*) CONFIG (.*\))/\1 \2/' \
libethash-cl/CMakeLists.txt \
CMakeLists.txt || die
sed -r -i \
-e '1s/^/set\(CMAKE_CXX_STANDARD 14\)\n\n/' \
-e 's/include(\(HunterGate\))/function\1\nendfunction\(\)/' \
-e '/find_package\(libjson-rpc-cpp.*\)/d' \
-e '/find_package\(PythonInterp\)/d' \
-e '/include\(EthCompilerSettings\)/d' \
CMakeLists.txt || die
sed -r -i \
-e 's/libjson-rpc-cpp\:\:client/jsoncpp jsonrpccpp\-client jsonrpccpp\-common/' \
ethminer/CMakeLists.txt || die
sed -r -i \
-e '1s/^/include_directories\(\/usr\/include\/jsoncpp\)\n\n/' \
ethminer/CMakeLists.txt \
libstratum/CMakeLists.txt || die
sed -r -i \
-e 's/(jsoncpp)_lib_static/\1 devcore/' \
libstratum/CMakeLists.txt || die This is from https://gpo.zugaina.org/AJAX/Ebuild/31566206/View All in all, I would really appreciate the option to disable the hunter requirement. |
Wonderful, the ebuild worked for me as well, thanks for reporting. It's not elegant so far to hack |
Fixed by #229 |
Could we also add some documentation on how to disable it? If you enable hunter, you are probably running into ruslo/hunter#423 as well. Is it worth opening another bug here? |
It's a known issue and actually there is a pending pull request with fix: However it seems that author of pull request abandon it. I can finish it but I need someone to test the fix. I don't have Gentoo and not planning to install one. |
I'm happy to test it for you, I'd like to see some day that we simply cmake .. -DHUNTER_ENABLED=OFF |
@PikkuJose I think @ruslo was talking about testing ruslo/hunter#874 and not testing a toggle to disable hunter for ethminer. I think we should move the discussion about ruslo/hunter#874 to ruslo/hunter#874 and talk only about the toggle to disable hunter for ethminer here. Otherwise it will get confusing here. |
@PikkuJose We are talking about different things I think. There is a patch that will fix Boost on Gentoo and will make possible to build ethminer with Hunter on Gentoo. That what I asking to test. |
Yes, agreed, it was a different thing I misunderstood. Getting back to the switch, the stubs are still CMake Error at CMakeLists.txt:113 (find_package):
Add the installation prefix of "Boost" to CMAKE_PREFIX_PATH or set I'm happy to work on it when I get some cycles. But I let you know if you have more availability. |
@PikkuJose check that you have latest version with my commit where "disabled-mode" introduced, also check you have submodule initialized: |
How about to add
to main CMakeLists.txt? I consider this approach more reliable. |
I agree. Disabling hunter by adding a hunter module does not sound very resilient. So far I haven't been able to successfully (and reliably) disable hunter despite all the hints provided here. |
You don't need to add HunterGate to disable Hunter. We already have HunterGate in code. As I already said it will do almost nothing if |
@ruslo don't get me wrong, I like the idea of hunter. This way people without the proper background can easily build ethminer without anything else. I also don't mind that it's enabled by default. But from a perspective of an advanced developer or even a package maintainer for a distribution (like reagentoo), it really should be as simple as possible. The more complexity a build process does have (which is introduced by hunter) the more likely it will fail at some point in the future. So having hunter as a dependency to disable hunter, is exactly why it's less resilient in the long run. |
Add
I don't understand what you mean by this. Please explain it in details, I think there is huge misunderstanding about how everything is chained together. |
To ensure it's easier to integrate with any distribution it would be great to be able
to disable hunter and build against the system libraries, leaving the package handling
to the underlaying operative system, meanwhile building with it for the ones that
want upstream support.
The text was updated successfully, but these errors were encountered: