Repository navigation
Notes on gyp
Note: We ended up using premake instead. Leaving the notes in case I'll try gyp again.
We're trying to rewrite nmake-based build system for Sumatra in gyp. Gyp is a meta-build system that generates project files (Visual Studio, XCode, makefiles) based on gyp description, which is json-like.
Gyp is not well documented, what I know comes from reverse-engineering by looking at .gyp files from other projects, found with github code search
Basic setup:
- get the latest version of gyp with
git clone --depth 1 https://chromium.googlesource.com/external/gyp - for each component (a library or executable) write
foo.gyp - write
common.gypiwhich will contain definitions common for all components. Things like configuration settings (Release, Debug etc.) and variables that can modify how a component is build
Gyp is json-like, it has keys that map to values, arrays or dicts. It has hierarchical structure and some keys are only allowed in certain contexts.
This is a summary of what keys can be used in what context. Some trees can appear in many context, to avoid duplication I flatten the tree my marking a sub-tree that has already been described with "*".
msvs_configuration_attributes
CharacterSet : 1 - unicode
VCCLCompilerTool
InlineFunctionExpansion : 2 - /Ob2, AnySuitable
EnableIntrinsicFunctions : true, false
EnableFunctionLevelLinking : true, false
FavorSizeOrSpeed : 1 -/Ot speed,
OmitFramePointers : true, false
Optimization : 0 - none, 2 - max speed
StringPooling : true, false
WholeProgramOptimization : true, false
RuntimeLibrary : 0 - /MT, 1 - /MTd
EnablePREfast : true, false
WarningLevel : 3, 4
DebugInformationFormat : 3 - generate PDB
BufferSecurityCheck : true, false
RuntimeTypeInfo : true, false
BasicRuntimeChecks : 3 - /RTC1
ExceptionHandling : 2 - /EHsc
WarnAsError : true, false
AdditionalOptions : [ '/wd4800', '/MP' ]
VCLinkerTool
SubSystem : 1 - Console, 2 - Windows
EnableCOMDATFolding : 2 - /opt:icf
OptimizeReferences : 2 - /opt:ref
LinkTimeCodeGeneration : 1 - UseLinkTimeCodeGeneration
LinkIncremental : 1 - disable
GenerateManifest : true, false
GenerateDebugInformation : true, false
ErrorReporting : 0 - None
EnableUAC : true, false
VCMIDLTool
TypeLibraryName : '$(TargetName).tlb'
msvs_settings
VCCLCompilerTool*
VCLinkerTool*
VCMIDLTool*
Configuration settings:
defines
msbuild_toolset : v120_xp, v120
msvs_settings*
msvs_configuration_attributes*
msvs_cygwin_shell : 0 - enable use without cygwin
target_defaults
configurations - dict, maps name to configuration settings
targets
target_name
type : executable, shared_library, static_library
variables
include_dirs
sources
defines
dependencies
direct_dependent_settings
include_dirs
link_settings
libraries: ['gdiplus.lib', 'comctl32.lib']
msvs_disabled_warnings : [4996, 4800]
msvs_settings*