premake/util/sdl_projects.lua
author Sam Lantinga <slouken@libsdl.org>
Sat, 02 Jan 2016 10:10:34 -0800
changeset 9998 f67cf37e9cd4
parent 9619 b94b6d0bff0f
permissions -rwxr-xr-x
Updated copyright to 2016
slouken@9998
     1
-- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
icculus@7925
     2
--
icculus@7925
     3
-- This software is provided 'as-is', without any express or implied
icculus@7925
     4
-- warranty.  In no event will the authors be held liable for any damages
icculus@7925
     5
-- arising from the use of this software.
icculus@7925
     6
--
icculus@7925
     7
-- Permission is granted to anyone to use this software for any purpose,
icculus@7925
     8
-- including commercial applications, and to alter it and redistribute it
icculus@7925
     9
-- freely.
icculus@7925
    10
--
icculus@7925
    11
-- Meta-build system using premake created and maintained by
icculus@7925
    12
-- Benjamin Henning <b.henning@digipen.edu>
icculus@7925
    13
icculus@7925
    14
--[[
icculus@7925
    15
sdl_projects.lua
icculus@7925
    16
icculus@7925
    17
	This file contains all the functions which are needed to define any project
icculus@7925
    18
	within the meta-build system. Many of these functions serve as
icculus@7925
    19
	pseudo-replacements for many similarly named premake functions, and that is
icculus@7925
    20
	intentional. Even the implementation of these functions are intended to look
icculus@7925
    21
	similar to regular premake code. These functions serve to dramatically
icculus@7925
    22
	simplify the project definition process to just a few lines of code, versus
icculus@7925
    23
	the many more needed for projects defined purely with premake.
icculus@7925
    24
icculus@7925
    25
	This approach is possible because this meta-build system adds another layer of
icculus@7925
    26
	indirection to the premake system, creating a sort of 'meta-meta-build'
icculus@7925
    27
	system. Nevertheless, there is a lot more flexibility because the meta-build
icculus@7925
    28
	system itself can be used to check for dependencies in a much more complex way
icculus@7925
    29
	than premake originally intended. All of the functions useful to the project
icculus@7925
    30
	definition system are contained in this file and are documented.
icculus@7925
    31
]]
icculus@7925
    32
icculus@7925
    33
projects = { }
icculus@7925
    34
icculus@7925
    35
local currentProject = nil
icculus@7925
    36
local currentDep = nil
icculus@7925
    37
local nextFuncCompat = true -- by default, unless state otherwise changed
icculus@7925
    38
local dependencyFunctions = { }
icculus@7925
    39
local dependencyResults = { } -- for when the dependencies are executed
icculus@7925
    40
icculus@7925
    41
-- query whether this function is compatible; resets internal state of
icculus@7925
    42
-- compatibility to true until SDL_isos is called again
icculus@7925
    43
local function oscompat()
icculus@7925
    44
	local compat = nextFuncCompat
icculus@7925
    45
	nextFuncCompat = true
icculus@7925
    46
	return compat
icculus@7925
    47
end
icculus@7925
    48
icculus@7925
    49
-- determine whether the specific OS name is within a pattern.
icculus@7925
    50
local function osmatch(name, pattern)
icculus@7925
    51
	local checks = pattern:explode('|')
icculus@7925
    52
	for i,v in pairs(checks) do
icculus@7925
    53
		if name == v then
icculus@7925
    54
			return true
icculus@7925
    55
		end
icculus@7925
    56
	end
icculus@7925
    57
	return false
icculus@7925
    58
end
icculus@7925
    59
icculus@7925
    60
-- Registers a dependency checker function based on a name. This function is
icculus@7925
    61
-- used in order to determine compatibility with the current system for a given
icculus@7925
    62
-- SDL_dependency. See SDL_depfunc for more information.
icculus@7925
    63
--
icculus@7925
    64
-- Specifies a function which will be invoked upon determining whether this
icculus@7925
    65
