Browse Source

add waf buildsystem

pull/11/head
nillerusr 3 years ago
parent
commit
5e870e53c1
  1. 8
      .gitignore
  2. 53
      appframework/wscript
  3. 61
      bitmap/wscript
  4. 52
      datacache/wscript
  5. 58
      datamodel/wscript
  6. 2
      devtools/makefile_base_posix.mak
  7. 52
      dmxloader/wscript
  8. 47
      engine/voice_codecs/minimp3/wscript
  9. 346
      engine/wscript
  10. 61
      filesystem/wscript
  11. 126
      gameui/wscript
  12. 52
      inputsystem/wscript
  13. 50
      launcher/wscript
  14. 43
      launcher_main/wscript
  15. 75
      materialsystem/shaderapidx9/wscript
  16. 51
      materialsystem/shaderlib/wscript
  17. 167
      materialsystem/stdshaders/wscript
  18. 77
      materialsystem/wscript
  19. 69
      mathlib/wscript
  20. 49
      scenefilecache/wscript
  21. 15
      scripts/continious_upload.sh
  22. BIN
      scripts/waifulib/__pycache__/compiler_optimizations.cpython-39.pyc
  23. BIN
      scripts/waifulib/__pycache__/enforce_pic.cpython-39.pyc
  24. BIN
      scripts/waifulib/__pycache__/xcompile.cpython-38.pyc
  25. BIN
      scripts/waifulib/__pycache__/xcompile.cpython-39.pyc
  26. BIN
      scripts/waifulib/__pycache__/xshlib.cpython-38.pyc
  27. BIN
      scripts/waifulib/__pycache__/xshlib.cpython-39.pyc
  28. 164
      scripts/waifulib/compiler_optimizations.py
  29. 124
      scripts/waifulib/owcc.py
  30. 433
      scripts/waifulib/xcompile.py
  31. 115
      scripts/waifulib/xshlib.py
  32. 72
      serverbrowser/wscript
  33. 53
      soundemittersystem/wscript
  34. 60
      studiorender/wscript
  35. 2
      thirdparty
  36. 84
      tier0/wscript
  37. 92
      tier1/wscript
  38. 66
      tier2/wscript
  39. 54
      tier3/wscript
  40. 63
      togl/wscript
  41. 56
      utils/bzip2/wscript
  42. 67
      vgui2/matsys_controls/wscript
  43. 69
      vgui2/src/wscript
  44. 123
      vgui2/vgui_controls/wscript
  45. 54
      vgui2/vgui_surfacelib/wscript
  46. 61
      vguimatsurface/wscript
  47. 48
      video/wscript
  48. 49
      vpklib/wscript
  49. 57
      vstdlib/wscript
  50. 51
      vtf/wscript
  51. 175
      waf
  52. 260
      wscript

8
.gitignore vendored

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
*.mak
*.mak.vpc_crc
*.vpc_crc
*.a
*.project
lib/
*obj_*
build/

53
appframework/wscript

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'appframework'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'AppSystemGroup.cpp',
'../public/filesystem_init.cpp',
# 'vguimatsysapp.cpp' [$WIN32]
# 'winapp.cpp' [$WIN32]
'posixapp.cpp',# [$POSIX]
'sdlmgr.cpp'# [$SDL]
# 'glmrendererinfo_osx.mm' [$OSXALL]
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1'
] + bld.env.INCLUDES_SDL2
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

61
bitmap/wscript

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'bitmap'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'ImageByteSwap.cpp',
'colorconversion.cpp',
'float_bm.cpp',
'float_bm2.cpp',
'float_bm3.cpp',
#'float_bm4.cpp', [$WINDOWS]
'float_bm_bilateral_filter.cpp',
'float_cube.cpp',
'imageformat.cpp',
'psd.cpp',
'resample.cpp',
'tgaloader.cpp',
'tgawriter.cpp',
'bitmap.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../thirdparty/stb'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

52
datacache/wscript vendored

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'datacache'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'datacache.cpp',
'mdlcache.cpp',
'../public/studio.cpp',
'../public/studio_virtualmodel.cpp',
'../common/studiobyteswap.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
]
defines = []
libs = ['tier0','tier1','tier2','tier3']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

