Skip to content

Commit

Permalink
Move a compilation flag out of the Makefile and fix-project-settings.…
Browse files Browse the repository at this point in the history
…rb and into vendor-grpc.sh, which adds them to Sources/CgRPC/third_party/nanopb/pb.h.
  • Loading branch information
MrMage committed May 30, 2018
1 parent 0368de9 commit 4a16c13
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

CFLAGS = -Xcc -ISources/BoringSSL/include -Xcc -DPB_FIELD_16BIT=1
CFLAGS = -Xcc -ISources/BoringSSL/include

all:
swift build -v $(CFLAGS)
Expand All @@ -8,7 +8,7 @@ all:

project:
swift package generate-xcodeproj
@ruby fix-project-settings.rb || echo "ERROR: Please install Ruby and the 'xcodeproj' gem to automatically fix the Xcode project's settings."
@-ruby fix-project-settings.rb || echo "Consider running 'sudo gem install xcodeproj' to automatically set correct indentation settings for the generated project."

test: all
swift test -v $(CFLAGS)
Expand Down
2 changes: 1 addition & 1 deletion Sources/CgRPC/third_party/nanopb/pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/* #define PB_MAX_REQUIRED_FIELDS 256 */

/* Add support for tag numbers > 255 and fields larger than 255 bytes. */
/* #define PB_FIELD_16BIT 1 */
#define PB_FIELD_16BIT 1

/* Add support for tag numbers > 65536 and fields larger than 65536 bytes. */
/* #define PB_FIELD_32BIT 1 */
Expand Down
6 changes: 0 additions & 6 deletions fix-project-settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,4 @@
project.main_group.tab_width = '2'
project.main_group.indent_width = '2'

cgrpc = project.targets.select { |t| t.name == 'CgRPC' }.first
cgrpc.build_configurations.each do |config|
config.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++0x'
config.build_settings['OTHER_CFLAGS'] = '-DPB_FIELD_16BIT=1'
end

project.save
3 changes: 3 additions & 0 deletions vendor-grpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ done
echo "COPYING additional nanopb headers"
cp third_party/grpc/third_party/nanopb/*.h Sources/CgRPC/third_party/nanopb/

echo "ADDING additional compiler flags to nanopb/pb.h"
perl -pi -e 's/\/\* #define PB_FIELD_16BIT 1 \*\//#define PB_FIELD_16BIT 1/' Sources/CgRPC/third_party/nanopb/pb.h

echo "DISABLING ARES"
perl -pi -e 's/#define GRPC_ARES 1/#define GRPC_ARES 0/' Sources/CgRPC/include/grpc/impl/codegen/port_platform.h

Expand Down

0 comments on commit 4a16c13

Please sign in to comment.