Skip to content

Commit

Permalink
Merge pull request #41 from lightstep/jmacd/no_proto_dir
Browse files Browse the repository at this point in the history
Fix build for $(builddir) != $(srcdir); Have `make distcheck` run the tests on the release .tar.gz
  • Loading branch information
jmacd authored Feb 14, 2017
2 parents 6d2cc31 + 7e9ec66 commit 1693c69
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 46 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ stamp-h1
tracer_test
cppclient
flushproto_test
*.pb.h
*.pb.cc
*.stamp
test-driver
*.log
*.trs
1 change: 0 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# In case this source is being cross-compiled.
make maintainer-clean 2> /dev/null
rm -rf autom4te.cache 2> /dev/null
rm -rf vendor/cpp-netlib/build

LIBTOOLIZE=libtoolize
if [ `uname` = 'Darwin' ]; then
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# by homebrew, see the commands to set PKG_CONFIG_PATH in build.sh.

AC_PREREQ([2.69])
AC_INIT([lightstep-tracer-cpp], [0.34],
AC_INIT([lightstep-tracer-cpp], [0.35],
[https://github.com/lightstep/lightstep-tracer-cpp/issues])
LT_INIT([disable-shared])
AM_INIT_AUTOMAKE([1.14 foreign subdir-objects])
Expand Down
68 changes: 32 additions & 36 deletions src/c++11/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,28 @@ PROTOC = @PROTOC@
.PHONY: $(PROTOC)

# Lightstep Collector reporting:
COLLECTOR_SRC = $(top_srcdir)/lightstep-tracer-common
ENVOY_SRC = ./envoy
PROTO_DIR = ./proto
collector_srcdir = $(top_srcdir)/lightstep-tracer-common

PROTO_SRC = \
$(COLLECTOR_SRC)/collector.proto \
$(ENVOY_SRC)/envoy_carrier.proto
$(collector_srcdir)/collector.proto \
$(srcdir)/envoy_carrier.proto

PROTO_GEN = \
lightstep/collector.pb.h \
lightstep/envoy_carrier.pb.h \
$(PROTO_DIR)/collector.pb.cc \
$(PROTO_DIR)/envoy_carrier.pb.cc
collector.pb.h \
collector.pb.cc \
envoy_carrier.pb.h \
envoy_carrier.pb.cc

$(PROTO_DIR).stamp: $(PROTO_SRC)
mkdir -p $(PROTO_DIR)
$(PROTOC) --proto_path=$(COLLECTOR_SRC) --cpp_out=$(PROTO_DIR) $(COLLECTOR_SRC)/collector.proto
$(PROTOC) --proto_path=$(ENVOY_SRC) --cpp_out=$(PROTO_DIR) $(ENVOY_SRC)/envoy_carrier.proto
mv $(PROTO_DIR)/*.h lightstep
touch $(PROTO_DIR).stamp
proto.stamp: $(PROTO_SRC)
$(PROTOC) --proto_path=$(collector_srcdir) --cpp_out=$(builddir) $(collector_srcdir)/collector.proto
$(PROTOC) --proto_path=$(srcdir) --cpp_out=$(builddir) $(srcdir)/envoy_carrier.proto
touch proto.stamp

$(PROTO_GEN): $(PROTO_DIR).stamp
$(PROTO_GEN): proto.stamp

# Tell Automake that these files have to be generated first (also cleaned)
BUILT_SOURCES = $(PROTO_GEN)
CLEANFILES = $(PROTO_GEN)
CLEANFILES = $(PROTO_GEN) proto.stamp

# Lightstep Tracer core library
lib_LTLIBRARIES = liblightstep_core_cxx11.la
Expand All @@ -57,26 +53,26 @@ liblightstep_core_cxx11_la_SOURCES = \
util.cc

nobase_nodist_include_HEADERS = \
lightstep/collector.pb.h \
lightstep/envoy_carrier.pb.h
collector.pb.h \
envoy_carrier.pb.h

nodist_liblightstep_core_cxx11_la_SOURCES = \
$(PROTO_DIR)/collector.pb.cc \
$(PROTO_DIR)/envoy_carrier.pb.cc
collector.pb.cc \
envoy_carrier.pb.cc

# Note: To set the protobuf library include and library flags, e.g.,
#
# ./configure protobuf_CFLAGS="..." protobuf_LIBS="..."
liblightstep_core_cxx11_la_LIBADD =
liblightstep_core_cxx11_la_CXXFLAGS = $(AM_CXXFLAGS) $(protobuf_CFLAGS) -I$(srcdir)/lightstep
liblightstep_core_cxx11_la_CXXFLAGS = $(AM_CXXFLAGS) $(protobuf_CFLAGS) -I$(builddir)
liblightstep_core_cxx11_la_LDFLAGS = $(protobuf_LIBS)

# Options
AM_CXXFLAGS = -Wno-deprecated-declarations

EXTRA_DIST = \
mapbox_variant/LICENSE \
envoy/envoy_carrier.proto
envoy_carrier.proto

# The builtin gRPC transport is built by default. When supplying your
# own gRPC transport, you can disable the built-in recorder:
Expand All @@ -85,24 +81,24 @@ EXTRA_DIST = \
if ENABLE_GRPC

GRPC_PROTO_SRC = \
$(COLLECTOR_SRC)/collector.proto
$(collector_srcdir)/collector.proto

GRPC_PROTO_GEN = \
lightstep/collector.grpc.pb.h \
$(PROTO_DIR)/collector.grpc.pb.cc
collector.grpc.pb.h \
collector.grpc.pb.cc

BUILT_SOURCES += $(GRPC_PROTO_GEN)
CLEANFILES += $(GRPC_PROTO_GEN)
CLEANFILES += $(GRPC_PROTO_GEN) proto.grpc.stamp

# TODO make grpc_cpp_plugin a configure option
#
$(PROTO_DIR).grpc.stamp: $(GRPC_PROTO_SRC)
mkdir -p $(PROTO_DIR)
$(PROTOC) --proto_path=$(COLLECTOR_SRC) --grpc_out=$(PROTO_DIR) --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` $(COLLECTOR_SRC)/collector.proto
mv $(PROTO_DIR)/*.h lightstep
touch $(PROTO_DIR).grpc.stamp
proto.grpc.stamp: $(GRPC_PROTO_SRC)
$(PROTOC) --proto_path=$(collector_srcdir) --grpc_out=$(builddir) \
--plugin=protoc-gen-grpc=`which grpc_cpp_plugin` \
$(collector_srcdir)/collector.proto
touch proto.grpc.stamp

$(GRPC_PROTO_GEN): $(PROTO_DIR).grpc.stamp
$(GRPC_PROTO_GEN): proto.grpc.stamp

# LightStep gRPC recorder library
lib_LTLIBRARIES += liblightstep_grpc_cxx11.la
Expand All @@ -111,15 +107,15 @@ liblightstep_grpc_cxx11_la_SOURCES = \
recorder.cc

nobase_nodist_include_HEADERS += \
lightstep/collector.grpc.pb.h
collector.grpc.pb.h

nodist_liblightstep_grpc_cxx11_la_SOURCES = \
$(PROTO_DIR)/collector.grpc.pb.cc
collector.grpc.pb.cc

# Note $(grpc_LIBS)++ shenanigans. The grpc C++ pkg-config input (grpc++.pc) uses
# characters that are invalid to autoconf, so we can't find it. Instead, we locate
# the C library and tack on a '++'.
liblightstep_grpc_cxx11_la_LIBADD = liblightstep_core_cxx11.la
liblightstep_grpc_cxx11_la_CXXFLAGS = $(AM_CXXFLAGS) $(grpc_CFLAGS) $(protobuf_CFLAGS) -I$(srcdir)/lightstep
liblightstep_grpc_cxx11_la_CXXFLAGS = $(AM_CXXFLAGS) $(grpc_CFLAGS) $(protobuf_CFLAGS) -I$(builddir)
liblightstep_grpc_cxx11_la_LDFLAGS = $(protobuf_LIBS) $(grpc_LIBS)++
endif
File renamed without changes.
2 changes: 1 addition & 1 deletion src/c++11/lightstep/envoy.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef __LIGHTSTEP_ENVOY_H__
#define __LIGHTSTEP_ENVOY_H__

#include "lightstep/envoy_carrier.pb.h"
#include "envoy_carrier.pb.h"
#include "lightstep/propagation.h"

namespace lightstep {
Expand Down
2 changes: 1 addition & 1 deletion src/c++11/lightstep/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <mutex>
#include <random>

#include "lightstep/collector.pb.h"
#include "collector.pb.h"
#include "lightstep/options.h"
#include "lightstep/propagation.h"
#include "lightstep/value.h"
Expand Down
2 changes: 1 addition & 1 deletion src/c++11/lightstep/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define __LIGHTSTEP_UTIL_H__

#include <string>
#include "lightstep/collector.pb.h"
#include "collector.pb.h"

namespace lightstep {

Expand Down
6 changes: 3 additions & 3 deletions src/c++11/recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "config.h"
#endif

#include "lightstep/collector.grpc.pb.h"
#include "collector.grpc.pb.h"
#include "lightstep/impl.h"
#include "lightstep/options.h"
#include "lightstep/recorder.h"
Expand All @@ -30,8 +30,8 @@ std::string hostPortOf(const TracerOptions& options) {
}

BasicRecorderOptions::BasicRecorderOptions()
: time_limit(std::chrono::seconds(1)),
span_limit(1000),
: time_limit(std::chrono::milliseconds(500)),
span_limit(2000),
report_timeout(std::chrono::seconds(5)) { }

class BasicRecorder : public Recorder {
Expand Down
5 changes: 5 additions & 0 deletions test/c++11/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ noinst_HEADERS = \
dropbox_json/json11.hpp \
zintinio_happyhttp/happyhttp.h


TESTS = flushproto_test

if ENABLE_GRPC

noinst_PROGRAMS += tracer_test
Expand All @@ -26,6 +29,7 @@ tracer_test_LDFLAGS = $(protobuf_LIBS) $(grpc_LIBS)++

noinst_PROGRAMS += cppclient

# Note: See github.com/lightstep-benchmarks to execute this test program.
cppclient_SOURCES = \
cppclient.cc \
dropbox_json/json11.cpp \
Expand All @@ -35,4 +39,5 @@ cppclient_CXXFLAGS = $(AM_CXXFLAGS) -I $(top_srcdir)/src/c++11 -I $(top_srcdir)/
cppclient_LDADD = ../../src/c++11/liblightstep_grpc_cxx11.la
cppclient_LDFLAGS = $(protobuf_LIBS) $(grpc_LIBS)++

TESTS += tracer_test
endif
4 changes: 2 additions & 2 deletions test/c++11/tracer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main() {
topts.access_token = "3e5170e56cc4f4b2c94695a13ddf23d1";
topts.collector_host = "localhost";
topts.collector_port = 9997;
topts.collector_encryption = "";
topts.collector_encryption = "none";

BasicRecorderOptions bopts;

Expand All @@ -57,10 +57,10 @@ int main() {
cspan.Finish();

Tracer::Global().impl()->Flush();
std::cerr << "Success!" << std::endl;
} catch (std::exception &e) {
std::cerr << "Exception! " << e.what() << std::endl;
return 1;
}
std::cerr << "Success!" << std::endl;
return 0;
}

0 comments on commit 1693c69

Please sign in to comment.