Browse files

Better hack for library checking on OS X

  • Loading branch information...
simtr committed Jul 11, 2016
1 parent e881748 commit 0cf117a5f05bab47d4aed377e2e0c542ead41dfc
Showing with 9 additions and 5 deletions.
  1. +9 −5 SConscript
@@ -209,12 +209,16 @@ def CheckBit(context):
def CheckFramework(context, framework):
import SCons.Conftest
#Extreme hack, TODO: maybe think of a better one (like replicating CheckLib here) or at least just fix the message
ret = SCons.Conftest.CheckLib(context, ['m" -framework {0}"'.format(framework)], autoadd = 0)
oldLinkFlags = context.env.Append(LINKFLAGS=["-framework", framework])
context.Display("Checking for Darwin Framework {0}...".format(framework))
ret = SCons.Conftest.CheckLib(context, ["m"], autoadd = 0)
context.did_show_result = 1
if not ret:
context.env.Append(LINKFLAGS=["-framework", framework])
if framework != "Cocoa":
return not ret
#function that finds libraries and appends them to LIBS
@@ -324,15 +328,15 @@ def findLibs(env, conf):
#Look for pthreads
if not conf.CheckLib(['pthread', 'pthreadVC2']):
FatalError("pthreads development library not found or not installed")
if msvc:
if not conf.CheckHeader('dirent.h') or not conf.CheckHeader('fftw3.h') or not conf.CheckHeader('pthread.h') or not conf.CheckHeader('zlib.h'):
FatalError("Required headers not found")
#Look for libm
if not conf.CheckLib('m'):
FatalError("libm not found or not installed")
#Look for OpenGL libraries
if GetOption('opengl'):
if platform == "Linux":
@@ -342,7 +346,7 @@ def findLibs(env, conf):
env.ParseConfig('pkg-config --libs glew gl glu')
elif platform == "Windows":
if not conf.CheckLib('opengl32'):
FatalError("opengl32 not found or not installed")
@@ -351,7 +355,7 @@ def findLibs(env, conf):
elif platform == "Darwin":
if not conf.CheckFramework("OpenGL"):
FatalError("OpenGL framework not found or not installed")
if platform == "Linux":
if not conf.CheckLib('X11'):
FatalError("X11 development library not found or not installed")

0 comments on commit 0cf117a

Please sign in to comment.