58
datamodel/wscript

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'datamodel'
def options(opt):
return
def configure(conf):
conf.define('DATAMODEL_LIB',1)
def build(bld):
source = [
'clipboardmanager.cpp',
'datamodel.cpp',
'dependencygraph.cpp',
'dmattribute.cpp',
'dmelement.cpp',
'dmelementdictionary.cpp',
'dmelementfactoryhelper.cpp',
'DmElementFramework.cpp',
'dmserializerbinary.cpp',
'dmserializerkeyvalues.cpp',
'dmserializerkeyvalues2.cpp',
'undomanager.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

2
devtools/makefile_base_posix.mak

@ -116,7 +116,7 @@ COPY_DLL_TO_SRV = 0 @@ -116,7 +116,7 @@ COPY_DLL_TO_SRV = 0
# We should always specify -Wl,--build-id, as documented at:
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
LDFLAGS += -Wl,--build-id -fsanitize=address -fsanitize=undefined
LDFLAGS += -Wl,--build-id
#
# If we should be running in a chroot, check to see if we are. If not, then prefix everything with the

52
dmxloader/wscript

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'dmxloader'
def options(opt):
# stub
return
def configure(conf):
conf.define('DMXLOADER_LIB',1)
def build(bld):
source = [
'dmxattribute.cpp',
'dmxelement.cpp',
'dmxloader.cpp',
'dmxloadertext.cpp',
'dmxserializationdictionary.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

47
engine/voice_codecs/minimp3/wscript

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'vaudio_minimp3'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'mp3codecs.cpp',
]
includes = [
'.',
'../../../public/tier1',
'../../../public/',
'../../../thirdparty/minimp3'
]
defines = []
libs = ['tier0','tier1','vstdlib']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

346
engine/wscript

@ -0,0 +1,346 @@ @@ -0,0 +1,346 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'engine'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES',[
'__USEA3D',
'_ADD_EAX_',
'ENGINE_DLL',
'VERSION_SAFE_STEAM_API_INTERFACES',
'USE_BREAKPAD_HANDLER'
])
def build(bld):
source = [
'client_pch.cpp', ##[!$DEDICATED]
'cl_rcon.cpp', ##[!$DEDICATED]
'socketcreator.cpp',
'rpt_engine.cpp', ##[!$DEDICATED]
'cl_steamauth.cpp',# #[!$DEDICATED]
'clientframe.cpp',
'decal_clip.cpp',
'demofile.cpp',
'DevShotGenerator.cpp',
'OcclusionSystem.cpp',
'tmessage.cpp',
'r_efx.cpp',# #[!$DEDICATED]
'view.cpp', ##[!$DEDICATED]
'baseclient.cpp',
'baseclientstate.cpp',
'cbenchmark.cpp',
'cdll_engine_int.cpp', ##[!$DEDICATED] /
'cl_main.cpp',##[!$DEDICATED] /
'cl_demo.cpp',##[!$DEDICATED] /
#'cl_null.cpp', [$DEDICATED] /
'cl_demoaction.cpp', #[!$DEDICATED] /
'cl_demoaction_types.cpp', #[!$DEDICATED] /
'cl_demoactioneditors.cpp', #[!$DEDICATED] /
'cl_demoactionmanager.cpp', #[!$DEDICATED] /
'cl_demoeditorpanel.cpp', #[!$DEDICATED] /
'cl_demosmootherpanel.cpp', #[!$DEDICATED] /
'cl_demouipanel.cpp', #[!$DEDICATED] /
'cl_foguipanel.cpp', #[!$DEDICATED] /
'cl_txviewpanel.cpp', #[!$DEDICATED] /
'cl_entityreport.cpp', #[!$DEDICATED] /
'cl_ents_parse.cpp', #[!$DEDICATED] /
'cl_localnetworkbackdoor.cpp', #[!$DEDICATED] /
'cl_parse_event.cpp', #[!$DEDICATED] /
'cl_pluginhelpers.cpp',#[!$DEDICATED] /
'cl_pred.cpp', #[!$DEDICATED] /
'cl_texturelistpanel.cpp', #[!$DEDICATED] /
'client.cpp',#[!$DEDICATED] /
'colorcorrectionpanel.cpp', #[!$DEDICATED] /
'console.cpp',
'render_pch.cpp',
'buildcubemaps.cpp', #[!$DEDICATED] /
'debug_leafvis.cpp', #[!$DEDICATED] /
'debugoverlay.cpp', #[!$DEDICATED] /
'decals.cpp',
'disp.cpp',
'disp_interface.cpp',
'disp_mapload.cpp',
'gl_draw.cpp',
'gl_rsurf.cpp',
'gl_shader.cpp',
'gl_drawlights.cpp', #[!$DEDICATED] /
'gl_lightmap.cpp', #[!$DEDICATED] /
'gl_matsysiface.cpp', #[!$DEDICATED] /
'gl_rlight.cpp',#[!$DEDICATED] /
'gl_rmain.cpp',#[!$DEDICATED] /
'gl_rmisc.cpp',#[!$DEDICATED] /
'gl_screen.cpp',#[!$DEDICATED] /
'gl_warp.cpp',#[!$DEDICATED] /
'l_studio.cpp',
'matsys_interface.cpp',
'modelloader.cpp',
'Overlay.cpp',
'r_areaportal.cpp', #[!$DEDICATED] /
'r_decal.cpp',
'r_linefile.cpp',
'shadowmgr.cpp',#[!$DEDICATED]
'server_pch.cpp',
'sv_ipratelimit.cpp',
'sv_rcon.cpp',
'sv_steamauth.cpp',
'sv_uploaddata.cpp',
'sv_uploadgamestats.cpp',
'vengineserver_impl.cpp',
'sv_main.cpp',
'sv_client.cpp',
'sv_ents_write.cpp',
'sv_filter.cpp',
'sv_framesnapshot.cpp',
'sv_log.cpp',
'sv_packedentities.cpp',
'sv_plugin.cpp',
'sv_precache.cpp',
'sv_redirect.cpp',
'sv_remoteaccess.cpp',
'baseautocompletefilelist.cpp',
'baseserver.cpp',
'bitbuf_errorhandler.cpp',
'../public/blockingudpsocket.cpp',
'../public/bsptreedata.cpp',
'../public/builddisp.cpp',
'changeframelist.cpp',
'checksum_engine.cpp',
'ccs.cpp',
'clockdriftmgr.cpp',
'cl_bounded_cvars.cpp', ##[!$DEDICATED]
'cl_check_process.cpp',
'cmd.cpp',
'cmodel.cpp',
'cmodel_bsp.cpp',
'cmodel_disp.cpp',
'../public/collisionutils.cpp',
'common.cpp',
'../public/crtmemdebug.cpp',
'cvar.cpp',
'../public/disp_common.cpp',
'disp_defs.cpp',
'disp_helpers.cpp',
'../public/disp_powerinfo.cpp',
'../public/dispcoll_common.cpp',
'DownloadListGenerator.cpp',
'downloadthread.cpp', ##[!$DEDICATED]
'dt.cpp',
'dt_common_eng.cpp',
'dt_encode.cpp',
'dt_instrumentation.cpp',
'dt_instrumentation_server.cpp',
'dt_localtransfer.cpp',
'../public/dt_recv.cpp',
'dt_recv_decoder.cpp',
'dt_recv_eng.cpp',
'../public/dt_send.cpp',
'dt_send_eng.cpp',
'dt_stack.cpp',
'dt_test.cpp',
'../public/dt_utlvector_common.cpp',
'../public/dt_utlvector_recv.cpp',
'../public/dt_utlvector_send.cpp',
'enginesingleuserfilter.cpp',
'enginestats.cpp',
'enginethreads.cpp',
'enginetrace.cpp',
'filesystem_engine.cpp',
'../public/filesystem_helpers.cpp',
'../public/filesystem_init.cpp',
'filetransfermgr.cpp',
'GameEventManager.cpp',
'GameEventManagerOld.cpp',
'gametrace_engine.cpp',
'hltvclient.cpp',
'hltvclientstate.cpp',
'hltvdemo.cpp',
'hltvserver.cpp',
'hltvtest.cpp',
'host.cpp',
'host_cmd.cpp',
'host_listmaps.cpp',
'host_phonehome.cpp',
'host_state.cpp',
'initmathlib.cpp',
'../common/language.cpp',
'LocalNetworkBackdoor.cpp',
'LoadScreenUpdate.cpp', #[!$DEDICATED]
'../public/lumpfiles.cpp',
'MapReslistGenerator.cpp',
'matchmakinghost.cpp', #[!$DEDICATED]
'matchmakingqos.cpp', #[!$DEDICATED]
'matchmakingclient.cpp', #[!$DEDICATED]
'matchmakingshared.cpp', #[!$DEDICATED]
'matchmakingmigrate.cpp', #[!$DEDICATED]
'materialproxyfactory.cpp',
'mem_fgets.cpp',
'mod_vis.cpp',
'ModelInfo.cpp',
'net_chan.cpp',
'net_synctags.cpp',
'net_ws.cpp',
'net_ws_queued_packet_sender.cpp',
'../common/netmessages.cpp',
'../common/steamid.cpp',
'networkstringtable.cpp',
'NetworkStringTableItem.cpp',
'networkstringtableserver.cpp',
'../public/networkvar.cpp',
'packed_entity.cpp',
'pure_server.cpp',
'pr_edict.cpp',
'precache.cpp',
'quakedef.cpp',
'randomstream.cpp',
'../common/randoverride.cpp',
'../public/registry.cpp',
'engine_replay_int.cpp',
'replay_internal.cpp',
'replaydemo.cpp',
'replaydemoplayer.cpp', #[!$DEDICATED]
'replayserver.cpp',
'../public/sentence.cpp',
'Session.cpp', #[!$DEDICATED]
'sound_shared.cpp',
'spatialpartition.cpp',
'staticpropmgr.cpp',
'../public/studio.cpp',
'sys_dll.cpp',
'sys_dll2.cpp',
'sys_engine.cpp',
'sys_mainwind.cpp', #[!$DEDICATED]
'sys_linuxwind.cpp', #[$POSIX]
'testscriptmgr.cpp',
'traceinit.cpp',
'../public/vallocator.cpp',
'voiceserver_impl.cpp',
'vprof_engine.cpp',
'vprof_record.cpp',
'world.cpp',
'../public/XZip.cpp',
'../public/XUnzip.cpp',
'zone.cpp',
'bugreporter.cpp', #[!$DEDICATED]
'cheatcodes.cpp',
'download.cpp', #[!$DEDICATED]
'../public/editor_sendcommand.cpp',
'host_saverestore.cpp', #[!$DEDICATED]
'keys.cpp',
'lightcache.cpp', #[!$DEDICATED]
'networkstringtableclient.cpp',
'saverestore_filesystem.cpp', #[!$DEDICATED]
'../public/scratchpad3d.cpp',
'servermsghandler.cpp',
'sys_getmodes.cpp', #[!$DEDICATED]
'vgui_askconnectpanel.cpp', #[!$DEDICATED]
'xboxsystem.cpp', #[!$DEDICATED]
'../common/SourceAppInfo.cpp',
'snd_io.cpp',
'EngineSoundServer.cpp',
'EngineSoundClient.cpp', #[!$DEDICATED]
'engsoundservice.cpp', #[!$DEDICATED]
'audio/private/voice_wavefile.cpp',
'audio/private/MPAFile.cpp', #[!$DEDICATED&&!$X360]
'audio/private/MPAHeader.cpp', #[!$DEDICATED&&!$X360]
'audio/private/circularbuffer.cpp', #[!$DEDICATED]
'audio/private/snd_posix.cpp', # [$POSIX]
'audio/audio_pch.cpp', #[!$DEDICATED]
'audio/private/vox.cpp',
'audio/private/snd_dev_common.cpp', #[!$DEDICATED] /
'audio/private/snd_dma.cpp', #[!$DEDICATED] /
'audio/private/snd_dsp.cpp', #[!$DEDICATED] /
'audio/private/snd_mix.cpp', #[!$DEDICATED] /
'audio/private/snd_sentence_mixer.cpp', #[!$DEDICATED]/
'audio/private/snd_wave_data.cpp', #[!$DEDICATED] /
'audio/private/snd_wave_mixer.cpp', #[!$DEDICATED] /
'audio/private/snd_wave_mixer_adpcm.cpp', #[!$DEDICATED] /
'audio/private/snd_wave_source.cpp', #[!$DEDICATED] /
'audio/private/snd_wave_temp.cpp', #[!$DEDICATED] /
'audio/private/snd_win.cpp', #[!$DEDICATED] /
'audio/private/voice_gain.cpp',
#'audio/private/snd_dev_direct.cpp', [$WINDOWS]/
#'audio/private/snd_dev_wave.cpp', [$WINDOWS]/
'audio/private/snd_mp3_source.cpp', #[!$DEDICATED]/
'audio/private/snd_wave_mixer_mp3.cpp', #[!$DEDICATED] /
'audio/private/VBRHeader.cpp', # [!$DEDICATED&&!$X360]/
'audio/private/voice.cpp', #[!$DEDICATED&&!$X360]/
#'audio/private/voice_mixer_controls.cpp', [$WINDOWS] /
#'audio/private/voice_record_dsound.cpp', [$WINDOWS] /
'audio/private/voice_sound_engine_interface.cpp', #[!$DEDICATED&&!$X360]
#'audio/private/snd_dev_xaudio.cpp',[$X360]
#'audio/private/snd_wave_mixer_xma.cpp', [$X360]
'audio/private/snd_dev_sdl.cpp', #[$SDL && !$OSXALL]
#'audio/private/snd_dev_openal.cpp', # [$OSXALL]
#'audio/private/snd_dev_mac_audioqueue.cpp',# [$OSXALL]
'audio/private/voice_mixer_controls_openal.cpp', #[$OSXALL||($LINUXALL&&!$DEDICATED)]
'audio/private/voice_record_openal.cpp', #[$OSXALL||($LINUXALL&&!$DEDICATED)]
#'audio/private/voice_record_mac_audioqueue.cpp', #[$OSXALL]
'../public/vgui_controls/vgui_controls.cpp',
'../common/vgui/vgui_basebudgetpanel.cpp',
'../common/vgui/vgui_budgetbargraphpanel.cpp',
'../common/vgui/vgui_budgethistorypanel.cpp',
'../common/vgui/vgui_budgetpanelshared.cpp',
'perfuipanel.cpp',
'vgui_basepanel.cpp',
'vgui_baseui_interface.cpp',
'vgui_budgetpanel.cpp',
'vgui_DebugSystemPanel.cpp',
'vgui_drawtreepanel.cpp',
'vgui_helpers.cpp',
'vgui_texturebudgetpanel.cpp',
'vgui_vprofgraphpanel.cpp',
'vgui_vprofpanel.cpp',
'enginetool.cpp', #[!$DEDICATED]
'toolframework.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common',
'audio',
'audio/public',
'audio/private'
]
defines = []
libs = ['tier0','vgui_controls','dmxloader','tier1','tier2','tier3','bitmap','vstdlib','appframework','datamodel','vtf','mathlib','steam_api','matsys_controls','BZIP2','SDL2','JPEG','ZLIB','OPENAL','CURL']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

61
filesystem/wscript

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'filesystem_stdio'
def options(opt):
# stub
return
def configure(conf):
conf.define('FILESYSTEM_STDIO_EXPORTS',1)
conf.define('DONT_PROTECT_FILEIO_FUNCTIONS',1)
# conf.define('PROTECTED_THINGS_ENABLE',1)
conf.define('_USE_32BIT_TIME_T',1)
conf.define('SUPPORT_PACKED_STORE',1)
def build(bld):
source = [
'basefilesystem.cpp',
'packfile.cpp',
'filetracker.cpp',
'filesystem_async.cpp',
'filesystem_stdio.cpp',
'../public/kevvaluescompiler.cpp',
'../public/zip_utils.cpp',
'QueuedLoader.cpp',
'linux_support.cpp', # [$POSIX]
'../public/tier0/memoverride.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
]
defines = []
libs = ['tier0','tier1','tier2','vstdlib','vpklib']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

126
gameui/wscript

@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'GameUI'
def options(opt):
# stub
return
def configure(conf):
conf.define('GAMEUI_EXPORTS',1)
conf.define('VERSION_SAFE_STEAM_API_INTERFACES',1)
def build(bld):
source = [
'BackgroundMenuButton.cpp',
'BasePanel.cpp',
'GameConsole.cpp',
'GameUI_Interface.cpp',
# 'LogoFile.cpp', [!$POSIX]
'ModInfo.cpp',
'MouseMessageForwardingPanel.cpp',
'../common/GameUI/ObjectList.cpp',
'PanelListPanel.cpp',
'RunGameEngine.cpp',
'../common/GameUI/scriptobject.cpp',
'Sys_Utils.cpp',
'TextEntryBox.cpp',
'TGAImagePanel.cpp',
'../public/vgui_controls/vgui_controls.cpp',
'VGuiSystemModuleLoader.cpp',
'BonusMapsDatabase.cpp',
'../common/language.cpp',
'../common/imageutils.cpp',
'SaveGameBrowserDialog.cpp',
'gameui_util.cpp',
'BitmapImagePanel.cpp',
'CommandCheckButton.cpp',
'CvarNegateCheckButton.cpp',
'../common/GameUI/cvarslider.cpp',
'CvarTextEntry.cpp',
'CvarToggleCheckButton.cpp',
'HapticControlBox.cpp',
'KeyToggleCheckButton.cpp',
'LabeledCommandComboBox.cpp',
'URLButton.cpp',
'vcontrolslistpanel.cpp',
'BenchmarkDialog.cpp',
'BonusMapsDialog.cpp',
'CommentaryDialog.cpp',
'CommentaryExplanationDialog.cpp',
'ContentControlDialog.cpp',
'CustomTabExplanationDialog.cpp',
'GameConsoleDialog.cpp',
'LoadGameDialog_Xbox.cpp',
'LoadGameDialog.cpp',
'MultiplayerAdvancedDialog.cpp',
'NewGameDialog.cpp',
'PlayerListDialog.cpp',
'SaveGameDialog_Xbox.cpp',
'SaveGameDialog.cpp',
'LoadCommentaryDialog.cpp',
'LoadingDialog.cpp',
'BaseSaveGameDialog.cpp',
#'ChangeGameDialog.cpp', [!$POSIX]
'CreateMultiplayerGameBotPage.cpp',
'CreateMultiplayerGameDialog.cpp',
'CreateMultiplayerGameGameplayPage.cpp',
'CreateMultiplayerGameServerPage.cpp',
'OptionsDialog_Xbox.cpp',
'ControllerDialog.cpp',
'matchmaking/achievementsdialog.cpp',
'matchmaking/basedialog.cpp',
'matchmaking/dialogmenu.cpp',
'matchmaking/leaderboarddialog.cpp',
'matchmaking/matchmakingbasepanel.cpp',
'matchmaking/pausedialog.cpp',
'matchmaking/sessionlobbydialog.cpp',
'matchmaking/sessionoptionsdialog.cpp',
'matchmaking/sessionbrowserdialog.cpp',
'matchmaking/welcomedialog.cpp',
'OptionsDialog.cpp',
'OptionsSubAudio.cpp',
'OptionsSubDifficulty.cpp',
'OptionsSubGame.cpp',
#'OptionsSubHaptics.cpp', [$WIN32] [$WIN32]
'OptionsSubKeyboard.cpp',
'OptionsSubMouse.cpp',
'OptionsSubMultiplayer.cpp',
'OptionsSubPortal.cpp',
'OptionsSubVideo.cpp',
'OptionsSubVoice.cpp',
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common',
'../common/GameUI'
]
defines = []
libs = ['tier0','vgui_controls','tier1','tier2','tier3','vstdlib','vtf','bitmap','mathlib','SDL2','steam_api','matsys_controls','JPEG','PNG']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

