diff options
-rw-r--r-- | Makefile | 23 | ||||
-rw-r--r-- | examples/example.pb-c.h | 14 |
2 files changed, 23 insertions, 14 deletions
@@ -4,6 +4,9 @@ endif include $(DPP_ROOT)/Makefile.inc +PROTOBUF_OBJECT = protobuf-build/protobuf-c.o +PROTOBUF_CFLAGS_PRIVATE = -Wno-unused-but-set-variable + FLATBUFFERS_LIB = flatbuffers-build/lib/libflatccrt.a FLATBUFFERS_CFLAGS = -Iflatbuffers-build/include -Wno-misleading-indentation FLATBUFFERS_FLATC = flatbuffers-flatcc-build/bin/flatcc @@ -13,11 +16,11 @@ DRIVER0_OBJECTS = examples/$(DRIVER0_NAME).o ksocket/ksocket.o ksocket/berkeley. DRIVER0_TARGET = $(DRIVER0_NAME).sys DRIVER1_NAME = driver-protobuf-c -DRIVER1_OBJECTS = examples/$(DRIVER1_NAME).o protobuf-c/protobuf-c.o examples/example.pb-c.o +DRIVER1_OBJECTS = examples/$(DRIVER1_NAME).o examples/example.pb-c.o $(PROTOBUF_OBJECT) DRIVER1_TARGET = $(DRIVER1_NAME).sys DRIVER2_NAME = driver-protobuf-c-tcp -DRIVER2_OBJECTS = examples/$(DRIVER2_NAME).o ksocket/ksocket.o ksocket/berkeley.o protobuf-c/protobuf-c.o examples/example.pb-c.o +DRIVER2_OBJECTS = examples/$(DRIVER2_NAME).o ksocket/ksocket.o ksocket/berkeley.o examples/example.pb-c.o $(PROTOBUF_OBJECT) DRIVER2_TARGET = $(DRIVER2_NAME).sys DRIVER3_NAME = driver-flatbuffers @@ -29,12 +32,12 @@ USERSPACE0_OBJECTS = examples/$(USERSPACE0_NAME).o USERSPACE0_TARGET = $(USERSPACE0_NAME).exe USERSPACE1_NAME = userspace_client_protobuf -USERSPACE1_OBJECTS = examples/$(USERSPACE1_NAME).o protobuf-c/protobuf-c.o examples/example.pb-c.o +USERSPACE1_OBJECTS = examples/$(USERSPACE1_NAME).o examples/example.pb-c.o $(PROTOBUF_OBJECT) USERSPACE1_TARGET = $(USERSPACE1_NAME).exe # mingw-w64-dpp related -CFLAGS_protobuf-c/protobuf-c.o = -Wno-unused-but-set-variable -CUSTOM_CFLAGS = -I. -Iexamples $(FLATBUFFERS_CFLAGS) -Wl,--exclude-all-symbols -DNDEBUG +CFLAGS_$(PROTOBUF_OBJECT) = $(PROTOBUF_CFLAGS_PRIVATE) +CUSTOM_CFLAGS = -I. -Iexamples -Werror $(FLATBUFFERS_CFLAGS) -Wl,--exclude-all-symbols -DNDEBUG DRIVER_LIBS += -lnetio USER_LIBS += -lws2_32 @@ -46,6 +49,10 @@ all: deps $(DRIVER0_TARGET) $(DRIVER1_TARGET) $(DRIVER2_TARGET) $(DRIVER3_TARGET %.o: %.c $(call BUILD_C_OBJECT,$<,$@) +$(PROTOBUF_OBJECT): protobuf-c/protobuf-c.c + mkdir -p '$(dir $(PROTOBUF_OBJECT))' + $(call BUILD_C_OBJECT,$<,$@) + $(DRIVER0_TARGET): $(DRIVER0_OBJECTS) $(call LINK_CPP_KERNEL_TARGET,$(DRIVER0_OBJECTS),$@) @@ -71,7 +78,7 @@ $(FLATBUFFERS_LIB): -DCMAKE_INSTALL_PREFIX=/ \ -DCMAKE_C_COMPILER="$(realpath $(CC))" \ -DCMAKE_SYSTEM_NAME="Windows" \ - -DCMAKE_C_FLAGS='$(CFLAGS)' \ + -DCMAKE_C_FLAGS='$(CFLAGS) $(FLATBUFFERS_CFLAGS_PRIVATE)' \ -DCMAKE_BUILD_TYPE=Release \ -DFLATCC_ALLOW_WERROR=ON -DFLATCC_COVERAGE=OFF -DFLATCC_CXX_TEST=OFF \ -DFLATCC_REFLECTION=OFF -DFLATCC_RTONLY=ON -DFLATCC_TEST=OFF -DFLATCC_INSTALL=ON \ @@ -88,7 +95,9 @@ $(FLATBUFFERS_FLATC): cmake --build flatbuffers-flatcc-build make -C flatbuffers-flatcc-build install DESTDIR="$(realpath .)/flatbuffers-flatcc-build" -generate: +generate: $(FLATBUFFERS_FLATC) + @echo 'Generating flatbuffer files..' + $(FLATBUFFERS_FLATC) -a -o examples examples/monster.fbs @echo '==========================================' @echo '= You need protobuf-c to make this work! =' @echo '==========================================' diff --git a/examples/example.pb-c.h b/examples/example.pb-c.h index 9e4f1db..fcc9aeb 100644 --- a/examples/example.pb-c.h +++ b/examples/example.pb-c.h @@ -10,14 +10,14 @@ PROTOBUF_C__BEGIN_DECLS #if PROTOBUF_C_VERSION_NUMBER < 1000000 # error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. -#elif 1003003 < PROTOBUF_C_MIN_COMPILER_VERSION +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION # error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. #endif -typedef struct _SomethingWithUINTs SomethingWithUINTs; -typedef struct _SomethingMore SomethingMore; -typedef struct _EvenMore EvenMore; +typedef struct SomethingWithUINTs SomethingWithUINTs; +typedef struct SomethingMore SomethingMore; +typedef struct EvenMore EvenMore; /* --- enums --- */ @@ -38,7 +38,7 @@ typedef enum _EvenMore__SomeEnum { /* --- messages --- */ -struct _SomethingWithUINTs +struct SomethingWithUINTs { ProtobufCMessage base; protobuf_c_boolean has_id; @@ -53,7 +53,7 @@ struct _SomethingWithUINTs , 0, 0, 0, 0, 0, 0 } -struct _SomethingMore +struct SomethingMore { ProtobufCMessage base; protobuf_c_boolean has_error_code; @@ -65,7 +65,7 @@ struct _SomethingMore , 0, SOMETHING_MORE__ERRORS__SUCCESS, NULL } -struct _EvenMore +struct EvenMore { ProtobufCMessage base; EvenMore__SomeEnum enum_value; |