Explorar o código

Added check_c_headers to SCons env to check for the existence of headers

Marcelo Fernandez %!s(int64=8) %!d(string=hai) anos
pai
achega
8f133e2c4d
Modificáronse 2 ficheiros con 13 adicións e 0 borrados
  1. 1 0
      .gitignore
  2. 12 0
      SConstruct

+ 1 - 0
.gitignore

@@ -55,6 +55,7 @@ gmon.out
 .DS_Store
 .DS_Store
 
 
 # for projects that use SCons for building: http://http://www.scons.org/
 # for projects that use SCons for building: http://http://www.scons.org/
+.sconf_temp
 .sconsign.dblite
 .sconsign.dblite
 *.pyc
 *.pyc
 
 

+ 12 - 0
SConstruct

@@ -289,7 +289,9 @@ if selected_platform in platform_list:
     if (env["warnings"] == 'yes'):
     if (env["warnings"] == 'yes'):
         print("WARNING: warnings=yes is deprecated; assuming warnings=all")
         print("WARNING: warnings=yes is deprecated; assuming warnings=all")
 
 
+    env.msvc = 0
     if (os.name == "nt" and os.getenv("VCINSTALLDIR") and (platform_arg == "windows" or platform_arg == "uwp")): # MSVC, needs to stand out of course
     if (os.name == "nt" and os.getenv("VCINSTALLDIR") and (platform_arg == "windows" or platform_arg == "uwp")): # MSVC, needs to stand out of course
+        env.msvc = 1
         disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions...
         disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions...
         if (env["warnings"] == 'extra'):
         if (env["warnings"] == 'extra'):
             env.Append(CCFLAGS=['/Wall']) # Implies /W4
             env.Append(CCFLAGS=['/Wall']) # Implies /W4
@@ -412,6 +414,16 @@ if selected_platform in platform_list:
     if (env['vsproj']) == "yes":
     if (env['vsproj']) == "yes":
         methods.generate_vs_project(env, GetOption("num_jobs"))
         methods.generate_vs_project(env, GetOption("num_jobs"))
 
 
+    # Check for the existence of headers
+    conf = Configure(env)
+    if ("check_c_headers" in env):
+        for header in env["check_c_headers"]:
+            if (conf.CheckCHeader(header[0])):
+                if (env.msvc):
+                    env.Append(CCFLAGS=['/D' + header[1]])
+                else:
+                    env.Append(CCFLAGS=['-D' + header[1]])
+
 else:
 else:
 
 
     print("No valid target platform selected.")
     print("No valid target platform selected.")