52
inputsystem/wscript

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'inputsystem'
def options(opt):
# stub
return
def configure(conf):
conf.define('VERSION_SAFE_STEAM_API_INTERFACES',1)
def build(bld):
source = [
'inputsystem.cpp',
'joystick_sdl.cpp',
#'novint.cpp', # [$WIN32]
'key_translation.cpp',
'steamcontroller.cpp'
]
includes = [
'.',
'../common',
'../public',
'../public/tier0',
'../thirdparty/SDL2'
]
defines = []
libs = ['tier0','tier1','tier2','vstdlib','SDL2','steam_api']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

50
launcher/wscript

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'launcher'
def options(opt):
# stub
return
def configure(conf):
conf.define('LAUNCHERONLY',1)
def build(bld):
source = [
'../public/filesystem_init.cpp',
'launcher.cpp',
'reslistgenerator.cpp',
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','tier1','tier2','tier3','vstdlib','steam_api','appframework','SDL2','togl']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

43
launcher_main/wscript

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'hl2'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = ['main.cpp']
includes = ['../public']
defines = []
libs = []
if bld.env.DEST_OS != 'win32':
libs += [ 'DL' ]
else:
libs += ['USER32', 'SHELL32']
source += ['launcher_main.rc']
install_path = bld.env.PREFIX
bld(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx cxxprogram',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

75
materialsystem/shaderapidx9/wscript

@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'shaderapidx9'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES',[
'SHADERAPIDX9',
'SHADER_DLL_EXPORT',
'PROTECTED_THINGS_ENABLE',
'strncpy=use_Q_strncpy_instead',
'_snprintf=use_Q_snprintf_instead',
'GL_GLEXT_PROTOTYPES',
'DX_TO_GL_ABSTRACTION'
])
def build(bld):
source = [
'colorformatdx8.cpp',
'../../public/filesystem_helpers.cpp',
'hardwareconfig.cpp',
'meshbase.cpp',
'meshdx8.cpp',
#'recording.cpp', [$WIN32 && !$GL]
'shaderapidx8.cpp',
'shaderdevicebase.cpp',
'shaderapibase.cpp',
'shaderdevicedx8.cpp',
'shadershadowdx8.cpp',
'texturedx8.cpp',
'TransitionTable.cpp',
'cvballoctracker.cpp',
'vertexdecl.cpp',
'vertexshaderdx8.cpp',
#'wmi.cpp', [$WIN32 && !$GL]
#'textureheap.cpp', [$X360]
'winutils.cpp'# [!$WIN32]
]
includes = [
'.',
'../../public',
'../../public/tier0',
'../../public/tier1',
'../../common',
'../'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','tier1','tier2','vstdlib','togl','bitmap','mathlib']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

51
materialsystem/shaderlib/wscript

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'shaderlib'
def options(opt):
# stub
return
def configure(conf):
conf.define('FAST_MATERIALVAR_ACCESS',1)
def build(bld):
source = [
'BaseShader.cpp',
'ShaderDLL.cpp',
'shaderlib_cvar.cpp'
]
includes = [
'.',
'../../public',
'../../public/tier0',
'../../public/tier1',
'../../common',
'../'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

167
materialsystem/stdshaders/wscript

@ -0,0 +1,167 @@ @@ -0,0 +1,167 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'stdshader_dx9'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES',[
'STDSHADER_DX9_DLL_EXPORT',
'FAST_MATERIALVAR_ACCESS'
])
def build(bld):
source = [
'aftershock.cpp',
'aftershock_helper.cpp',
'AccumBuff4Sample.cpp',
'accumbuff5sample.cpp',
'BaseVSShader.cpp',
'bik_dx90.cpp',
'Bloom.cpp',
'BlurFilterX.cpp',
'BlurFilterY.cpp',
'BufferClearObeyStencil_dx9.cpp',
'cable_dx9.cpp',
'cloak.cpp',
'cloak_blended_pass_helper.cpp',
'cloak_dx9_helper.cpp',
'cloud_dx9.cpp',
'colorcorrection.cpp',
'compositor.cpp',
'core_dx9.cpp',
'color_projection.cpp',
'debugmrttexture.cpp',
#'debugmorphaccumulator_dx9.cpp', [$WIN32]
'DebugTextureView.cpp',
'DecalBaseTimesLightmapAlphaBlendSelfIllum_dx9.cpp',
'DecalModulate_dx9.cpp',
'depthwrite.cpp',
'Downsample.cpp',
'downsample_nohdr.cpp',
'Engine_Post_dx9.cpp',
'emissive_scroll_blended_pass_helper.cpp',
'eye_refract.cpp',
'eye_refract_helper.cpp',
'eyes_dx8_dx9_helper.cpp',
'eyes_dx9.cpp',
'eyeglint_dx9.cpp',
'filmdust_dx8_dx9.cpp',
'filmgrain_dx8_dx9.cpp',
'flesh_interior_blended_pass_helper.cpp',
'floatcombine.cpp',
'floatcombine_autoexpose.cpp',
'floattoscreen.cpp',
'floattoscreen_vanilla.cpp',
'HDRCombineTo16Bit.cpp',
'HDRSelectRange.cpp',
'hsl_filmgrain_pass1.cpp',
'hsl_filmgrain_pass2.cpp',
'hsv.cpp',
'introscreenspaceeffect.cpp',
'lightmappedgeneric_dx9.cpp',
'lightmappedgeneric_dx9_helper.cpp',
'lightmappedreflective.cpp',
'modulate_dx9.cpp',
'MonitorScreen_dx9.cpp',
#'morphaccumulate_dx9.cpp', [$WIN32]
#'morphweight_dx9.cpp', [$WIN32]
'motion_blur_dx9.cpp',
'occlusion_dx9.cpp',
'particlelitgeneric_dx9.cpp',
'particlelitgeneric_dx9_helper.cpp',
'particlesphere_dx9.cpp',
'portal.cpp',
'portalstaticoverlay.cpp',
'portal_refract.cpp',
'portal_refract_helper.cpp',
'pyro_vision.cpp',
'refract.cpp',
'refract_dx9_helper.cpp',
#'rendertargetblit_x360.cpp', [$X360]
'sample4x4.cpp',
'sample4x4_blend.cpp',
'screenspace_general.cpp',
'sfm_blurfilterx.cpp',
'sfm_blurfiltery.cpp',
'sfm_downsample.cpp',
'sfm_integercombine.cpp',
'shadow.cpp',
'shadowbuild_dx9.cpp',
'shadowmodel_dx9.cpp',
'shatteredglass.cpp',
'showz.cpp',
'skin_dx9_helper.cpp',
'sky_dx9.cpp',
'sky_hdr_dx9.cpp',
'sprite_dx9.cpp',
'spritecard.cpp',
'teeth.cpp',
'TreeLeaf.cpp',
'unlitgeneric_dx9.cpp',
'unlittwotexture_dx9.cpp',
'vertexlitgeneric_dx9.cpp',
'vertexlitgeneric_dx9_helper.cpp',
'volume_clouds.cpp',
'volume_clouds_helper.cpp',
'vortwarp_dx9.cpp',
'vr_distort_hud.cpp',
'vr_distort_texture.cpp',
'warp.cpp',
'water.cpp',
'weapon_sheen_pass_helper.cpp',
'windowimposter_dx90.cpp',
'wireframe_dx9.cpp',
'worldtwotextureblend.cpp',
'worldvertexalpha.cpp',
'worldvertextransition.cpp',
'worldvertextransition_dx8_helper.cpp',
'writez_dx9.cpp',
'writestencil_dx9.cpp',
'eyeball.cpp'
# $Folder 'stdshader_dbg Files', [$X360]
# {
# 'debugdepth.cpp',
# 'DebugDrawEnvmapMask.cpp',
# 'debugluxel.cpp',
# 'debugnormalmap.cpp',
# 'debugtangentspace.cpp',
# 'fillrate.cpp',
]
includes = [
'.',
'../../public',
'../../public/tier0',
'../../public/tier1',
'fxctmp9',
'vshtmp9'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','shaderlib','tier1','mathlib']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

77
materialsystem/wscript

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'materialsystem'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES',[
'DEFINE_MATERIALSYSTEM_INTERFACE',
'MATERIALSYSTEM_EXPORTS',
'PROTECTED_THINGS_ENABLE',
'strncpy=use_Q_strncpy_instead',
'_snprintf=use_Q_snprintf_instead'
])
def build(bld):
source = [
'CColorCorrection.cpp',
'cmaterial.cpp',
'cmaterial_queuefriendly.cpp',
'CMaterialSubRect.cpp',
'cmaterialvar.cpp',
'cmatnullrendercontext.cpp',
'colorspace.cpp',
'ctexture.cpp',
'../public/filesystem_helpers.cpp',
'imagepacker.cpp',
'mat_stub.cpp',
'materialsystem_global.cpp',
'morph.cpp',
'occlusionquerymgr.cpp',
'shadersystem.cpp',
'texturemanager.cpp',
'pch_materialsystem.cpp',
'cmaterialdict.cpp',
'cmaterialsystem.cpp',
'cmatlightmaps.cpp',
'cmatrendercontext.cpp',
'cmatqueuedrendercontext.cpp',
'ctexturecompositor.cpp'
]
includes = [
'.',
'../../public',
'../../public/tier0',
'../../public/tier1',
'../../common',
'../'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','tier1','tier2','vstdlib','mathlib','bitmap','shaderlib','vtf']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

69
mathlib/wscript

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'mathlib'
def options(opt):
# stub
return
def configure(conf):
conf.define('MATHLIB_LIB',1)
def build(bld):
source = [
'color_conversion.cpp',
'halton.cpp',
'lightdesc.cpp',
'mathlib_base.cpp',
'powsse.cpp',
'sparse_convolution_noise.cpp',
'sseconst.cpp',
'sse.cpp', # [$WINDOWS||$POSIX]
'ssenoise.cpp',
'3dnow.cpp', # [$WINDOWS||$LINUX]
'anorms.cpp',
'bumpvects.cpp',
'IceKey.cpp',
'imagequant.cpp',
'polyhedron.cpp',
'quantize.cpp',
'randsse.cpp',
'spherical.cpp',
'simdvectormatrix.cpp',
'vector.cpp',
'vmatrix.cpp',
'almostequal.cpp'
]
includes = [
'.',
'../common',
'../public',
'../public/tier0',
'../public/mathlib'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

49
scenefilecache/wscript vendored

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'scenefilecache'
def options(opt):
# stub
return
def configure(conf):
conf.define('_WINDOWS',1) # WTF? this defined in original vpc file
conf.define('PROTECTED_THINGS_ENABLE',1)
def build(bld):
source = [
'SceneFileCache.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../game/shared'
]
defines = []
libs = ['tier0','tier1']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

15
scripts/continious_upload.sh

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
##################################
#
# GitHub Releases
#
##################################
set +x
# Disabled until GitHub sends prereleases to email
wget -O upload.sh "https://raw.githubusercontent.com/FWGS/uploadtool/master/upload.sh"
chmod +x upload.sh
export GITHUB_TOKEN=$GH_TOKEN
./upload.sh $*

BIN
scripts/waifulib/__pycache__/compiler_optimizations.cpython-39.pyc

Binary file not shown.

BIN
scripts/waifulib/__pycache__/enforce_pic.cpython-39.pyc

Binary file not shown.

BIN
scripts/waifulib/__pycache__/xcompile.cpython-38.pyc

Binary file not shown.

BIN
scripts/waifulib/__pycache__/xcompile.cpython-39.pyc

Binary file not shown.

BIN
scripts/waifulib/__pycache__/xshlib.cpython-38.pyc

Binary file not shown.

BIN
scripts/waifulib/__pycache__/xshlib.cpython-39.pyc

Binary file not shown.

164
scripts/waifulib/compiler_optimizations.py

@ -0,0 +1,164 @@ @@ -0,0 +1,164 @@
# encoding: utf-8
# compiler_optimizations.py -- main entry point for configuring C/C++ compilers
# Copyright (C) 2021 a1batross
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
try: from fwgslib import get_flags_by_type, get_flags_by_compiler
except: from waflib.extras.fwgslib import get_flags_by_type, get_flags_by_compiler
from waflib.Configure import conf
from waflib import Logs
'''
Flags can be overriden and new types can be added
by importing this as normal Python module
Example:
#!/usr/bin/env python
from waflib.extras import compiler_optimizations
compiler_optimizations.VALID_BUILD_TYPES += 'gottagofast'
compiler_optimizations.CFLAGS['gottagofast'] = {
'gcc': ['-Ogentoo']
}
'''
VALID_BUILD_TYPES = ['fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']
LINKFLAGS = {
'common': {
'msvc': ['/DEBUG'], # always create PDB, doesn't affect result binaries
'gcc': ['-Wl,--no-undefined'],
'owcc': ['-Wl,option stack=512k']
},
'sanitize': {
'clang': ['-fsanitize=undefined', '-fsanitize=address'],
'gcc': ['-fsanitize=undefined', '-fsanitize=address'],
}
}
CFLAGS = {
'common': {
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-', '/MT'],
'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden'],
'gcc': ['-fvisibility=hidden'],
'owcc': ['-fno-short-enum', '-ffloat-store', '-g3']
},
'fast': {
'msvc': ['/O2', '/Oy'],
'gcc': {
'3': ['-O3', '-fomit-frame-pointer'],
'default': ['-Ofast', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer']
},
'clang': ['-Ofast'],
'default': ['-O3']
},
'fastnative': {
'msvc': ['/O2', '/Oy'],
'gcc': ['-Ofast', '-march=native', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer'],
'clang': ['-Ofast', '-march=native'],
'default': ['-O3']
},
'release': {
'msvc': ['/O2'],
'owcc': ['-O3', '-foptimize-sibling-calls', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-fschedule-insns', '-funsafe-math-optimizations', '-funroll-loops', '-frerun-optimizer', '-finline-functions', '-finline-limit=512', '-fguess-branch-probability', '-fno-strict-aliasing', '-floop-optimize'],
'default': ['-O0']
},
'debug': {
'msvc': ['/Od'],
'owcc': ['-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
'default': ['-O0']
},
'sanitize': {
'msvc': ['/Od', '/RTC1'],
'gcc': ['-Og', '-fsanitize=undefined', '-fsanitize=address'],
'clang': ['-O0', '-fsanitize=undefined', '-fsanitize=address'],
'default': ['-O0']
},
'nooptimize': {
'msvc': ['/Od'],
'default': ['-O0']
}
}
LTO_CFLAGS = {
'msvc': ['/GL'],
'gcc': ['-flto'],
'clang': ['-flto']
}
LTO_LINKFLAGS = {
'msvc': ['/LTCG'],
'gcc': ['-flto'],
'clang': ['-flto']
}
POLLY_CFLAGS = {
'gcc': ['-fgraphite-identity'],
'clang': ['-mllvm', '-polly']
# msvc sosat :(
}
def options(opt):
grp = opt.add_option_group('Compiler optimization options')
grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default=None,
help = 'build type: debug, release or none(custom flags)')
grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False,
help = 'enable Link Time Optimization if possible [default: %default]')
grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False,
help = 'enable polyhedral optimization if possible [default: %default]')
def configure(conf):
conf.start_msg('Build type')
if conf.options.BUILD_TYPE == None:
conf.end_msg('not set', color='RED')
conf.fatal('Set a build type, for example "-T release"')
elif not conf.options.BUILD_TYPE in VALID_BUILD_TYPES:
conf.end_msg(conf.options.BUILD_TYPE, color='RED')
conf.fatal('Invalid build type. Valid are: %s' % ', '.join(VALID_BUILD_TYPES))
conf.end_msg(conf.options.BUILD_TYPE)
conf.msg('LTO build', 'yes' if conf.options.LTO else 'no')
conf.msg('PolyOpt build', 'yes' if conf.options.POLLY else 'no')
# -march=native should not be used
if conf.options.BUILD_TYPE.startswith('fast'):
Logs.warn('WARNING: \'%s\' build type should not be used in release builds', conf.options.BUILD_TYPE)
try:
conf.env.CC_VERSION[0]
except IndexError:
conf.env.CC_VERSION = (0,)
@conf
def get_optimization_flags(conf):
'''Returns a list of compile flags,
depending on build type and options set by user
NOTE: it doesn't filter out unsupported flags
:returns: tuple of cflags and linkflags
'''
linkflags = conf.get_flags_by_type(LINKFLAGS, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0])
cflags = conf.get_flags_by_type(CFLAGS, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0])
if conf.options.LTO:
linkflags+= conf.get_flags_by_compiler(LTO_LINKFLAGS, conf.env.COMPILER_CC)
cflags += conf.get_flags_by_compiler(LTO_CFLAGS, conf.env.COMPILER_CC)
if conf.options.POLLY:
cflags += conf.get_flags_by_compiler(POLLY_CFLAGS, conf.env.COMPILER_CC)
return cflags, linkflags

