-
Notifications
You must be signed in to change notification settings - Fork 5
Fix -DHUNTER_ENABLED=0 builds #3
base: master
Are you sure you want to change the base?
Changes from all commits
0cfd35e
8132cfe
f6e6a9e
875f0fc
df918fe
3e13da5
91f0249
566f363
8b40b2a
81852fe
c5b7aa5
b11c2cd
ee3c238
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,19 +113,24 @@ if(HUNTER_ENABLED) | |
hunter_add_package(Protobuf) | ||
find_package(Protobuf ${hunter_config} REQUIRED) | ||
list(APPEND package_deps Protobuf) | ||
set(protoc_exe protobuf::protoc) | ||
else() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So how do we generate the messages? How do we connect to backend at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You will have seen the answer to that further down, guessing this is outdated. It's just a change in how the IDL is compiled by cmake. |
||
find_program(protoc_exe protoc) | ||
if(NOT protoc_exe) | ||
message(FATAL_ERROR | ||
"Cannot find protoc executable, please install Protobuf") | ||
endif() | ||
endif() | ||
|
||
hunter_add_package(protobuf-c) | ||
find_package(protobuf-c ${hunter_config} REQUIRED) | ||
list(APPEND package_deps protobuf-c) | ||
|
||
if(TARGET protobuf-c::protoc-gen-c AND TARGET protobuf::protoc) | ||
message(STATUS "using protoc and protoc-gen-c") | ||
set(protoc_exe $<TARGET_FILE:protobuf::protoc>) | ||
set(protoc_plugin_arg --plugin=$<TARGET_FILE:protobuf-c::protoc-gen-c>) | ||
elseif(TARGET protobuf-c::protoc-c) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can fix this issue by using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's what I did in an earlier revision, but there turns out to be no point. protobuf-c 1.3 adds It's silly that Hunter doesn't expose a |
||
# 1.2-style protoc-c | ||
# the CMake files don't report the version properly | ||
message(FATAL_ERROR "could only find protoc-c not protoc-gen-c; you must have protobuf 1.2 or older, which is not supported") | ||
else() | ||
message(FATAL_ERROR "neither protoc and protoc-gen-c, nor the standalone protoc-c, were found") | ||
endif() | ||
|
||
option(JAEGERTRACINGC_USE_PCG "Use pcg random number generation" ON) | ||
if(JAEGERTRACINGC_USE_PCG) | ||
hunter_add_package(pcg) | ||
|
@@ -206,16 +211,17 @@ function(generate_protobuf_c gen_src) | |
set(protoc_out_files | ||
"${generated_src_dir}/protoc-gen/${component}.pb-c.h" | ||
"${generated_src_dir}/protoc-gen/${component}.pb-c.c") | ||
add_custom_command( | ||
OUTPUT ${protoc_out_files} | ||
COMMAND ${protoc_exe} | ||
ARGS --plugin=$<TARGET_FILE:protobuf-c::protoc-gen-c> | ||
--c_out "${generated_src_dir}/protoc-gen" | ||
-I. "${component}.proto" | ||
WORKING_DIRECTORY ${dir} | ||
MAIN_DEPENDENCY ${proto_src} | ||
VERBATIM | ||
USES_TERMINAL) | ||
|
||
add_custom_command( | ||
OUTPUT ${protoc_out_files} | ||
COMMAND ${protoc_exe} | ||
ARGS ${protoc_plugin_arg} | ||
--c_out "${generated_src_dir}/protoc-gen" | ||
-I. "${component}.proto" | ||
WORKING_DIRECTORY ${dir} | ||
MAIN_DEPENDENCY ${proto_src} | ||
VERBATIM | ||
USES_TERMINAL) | ||
list(APPEND out_files ${protoc_out_files}) | ||
endforeach() | ||
set(${gen_src} ${out_files} PARENT_SCOPE) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,72 @@ | |
|
||
## Install | ||
|
||
Install the project library dependencies. On Debian, the following command | ||
should work. | ||
By default the client build will fetch all dependencies from the Hunter | ||
build dependency system. Only cmake must be installed. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
``` | ||
sudo apt install libhttp-parser-dev libjansson-dev protobuf-c-compiler \ | ||
libprotobuf-c-dev | ||
``` | ||
This builds a static library which must be linked into the application | ||
along with all its dependencies. The simplest way to do that is to use | ||
Hunter to find it in your own application's CMakeLists.txt. | ||
|
||
Run `git submodule update --init` to fetch the submodules. | ||
git submodule update --init | ||
mkdir -p build | ||
cd build | ||
cmake .. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just minor suggestion: |
||
make -s | ||
make -s test | ||
make -s install | ||
|
||
## Install (manual dependencies) | ||
|
||
If you don't want to use Hunter or you can't you'll want to use local | ||
dependencies. This will be the case if you need offline builds, are building | ||
for packages that must be reproducible, or aren't using cmake in your own | ||
application's builds. | ||
|
||
Hunter may be disabled with | ||
|
||
cmake -DHUNTER_ENABLED=0 -DJAEGERTRACINGC_USE_PCG=0 | ||
|
||
in which case local library dependencies must be installed: | ||
|
||
* protobuf | ||
https://developers.google.com/protocol-buffers/ | ||
* protobuf-c >= 1.3.0 | ||
https://github.com/protobuf-c/protobuf-c | ||
* libhttp-parser | ||
https://github.com/nodejs/http-parser | ||
* libjansson-dev | ||
https://github.com/akheron/jansson | ||
* OpenTracing C API | ||
https://github.com/opentracing/opentracing-c | ||
(in `third_party/opentracing-c/`) | ||
|
||
Run `git submodule update --init` to fetch submodules for IDL and testing. | ||
|
||
Most systems do not package protobuf-c 1.3.0, so a source install or backported | ||
packages will be required. | ||
|
||
### Dependencies (Debian/Ubuntu) | ||
|
||
Install avilable dependencies with: | ||
|
||
sudo apt install libhttp-parser-dev libjansson-dev | ||
|
||
# For protocol buffers 3.3, Ubuntu only: | ||
sudo add-apt-repository ppa:maarten-fonville/protobuf | ||
sudo apt-get update | ||
sudo apt-get install libprotobuf-dev protobuf-compiler | ||
|
||
The packages `protobuf-c-compiler` and `libprotobuf-c-dev`, if available, will | ||
be too old and must be installed from source or a backports repository. | ||
|
||
### Dependencies (Fedora) | ||
|
||
On Fedora 28: | ||
|
||
sudo dnf install jansson-devel http-parser-devel \ | ||
protobuf-c-devel protobuf-c-compiler | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! I haven't tested |
||
On older Fedora releases, RHEL, and CentOS, protobuf-c-devel | ||
protobuf-c-compiler are too old and must be installed from source, custom | ||
packages, or a backport repository instead. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :) excellent! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
# | ||
# and the following imported targets:: | ||
# | ||
# Jansson::Jansson - The Jansson library | ||
# jansson::jansson - The Jansson library | ||
# | ||
# Based on https://cmake.org/cmake/help/v3.10/manual/cmake-developer.7.html#a-sample-find-module | ||
|
||
|
@@ -55,9 +55,9 @@ if(JANSSON_FOUND) | |
set(JANSSON_DEFINITIONS ${PC_JANSSON_CFLAGS_OTHER}) | ||
endif() | ||
|
||
if(JANSSON_FOUND AND NOT TARGET Jansson::Jansson) | ||
add_library(Jansson::Jansson UNKNOWN IMPORTED) | ||
set_target_properties(Jansson::Jansson PROPERTIES | ||
if(JANSSON_FOUND AND NOT TARGET jansson::jansson) | ||
add_library(jansson::jansson UNKNOWN IMPORTED) | ||
set_target_properties(jansson::jansson PROPERTIES | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fantastic! The casing can be annoying, but that seems to be the correct fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very. CMake could at least offer a "hint" message of some kind. "Target Jansson::Jansson not found (but there's a jansson::jansson, did you mean that?" |
||
IMPORTED_LOCATION "${JANSSON_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${PC_JANSSON_CFLAGS_OTHER}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${JANSSON_INCLUDE_DIR}") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this is for your own testing. In practice, we can add an additional matrix entry (probably one will suffice) that will test
HUNTER_ENABLED=0
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but actually I don't see the benefit of the build matrix being so dense for all builds. Unless you're chasing a very specific compiler bug of regression it seems oddly broad. Much more useful to add an osx target at some point instead.