Browse Source

Move a compilation flag out of the Makefile and fix-project-settings.rb and into vendor-grpc.sh, which adds them to Sources/CgRPC/third_party/nanopb/pb.h.

Daniel Alm 7 years ago
parent
commit
4a16c13ebb
4 changed files with 6 additions and 9 deletions
  1. 2 2
      Makefile
  2. 1 1
      Sources/CgRPC/third_party/nanopb/pb.h
  3. 0 6
      fix-project-settings.rb
  4. 3 0
      vendor-grpc.sh

+ 2 - 2
Makefile

@@ -1,5 +1,5 @@
 
-CFLAGS = -Xcc -ISources/BoringSSL/include -Xcc -DPB_FIELD_16BIT=1
+CFLAGS = -Xcc -ISources/BoringSSL/include
 
 all:
 	swift build -v $(CFLAGS)
@@ -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)

+ 1 - 1
Sources/CgRPC/third_party/nanopb/pb.h

@@ -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 */ 

+ 0 - 6
fix-project-settings.rb

@@ -6,10 +6,4 @@ project.main_group.uses_tabs = '0'
 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 - 0
vendor-grpc.sh

@@ -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