124
scripts/waifulib/owcc.py

@ -0,0 +1,124 @@ @@ -0,0 +1,124 @@
#! /usr/bin/env python
# encoding: utf-8
"""
Compiler definition for OpenWatcom's owcc
"""
from waflib import Errors, Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_owcc(conf):
v = conf.env
cc = None
if v.CC:
cc = v.CC
else:
cc = conf.find_program('cc', var='CC')
if not cc:
conf.fatal('owcc was not found')
try:
out = conf.cmd_and_log(cc + ['-v'])
except Errors.WafError:
conf.fatal('%r -v could not be executed' % cc)
if not 'Open Watcom' in out:
conf.fatal('failed to detect owcc')
v.CC = cc
v.CC_NAME = 'owcc'
v.CXX = v.CC
v.CXX_NAME = v.cc_NAME
if not v.AR:
conf.find_program('wlib', var='AR')
conf.add_os_flags('ARFLAGS')
if not v.ARFLAGS:
v.ARFLAGS = ['-fo']
@conf
def owcc_common_flags(conf):
v = conf.env
v.CC_SRC_F = ''
v.CXX_SRC_F = ''
v.CC_TGT_F = ['-c', '-o']
v.CXX_TGT_F = ['-c', '-o']
v.CPPPATH_ST = '-I%s'
v.DEFINES_ST = '-D%s'
if not v.LINK_CC:
v.LINK_CC = v.CC
if not v.LINK_CXX:
v.LINK_CXX = v.CXX
v.CCLNK_SRC_F = ''
v.CCLNK_TGT_F = ['-o']
v.CXXLNK_SRC_F = ''
v.CXXLNK_TGT_F = ['-o']
v.LIB_ST = '-l%s' # template for adding libs
v.LIBPATH_ST = '-L%s' # template for adding libpaths
v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
v.cprogram_PATTERN = '%s.exe'
v.cxxprogram_PATTERN = '%s.exe'
v.cshlib_PATTERN = 'lib%s.so'
v.cxxshlib_PATTERN = 'lib%s.so'
v.cstlib_PATTERN = '%s.a'
v.cxxstlib_PATTERN = '%s.a'
def find_target(flags):
if '-b' in flags:
return flags[flags.index('-b')+1]
@conf
def owcc_detect_platform(conf):
v = conf.env
target = find_target(v.LINKFLAGS)
if not target:
target = find_target(v.CC)
if not target:
target = find_target(v.CFLAGS)
if not target:
target = Utils.unversioned_sys_platform()
if target in ['dos4g', 'dos4gnz', 'dos32a', 'stub32a', 'stub32ac']:
v.DEST_BINFMT = 'le'
v.DEST_OS = 'dos'
elif target in ['dos32x', 'stub32x', 'stub32xc']:
v.DEST_BINFMT = 'lx'
v.DEST_OS = 'dos'
elif target.startswith('win') or target.startswith('nt'):
v.DEST_BINFMT = 'pe'
v.DEST_OS = 'win32'
elif target == 'qnx386':
v.DEST_OS = 'qnx'
v.DEST_BINFMT = 'qnx'
elif target in ['linux', '386']:
v.DEST_OS = 'linux'
v.DEST_BINFMT = 'elf'
else:
v.DEST_OS = target
v.DEST_BINFMT = None
v.DEST_CPU = 'i386'
for f in v.LINKFLAGS + v.CC + v.CFLAGS:
if f.startswith('-march'):
v.DEST_CPU=f.split('=')[1]
break
def configure(conf):
conf.find_owcc()
conf.owcc_common_flags()
conf.cc_load_tools()
conf.cc_add_flags()
conf.env.append_unique('CFLAGS','-Wc,-xx')
conf.cxx_load_tools()
conf.cxx_add_flags()
conf.env.append_unique('CXXFLAGS','-Wc,-xx')
conf.link_add_flags()
conf.owcc_detect_platform()

433
scripts/waifulib/xcompile.py

