Last active
December 11, 2015 07:28
-
-
Save dimitarcl/4566204 to your computer and use it in GitHub Desktop.
Converting a gyp library to premake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solution 'node-lame' | |
project 'bindings' | |
includedirs { | |
'deps/lame/include', | |
'deps/mpg123/src/libmpg123', | |
'deps/mpg123/%{GetConfigInclude(cfg)}', | |
} | |
include 'deps/lame' | |
include 'deps/mpg123' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetConfigInclude(cfg) | |
local arch = cfg.architecture | |
local system = cfg.system | |
if arch == 'x32' or arch == 'Win32' then | |
arch = 'ia32' | |
end | |
if system == 'windows' then | |
system = 'win' | |
end | |
return string.format('config/%s/%s', system, arch) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'target_defaults': { | |
'default_configuration': 'Debug', | |
'configurations': { | |
'Debug': { | |
'defines': [ 'DEBUG', '_DEBUG' ], | |
'msvs_settings': { | |
'VCCLCompilerTool': { | |
'RuntimeLibrary': 1, # static debug | |
}, | |
}, | |
}, | |
'Release': { | |
'defines': [ 'NDEBUG' ], | |
'msvs_settings': { | |
'VCCLCompilerTool': { | |
'RuntimeLibrary': 0, # static release | |
}, | |
}, | |
} | |
}, | |
'msvs_settings': { | |
'VCLinkerTool': { | |
'GenerateDebugInformation': 'true', | |
}, | |
}, | |
'conditions': [ | |
['OS=="mac"', { | |
'conditions': [ | |
['target_arch=="ia32"', { 'xcode_settings': { 'ARCHS': [ 'i386' ] } }], | |
['target_arch=="x64"', { 'xcode_settings': { 'ARCHS': [ 'x86_64' ] } }] | |
], | |
}], | |
] | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project 'mpg123' | |
kind 'StaticLib' | |
language 'C' | |
defines { | |
'HAVE_CONFIG_H', | |
'PIC', | |
'NOXFERMEM', | |
} | |
includedirs { '%{GetConfigInclude(cfg)}' } | |
files { | |
'src/libmpg123/compat.c', | |
-- all the source files | |
'src/libmpg123/feature.c', | |
} | |
local notOptimizedDefines = { | |
'OPT_I386', | |
'REAL_IS_FLOAT', | |
'NEWOLD_WRITE_SAMPLE', | |
} | |
local notOptmizedSynthFiles = { | |
'src/libmpg123/synth_s32.c', | |
'src/libmpg123/synth_real.c', | |
'src/libmpg123/dct64_i386.c', | |
} | |
configuration 'x32' | |
defines(notOptimizedDefines) | |
files(notOptmizedSynthFiles) | |
configuration { 'windows', 'x64' } | |
defines(notOptimizedDefines) | |
files(notOptmizedSynthFiles) | |
configuration 'x64' | |
defines { | |
'OPT_X86_64', | |
'REAL_IS_FLOAT', | |
} | |
files { | |
'src/libmpg123/dct64_x86_64.S', | |
-- more assembler files | |
'src/libmpg123/synth_x86_64_float.S', | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solution 'node-lame' | |
configurations { 'Debug', 'Release' } | |
if os.is('windows') then | |
platforms { 'Win32', 'x64' } | |
else | |
platforms { 'x32', 'x64' } | |
end | |
flags { | |
'StaticRuntime', | |
'Symbols' | |
} | |
configuration 'Debug' | |
defines { 'DEBUG', '_DEBUG' } | |
configuration 'Release' | |
defines { 'NDEBUG' } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project 'mp3lame' | |
kind 'StaticLib' | |
language 'C' | |
defines { 'HAVE_CONFIG_H' } | |
includedirs { '%{GetConfigInclude(cfg)}' } | |
includedirs { | |
'include', | |
'mpglib', | |
'libmp3lame', | |
} | |
files { | |
'libmp3lame/*.c', | |
'libmp3lame/*.h', | |
} | |
vpaths { | |
['Source Files'] = '*.c', | |
['Header Files'] = '*.h', | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newoption { | |
trigger = 'node', | |
description = 'node source directory', | |
value = 'path to nodejs source directory', | |
} | |
local node = _OPTIONS['node'] | |
if not node then | |
error('Missing node source directory. Use --node=path-to-node.') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solution 'node-lame' | |
project 'bindings' | |
kind 'SharedLib' | |
language 'C++' | |
files { | |
'src/*.cc', | |
'src/*.h', | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment