mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
d24e5a37a6
on OS X, always build with static libraries from Externals. XXX LZO/SFML/SOIL are currently static only on Linux as well, as they have been all along, because of a conflict between CheckPKG('FOO') and the SHARED_FOO conditionals - on the second build run with static version of these libraries, CheckPKG picks them up, negating SHARED_FOO and making the code try to include the canonical locations for these packages. The easiest fix is probably to adjust the relative pathnames for those header files in Externals, so that the same ones are included in the shared and static cases. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5722 8ced0084-cf51-0410-be5f-012b33b47a6e
116 lines
3.4 KiB
Python
116 lines
3.4 KiB
Python
import os
|
|
import platform
|
|
|
|
# taken from scons wiki
|
|
def CheckPKGConfig(context, version):
|
|
context.Message( 'Checking for pkg-config version > %s... ' % version)
|
|
ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
|
|
context.Result( ret )
|
|
return ret
|
|
|
|
def CheckFramework(context, name):
|
|
ret = 0
|
|
if (platform.system().lower() == 'darwin'):
|
|
context.Message( '\nLooking for framework %s... ' % name )
|
|
lastFRAMEWORKS = context.env['FRAMEWORKS']
|
|
context.env.Append(FRAMEWORKS = [name])
|
|
ret = context.TryLink("""
|
|
int main(int argc, char **argv) {
|
|
return 0;
|
|
}
|
|
""", '.c')
|
|
if not ret:
|
|
context.env.Replace(FRAMEWORKS = lastFRAMEWORKS)
|
|
|
|
return ret
|
|
|
|
# TODO: We should use the scons one instead
|
|
def CheckLib(context, name):
|
|
context.Message( 'Looking for lib %s... ' % name )
|
|
lastLIBS = context.env['LIBS']
|
|
context.env.Append(LIBS = [name])
|
|
ret = context.TryLink("""
|
|
int main(int argc, char **argv) {
|
|
return 0;
|
|
}
|
|
""", '.c')
|
|
if not ret:
|
|
context.env.Replace(LIBS = lastLIBS)
|
|
|
|
return ret
|
|
|
|
def ConfigPKG(context, name):
|
|
context.Message( '\nUsing pkg-config for %s... ' % name )
|
|
ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
|
|
context.Result( ret )
|
|
if ret:
|
|
context.env.ParseConfig('pkg-config --cflags --libs \'%s\'' % name)
|
|
return int(ret)
|
|
|
|
def CheckPKG(context, name):
|
|
context.Message( 'Checking for %s... ' % name )
|
|
if platform.system().lower() == 'windows':
|
|
return 0
|
|
ret = 1
|
|
if not CheckFramework(context, name):
|
|
if not ConfigPKG(context, name.lower()):
|
|
ret = CheckLib(context, name)
|
|
|
|
context.Result(ret)
|
|
return int(ret)
|
|
|
|
def CheckSDL(context, version):
|
|
context.Message( 'Checking for SDL lib version > %s... ' % version)
|
|
if platform.system().lower() == 'windows':
|
|
return 1
|
|
sdl_config = context.env.WhereIs('sdl-config')
|
|
if sdl_config == None:
|
|
ret = 0
|
|
else:
|
|
found_ver = os.popen('sdl-config --version').read().strip()
|
|
required = [int(n) for n in version.split(".")]
|
|
found = [int(n) for n in found_ver.split(".")]
|
|
ret = (found >= required)
|
|
|
|
context.Result(ret)
|
|
if ret:
|
|
context.env.ParseConfig('sdl-config --cflags --libs')
|
|
ret = CheckLib(context, 'SDL')
|
|
return int(ret)
|
|
|
|
def CheckPortaudio(context, version):
|
|
found = 0
|
|
if CheckPKG(context, 'portaudio'):
|
|
context.Message( 'Checking for lib portaudio version > %s... ' % version)
|
|
found = context.TryRun("""
|
|
#include <portaudio.h>
|
|
#include <stdio.h>
|
|
int main(int argc, char **argv) {
|
|
printf("%d", Pa_GetVersion());
|
|
return 0;
|
|
}
|
|
""", '.c')[1]
|
|
|
|
if found:
|
|
ret = (version <= found)
|
|
else:
|
|
ret = 0
|
|
|
|
context.Result(ret)
|
|
return int(ret)
|
|
|
|
def GenerateRevFile(flavour, template, output):
|
|
|
|
try:
|
|
svnrev = os.popen('svnversion .').read().strip().split(':')[0]
|
|
except:
|
|
svnrev = ""
|
|
|
|
revstr = svnrev + "-" + flavour
|
|
tmpstr = open(template, "r").read().replace("$WCMODS?$WCREV$M:$WCREV$$",revstr)
|
|
outfile = open(output, 'w')
|
|
outfile.write(tmpstr +"\n")
|
|
outfile.close()
|
|
|
|
return revstr
|