@ -0,0 +1,433 @@ @@ -0,0 +1,433 @@
# encoding: utf-8
# xcompile.py -- crosscompiling utils
# Copyright (C) 2018 a1batross
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
try: from fwgslib import get_flags_by_compiler
except: from waflib.extras.fwgslib import get_flags_by_compiler
from waflib import Logs, TaskGen
from waflib.Tools import c_config
from collections import OrderedDict
import os
import sys
ANDROID_NDK_ENVVARS = ['ANDROID_NDK_HOME', 'ANDROID_NDK']
ANDROID_NDK_SUPPORTED = [10, 19, 20]
ANDROID_NDK_HARDFP_MAX = 11 # latest version that supports hardfp
ANDROID_NDK_GCC_MAX = 17 # latest NDK that ships with GCC
ANDROID_NDK_UNIFIED_SYSROOT_MIN = 15
ANDROID_NDK_SYSROOT_FLAG_MAX = 19 # latest NDK that need --sysroot flag
ANDROID_NDK_API_MIN = { 10: 3, 19: 16, 20: 16 } # minimal API level ndk revision supports
ANDROID_64BIT_API_MIN = 21 # minimal API level that supports 64-bit targets
# This class does support ONLY r10e and r19c/r20 NDK
class Android:
ctx = None # waf context
arch = None
toolchain = None
api = None
ndk_home = None
ndk_rev = 0
is_hardfloat = False
clang = False
def __init__(self, ctx, arch, toolchain, api):
self.ctx = ctx
self.api = api
self.toolchain = toolchain
self.arch = arch
for i in ANDROID_NDK_ENVVARS:
self.ndk_home = os.getenv(i)
if self.ndk_home != None:
break
else:
ctx.fatal('Set %s environment variable pointing to the root of Android NDK!' %
' or '.join(ANDROID_NDK_ENVVARS))
# TODO: this were added at some point of NDK development
# but I don't know at which version
# r10e don't have it
source_prop = os.path.join(self.ndk_home, 'source.properties')
if os.path.exists(source_prop):
with open(source_prop) as ndk_props_file:
for line in ndk_props_file.readlines():
tokens = line.split('=')
trimed_tokens = [token.strip() for token in tokens]
if 'Pkg.Revision' in trimed_tokens:
self.ndk_rev = int(trimed_tokens[1].split('.')[0])
if self.ndk_rev not in ANDROID_NDK_SUPPORTED:
ctx.fatal('Unknown NDK revision: %d' % (self.ndk_rev))
else:
self.ndk_rev = ANDROID_NDK_SUPPORTED[0]
if 'clang' in self.toolchain or self.ndk_rev > ANDROID_NDK_GCC_MAX:
self.clang = True
if self.arch == 'armeabi-v7a-hard':
if self.ndk_rev <= ANDROID_NDK_HARDFP_MAX:
self.arch = 'armeabi-v7a' # Only armeabi-v7a have hard float ABI
self.is_hardfloat = True
else:
ctx.fatal('NDK does not support hardfloat ABI')
if self.api < ANDROID_NDK_API_MIN[self.ndk_rev]:
self.api = ANDROID_NDK_API_MIN[self.ndk_rev]
Logs.warn('API level automatically was set to %d due to NDK support' % self.api)
if self.is_arm64() or self.is_amd64() and self.api < ANDROID_64BIT_API_MIN:
self.api = ANDROID_64BIT_API_MIN
Logs.warn('API level for 64-bit target automatically was set to %d' % self.api)
def is_host(self):
'''
Checks if we using host compiler(implies clang)
'''
return self.toolchain == 'host'
def is_arm(self):
'''
Checks if selected architecture is **32-bit** ARM
'''
return self.arch.startswith('armeabi')
def is_x86(self):
'''
Checks if selected architecture is **32-bit** or **64-bit** x86
'''
return self.arch == 'x86'
def is_amd64(self):
'''
Checks if selected architecture is **64-bit** x86
'''
return self.arch == 'x86_64'
def is_arm64(self):
'''
Checks if selected architecture is AArch64
'''
return self.arch == 'aarch64'
def is_clang(self):
'''
Checks if selected toolchain is Clang (TODO)
'''
return self.clang
def is_hardfp(self):
return self.is_hardfloat
def ndk_triplet(self, llvm_toolchain = False, toolchain_folder = False):
if self.is_x86():
if toolchain_folder:
return 'x86'
else:
return 'i686-linux-android'
elif self.is_arm():
if llvm_toolchain:
return 'armv7a-linux-androideabi'
else:
return 'arm-linux-androideabi'
elif self.is_amd64() and toolchain_folder:
return 'x86_64'
else:
return self.arch + '-linux-android'
def apk_arch(self):
if self.is_arm64():
return 'arm64-v8a'
return self.arch
def gen_host_toolchain(self):
# With host toolchain we don't care about OS
# so just download NDK for Linux x86_64
if 'HOST_TOOLCHAIN' in self.ctx.environ:
return self.ctx.environ['HOST_TOOLCHAIN']
if self.is_host():
return 'linux-x86_64'
if sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
osname = 'windows'
elif sys.platform.startswith('darwin'):
osname = 'darwin'
elif sys.platform.startswith('linux'):
osname = 'linux'
else:
self.ctx.fatal('Unsupported by NDK host platform')
if sys.maxsize > 2**32:
arch = 'x86_64'
else: arch = 'x86'
return '%s-%s' % (osname, arch)
def gen_gcc_toolchain_path(self):
path = 'toolchains'
toolchain_host = self.gen_host_toolchain()
if self.is_clang():
toolchain_folder = 'llvm'
else:
if self.is_host():
toolchain = '4.9'
else:
toolchain = self.toolchain
toolchain_folder = '%s-%s' % (self.ndk_triplet(toolchain_folder = True), toolchain)
return os.path.abspath(os.path.join(self.ndk_home, path, toolchain_folder, 'prebuilt', toolchain_host))
def gen_toolchain_path(self):
if self.is_clang():
triplet = '%s%d-' % (self.ndk_triplet(llvm_toolchain = True), self.api)
else:
triplet = self.ndk_triplet() + '-'
return os.path.join(self.gen_gcc_toolchain_path(), 'bin', triplet)
def gen_binutils_path(self):
return os.path.join(self.gen_gcc_toolchain_path(), self.ndk_triplet(), 'bin')
def cc(self):
if self.is_host():
return 'clang --target=%s%d' % (self.ndk_triplet(), self.api)
return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc')
def cxx(self):
if self.is_host():
return 'clang++ --target=%s%d' % (self.ndk_triplet(), self.api)
return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++')
def strip(self):
if self.is_host():
return 'llvm-strip'
return os.path.join(self.gen_binutils_path(), 'strip')
def system_stl(self):
# TODO: proper STL support
return os.path.abspath(os.path.join(self.ndk_home, 'sources', 'cxx-stl', 'system', 'include'))
def libsysroot(self):
arch = self.arch
if self.is_arm():
arch = 'arm'
elif self.is_arm64():
arch = 'arm64'
path = 'platforms/android-%s/arch-%s' % (self.api, arch)
return os.path.abspath(os.path.join(self.ndk_home, path))
def sysroot(self):
if self.ndk_rev >= ANDROID_NDK_UNIFIED_SYSROOT_MIN:
return os.path.abspath(os.path.join(self.ndk_home, 'sysroot'))
else:
return self.libsysroot()
def cflags(self, cxx = False):
cflags = []
if self.ndk_rev <= ANDROID_NDK_SYSROOT_FLAG_MAX:
cflags += ['--sysroot=%s' % (self.sysroot())]
else:
if self.is_host():
cflags += [
'--sysroot=%s/sysroot' % (self.gen_gcc_toolchain_path()),
'-isystem', '%s/usr/include/' % (self.sysroot())
]
cflags += ['-I%s' % (self.system_stl()), '-DANDROID', '-D__ANDROID__']
if cxx and not self.is_clang() and self.toolchain not in ['4.8','4.9']:
cflags += ['-fno-sized-deallocation']
def fixup_host_clang_with_old_ndk():
cflags = []
# Clang builtin redefine w/ different calling convention bug
# NOTE: I did not added complex.h functions here, despite
# that NDK devs forgot to put __NDK_FPABI_MATH__ for complex
# math functions
# I personally don't need complex numbers support, but if you want it
# just run sed to patch header
for f in ['strtod', 'strtof', 'strtold']:
cflags += ['-fno-builtin-%s' % f]
return cflags
if self.is_arm():
if self.arch == 'armeabi-v7a':
# ARMv7 support
cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS', '-DVECTORIZE_SINCOS']
if not self.is_clang() and not self.is_host():
cflags += [ '-mvectorize-with-neon-quad' ]
if self.is_host() and self.ndk_rev <= ANDROID_NDK_HARDFP_MAX:
cflags += fixup_host_clang_with_old_ndk()
if self.is_hardfp():
cflags += ['-D_NDK_MATH_NO_SOFTFP=1', '-mfloat-abi=hard', '-DLOAD_HARDFP', '-DSOFTFP_LINK']
else:
cflags += ['-mfloat-abi=softfp']
else:
if self.is_host() and self.ndk_rev <= ANDROID_NDK_HARDFP_MAX:
cflags += fixup_host_clang_with_old_ndk()
# ARMv5 support
cflags += ['-march=armv5te', '-msoft-float']
elif self.is_x86():
cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse', '-DVECTORIZE_SINCOS', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS']
return cflags
# they go before object list
def linkflags(self):
linkflags = []
if self.is_host():
linkflags += ['--gcc-toolchain=%s' % self.gen_gcc_toolchain_path()]
if self.ndk_rev <= ANDROID_NDK_SYSROOT_FLAG_MAX:
linkflags += ['--sysroot=%s' % (self.sysroot())]
elif self.is_host():
linkflags += ['--sysroot=%s/sysroot' % (self.gen_gcc_toolchain_path())]
if self.is_clang() or self.is_host():
linkflags += ['-fuse-ld=lld']
linkflags += ['-Wl,--hash-style=sysv', '-Wl,--no-undefined', '-no-canonical-prefixes']
return linkflags
def ldflags(self):
ldflags = ['-lgcc', '-no-canonical-prefixes']
if self.is_clang() or self.is_host():
ldflags += ['-stdlib=libstdc++']
if self.is_arm():
if self.arch == 'armeabi-v7a':
ldflags += ['-march=armv7-a', '-mthumb']
if not self.is_clang() and not self.is_host(): # lld only
ldflags += ['-Wl,--fix-cortex-a8']
if self.is_hardfp():
ldflags += ['-Wl,--no-warn-mismatch', '-lm_hard']
else:
ldflags += ['-march=armv5te']
return ldflags
def options(opt):
android = opt.add_option_group('Android options')
android.add_option('--android', action='store', dest='ANDROID_OPTS', default=None,
help='enable building for android, format: --android=<arch>,<toolchain>,<api>, example: --android=armeabi-v7a-hard,4.9,9')
magx = opt.add_option_group('MotoMAGX options')
magx.add_option('--enable-magx', action = 'store_true', dest = 'MAGX', default = False,
help = 'enable targetting for MotoMAGX phones [default: %default]')
def configure(conf):
if conf.options.ANDROID_OPTS:
values = conf.options.ANDROID_OPTS.split(',')
if len(values) != 3:
conf.fatal('Invalid --android paramater value!')
valid_archs = ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'aarch64']
if values[0] not in valid_archs:
conf.fatal('Unknown arch: %s. Supported: %r' % (values[0], ', '.join(valid_archs)))
conf.android = android = Android(conf, values[0], values[1], int(values[2]))
conf.environ['CC'] = android.cc()
conf.environ['CXX'] = android.cxx()
conf.environ['STRIP'] = android.strip()
conf.env.CFLAGS += android.cflags()
conf.env.CXXFLAGS += android.cflags(True)
conf.env.LINKFLAGS += android.linkflags()
conf.env.LDFLAGS += android.ldflags()
conf.env.HAVE_M = True
if android.is_hardfp():
conf.env.LIB_M = ['m_hard']
else: conf.env.LIB_M = ['m']
conf.env.PREFIX = '/lib/%s' % android.apk_arch()
conf.msg('Selected Android NDK', '%s, version: %d' % (android.ndk_home, android.ndk_rev))
# no need to print C/C++ compiler, as it would be printed by compiler_c/cxx
conf.msg('... C/C++ flags', ' '.join(android.cflags()).replace(android.ndk_home, '$NDK/'))
conf.msg('... link flags', ' '.join(android.linkflags()).replace(android.ndk_home, '$NDK/'))
conf.msg('... ld flags', ' '.join(android.ldflags()).replace(android.ndk_home, '$NDK/'))
# conf.env.ANDROID_OPTS = android
conf.env.DEST_OS2 = 'android'
elif conf.options.MAGX:
# useless to change toolchain path, as toolchain meant to be placed in this path
toolchain_path = '/opt/toolchains/motomagx/arm-eabi2/lib/'
conf.env.INCLUDES_MAGX = [toolchain_path + i for i in ['ezx-z6/include', 'qt-2.3.8/include']]
conf.env.LIBPATH_MAGX = [toolchain_path + i for i in ['ezx-z6/lib', 'qt-2.3.8/lib']]
conf.env.LINKFLAGS_MAGX = ['-Wl,-rpath-link=' + i for i in conf.env.LIBPATH_MAGX]
for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']:
conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX')
conf.env.MAGX = conf.options.MAGX
MACRO_TO_DESTOS = OrderedDict({ '__ANDROID__' : 'android' })
for k in c_config.MACRO_TO_DESTOS:
MACRO_TO_DESTOS[k] = c_config.MACRO_TO_DESTOS[k] # ordering is important
c_config.MACRO_TO_DESTOS = MACRO_TO_DESTOS
def post_compiler_cxx_configure(conf):
conf.msg('Target OS', conf.env.DEST_OS)
conf.msg('Target CPU', conf.env.DEST_CPU)
conf.msg('Target binfmt', conf.env.DEST_BINFMT)
if conf.options.ANDROID_OPTS:
if conf.android.ndk_rev == 19:
conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++']
conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++']
return
def post_compiler_c_configure(conf):
conf.msg('Target OS', conf.env.DEST_OS)
conf.msg('Target CPU', conf.env.DEST_CPU)
conf.msg('Target binfmt', conf.env.DEST_BINFMT)
return
from waflib.Tools import compiler_cxx, compiler_c
compiler_cxx_configure = getattr(compiler_cxx, 'configure')
compiler_c_configure = getattr(compiler_c, 'configure')
def patch_compiler_cxx_configure(conf):
compiler_cxx_configure(conf)
post_compiler_cxx_configure(conf)
def patch_compiler_c_configure(conf):
compiler_c_configure(conf)
post_compiler_c_configure(conf)
setattr(compiler_cxx, 'configure', patch_compiler_cxx_configure)
setattr(compiler_c, 'configure', patch_compiler_c_configure)
@TaskGen.feature('cshlib', 'cxxshlib', 'dshlib', 'fcshlib', 'vnum')
@TaskGen.after_method('apply_link', 'propagate_uselib_vars')
@TaskGen.before_method('apply_vnum')
def apply_android_soname(self):
"""
Enforce SONAME on Android
"""
if self.env.DEST_OS != 'android':
return
setattr(self, 'vnum', None) # remove vnum, so SONAME would not be overwritten
link = self.link_task
node = link.outputs[0]
libname = node.name
v = self.env.SONAME_ST % libname
self.env.append_value('LINKFLAGS', v.split())