-- dependency is valid for the current system setup (ie, whether the system
icculus@7925
    66
-- has the right architecture, operating system, or even if it's installed).
icculus@7925
    67
-- The dependency function takes no arguments, but it must return the following
icculus@7925
    68
-- values:
icculus@7925
    69
--
icculus@7925
    70
--   <foundDep> [includePaths] [libPaths] [inputLibLibraries]
icculus@7925
    71
--
icculus@7925
    72
-- The last three are optional, unless foundDep is true. The name should be
icculus@7925
    73
-- descriptive of the outside dependency, since it may be shown to the user.
icculus@7925
    74
-- This function is intended to be used only after invoking SDL_dependency.
icculus@7925
    75
function SDL_registerDependencyChecker(name, func)
icculus@7925
    76
	dependencyFunctions[name:lower()] = func
icculus@7925
    77
end
icculus@7925
    78
icculus@7925
    79
-- Initializes the definition of a SDL project given the name of the project.
icculus@7925
    80
function SDL_project(name)
icculus@7925
    81
	if not oscompat() then return end
icculus@7925
    82
	currentProject = { }
icculus@7925
    83
	currentProject.name = name
icculus@7925
    84
	currentProject.compat = true
icculus@7925
    85
	projects[name] = currentProject
icculus@7925
    86
	currentProject.dependencyTree = { }
icculus@7925
    87
	-- stores which dependencies have already been checked on behalf of this
icculus@7925
    88
	-- project
icculus@7925
    89
	currentProject.dependencyValues = { }
icculus@7925
    90
	currentDep = nil
icculus@7925
    91
end
icculus@7925
    92
icculus@7925
    93
-- Specifies the build kind of the SDL project (e.g. StaticLib, SharedLib,
icculus@7925
    94
-- ConsoleApp, etc.), based on premake presets.
icculus@7925
    95
function SDL_kind(k)
icculus@7925
    96
	if not oscompat() then return end
icculus@7925
    97
	currentProject.kind = k
icculus@7925
    98
end
icculus@7925
    99
icculus@7925
   100
-- Specifies which platforms this project supports. Note: this list is not the
icculus@7925
   101
-- exact list of supported platforms in the generated project. The list of
icculus@7925
   102
-- platforms this project supports will be the unique list of all combined
icculus@7925
   103
-- projects for this SDL solution. Thus, only one project needs to actually
icculus@7925
   104
-- maintain a list. This function is additive, that is, everytime it is called
icculus@7925
   105
-- it adds it to a unique list of platforms
icculus@7925
   106
function SDL_platforms(tbl)
icculus@7925
   107
	if not oscompat() then return end
icculus@7925
   108
	if not currentProject.platforms then
icculus@7925
   109
		currentProject.platforms = { }
icculus@7925
   110
	end
icculus@7925
   111
	for k,v in pairs(tbl) do
icculus@7925
   112
		currentProject.platforms[#currentProject.platforms + 1] = v
icculus@7925
   113
	end
icculus@7925
   114
end
icculus@7925
   115
icculus@7925
   116
-- Specifies the programming language of the project, such as C or C++.
icculus@7925
   117
function SDL_language(k)
icculus@7925
   118
	if not oscompat() then return end
icculus@7925
   119
	currentProject.language = k
icculus@7925
   120
end
icculus@7925
   121
icculus@7925
   122
-- Specifies the root directory in which the meta-build system should search for
icculus@7925
   123
-- source files, given the paths and files added.
icculus@7925
   124
function SDL_sourcedir(src)
icculus@7925
   125
	if not oscompat() then return end
icculus@7925
   126
	currentProject.sourcedir = src
icculus@7925
   127
end
icculus@7925
   128
icculus@7925
   129
-- Specifies the destination location of where the IDE files related to the
icculus@7925
   130
-- project should be saved after generation.
icculus@7925
   131
function SDL_projectLocation(loc)
icculus@7925
   132
	if not oscompat() then return end
icculus@7925
   133
	currentProject.projectLocation = loc
icculus@7925
   134
end
icculus@7925
   135
icculus@7925
   136
-- Specifies a table of files that should be copied from the source directory
icculus@7925
   137
-- to the end result build directory of the binary file.
icculus@7925
   138
function SDL_copy(tbl)
icculus@7925
   139
	if not oscompat() then return end
icculus@7925
   140
	currentProject.copy = tbl
icculus@7925
   141
end
icculus@7925
   142
icculus@7925
   143
-- Specifies a list of other SDL projects in this workspace the currently active
icculus@7925
   144
-- project is dependent on. If the dependent project is a library, the binary
icculus@7925
   145
-- result will be copied from its directory to the build directory of the
icculus@7925
   146
-- currently active project automatically.
icculus@7925
   147
function SDL_projectDependencies(tbl)
icculus@7925
   148
	if not oscompat() then return end
icculus@7925
   149
	currentProject.projectDependencies = tbl
icculus@7925
   150
end
icculus@7925
   151
icculus@7925
   152
-- Specifies a list of compiler-level preprocessor definitions that should be
icculus@7925
   153
-- set in the resulting project upon compile time. This adds to the current
icculus@7925
   154
-- table of defines.
icculus@7925
   155
function SDL_defines(tbl)
icculus@7925
   156
	if not oscompat() then return end
icculus@7925
   157
	if not currentProject.defines then
icculus@7925
   158
		currentProject.defines = { }
icculus@7925
   159
	end
icculus@7925
   160
	for k,v in pairs(tbl) do
icculus@7925
   161
		currentProject.defines[#currentProject.defines + 1] = v
icculus@7925
   162
	end
icculus@7925
   163
end
icculus@7925
   164
icculus@7925
   165
-- Initializes an outside dependency this project has, such as X11 or DirectX.
icculus@7925
   166
-- This function, once invoked, may change the behavior of other SDL
icculus@7925
   167
-- project-related functions, so be sure to be familiar with all the functions
icculus@7925
   168
-- and any specified behavior when used around SDL_dependency.
icculus@7925
   169
function SDL_dependency(name)
icculus@7925
   170
	if not oscompat() then return end
icculus@7925
   171
	currentDep = { nil, compat = true, }
icculus@7925
   172
	currentDep.name = name
icculus@7925
   173
	table.insert(currentProject.dependencyTree, currentDep)
icculus@7925
   174
end
icculus@7925
   175
icculus@7925
   176
-- Special function for getting the current OS. This factors in whether the
icculus@7925
   177
-- metabuild system is in MinGW, Cygwin, or iOS mode.
icculus@7925
   178
function SDL_getos()
icculus@7925
   179
	if _OPTIONS["ios"] ~= nil then
icculus@7925
   180
		return "ios"
icculus@7925
   181
	elseif _OPTIONS["mingw"] ~= nil then
icculus@7925
   182
		return "mingw"
icculus@7925
   183
	elseif _OPTIONS["cygwin"] ~= nil then
icculus@7925
   184
		return "cygwin"
icculus@7925
   185
	end
icculus@7925
   186
	return os.get()
icculus@7925
   187
end
icculus@7925
   188
icculus@7925
   189
-- Specifies which operating system this dependency targets, such as windows or
icculus@7925
   190
-- macosx, as per premake presets.
icculus@7925
   191
function SDL_os(name)
icculus@7925
   192
	if not oscompat() then return end
icculus@7925
   193
	if not currentProject then return end
icculus@7925
   194
	if not currentDep then
icculus@7925
   195
		currentProject.opsys = name
icculus@7925
   196
		currentProject.compat = osmatch(SDL_getos(), name)
icculus@7925
   197
	else
icculus@7925
   198
		currentDep.opsys = name
icculus@7925
   199
		currentDep.compat = osmatch(SDL_getos(), name)
icculus@7925
   200
	end
icculus@7925
   201
end
icculus@7925
   202
icculus@7925
   203
-- Specifies which operating system this dependency does not targets. This is
icculus@7925
   204
-- for nearly platform-independent projects or dependencies that will not work
icculus@7925
   205
-- on specific systems, such as ios.
icculus@7925
   206
function SDL_notos(name)
icculus@7925
   207
	if not oscompat() then return end
icculus@7925
   208
	if not currentProject then return end
icculus@7925
   209
	if not currentDep then
icculus@7925
   210
		currentProject.opsys = "~" .. name
icculus@7925
   211
		currentProject.compat = not osmatch(SDL_getos(), name)
icculus@7925
   212
	else
icculus@7925
   213
		currentDep.opsys = "~" .. name
icculus@7925
   214
		currentDep.compat = not osmatch(SDL_getos(), name)
icculus@7925
   215
	end
icculus@7925
   216
end
icculus@7925
   217
icculus@7925
   218
-- Changes the internal state of function compatibility based on whether the
icculus@7925
   219
-- current os is the one expected; the next function will be affected by this
icculus@7925
   220
-- change, but no others. The name can be a pattern using '|' to separate
icculus@7925
   221
-- multiple operating systems, such as:
icculus@7925
   222
--   SDL_isos("windows|macosx")
icculus@7925
   223
function SDL_isos(name)
icculus@7925
   224
	nextFuncCompat = osmatch(SDL_getos(), name)
icculus@7925
   225
end
icculus@7925
   226
icculus@7925
   227
-- Same as SDL_isos, except it negates the internal state for exclusion
icculus@7925
   228
-- checking.
icculus@7925
   229
function SDL_isnotos(name)
icculus@7925
   230
	nextFuncCompat = not osmatch(SDL_getos(), name)
icculus@7925
   231
end
icculus@7925
   232
icculus@7925
   233
-- Changes the internal state of function compatibility based on whether the
icculus@7925
   234
-- current system is running a 64bit Operating System and architecture; the
icculus@7925
   235
-- next function will be affected by this change, but none thereafter.
icculus@7925
   236
function SDL_is64bit()
icculus@7925
   237
	nextFuncCompat = os.is64bit()
icculus@7925
   238
end
icculus@7925
   239
icculus@7925
   240
-- Same as SDL_is64bit, except it negates the internal state for
icculus@7925
   241
-- exclusion checking.
icculus@7925
   242
function SDL_isnot64bit()
icculus@7925
   243
	nextFuncCompat = not os.is64bit()
icculus@7925
   244
end
icculus@7925
   245
icculus@7925
   246
-- Look at SDL_depfunc and SDL_notdepfunc for detailed information about this
icculus@7925
   247
-- function.
icculus@7925
   248
local function SDL_depfunc0(funcname, exclude)
icculus@7925
   249
	if not oscompat() then return end
icculus@7925
   250
	if not currentDep.compat then return end
icculus@7925
   251
	local force = _OPTIONS[funcname:lower()] ~= nil
icculus@7925
   252
	local func = dependencyFunctions[funcname:lower()]
icculus@7925
   253
	if not func then
icculus@7925
   254
		print("Warning: could not find dependency function named: " .. funcname)
icculus@7925
   255
		currentDep.compat = false
icculus@7925
   256
		return
icculus@7925
   257
	end
icculus@7925
   258
	local cachedFuncResults = dependencyResults[funcname:lower()]
icculus@7925
   259
	local depFound, depInc, depLib, depInput
icculus@7925
   260
	if cachedFuncResults then
icculus@7925
   261
		depFound = cachedFuncResults.depFound
icculus@7925
   262
		-- just skip the rest of the function, the user was already warned
icculus@7925
   263
		-- exclude mode varies the compatibility slightly
icculus@7925
   264
		if force then
icculus@7925
   265
			depFound = true
icculus@7925
   266
		end
icculus@7925
   267
		if not depFound and not exclude then
icculus@7925
   268
			currentDep.compat = false
icculus@7925
   269
			return
icculus@7925
   270
		elseif depFound and exclude then
icculus@7925
   271
			currentDep.compat = false
icculus@7925
   272
			return
icculus@7925
   273
		end
icculus@7925
   274
		depInc = cachedFuncResults.depInc
icculus@7925
   275
		depLib = cachedFuncResults.depLib
icculus@7925
   276
		depInput = cachedFuncResults.depInput
icculus@7925
   277
	else
icculus@7925
   278
		local result = func()
icculus@7925
   279
		if result.found then
icculus@7925
   280
			depFound = result.found
icculus@7925
   281
		else
icculus@7925
   282
			depFound = false
icculus@7925
   283
		end
icculus@7925
   284
		if force then
icculus@7925
   285
			depFound = true
icculus@7925
   286
		end
icculus@7925
   287
		if result.incDirs then
icculus@7925
   288
			depInc = result.incDirs
icculus@7925
   289
		else
icculus@7925
   290
			depInc = { }
icculus@7925
   291
		end
icculus@7925
   292
		if result.libDirs then
icculus@7925
   293
			depLib = result.libDirs
icculus@7925
   294
		else
icculus@7925
   295
			depLib = { }
icculus@7925
   296
		end
icculus@7925
   297
		if result.libs then
icculus@7925
   298
			depInput = result.libs
icculus@7925
   299
		else
icculus@7925
   300
			depInput = { }
icculus@7925
   301
		end
icculus@7925
   302
		cachedFuncResults = { }
icculus@7925
   303
		cachedFuncResults.depFound = depFound
icculus@7925
   304
		cachedFuncResults.depInc = depInc
icculus@7925
   305
		cachedFuncResults.depLib = depLib
icculus@7925
   306
		cachedFuncResults.depInput = depInput
icculus@7925
   307
		dependencyResults[funcname:lower()] = cachedFuncResults
icculus@7925
   308
		if not depFound and not exclude then
icculus@7925
   309
			currentDep.compat = false
icculus@7925
   310
			return
icculus@7925
   311
		elseif depFound and exclude then
icculus@7925
   312
			currentDep.compat = false
icculus@7925
   313
			return
icculus@7925
   314
		end
icculus@7925
   315
	end
icculus@7925
   316
	-- we only want to embed this dependency if we're not in exclude mode
icculus@7925
   317
	if depFound and not exclude then
icculus@7925
   318
		local dependency = { }
icculus@7925
   319
		if not currentDep.includes then
icculus@7925
   320
			currentDep.includes = { }
icculus@7925
   321
		end
icculus@7925
   322
		for k,v in pairs(depInc) do
icculus@7925
   323
			currentDep.includes[v] = v
icculus@7925
   324
		end
icculus@7925
   325
		if not currentDep.libs then
icculus@7925
   326
			currentDep.libs = { }
icculus@7925
   327
		end
icculus@7925
   328
		for k,v in pairs(depLib) do
icculus@7925
   329
			currentDep.libs[v] = v
icculus@7925
   330
		end
icculus@7925
   331
		if not currentDep.links then
icculus@7925
   332
			currentDep.links = { }
icculus@7925
   333
		end
icculus@7925
   334
		for k,v in pairs(depInput) do
icculus@7925
   335
			currentDep.links[v] = v
icculus@7925
   336
		end
icculus@7925
   337
	else -- end of dependency found check
icculus@7925
   338
		-- if we are not excluding this dependency, then print a warning
icculus@7925
   339
		-- if not found
icculus@7925
   340
		if not exclude then
icculus@7925
   341
			print("Warning: could not find dependency: " .. funcname)
icculus@7925
   342
		end
icculus@7925
   343
		currentDep.compat = exclude
icculus@7925
   344
	end
icculus@7925
   345
end
icculus@7925
   346
icculus@7925
   347
-- Given a dependency name, this function will register the dependency and try
icculus@7925
   348
-- to pair it with a dependency function that was registered through
icculus@7925
   349
-- SDL_registerDependencyChecker. If the function is not found, compatibility
icculus@7925
   350
-- will automatically be dropped for this project and a warning will be printed
icculus@7925
   351
-- to the standard output. Otherwise, the dependency function will be invoked
icculus@7925
   352
-- and compatibility for the project will be updated. If the project currently
icculus@7925
   353
-- is not compatible based on the Operating System or previous dependency, the
icculus@7925
   354
-- dependency function will not be checked at all and this function will
icculus@7925
   355
-- silently return.
icculus@7925
   356
function SDL_depfunc(funcname)
icculus@7925
   357
	SDL_depfunc0(funcname, false)
icculus@7925
   358
end
icculus@7925
   359
icculus@7925
   360
-- Same as SDL_depfunc, except this forces dependency on the function failing,
icculus@7925
   361
-- rather than succeeding. This is useful for situations where two different
icculus@7925
   362
-- files are required based on whether a dependency is found (such as the
icculus@7925
   363
-- joystick and haptic systems).
icculus@7925
   364
function SDL_notdepfunc(funcname)
icculus@7925
   365
	SDL_depfunc0(funcname, true)
icculus@7925
   366
end
icculus@7925
   367
icculus@7925
   368
-- Determines whether the specified dependency is supported without actually
icculus@7925
   369
-- executing the dependency or changing the internal states of the current
icculus@7925
   370
-- project or dependency definition. This function will only work if the
icculus@7925
   371
-- dependency has already been checked and its results cached within the
icculus@7925
   372
-- definition system. This function returns true if the dependency is known to
icculus@7925
   373
-- be supported, or false if otherwise (or if it cannot be known at this time).
icculus@7925
   374
function SDL_assertdepfunc(funcname)
icculus@7925
   375
	-- if forced, then of course it's on
icculus@7925
   376
	if _OPTIONS[funcname:lower()] then
icculus@7925
   377
		return true
icculus@7925
   378
	end
icculus@7925
   379
	local results = dependencyResults[funcname:lower()]
icculus@7925
   380
	if not results or not results.depFound then
icculus@7925
   381
		-- either not excuted yet, doesn't exist, or wasn't found
icculus@7925
   382
		print("Warning: required dependency not found: " .. funcname ..
icculus@7925
   383
			". Make sure your dependencies are in a logical order.")
icculus@7925
   384
		return false
icculus@7925
   385
	end
icculus@7925
   386
	return true
icculus@7925
   387
end
icculus@7925
   388
icculus@7925
   389
-- Returns a list of currently registered dependencies. The values within the
icculus@7925
   390
-- table will be sorted, but their names will be lowercased due to internal
icculus@7925
   391
-- handling of case-insensitive dependency names.
icculus@7925
   392
function SDL_getDependencies()
icculus@7925
   393
	local deps = { }
icculus@7925
   394
	for k,_ in pairs(dependencyFunctions) do
icculus@7925
   395
		deps[#deps + 1] = k
icculus@7925
   396
	end
icculus@7925
   397
	table.sort(deps)
icculus@7925
   398
	return deps
icculus@7925
   399
end
icculus@7925
   400
icculus@7925
   401
-- Specifies a list of libraries that should always be linked to in this
icculus@7925
   402
-- project, regardless of a dependency function. If after a dependency
icculus@7925
   403
-- declaration, these files will only be included in the project if the
icculus@7925
   404
-- dependency is compatible with the native system, given SDL_os usage and any
icculus@7925
   405
-- sort of custom dependency function.
icculus@7925
   406
function SDL_links(tbl)
icculus@7925
   407
	if not oscompat() then return end
icculus@7925
   408
	if currentDep and not currentDep.compat then return end
icculus@7925
   409
	if currentProject.customLinks == nil then
icculus@7925
   410
		currentProject.customLinks = { }
icculus@7925
   411
	end
icculus@7925
   412
	for i,v in ipairs(tbl) do
icculus@7925
   413
		currentProject.customLinks[#currentProject.customLinks + 1] = v
icculus@7925
   414
	end
icculus@7925
   415
end
icculus@7925
   416
icculus@7925
   417
-- Specifies a list of configuration values that are assigned as preprocessor
icculus@7925
   418
-- definitions in the SDL configuration header, used to globally configure
icculus@7925
   419
-- features during the building of the SDL library. If after a dependency
icculus@7925
   420
-- declaration, these files will only be included in the project if the
icculus@7925
   421
-- dependency is compatible with the native system, given SDL_os usage and any
icculus@7925
   422
-- sort of custom dependency function.
icculus@7925
   423
function SDL_config(tbl)
icculus@7925
   424
	if not oscompat() then return end
icculus@7925
   425
	if not currentDep then
icculus@7925
   426
		currentProject.config = tbl
icculus@7925
   427
		return
icculus@7925
   428
	end
icculus@7925
   429
	if not currentDep.compat then return end
icculus@7925
   430
	currentDep.config = tbl
icculus@7925
   431
end
icculus@7925
   432
icculus@7925
   433
-- Specifies a list of paths where all .c, .h, and .m files should be included
icculus@7925
   434
-- for compiling, where the source directory is the root. If after a dependency
icculus@7925
   435
-- declaration, these files will only be included in the project if the
icculus@7925
   436
-- dependency is compatible with the native system, given SDL_os usage and any
icculus@7925
   437
-- sort of custom dependency function.
icculus@7925
   438
function SDL_paths(tbl)
icculus@7925
   439
	if not oscompat() then return end
icculus@7925
   440
	if not currentDep then
icculus@7925
   441
		currentProject.paths = tbl
icculus@7925
   442
		return
icculus@7925
   443
	end
icculus@7925
   444
	if not currentDep.compat then return end
icculus@7925
   445
	currentDep.paths = tbl
icculus@7925
   446
end
icculus@7925
   447
icculus@7925
   448
-- Specifies a list of files found within the source directory that this project
icculus@7925
   449
-- should include during compile time. If after a dependency declaration, these
icculus@7925
   450
-- files will only be included in the project if the dependency is compatible
icculus@7925
   451
-- with the native system, given SDL_os usage and any sort of custom dependency
icculus@7925
   452
-- function.
icculus@7925
   453
function SDL_files(tbl)
icculus@7925
   454
	if not oscompat() then return end
icculus@7925
   455
	if not currentDep then
icculus@7925
   456
		currentProject.files = tbl
icculus@7925
   457
		return
icculus@7925
   458
	end
icculus@7925
   459
	if not currentDep.compat then return end
icculus@7925
   460
	currentDep.files = tbl
slouken@8149
   461
end