1 # vim: set ts=2 sw=2 tw=99 noet ft=python:
3 from ambuild.command import SymlinkCommand
7 if AMBuild.target['platform'] not in sdk['platform']:
10 name = 'sourcemod.' + sdk['ext']
12 compiler = SM.DefaultHL2Compiler('core', i)
15 # Protobuf 2.3 headers have some signed/unsigned compares. I believe that it's fixed in later versions, but Valve.
16 if isinstance(compiler.cxx, Cpp.CompatGCC):
17 compiler.AddToListVar('CFLAGS', '-Wno-sign-compare')
18 compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'common', 'protobuf-2.3.0', 'src'))
19 compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'engine', 'protobuf'))
20 compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'csgo', 'protobuf'))
22 compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'common', 'protobuf-2.4.1', 'src'))
23 compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'engine', 'protobuf'))
24 compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'protobuf'))
25 compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'dota', 'protobuf'))
27 extension = AMBuild.AddJob(name)
28 binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
29 SM.PreSetupHL2Job(extension, binary, i)
31 if AMBuild.target['platform'] == 'linux':
32 compiler['POSTLINKFLAGS'].append('-lpthread')
33 compiler['POSTLINKFLAGS'].append('-lrt')
35 if i in ['csgo', 'dota']:
36 if AMBuild.target['platform'] == 'linux':
37 link = os.path.join(os.path.join(AMBuild.outputFolder, extension.workFolder), 'libprotobuf.a')
38 target = os.path.join(os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'linux32', 'release'), 'libprotobuf.a')
42 extension.AddCommand(SymlinkCommand(link, target))
43 elif AMBuild.target['platform'] == 'darwin':
44 link = os.path.join(os.path.join(AMBuild.outputFolder, extension.workFolder), 'libprotobuf.a')
45 target = os.path.join(os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'osx32', 'release'), 'libprotobuf.a')
49 extension.AddCommand(SymlinkCommand(link, target))
50 elif AMBuild.target['platform'] == 'windows':
51 if 'DEBUG' in compiler['CDEFINES']:
52 libPath = os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'win32', 'debug', 'vs2010', 'libprotobuf.lib')
54 libPath = os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'win32', 'release', 'vs2010', 'libprotobuf.lib')
55 binary.RebuildIfNewer(libPath)
56 binary['POSTLINKFLAGS'].append(libPath)
60 'MenuStyle_Valve.cpp',
99 'MenuStyle_Radio.cpp',
100 'sm_autonatives.cpp',
105 if i in ['csgo', 'dota']:
106 files.append('smn_protobuf.cpp')
108 files.append('smn_bitbuffer.cpp')
110 binary.AddSourceFiles('core', files)
114 os.path.join('public', 'engine', 'protobuf', 'netmessages.pb.cc'),
115 os.path.join('public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
116 os.path.join('public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
118 binary.AddSourceFiles(AMBuild.cache[sdk['sdk']], files)
121 os.path.join('public', 'engine', 'protobuf', 'networkbasetypes.pb.cc'),
122 os.path.join('public', 'engine', 'protobuf', 'netmessages.pb.cc'),
123 os.path.join('public', 'game', 'shared', 'protobuf', 'ai_activity.pb.cc'),
124 os.path.join('public', 'game', 'shared', 'protobuf', 'usermessages.pb.cc'),
125 os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_commonmessages.pb.cc'),
126 os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessages.pb.cc'),
127 os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessage_helpers.cpp'),
129 binary.AddSourceFiles(AMBuild.cache[sdk['sdk']], files)
131 SM.PostSetupHL2Job(extension, binary, i)
133 if i in ['csgo', 'dota']:
134 if AMBuild.target['platform'] in ['linux', 'darwin']:
135 binary.AddObjectFiles(['libprotobuf.a'])
137 SM.AutoVersion('core', binary)
138 SM.ExtractDebugInfo(extension, binary)