115
scripts/waifulib/xshlib.py

@ -0,0 +1,115 @@ @@ -0,0 +1,115 @@
# encoding: utf-8
# xshlib.py -- advanced linking utils
# Copyright (C) 2019 mittorn
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
from waflib import Logs, Utils, TaskGen, Task
from waflib.Tools import ccroot, c, cxx
MAIN_BINARY = 'xash'
def options(opt):
opt.add_option('--static-linking', action='store', dest='STATIC_LINKING', default=None)
def configure(conf):
if conf.options.STATIC_LINKING:
conf.find_program('ld')
conf.find_program('objcopy')
conf.env.STATIC_LINKING = conf.options.STATIC_LINKING
conf.add_os_flags('LD_RELOCATABLE_FLAGS')
def build(bld):
if bld.env.STATIC_LINKING:
apply_static(MAIN_BINARY,*bld.env.STATIC_LINKING.split(','))
class objcopy_relocatable_lib(Task.Task):
"remove all exports except of lib_${NAME}_exports"
no_errcheck_out = True
run_str = '${OBJCOPY} -G lib_${NAME}_exports ${SRC[0].abspath()} ${TGT[0].abspath()}'
def keyword(self):
return 'ObjCopy'
class xshlib(ccroot.link_task):
"make relocatable library"
no_errcheck_out = True
run_str = '${LD} -r -o ${TGT[0].abspath()} ${LD_RELOCATABLE_FLAGS} ${CCLNK_SRC_F}${SRC}'
def add_target(self, target):
"create objcopy task for target"
if not self.env.LD_RELOCATABLE_FLAGS:
self.env.LD_RELOCATABLE_FLAGS = []
if '-m32' in self.env.LINKFLAGS:
self.env.LD_RELOCATABLE_FLAGS.append('-melf_i386')
base = self.generator.path
target_unstripped = base.find_or_declare('%s.unstripped.o'% target)
target_stripped = base.find_or_declare('%s.o'% target)
self.set_outputs(target_unstripped)
self.generator.objcopy_task= self.generator.create_task('objcopy_relocatable_lib', target_unstripped, target_stripped)
self.generator.objcopy_task.env['NAME'] = target
class cprogram_static(c.cprogram):
"build static c program"
run_str = '${LINK_CC} -static ${LINKFLAGS} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${STLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
class cxxprogram_static(cxx.cxxprogram):
"build static cxx program"
run_str = '${LINK_CXX} -static ${LINKFLAGS} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${STLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
# usevars are same
ccroot.USELIB_VARS['cprogram_static'] = ccroot.USELIB_VARS['cxxprogram_static'] = ccroot.USELIB_VARS['cxxprogram']
def apply_static(main, *reloc):
"apply xshlib tasks and generate files"
def write_libraries_list(out_node):
"generate library list"
libraries = reloc
externs = '\n'.join(['extern table_t lib_%s_exports[];' % e for e in libraries])
table = '\n'.join(['{ "%s", &lib_%s_exports },' % (e, e) for e in libraries])
out_node.write('%s\nstruct {const char *name;void *func;} libs[] = {\n%s\n{0,0}\n};\n' % (externs, table ))
def write_export_list(name, in_node, out_node):
"generate exports list for library"
exports = in_node.read().splitlines()
externs = '\n'.join(['extern void %s(void);' % e for e in exports])
table = '\n'.join(['{ "%s", &%s },' % (e, e) for e in exports])
out_node.write('%s\nstruct {const char *name;void *func;} lib_%s_exports[] = {\n%s\n{0,0}\n};\n' % (externs, name, table ))
@TaskGen.feature('cshlib', 'cxxshlib')
@TaskGen.before('process_source', 'propogate_uselib_vars')
def apply_xshlib(self):
"apply xshlib feature and inject link_helper.c to sources"
if self.name in reloc:
for k in ('cshlib', 'cxxshlib'):
if k in self.features:
self.features.remove(k)
self.features.append('xshlib')
in_node = self.path.get_src().make_node('exports.txt')
bldnode = self.path.get_bld()
bldnode.mkdir()
out_node = bldnode.make_node('link_helper.c')
write_export_list(self.name,in_node, out_node)
self.source = Utils.to_list(self.source) + [out_node]
@TaskGen.feature('cshlib', 'cxxshlib', 'cprogram', 'cxxprogram', 'cprogram_static', 'cxxprogram_static')
@TaskGen.before('process_source')
def add_deps(self):
"add all relocatable objects to main binary source list"
if self.name == main:
write_libraries_list(self.path.get_bld().make_node('generated_library_tables.h'))
for t in reloc:
self.source += [self.bld.get_tgen_by_name(t).objcopy_task.outputs[0]]

72
serverbrowser/wscript

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'ServerBrowser'
def options(opt):
# stub
return
def configure(conf):
conf.define('SERVERBROWSER_EXPORTS',1)
conf.define('VERSION_SAFE_STEAM_API_INTERFACES',1)
conf.define('SERVERBROWSER_EXPORTS',1)
conf.define('GAME_SRC',1)
conf.define('_USE_32BIT_TIME_T',1)
def build(bld):
source = [
'BaseGamesPage.cpp',
'BlacklistedServers.cpp',
'CustomGames.cpp',
'DialogAddServer.cpp',
'DialogGameInfo.cpp',
'DialogServerPassword.cpp',
'FavoriteGames.cpp',
'FriendsGames.cpp',
'HistoryGames.cpp',
'InternetGames.cpp',
'LanGames.cpp',
'ModList.cpp',
'ServerBrowser.cpp',
'ServerBrowserDialog.cpp',
'ServerContextMenu.cpp',
'ServerListCompare.cpp',
'SpectateGames.cpp',
'VACBannedConnRefusedDialog.cpp',
'QuickListPanel.cpp',
'../public/vgui_controls/vgui_controls.cpp',
'../common/ServerBrowser/blacklisted_server_manager.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
]
defines = []
libs = ['tier0','vgui_controls','mathlib','tier1','tier2','tier3','vstdlib','steam_api']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

53
soundemittersystem/wscript

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'SoundEmitterSystem'
def options(opt):
# stub
return
def configure(conf):
conf.define('SOUNDEMITTERSYSTEM_EXPORTS',1)
conf.define('_WINDOWS',1)
conf.define('PROTECTED_THINGS_ENABLE',1)
#conf.define('fopen','dont_use_fopen') # WINDOWS
def build(bld):
source = [
'../game/shared/interval.cpp',
'soundemittersystembase.cpp',
'../public/SoundParametersInternal.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../game/shared'
]
defines = []
libs = ['tier0','tier1','vstdlib']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

60
studiorender/wscript

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'StudioRender'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES',[
'STUDIORENDER_EXPORTS',
'PROTECTED_THINGS_ENABLE'
])
def build(bld):
source = [
'studiorender.cpp',
'studiorendercontext.cpp',
'flexrenderdata.cpp',
'r_studio.cpp',
'r_studiodecal.cpp',
'r_studiodraw.cpp',
'r_studiodraw_computeflexedvertex.cpp',
'r_studioflex.cpp',
'r_studiogettriangles.cpp',
'r_studiolight.cpp',
'r_studiostats.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
]
defines = []
libs = ['tier0','tier1','tier2','tier3','vstdlib','mathlib','bitmap']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

2
thirdparty

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 495addbab3e40a60e3e7c7ebf3ee405a53148b0c
Subproject commit 31ae58f64f9169db7f4e02c83dba46e5a47e0c7b

84
tier0/wscript

