wscript (1649B)
1 #! /usr/bin/env python 2 3 import os 4 from waflib import Logs 5 6 top = '.' 7 out = 'build' 8 9 def options(opt): 10 opt.load('compiler_cxx python java') 11 12 def configure(conf): 13 conf.load('compiler_cxx python java protoc') 14 conf.check_python_version(minver=(2, 5, 0)) 15 # Here you have to point to your protobuf-java JAR 16 if os.path.isfile('/tmp/cp/protobuf-java-2.5.0.jar'): 17 conf.env.CLASSPATH_PROTOBUF = ['/tmp/cp/protobuf-java-2.5.0.jar'] 18 else: 19 Logs.warn('Edit the wscript file and set CLASSPATH_PROTOBUF for java') 20 21 def build(bld): 22 bld( 23 features = 'cxx cxxshlib', 24 source = ['inc/message_inc.proto','inc/message.proto'], 25 name = 'somelib', 26 target = 'somelib', 27 includes = ['inc'], 28 export_includes = ['inc']) 29 30 bld( 31 features = 'cxx cxxshlib', 32 source = ['incdeep/a/b/test.proto'], 33 target = 'somedeeplib', 34 includes = ['incdeep']) 35 36 bld( 37 features = 'cxx cxxshlib', 38 source = ['incseparate/depinotherdir.proto'], 39 target = 'crossdirlib', 40 includes = ['incseparate'], 41 use = ['somelib']) 42 43 bld( 44 features = 'py', 45 name = 'pbpy', 46 source = ['inc/message_inc.proto','inc/message.proto'], 47 protoc_includes = ['inc']) 48 49 bld( 50 features = 'cxx py', 51 name = 'pbboth', 52 source = ['incboth/messageboth_inc.proto', 'incboth/messageboth.proto'], 53 protoc_includes = ['incboth']) # either protoc_includes or includes would work in this case 54 55 if bld.env.CLASSPATH_PROTOBUF: 56 bld( 57 features = 'javac protoc', 58 name = 'pbjava', 59 srcdir = 'inc/', 60 source = ['inc/message_inc.proto', 'inc/message.proto', 'inc/msgCaseTest.proto' ], 61 use = 'PROTOBUF', 62 protoc_includes = ['inc']) 63 64 bld.recurse('increcurse')