@ -0,0 +1,84 @@ @@ -0,0 +1,84 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'tier0'
def options(opt):
# stub
return
def configure(conf):
conf.define('TIER0_DLL_EXPORT',1)
# conf.define('NO_HOOK_MALLOC',1)
def build(bld):
source = [
'assert_dialog.cpp',
#'assert_dialog.rc', [$WINDOWS]
'commandline.cpp',
'cpu.cpp',
'cpumonitoring.cpp',
'cpu_posix.cpp', #[$POSIX]
'cpu_usage.cpp',
'dbg.cpp',
'dynfunction.cpp',
#'etwprof.cpp', [$WINDOWS]
'fasttimer.cpp',
# 'InterlockedCompareExchange128.masm', [$WIN64]
'mem.cpp',
'mem_helpers.cpp',
'memdbg.cpp',
'memstd.cpp',
'memvalidate.cpp',
'minidump.cpp',
'pch_tier0.cpp',
#'platform.cpp', [$WINDOWS||$X360]
'platform_posix.cpp', # [$POSIX]
#'pmc360.cpp', [$X360]
#'pme.cpp', [$WINDOWS]
'pme_posix.cpp', # [$POSIX]
'PMELib.cpp', #[$WINDOWS||$POSIX]
'progressbar.cpp',
'security.cpp',
'systeminformation.cpp',
'stacktools.cpp',
'thread.cpp', #[$WINDOWS||$POSIX]
'threadtools.cpp',
'tier0_strtools.cpp',
'tslist.cpp',
#'vcrmode.cpp', #[$WINDOWS]
'vcrmode_posix.cpp', #[$POSIX]
'vprof.cpp',
# 'win32consoleio.cpp', [$WINDOWS]
'../tier1/pathmatch.cpp' # [$LINUXALL]
]
includes = [
'.',
'../public',
'../public/tier0',
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['DL']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

92
tier1/wscript

@ -0,0 +1,92 @@ @@ -0,0 +1,92 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'tier1'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES', ['TIER1_STATIC_LIB=1'])
def build(bld):
print(bld)
source = [
'../utils/lzma/C/LzmaDec.c',
'bitbuf.cpp',
'byteswap.cpp',
'characterset.cpp',
'checksum_crc.cpp',
'checksum_md5.cpp',
'checksum_sha1.cpp',
'commandbuffer.cpp',
'convar.cpp',
'datamanager.cpp',
'diff.cpp',
'generichash.cpp',
'ilocalize.cpp',
'interface.cpp',
'KeyValues.cpp',
'keyvaluesjson.cpp',
'kvpacker.cpp',
'lzmaDecoder.cpp',
'lzss.cpp', # [!$SOURCESDK]
'mempool.cpp',
'memstack.cpp',
'NetAdr.cpp',
'newbitbuf.cpp',
'pathmatch.cpp', # [$LINUXALL]
# 'processor_detect.cpp', # [$WINDOWS||$X360]
'processor_detect_linux.cpp', # [$POSIX]
'qsort_s.cpp', # [$LINUXALL||$PS3]
'rangecheckedvar.cpp',
'reliabletimer.cpp',
'snappy-sinksource.cpp',
'snappy-stubs-internal.cpp',
'snappy.cpp',
'sparsematrix.cpp',
'splitstring.cpp',
'stringpool.cpp',
'strtools.cpp',
'strtools_unicode.cpp',
'tier1.cpp',
'tokenreader.cpp',
'uniqueid.cpp',
'utlbinaryblock.cpp',
'utlbuffer.cpp',
'utlbufferutil.cpp',
'utlstring.cpp',
'utlsymbol.cpp'
]
includes = [
'.',
'../public',
'../public/tier1',
'../public/tier0'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

66
tier2/wscript

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'tier2'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'beamsegdraw.cpp',
'defaultfilesystem.cpp',
'dmconnect.cpp',
'fileutils.cpp',
'keybindings.cpp',
'../public/map_utils.cpp',
'../public/materialsystem/MaterialSystemUtil.cpp',
'camerautils.cpp',
'meshutils.cpp',
'p4helpers.cpp',
'renderutils.cpp',
'riff.cpp',
'soundutils.cpp',
'tier2.cpp',
'util_init.cpp',
'utlstreambuffer.cpp',
'vconfig.cpp',
'keyvaluesmacros.cpp'
]
includes = [
'.',
'../common',
'../public',
'../public/tier0',
'../public/tier1',
'../public/tier2',
] + bld.env.INCLUDES_SDL2
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

54
tier3/wscript

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'tier3'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'tier3.cpp',
'mdlutils.cpp',
'choreoutils.cpp',
'scenetokenprocessor.cpp',
'studiohdrstub.cpp'
]
includes = [
'.',
'../common',
'../public',
'../public/tier0',
'../public/tier1',
'../public/tier2',
'../public/tier3'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

63
togl/wscript

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'togl'
def options(opt):
# stub
return
def configure(conf):
conf.define('TOGL_DLL_EXPORT',1)
conf.define('PROTECTED_THINGS_ENABLE',1)
conf.env.append_unique('DEFINES',['strncpy=use_Q_strncpy_instead',
'_snprintf=use_Q_snprintf_instead'])
def build(bld):
source = [
'linuxwin/dx9asmtogl2.cpp',
'linuxwin/dxabstract.cpp',
'linuxwin/glentrypoints.cpp',
'linuxwin/glmgr.cpp',
'linuxwin/glmgrbasics.cpp',
#'linuxwin/glmgrcocoa.mm', [$OSXALL]
#'linuxwin/intelglmallocworkaround.cpp', [$OSXALL]
#'linuxwin/mach_override.c', [$OSXALL]
'linuxwin/cglmtex.cpp',
'linuxwin/cglmfbo.cpp',
'linuxwin/cglmprogram.cpp',
'linuxwin/cglmbuffer.cpp',
'linuxwin/cglmquery.cpp',
'linuxwin/asanstubs.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','tier1','tier2','vstdlib','mathlib']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

56
utils/bzip2/wscript

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'bzip2'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('CFLAGS',['-std=gnu11'])
def build(bld):
source = [
'blocksort.c',
'bzip2.c',
'bzlib.c',
'compress.c',
'crctable.c',
'decompress.c',
'huffman.c',
'randtable.c'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

67
vgui2/matsys_controls/wscript

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'matsys_controls'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'assetpicker.cpp',
'baseassetpicker.cpp',
'colorpickerpanel.cpp',
'curveeditorpanel.cpp',
'gamefiletreeview.cpp',
'manipulator.cpp',
'matsyscontrols.cpp',
'mdlpanel.cpp',
'mdlpicker.cpp',
'mdlsequencepicker.cpp',
'picker.cpp',
'potterywheelpanel.cpp',
'proceduraltexturepanel.cpp',
'QCGenerator.cpp',
'sequencepicker.cpp',
'tgapreviewpanel.cpp',
'vmtpicker.cpp',
'vmtpreviewpanel.cpp',
'vtfpicker.cpp',
'vtfpreviewpanel.cpp',
'vmtpanel.cpp'
]
includes = [
'.',
'../../public',
'../../public/tier0',
'../../public/tier1'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

69
vgui2/src/wscript

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'vgui2'
def options(opt):
# stub
return
def configure(conf):
conf.define('DONT_PROTECT_FILEIO_FUNCTIONS',1)
def build(bld):
source = [
'Bitmap.cpp',
'Border.cpp',
'ScalableImageBorder.cpp',
'ImageBorder.cpp',
'fileimage.cpp',
'../../public/filesystem_helpers.cpp',
'../../public/filesystem_init.cpp',
'InputWin32.cpp',
'LocalizedStringTable.cpp',
'MemoryBitmap.cpp',
'MessageListener.cpp',
'Scheme.cpp',
#'Surface.cpp', [$WIN32]
#'System.cpp', [$WINDOWS||$X360]
'system_posix.cpp',# [$POSIX]
'../../public/UnicodeFileHelpers.cpp',
'vgui.cpp',
'vgui_internal.cpp',
'vgui_key_translation.cpp',
'VPanel.cpp',
'VPanelWrapper.cpp',
'keyrepeat.cpp'
]
includes = [
'.',
'../../public',
'../../public/tier0',
'../../public/tier1',
'../../common'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','tier1','tier2','tier3','vstdlib','SDL2']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

123
vgui2/vgui_controls/wscript

@ -0,0 +1,123 @@ @@ -0,0 +1,123 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'vgui_controls'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'AnalogBar.cpp',
'AnimatingImagePanel.cpp',
'AnimationController.cpp',
'BitmapImagePanel.cpp',
'BuildFactoryHelper.cpp',
'BuildGroup.cpp',
'BuildModeDialog.cpp',
'Button.cpp',
'CheckButton.cpp',
'CheckButtonList.cpp',
'CircularProgressBar.cpp',
'ComboBox.cpp',
'consoledialog.cpp',
'ControllerMap.cpp',
'controls.cpp',
'cvartogglecheckbutton.cpp',
'DirectorySelectDialog.cpp',
'Divider.cpp',
'EditablePanel.cpp',
'ExpandButton.cpp',
'FileOpenDialog.cpp',
'FileOpenStateMachine.cpp',
'../../public/filesystem_helpers.cpp',
'FocusNavGroup.cpp',
'Frame.cpp',
'GraphPanel.cpp',
'HTML.cpp',
'Image.cpp',
'ImageList.cpp',
'ImagePanel.cpp',
'InputDialog.cpp',
'KeyBindingHelpDialog.cpp',
'KeyBoardEditorDialog.cpp',
'KeyRepeat.cpp',
'Label.cpp',
'ListPanel.cpp',
'ListViewPanel.cpp',
'Menu.cpp',
'MenuBar.cpp',
'MenuButton.cpp',
'MenuItem.cpp',
'MessageBox.cpp',
'MessageDialog.cpp',
'Panel.cpp',
'PanelListPanel.cpp',
'PerforceFileExplorer.cpp',
'PerforceFileList.cpp',
'perforcefilelistframe.cpp',
'ProgressBar.cpp',
'ProgressBox.cpp',
'PropertyDialog.cpp',
'PropertyPage.cpp',
'PropertySheet.cpp',
'QueryBox.cpp',
'RadioButton.cpp',
'RichText.cpp',
'RotatingProgressBar.cpp',
'savedocumentquery.cpp',
'ScalableImagePanel.cpp',
'ScrollableEditablePanel.cpp',
'ScrollBar.cpp',
'ScrollBarSlider.cpp',
'SectionedListPanel.cpp',
'Slider.cpp',
'Splitter.cpp',
'subrectimage.cpp',
'TextEntry.cpp',
'TextImage.cpp',
'ToggleButton.cpp',
'Tooltip.cpp',
'ToolWindow.cpp',
'TreeView.cpp',
'TreeViewListControl.cpp',
'URLLabel.cpp',
'WizardPanel.cpp',
'WizardSubPanel.cpp',
'../src/vgui_key_translation.cpp'
]
includes = [
'.',
'../../public',
'../../public/tier0',
'../../public/tier1'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

54
vgui2/vgui_surfacelib/wscript

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'vgui_surfacelib'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'BitmapFont.cpp',
'FontAmalgam.cpp',
'FontManager.cpp',
'FontEffects.cpp',
#'Win32Font.cpp', [$WIN32 && !$X360]
#'Win32Font_x360.cpp', [$X360]
#'osxfont.cpp', [$OSXALL]
'linuxfont.cpp' # [$LINUXALL]
]
includes = [
'.',
'../../public',
'../../public/tier0',
'../../public/tier1',
'../../common'
] + bld.env.INCLUDES_FT2
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

61
vguimatsurface/wscript

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils, Configure
import os
top = '.'
PROJECT_NAME = 'vguimatsurface'
def options(opt):
# stub
return
def configure(conf):
conf.define('VGUIMATSURFACE_DLL_EXPORT',1)
conf.define('GAMEUI_EXPORTS',1)
conf.define('DONT_PROTECT_FILEIO_FUNCTIONS',1)
conf.define('PROTECTED_THINGS_ENABLE',1)
def build(bld):
source = [
'Clip2D.cpp',
'Cursor.cpp',
'../public/filesystem_helpers.cpp',
'FontTextureCache.cpp',
'Input.cpp',
'MatSystemSurface.cpp',
'asanstubs.cpp',
#'memorybitmap.cpp', [$WIN32]
'TextureDictionary.cpp',
'../vgui2/src/vgui_key_translation.cpp',
'../public/vgui_controls/vgui_controls.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
] + bld.env.INCLUDES_SDL2 + bld.env.INCLUDES_FREETYPE
defines = []
libs = ['bitmap','mathlib','tier0','vgui_controls','tier1','vstdlib','tier2','tier3','vgui_surfacelib','FT2','FC','SDL2']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

48
video/wscript

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'video_services'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'videoservices.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','tier1','tier2','tier3','vstdlib']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

49
vpklib/wscript

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'vpklib'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'packedstore.cpp',
'../common/simplebitstring.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

57
vstdlib/wscript

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'vstdlib'
def options(opt):
# stub
return
def configure(conf):
conf.define('VSTDLIB_DLL_EXPORT',1)
def build(bld):
source = [
#'xbox\___FirstModule.cpp' [$X360]
'coroutine.cpp', # [!$X360 && !$OSXALL]
'cvar.cpp',
'jobthread.cpp',
'KeyValuesSystem.cpp',
'osversion.cpp',
#'processutils.cpp' # [$WINDOWS]
'random.cpp',
'vcover.cpp',
'../public/tier0/memoverride.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../public/vstdlib'
]
defines = []
libs = ['tier0','tier1']
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

51
vtf/wscript

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'vtf'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'convert_x360.cpp',
#$File "s3tc_decode.cpp" # [$WINDOWS]
'vtf.cpp'
#$File "vtf_x360.cpp"# [$X360]
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1',
'../common'
]
defines = []
libs = []
install_path = bld.env.PREFIX
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

175
waf vendored

File diff suppressed because one or more lines are too long

260
wscript

@ -0,0 +1,260 @@ @@ -0,0 +1,260 @@
#! /usr/bin/env python
# encoding: utf-8
# a1batross, mittorn, 2018
from __future__ import print_function
from waflib import Logs, Context, Configure
import sys
import os
VERSION = '0.99'
APPNAME = 'source-engine'
top = '.'
FT2_CHECK='''extern "C" {
#include <ft2build.h>
#include FT_FREETYPE_H
}
int main() { return FT_Init_FreeType( NULL ); }
'''
FC_CHECK='''extern "C" {
#include <fontconfig/fontconfig.h>
}
int main() { return (int)FcInit(); }
'''
Context.Context.line_just = 55 # should fit for everything on 80x26
projects=[
'tier0','tier1','tier2',
'vstdlib','vpklib','filesystem'
,'mathlib','tier3',
'bitmap','scenefilecache','datacache',
'launcher_main','vgui2/vgui_controls','vgui2/matsys_controls','vgui2/vgui_surfacelib',
'serverbrowser','soundemittersystem','vgui2/src',
'togl','vguimatsurface','vtf','materialsystem/shaderlib',
'materialsystem','studiorender','materialsystem/stdshaders',
'video','inputsystem','appframework',
'launcher','engine/voice_codecs/minimp3','materialsystem/shaderapidx9',
'gameui','dmxloader','datamodel','engine'
]
projects += ['thirdparty/StubSteamAPI'] # ,'thirdparty/libjpeg','thirdparty/SDL2-src'] # thirdparty projects
@Configure.conf
def check_pkg(conf, package, uselib_store, fragment, *k, **kw):
errormsg = '{0} not available! Install {0} development package. Also you may need to set PKG_CONFIG_PATH environment variable'.format(package)
confmsg = 'Checking for \'{0}\' sanity'.format(package)
errormsg2 = '{0} isn\'t installed correctly. Make sure you installed proper development package for target architecture'.format(package)
try:
conf.check_cfg(package=package, args='--cflags --libs', uselib_store=uselib_store, *k, **kw )
except conf.errors.ConfigurationError:
conf.fatal(errormsg)
try:
conf.check_cxx(fragment=fragment, use=uselib_store, msg=confmsg, *k, **kw)
except conf.errors.ConfigurationError:
conf.fatal(errormsg2)
@Configure.conf
def get_taskgen_count(self):
try: idx = self.tg_idx_count
except: idx = 0 # don't set tg_idx_count to not increase counter
return idx
def define_platform(conf):
conf.define('SOURCE1',1)
if conf.env.DEST_OS == 'linux':
conf.define('_GLIBCXX_USE_CXX11_ABI',0)
conf.env.append_unique('DEFINES', [
'LINUX=1',
'_LINUX=1',
'POSIX=1',
'_POSIX=1',
'GNUC',
'DX_TO_GL_ABSTRACTION',
'GL_GLEXT_PROTOTYPES',
'BINK_VIDEO',
'USE_SDL',
'NDEBUG',
'NO_HOOK_MALLOC',
'_DLL_EXT=.so'
])
def options(opt):
grp = opt.add_option_group('Common options')
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
grp.add_option('-W', '--win-style-install', action = 'store_true', dest = 'WIN_INSTALL', default = False,
help = 'install like Windows build, ignore prefix, useful for development [default: %default]')
opt.load('compiler_optimizations subproject')
opt.add_subproject(projects)
opt.load('xcompile compiler_cxx compiler_c sdl2 clang_compilation_database strip_on_install waf_unit_test subproject')
if sys.platform == 'win32':
opt.load('msvc msdev msvs')
opt.load('reconfigure')
def configure(conf):
conf.env.PREFIX = ''
conf.load('fwgslib reconfigure')
# Force XP compability, all build targets should add
# subsystem=bld.env.MSVC_SUBSYSTEM
# TODO: wrapper around bld.stlib, bld.shlib and so on?
conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01'
conf.env.MSVC_TARGETS = ['x86'] # explicitly request x86 target for MSVC
if sys.platform == 'win32':
conf.load('msvc msvc_pdb msdev msvs')
conf.load('subproject xcompile compiler_c compiler_cxx gitversion clang_compilation_database strip_on_install waf_unit_test enforce_pic')
conf.check_cfg(package='sdl2', uselib_store='SDL2', args=['--cflags', '--libs'])
conf.check_cfg(package='libjpeg', uselib_store='JPEG', args=['--cflags', '--libs'])
conf.check_cfg(package='libpng', uselib_store='PNG', args=['--cflags', '--libs'])
conf.check_cfg(package='zlib', uselib_store='ZLIB', args=['--cflags', '--libs'])
conf.check_cfg(package='openal', uselib_store='OPENAL', args=['--cflags', '--libs'])
conf.check_cfg(package='libcurl', uselib_store='CURL', args=['--cflags', '--libs'])
conf.check_cfg(package='bzip2', uselib_store='BZIP2', args=['--cflags', '--libs'])
conf.check_pkg('freetype2', 'FT2', FT2_CHECK)
conf.check_pkg('fontconfig', 'FC', FC_CHECK)
# enforce_pic = True # modern defaults
# modify options dictionary early
# if conf.env.DEST_OS == 'android':
# if conf.env.STATIC_LINKING:
# enforce_pic = False # PIC may break full static builds
# conf.check_pic(enforce_pic)
# We restrict 64-bit builds ONLY for Win/Linux/OSX running on Intel architecture
# Because compatibility with original GoldSrc
if conf.env.DEST_OS in ['win32', 'linux', 'darwin'] and conf.env.DEST_CPU == 'x86_64':
conf.env.BIT32_MANDATORY = not conf.options.ALLOW64
if conf.env.BIT32_MANDATORY:
Logs.info('WARNING: will build engine for 32-bit target')
else:
conf.env.BIT32_MANDATORY = False
conf.load('force_32bit')
compiler_optional_flags = [
# '-Wall', '-Wextra', '-Wpedantic',
'-fdiagnostics-color=always',
# '-Werror=return-type',
# '-Werror=parentheses',
# '-Werror=vla',
# '-Werror=tautological-compare',
# '-Werror=duplicated-cond',
# '-Werror=duplicated-branches', # BEWARE: buggy
# '-Werror=bool-compare',
# '-Werror=bool-operation',
'-Wcast-align',
# '-Werror=cast-align=strict', # =strict is for GCC >=8
# '-Werror=packed',
# '-Werror=packed-not-aligned',
'-Wuninitialized', # older GCC versions have -Wmaybe-uninitialized enabled by this switch, which is not accurate
# so just warn, not error
'-Winit-self',
# '-Werror=implicit-fallthrough=2', # clang incompatible without "=2"
# '-Wdouble-promotion', # disable warning flood
'-Wstrict-aliasing'
]
c_compiler_optional_flags = [
# '-Werror=incompatible-pointer-types',
# '-Werror=implicit-function-declaration',
# '-Werror=int-conversion',
# '-Werror=implicit-int',
# '-Werror=strict-prototypes',
# '-Werror=old-style-declaration',
# '-Werror=old-style-definition',
# '-Werror=declaration-after-statement',
'-fnonconst-initializers', # owcc
]
cflags, linkflags = conf.get_optimization_flags()
cflags += ['-march=pentium4','-mtune=core2','-mfpmath=387']
linkflags += ['-march=pentium4','-mtune=core2','-mfpmath=387']
# And here C++ flags starts to be treated separately
cxxflags = list(cflags) + ['-std=c++11','-fpermissive']
if conf.env.COMPILER_CC == 'gcc':
wrapfunctions = ['fopen','freopen','open','creat','access','__xstat','stat','lstat','fopen64','open64',
'opendir','__lxstat','chmod','chown','lchown','symlink','link','__lxstat64','mknod',
'utimes','unlink','rename','utime','__xstat64','mount','mkfifo','mkdir','rmdir','scandir','realpath']
for func in wrapfunctions:
linkflags += ['-Wl,--wrap='+func]
conf.define('COMPILER_GCC', 1)
if conf.env.COMPILER_CC != 'msvc':
conf.check_cc(cflags=cflags, linkflags=linkflags, msg='Checking for required C flags')
conf.check_cxx(cxxflags=cxxflags, linkflags=linkflags, msg='Checking for required C++ flags')
linkflags += ['-pthread']
conf.env.append_unique('CFLAGS', cflags)
conf.env.append_unique('CXXFLAGS', cxxflags)
conf.env.append_unique('LINKFLAGS', linkflags)
cxxflags += conf.filter_cxxflags(compiler_optional_flags, cflags)
cflags += conf.filter_cflags(compiler_optional_flags + c_compiler_optional_flags, cflags)
conf.env.append_unique('CFLAGS', cflags)
conf.env.append_unique('CXXFLAGS', cxxflags)
conf.env.append_unique('LINKFLAGS', linkflags)
if conf.env.DEST_OS != 'win32':
conf.check_cc(lib='dl', mandatory=False)
if not conf.env.LIB_M: # HACK: already added in xcompile!
conf.check_cc(lib='m')
else:
# Common Win32 libraries
# Don't check them more than once, to save time
# Usually, they are always available
# but we need them in uselib
a = map(lambda x: {
# 'features': 'c',
# 'message': '...' + x,
'lib': x,
# 'uselib_store': x.upper(),
# 'global_define': False,
}, [
'user32',
'shell32',
'gdi32',
'advapi32',
'dbghelp',
'psapi',
'ws2_32'
])
for i in a:
conf.check_cc(**i)
# conf.multicheck(*a, run_all_tests = True, mandatory = True)
# indicate if we are packaging for Linux/BSD
if not conf.options.WIN_INSTALL and conf.env.DEST_OS not in ['win32', 'darwin', 'android']:
conf.env.LIBDIR = conf.env.BINDIR = '${PREFIX}/lib/'
else:
conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
define_platform(conf)
conf.add_subproject(projects)
def build(bld):
bld.add_subproject(projects)
Loading…
Cancel
Save