summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/genie/docs/scripting-reference.md
blob: 74a3f08d0d0b2923ea79ecbcf6560e421979b195 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
# Scripting Reference

## Table of Contents

* Predefined variables
    * [_ACTION](#_action)
    * [_ARGS](#_args)
    * [_OPTIONS](#_options)
    * [_PREMAKE_COMMAND](#_premake_command)
    * [_PREMAKE_VERSION](#_premake_version)
    * [_SCRIPT](#_script)
    * [_WORKING_DIR](#_working_dir)
* Build script functions
    * [buildaction](#buildactionaction)
    * [buildoptions](#buildoptionsoptions)
    * [configuration](#configurationkeywords)
    * [configurations](#configurationsnames)
    * [custombuildtask](#custombuildtasktask)
    * [debugargs](#debugargsargs)
    * [debugdir](#debugdirpath)
    * [defines](#definessymbols)
    * [dependency](#dependencyfiles)
    * [deploymentoptions](#deploymentoptionsoptions)
    * [excludes](#excludesfiles)
    * [files](#filesfiles)
    * [flags](#flagsflags)
    * [framework](#frameworkversion)
    * [group](#groupname)
    * [imageoptions](#imageoptionsoptions)
    * [imagepath](#imagepathpath)
    * [implibdir](#implibdir)
    * [implibextension](#implibextensionextension)
    * [implibname](#implibnamename)
    * [implibprefix](#implibprefixprefix)
    * [implibsuffix](#implibsuffixsuffix)
    * [include](#includedirectory)
    * [includedirs](#includedirspaths)
    * [kind](#kindkind)
    * [language](#languagelang)
    * [libdirs](#libdirspaths)
    * [linkoptions](#linkoptionsoptions)
    * [links](#linksreferences)
    * [location](#locationpath)
    * [messageskip](#messageskipoptions)
    * [newaction](#newactiondescription)
    * [newoption](#newoptionsdescription)
    * [nopch](#nopch)
    * [objdir](#objdirpath)
    * [pchheader](#pchheaderfile)
    * [pchsource](#pchsourcefile)
    * [platforms](#platformsidentifiers)
    * [postbuildcommands](#postbuildcommandscommands)
    * [postcompiletasks](#postcompiletaskstasks)
    * [prebuildcommands](#prebuildcommandscommands)
    * [prelinkcommands](#prelinkcommandscommands)
    * [project](#projectname)
    * [removefiles](#removefilesfiles)
    * [removeflags](#removeflagsflags)
    * [removelinks](#removelinkslinks)
    * [removeplatforms](#removeplatformsplatforms)
    * [resdefines](#resdefinessymbols)
    * [resincludedirs](#resincludedirspaths)
    * [resoptions](#resoptionsoptions)
    * [solution](#solutionname)
    * [startproject](#startprojectname)
    * [targetdir](#targetdirpath)
    * [targetextension](#targetextensionext)
    * [targetname](#targetnamename)
    * [targetprefix](#targetprefixprefix)
    * [targetsubdir](#targetsubdirpath)
    * [targetsuffix](#targetsuffixsuffix)
    * [userincludedirs](#userincludedirspaths)
    * [uuid](#uuidprojectuuid)
    * [vpaths](#vpathsgroup--pattern)
* Utility functions
    * [iif](#iifcondition-trueval-falseval)
    * [os.chdir](#oschdirpath)
    * [os.copyfile](#oscopyfilesource-destination)
    * [os.findlib](#osfindliblibname)
    * [os.get](#osget)
    * [os.getcwd](#osgetcwd)
    * [os.getversion](#osgetversion)
    * [os.is](#osisid)
    * [os.is64bit](#osis64bit)
    * [os.isdir](#osisdirpath)
    * [os.isfile](#osisfilepath)
    * [os.matchdirs](#osmatchdirspattern)
    * [os.matchfiles](#osmatchfilespatterns)
    * [os.mkdir](#osmkdirpath)
    * [os.outputof](#osoutputofcommand)
    * [os.pathsearch](#ospathsearchfname-paths)
    * [os.rmdir](#osrmdirpath)
    * [os.stat](#osstatpath)
    * [os.uuid](#osuuidname)
    * [path.getabsolute](#pathgetabsolutepath)
    * [path.getbasename](#pathgetbasenamepath)
    * [path.getdirectory](#pathgetdirectorypath)
    * [path.getdrive](#pathgetdrivepath)
    * [path.getextension](#pathgetextension)
    * [path.getname](#pathgetnamepath)
    * [path.getrelative](#pathgetrelativesrc-dest)
    * [path.isabsolute](#pathisabsolutepath)
    * [path.iscfile](#pathiscfilepath)
    * [path.isSourceFile](#pathiscppfilepath)
    * [path.isresourcefile](#pathisresourcefilepath)
    * [path.join](#pathjoinleading-trailing)
    * [path.rebase](#pathrebasepath-oldbase-newbase)
    * [path.translate](#pathtranslatepath-newsep)
    * [printf](#printfformat-args)
    * [string.endswith](#stringendswithhaystack-needle)
    * [string.explode](#stringexplodestr-pattern)
    * [string.findlast](#stringfindlaststr-pattern-plain)
    * [string.startswith](#stringstartswithhaystack-needle)
    * [table.contains](#tablecontainsarray-value)
    * [table.implode](#tableimplodearray-before-after-between)
* Additional information
    * [Wildcards](#wildcards)

---

## Predefined Variables

Each of the following variables is available for use in any GENie script.

### _ACTION

Name of the action to be performed on this execution run.

`$ genie vs2005`

produces

`_ACTION: "vs2005"`

[Back to top](#table-of-contents)

---
### _ARGS

Any arguments to the current action.

`$ genie vs2015 alpha beta`

produces

`_ARGS[0]: "alpha"`
`_ARGS[1]: "beta"`

[Back to top](#table-of-contents)

---
### _OPTIONS

Current set of command line options and their values, if any.

`$ genie vs2015 --gfxapi=directx`

produces

`_OPTIONS['gfxapi']: "directx"`

**Note:** Options may be registered with [newoption](#newoption) to fully integrate them into the CLI.

[Back to top](#table-of-contents)

---
### _PREMAKE_COMMAND

Full path to the GENie (Premake) executable.

[Back to top](#table-of-contents)

---
### _PREMAKE_VERSION

GENie (Premake) version.

[Back to top](#table-of-contents)

---
### _SCRIPT

Full path to the currently executing script.

[Back to top](#table-of-contents)

---
### _WORKING_DIR

Current working directory.

[Back to top](#table-of-contents)

---

## Build script functions

### buildaction(_action_)
Specifies what action should be performed on a set of files during compilation. Usually paired with a configuration filter to select a file set. If no build action is specified for a file, a default action will be used (chosen based on the file's extension).

**Scope:** solutions, projects, configurations

**Note:** only supported for .NET projects, and not for C or C++.

#### Arguments
_action_ - the action to be performed. One of:
* "Compile" - treat the file as source code: compile and run it
* "Embed" - embed the file into the target binary as a resource
* "Copy" - copy the file to the target directory
* "None" - do nothing with this file

#### Examples
Embed all PNGs into the target binary
```lua
configuration "**.png"
    buildaction "Embed"
```
[Back to top](#table-of-contents)

---
### buildoptions({_options_...})
Passes arguments direction to the compiler command line. Multiple calls in a project will be concatenated in order.

**Scope:** solutions, projects, configurations

You may also use one of these functions to configure buildoptions for each individual file extension:

* `buildoptions_asm` for .asm files
* `buildoptions_c` for .c files
* `buildoptions_cpp` for .cpp files
* `buildoptions_objc` for .m files
* `buildoptions_objcpp` for .mm files
* `buildoptions_swift` for .swift files
* `buildoptions_vala` for .vala files

#### Arguments
_options_ - list of compiler flags

#### Examples
Add some GCC-specific options
```lua
configuration {"linux", "gmake"}
    buildoptions {"-ansi", "-pedantic"}
```
[Back to top](#table-of-contents)

---
### configuration({_keywords_...})
Limits subsequent build settings to a particular environment. Acts as a filter, only applying settings that appear after this function if the environment matches the keywords.

#### Arguments
_keywords_ - list of identifiers to compare to the current runtime environment

Possible values:
* Configuration names - configuration names passed to [configurations](#configurations)
* Action names - "vs2015", "gmake", etc.
* Operating system names - "windows", "macosx", etc.
* Platform names - "ps3", "xbox360", etc.
* Command-line options - either built-in or custom
* File names - very limited, but some settings can be applied to specific files

You may also use "*" and "**" wildcards, as well as "not" and "or".

#### Return
Current configuration object with the following fields:
* _buildaction_       - build action.
* _buildoptions_      - list of compiler options.
* _defines_           - list of compiler symbols.
* _excludes_          - list of excluded files.
* _files_             - list of files.
* _flags_             - list of build flags.
* _implibdir_         - import library directory.
* _implibextension_   - import library file extension.
* _implibname_        - import library base file name.
* _implibprefix_      - import library file name prefix.
* _implibsuffix_      - import library file name suffix.
* _includedirs_       - list of include file search directories.
* _keywords_          - list of keywords associated with the block.
* _kind_              - target kind.
* _libdirs_           - list of library search directories.
* _linkoptions_       - list of linker options.
* _links_             - list of libraries or assemblies to link against.
* _objdir_            - objects and intermediate files directory.
* _pchheader_         - target file name for precompiled header support.
* _pchsource_         - target source file name for precompiled header support.
* _prebuildcommands_  - list of pre-build commands.
* _prelinkcommands_   - list of pre-link commands.
* _postbuildcommands_ - list of post-build commands.
* _resdefines_        - list of symbols for the resource compiler.
* _resincludedirs_    - list of include file search paths for the resource compiler.
* _resoptions_        - list of resource compiler options.
* _targetdir_         - target output directory.
* _targetextension_   - target file extension.
* _targetname_        - target base file name.
* _targetprefix_      - target file name prefix.
* _targetsuffix_      - target file name suffix.
* _terms_             - filter terms passed to the configuration function to create the block (i.e. "Debug").

#### Examples
Define debug symbol for debug configurations
```lua
configuration "Debug"
    defines { "DEBUG" }
```

Define a symbol based on a wildcard
```lua
configuration "vs*"
    defines { "VISUAL_STUDIO_2005" }
```

Define a symbol based on an "or"
```lua
configuration "linux or macosx"
    defines { "LINUX_OR_MACOSX" }
```

Define a symbol based on a "not"
```lua
configuration "not windows"
    defines { "NOT_WINDOWS" }
```

Reset the configuration filter
```lua
configuration {}
```
[Back to top](#table-of-contents)

---
### configurations({_names_...})
Defines a set of build configurations, such as "Debug" and "Release". Must be specified before any projects are defined, so can't be called after a project has been defined.

**Scope:** solutions

#### Arguments
_names_ - list of configuration names

#### Return Value
When called with no arguments - list of current configuration names

#### Examples
Specify configurations for a solution
```lua
solution "MySolution"
    configurations { "Debug", "Release" }
```

Add additional configurations
```lua
configurations{ "Debug", "Release", "DebugDLL", "ReleaseDLL" }
```

Retrieve current list of configurations
```lua
local cfgs = configurations()
```
[Back to top](#table-of-contents)

---
### custombuildtask({_input_file_, _output_file_, {_dependency_,...},{_command_,...}},...)
Defines custom build task for specific input file, that generates output file, there can be additional dependencies, and 
for rule listed commands are executed.

**Scope:** solutions, projects, configurations

#### Arguments
_input_file_ - source file that should be "compiled" with custom task  
_output_file_ - generated file name  
_dependency_ - additional dependencies, that can be used as parameters to commands  
_command_ - command list, special functions in commands are :  
    $(<) - input file  
    $(@) - output file  
    $(1) - $(9) - additional dependencies

#### Examples

```lua
custombuildtask {
        { ROOT_DIR .. "version.txt" , GEN_DIR .. "src/version.inc",   { ROOT_DIR .. "version.py" }, {"@echo Generating version.inc file...", "python $(1) $(<) > $(@)" }},
    }
```

[Back to top](#table-of-contents)

---
### debugargs({_args_...})
Specifies a list of arguments to pas to the application when run under the debugger.

**Note:** Not implemented for Xcode 3, where it must be configured in a per-user config file.

**Note:** In Visual Studio, this can be overridden by a per-user config file (e.g. ProjectName.vcxproj.MYDOMAIN-MYUSERNAME.user).

**Scope:** solutions, projects, configurations

#### Arguments
_args_ - list of arguments to pass to the executable while debugging

#### Examples
```lua
configuration "Debug"
    debugargs { "--append", "somefile.txt" }
```
[Back to top](#table-of-contents)

---
### debugdir(_path_)
Sets the working directory for the integrated debugger.

**Note:** Not implemented for Xcode 3, where it must be configured in a per-user config file.

**Note:** In Visual Studio, this can be overridden by a per-user config file (e.g. ProjectName.vcxproj.MYDOMAIN-MYUSERNAME.user).

**Scope:** solutions, projects, configurations

#### Arguments
_path_ - path to the working directory, relative to the currently-executing script file

#### Examples
```lua
configuration "Debug"
    debugdir "bin/debug"
```
[Back to top](#table-of-contents)

---
### defines({_symbols_...})
Adds preprocessor or compiler symbols to the project. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_symbols_ - list of symbols

#### Examples
Define two new symbols
```lua
defines { "DEBUG", "TRACE" }
```

Assign a symbol value
```lua
defines { "CALLSPEC=__dllexport" }
```
[Back to top](#table-of-contents)

---
### dependency({_main_file_, _depending_of_}...)
GMAKE specific adds dependency between source file and any other file.

**Scope:** solutions, projects, configurations

#### Arguments
_main_file_ - name of source file that depends of other file  
_depending_of_ - name of dependency file

#### Examples
```lua
dependency { { ROOT_DIR .. "src/test.c", ROOT_DIR .. "verion.txt" } }
```

[Back to top](#table-of-contents)

---
### deploymentoptions({_options_...})
Passes arguments directly to the deployment tool command line. Multiple calls are concatenated.

**Note:** Currently only supported for Xbox 360 targets.

**Scope:** solutions, projects, configurations

#### Arguments
_options_ - list of arguments

[Back to top](#table-of-contents)

---
### excludes({_files_...})
Excludes files from the project. This is different from [removefiles](#removefilesfiles) in that it may keep them in the project (Visual Studio) while still excluding them from the build. Multiple calls are concatenated.

**Note:** May be set on the solution, project, or configuration, but only project-level file lists are currently supported.

**Scope:** solutions, projects, configurations

#### Arguments
_files_ - List of files to exclude. Paths should be relative to the currently-executing script file and may contain [wildcards](#wildcards).

#### Examples
Add all c files in a directory, then exclude a specific file
```lua
files { "*.c" }
excludes { "a_file.c" }
```

Add an entire directory of C files, then exclude one directory
```lua
files { "*.c" }
excludes { "tests/*.c" }
```
[Back to top](#table-of-contents)

---
### files({_files_...})
Adds files to a project. Multiple calls are concatenated.

**Note:** May be set on the solution, project, or configuration, but only project-level file lists are currently supported.

**Scope:** solutions, projects, configurations

#### Arguments
_files_ - List of files to include. Paths should be relative to the currently-executing script file and may contain [wildcards](#wildcards).

#### Examples
Add two files to the current project
```lua
files { "hello.cpp", "goodbye.cpp" }
```

Add all C++ files from the "src/" directory to the project
```lua
files { "src/*.cpp" }
```

Add all C++ files from the "src/" directory and any subdirectories
```lua
files { "src/**.cpp" }
```
[Back to top](#table-of-contents)

---
### flags({_flags_...})
Specifies build flags to modify the compiling or linking process. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_flags_ - List of flag names from list below. Names are case-insensitive and ignored if not supported on a platform.

* _C7DebugInfo_ - Enables C7 compatible debug info for MSVC builds.
* _EnableSSE, EnableSSE2, EnableAVX, EnableAVX2_ - Enable SSE/AVX instruction sets
* _ExtraWarnings_ - Sets compiler's max warning level.
* _FatalWarnings_ - Treat warnings as errors.
* _FloatFast_ - Enable floating point optimizations at the expense of accuracy.
* _FloatStrict_ - Improve floating point consistency at the expense of performance.
* _Managed_ - Enable Managed C++ (.NET).
* _MinimumWarnings_ - - Sets compiler's minimum warning level (Visual Studio only).
* _MFC_ - Enable support for Microsoft Foundation Classes.
* _NativeWChar, NoNativeWChar_ - Toggle support for the wchar data type.
* _No64BitChecks_ - Disable 64-bit portability warnings.
* _NoBufferSecurityCheck_ - Turns off Visual Studio 'Security Check' option. Can give up to 10% performance improvement.
* _NoEditAndContinue_ - Disable support for Visual Studio's Edit-and-Continue feature.
* _NoExceptions_ - Disable C++ exception support.
* _NoFramePointer_ - Disable the generation of stack frame pointers.
* _NoIncrementalLink_ - Disable support for Visual Studio's incremental linking feature.
* _NoImportLib_ - Prevent the generation of an import library for a Windows DLL.
* _NoManifest_ - Prevent the generation of a manifest for Windows executables and shared libraries.
* _NoMultiProcessorCompilation_ - Disables Visual Studio's and FastBuild's multiprocessor compilation.
* _EnableMinimalRebuild_ - Enable Visual Studio's minimal rebuild feature.
* _NoPCH_ - Disable precompiled headers.
* _NoRTTI_ - Disable C++ runtime type information.
* _NoWinMD_ - Disables Generation of Windows Metadata.
* _NoWinRT_ - Disables Windows RunTime Extension for project.
* _ObjcARC_ - Enable automatic reference counting for Object-C and Objective-C++.
* _Optimize_ - Perform a balanced set of optimizations.
* _OptimizeSize_ - Optimize for the smallest file size.
* _OptimizeSpeed_ - Optimize for the best performance.
* _PedanticWarnings_ - Enables the pedantic warning flags.
* _SEH_ - Enable structured exception handling.
* _SingleOutputDir_ - Allow source files in the same project to have the same name.
* _StaticRuntime_ - Perform a static link against the standard runtime libraries.
* _Symbols_ - Generate debugging information.
* _Unicode_ - Enable Unicode strings. If not specified, the default toolset behavior is used.
* _Unsafe_ - Enable the use of unsafe code in .NET applications.
* _UseFullPaths_ - Enable absolute paths for `__FILE__`. 
* _UnsignedChar_ - Force `char`s to be `unsigned` by default.
* _WinMain_ - Use WinMain() as the entry point for Windows applications, rather than main().

**Note:** When not set, options will default to the tool default.

Additional tool-specific arguments can be passed with [`buildoptions`](#buildoptions) or [`linkoptions`](#linkoptions)

#### Examples
Enable debugging symbols in the Debug configuration and optimize the Release configuration
```lua
configuration "Debug"
    flags { "Symbols" }

configuration "Release"
    flags { "OptimizeSpeed", "No64BitChecks" }
```
[Back to top](#table-of-contents)

---
### framework(_version_)
Specifies a .NET framework version.

**Note:** Currently only applied to Visual Studio 2005+ and GNU Makefiles using Mono.

**Scope:** solutions, projects

#### Arguments
_version_ - one of the following:

* 1.0
* 1.1
* 2.0
* 3.0
* 3.5
* 4.0

#### Examples
Use the .NET 3.0 framework
```lua
framework "3.0"
```
[Back to top](#table-of-contents)

---
### group(_name_)
Creates a solution folder for Visual Studio solutions.

**Scope:** solutions

#### Arguments
_name_ - the name of the solution folder

#### Examples
```lua
solution "MySolution"
    group "MyGroup1"
        project "Project1"
        -- ...
        project "Project2"
        -- ...
    group "MyGroup2"
        project "Project3"
        -- ...
```
[Back to top](#table-of-contents)

---
### imageoptions({_options_...})
Passes arguments directly to the image tool command line without translation. Multiple calls are concatenated.

**Scope:** solutions, project, configurations

#### Arguments
_options_ - list of image tools flags and options

[Back to top](#table-of-contents)

---
### imagepath(_path_)
Sets the file name of the deployment image produced by the build

**Scope:** solutions, projects, configurations

#### Arguments
_path_ - the full path for the image file, relative to the currently-executing script

[Back to top](#table-of-contents)

---
### implibdir(_path_)
Specifies the import library output directory. Import libraries are generated for Windows DLL projects. By default, the generated files will place the import library in the same directory as the compiled binary.

**Scope:** solutions, projects, configurations

#### Arguments
_path_ - the output directory for the library, relative to the currently-executing script file

#### Examples
```lua
implibdir "../Libraries"
```
[Back to top](#table-of-contents)

---
### implibextension(_extension_)
Specifies the import library file extension. Import libraries are generated for Windows DLL projects. By default, the toolset static library file extension will be used (`.lib` with Windows tools, `.a` with GNU tools).

**Scope:** solutions, projects, configurations

#### Arguments
_extension_ - the extension, including the leading dot

[Back to top](#table-of-contents)

---
### implibname(_name_)
Specifies the import library base file name. Import libraries are generated for Windows DLL projects. By default the target name will be used as the import library file name.

**Scope:** solutions, projects, configurations

#### Arguments
_name_ - new base file name

[Back to top](#table-of-contents)

---
### implibprefix(_prefix_)
Specifies the import library file name prefix. Import libraries are generated for Windows DLL projects. By default the system naming convention will be used (no prefix on Windows, `lib` prefix on other systems).

**Scope:** solutions, projects, configurations

#### Arguments
_prefix_ - new file name prefix

#### Examples
```lua
implibprefix "plugin"
```

The prefix may also be set to an empty string for no prefix
```lua
implibprefix ""
```
[Back to top](#table-of-contents)

---
### implibsuffix(_suffix_)
Specifies the file name suffix for the import library base file name. Import libraries are generated for Windows DLL projects.

**Scope:** solutions, projects, configurations

#### Arguments
_suffix_ - the new filename suffix

#### Examples
```lua
-- Add "-d" to debug versions of files
configuration "Debug"
    implibsuffix "-d"
```
[Back to top](#table-of-contents)

---
### include(_directory_)
Includes a file named `premake4.lua` from the specified directory. This allows you to specify each project in its own file, and easily include them into a solution.

#### Arguments
_directory_ - path to the included directory, relative to the currently-executing script file.

#### Return Value
Any values returned by the script are passed through to the caller

#### Examples
```lua
-- runs "src/MyApplication/premake4.lua"
include "src/MyApplication"

-- runs "src/MyLibrary/premake4.lua"
include "src/MyLibrary"
```
[Back to top](#table-of-contents)

---
### includedirs({_paths_...})
Specifies include file search paths. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_paths_ - list of include file search directories, relative to the currently-executing script file.

#### Examples
Define two include file search paths
```lua
includedirs { "../lua/include", "../zlib" }
```
You can also use [wildcards](#wildcards) to match multiple directories.
```lua
includedirs { "../includes/**" }
```
[Back to top](#table-of-contents)

---
### kind(_kind_)
Sets the kind of binary object being created by the project, such as a console or windowed application.

**Scope:** solutions, projects, configurations

#### Arguments
_kind_ - project kind identifier. One of:

* _ConsoleApp_ - console executable
* _WindowedApp_ - application that runs in a desktop window. Does not apply on Linux.
* _StaticLib_ - static library
* _SharedLib_ - shared library or DLL
* _Bundle_ - Xcode: Cocoa Bundle, everywhere else: alias to _SharedLib_

#### Examples
```lua
kind "ConsoleApp"
```
You can also set different kinds for each configuration. **Not supported by XCode.**
```lua
solution "MySolution"
    configurations { "DebugLib", "ReleaseLib", "DebugDLL", "ReleaseDLL" }

project "MyProject"
    configuration "*Lib"
        kind "StaticLib"

    configuration "*DLL"
        kind "SharedLib"
```
[Back to top](#table-of-contents)

---
### language(_lang_)
Sets the programming language used by a project. GENie currently supports C, C++, C# and Vala. Not all languages are supported by all of the generators. For instance, SharpDevelop does not currently support C or C++ development, and Code::Blocks does not support the .NET languages (C#, managed C++).

**Scope:** solutions, projects

#### Arguments
_lang_ - language identifier string ("C", "C++", "C#" or "Vala"). Case insensitive.

#### Examples
```lua
language "C++"
```
[Back to top](#table-of-contents)

---
### libdirs({_paths_...})
Specifies the library search paths. Library search directories are not well supported by the .NET tools. Visual Studio will change relative paths to absolute, making it difficult to share the generated project. MonoDevelop and SharpDevelop do not support search directories at all, using only the GAC. In general, it is better to include the full (relative) path to the assembly in links instead. C/C++ projects do not have this limitation.

Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_paths_ - list of library search directories, relative to the currently-executing script file

#### Examples
```lua
libdirs { "../lua/libs", "../zlib" }
```
You can also use [wildcards](#wildcards) to match multiple directories.
```lua
libdirs { "../libs/**" }
```
[Back to top](#table-of-contents)

---
### linkoptions({_options_...})
Passes arguments to the linker command line. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_options_ - list of flags and options to pass

#### Examples
Use `pkg-config`-style configuration when building on Linux with GCC.
```lua
configuration { "linux", "gmake" }
    linkoptions { "`wx-config --libs`"}
```
[Back to top](#table-of-contents)

---
### links({_references_...})
Specifies a list of libraries and projects to link against. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_references_ - list of library and project names

When linking against another project in the same solution, specify the project name here, rather than the library name. GENie will figure out the correct library to link against for the current configuration and will also create a dependency between the projects to ensure proper build order.

When linking against system libraries, do not include any prefix or file extension. GENie will use the appropriate naming conventions for the current platform.

#### Examples
Link against some system libraries
```lua
configuration "windows"
    links { "user32", "gdi32" }

configuration "linux"
    links { "m", "png" }

configuration "macosx"
--- OS X frameworks need the extension to be handled properly
    links { "Cocoa.framework", "png" }
```
In a solution with two projects, link the library into the executable. Note that the project name is used to specify the link. GENie will automatically figure out the correct library file name and directory and create a project dependency.
```lua
solution "MySolution"
    configurations { "Debug", "Release" }
    language "C++"

    project "MyExecutable"
        kind "ConsoleApp"
        files "**.cpp"
        links { "MyLibrary" }

    project "MyLibrary"
        kind "SharedLib"
        files "**.cpp"
```
You may also create links between non-library projects. In this case, GENie will generate a build dependency (the linked project will build first) but not an actual link. In this example, MyProject uses a build dependency to ensure that MyTool gets built first. It then uses MyTool as part of its build process
```lua
solution "MySolution"
    configurations { "Debug", "Release" }
    language "C++"

    project "MyProject"
        kind "ConsoleApp"
        files "**.cpp"
        links { "MyTool" }
        prebuildcommands { "MyTool --dosomething" }

    project "MyTool"
        kind "ConsoleApp"
        files "**.cpp"
```
[Back to top](#table-of-contents)

---
### location(_path_)
Sets the destination directory for a generated solution or project file. By default, project files are generated into the same directory as the script that defines them.

**Note:** Does not automatically propagate to the contained projects. Projects will use their default location unless explicitly overridden.

**Scope:** solutions, projects

#### Arguments
_path_ - directory into which files should be generated, relative to the currently-executing script file.

#### Examples
```lua
solution "MySolution"
    location "../build"
```
If you plan to build with multiple tools from the same source tree, you might want to split up the project files by toolset. The _ACTION global variable contains the current toolset identifier, as specified on the command line. Note that Lua syntax requires parentheses around the function parameters in this case.
```lua
location ("../build/" .. _ACTION)
```
[Back to top](#table-of-contents)

---
### messageskip(_options_)
Skips certain messages in ninja and Makefile generated projects.

**Scope:** solutions

#### Arguments
_options_ - one or several of "SkipCreatingMessage", "SkipBuildingMessage", "SkipCleaningMessage"

#### Examples
```lua
messageskip { "SkipCreatingMessage", "SkipBuildingMessage", "SkipCleaningMessage" }
```
[Back to top](#table-of-contents)

---
### newaction(_description_)
Registers a new command-line action argument.

#### Arguments
_description_ - a table describing the new action with the following fields:

* _trigger_ - string identifier of the action; what the user would type on the command line
* _description_ - short description of the action, to be displayed in the help text
* _execute_ - Function to be executed when the action is fired

#### Examples
```lua
newaction {
    trigger     = "install",
    description = "Install the software",
    execute     = function()
        os.copyfile("bin/debug/myprogram", "/usr/local/bin/myprogram")
    end
}
```
[Back to top](#table-of-contents)

---
### newoption(_description_)
Registers a new command-line option argument.

**Scope:** solutions, projects, configurations

#### Arguments
_description_ - a table describing the new option with the following fields:

* _trigger_ - string identifier of the option; what the user would type on the command line
* _description_ - short description of the option, to be displayed in the help text
* _value_ - (optional) provides a hint to the user as to what type of data is expected
* _allowed_ - (optional) list of key-value pairs listing the allowed values for the option

#### Examples
```lua
newoption {
    trigger     = "gfxapi",
    value       = "API",
    description = "Choose a particular 3D API for rendering",
    allowed     = {
        { "opengl",   "OpenGL" },
        { "direct3d", "Direct3D (Windows only)"},
        { "software", "Software Renderer" }
    }
}
```
[Back to top](#table-of-contents)

---
### nopch({_files_...})
Sets sources files added with the [`files`](#files) function, to not use the precompiled header. Multiple calls are concatenated.

**Note:** May be set on the solution, project, or configuration, but only project-level file lists are currently supported.

**Scope:** solutions, projects, configurations

#### Arguments
_files_ - List of files to not use the precompiled header. Paths should be relative to the currently-executing script file and may contain [wildcards](#wildcards).

#### Examples
Add all c files in a directory, then set a specific file to not use precompiled headers.
```lua
files { "*.c" }
nopch { "a_file.c" }
```

Add an entire directory of C files, then set one directory to not use precompiled headers
```lua
files { "*.c" }
nopch { "tests/*.c" }
```
[Back to top](#table-of-contents)

---
### objdir(_path_)
Sets an object and intermediate file directory for a project. By default, object and intermediate files are stored in a directory named "obj" in the same directory as the project.

**Scope:** solutions, projects, configurations

#### Arguments
_path_ - directory where the object and intermediate files should be stored, relative to the currently-executing script file.

#### Examples
```lua
project "MyProject"
    objdir "objects"
```
Set object directories per configuration
```lua
configuration "Debug"
    objdir "../obj_debug"

configuration "Release"
    objdir "../obj_release"
```
[Back to top](#table-of-contents)

---
### pchheader(_file_)
Sets the main header file for precompiled header support.

**Scope:** projects

#### Arguments
_file_ - name of the header file, as it is specified in your `#include` statements

#### Examples
```lua
pchheader "afxwin.h"
pchsource "afxwin.cpp"
```
[Back to top](#table-of-contents)

---
### pchsource(_file_)
Sets the main source file for precompiled header support. Only used by Visual Studio.

**Scope:** projects

#### Arguments
_file_ - name of the source file, relative to the currently-executing script file

#### Examples
```lua
pchheader "afxwin.h"
pchsource "afxwin.cpp"
```
[Back to top](#table-of-contents)

---
### platforms({_identifiers_...})
Specifies a set of target hardware platforms for a solution.

_Platform support is a new, experimental feature. The syntax and behavior described here might change as we sort out the details_

**Scope:** solutions

#### Arguments
_identifiers_ - list of hardware platform specifiers from this list:

* _Native_ - general build not targeting any particular platform. If your project can be built in a generic fashion, you should include this as the first platform option
* _x32_ - 32-bit environment
* _x64_ - 64-bit environment
* _Universal_ - OS X universal binary, target both 32- and 64-bit versions of x86 and PPC. Automated dependency generation must be turned off, and always do a clean build. Not supported by Visual Studio.
* _Universal32_ - like _Universal_ above, but targeting only 32-bit platforms
* _Universal64_ - like _Universal_ above, but targeting only 64-bit platforms
* _PS3_ - Playstation 3
* _WiiDev_ - Wii
* _Xbox360_ - Xbox 360 compiler and linker under Visual Studio
* _PowerPC_ - PowerPC processors
* _ARM_ - ARM-based processors
* _Orbis_ - Playstation 4
* _Durango_ - Xbox One

#### Return Value
Current list of target platforms for the active solution

#### Examples
Generic build, as well as OS X Universal build
```lua
solution "MySolution"
    configurations { "Debug", "Release" }
    platforms { "native", "universal" }
```
Prove 32- and 64-bit specific build targets. No generic build is provided so one of these two platforms must always be used. Do this only if your software requires knowledge of the underlying architecture at build time; otherwise, include _native_ to provide a generic build.
```lua
solution "MySolution"
    configurations { "Debug", "Release" }
    platforms { "x32", "x64" }
```

You can retrieve the current list of platforms by calling the function with no parameters
```lua
local p = platforms()
```

Once you have defined a list of platforms, you may use those identifiers to set up configuration filters and apply platform-specific settings.
```lua
configuration "x64"
    defines "IS_64BIT"

-- You can also mix platforms with other configuration selectors
configuration { "Debug", "x64" }
    defines "IS_64BIT_DEBUG"
```
[Back to top](#table-of-contents)

---
### postbuildcommands({_commands_...})
Specifies shell commands to run after build is finished

**Scope:** solutions, projects, configurations

#### Arguments
_commands_ - one or more shell commands

#### Examples
```lua
configuration "windows"
    postbuildcommands { "copy default.config bin\\project.config" }

configuration "not windows"
    postbuildcommands { "cp default.config bin/project.config" }
```
[Back to top](#table-of-contents)

---
### postcompiletasks({_commands_...})
Specifies shell commands to run after compile of file is finished
(GMAKE specific)

**Scope:** solutions, projects, configurations

#### Arguments
_commands_ - one or more shell commands

#### Examples
```lua
    postcompiletasks { "rm $(@:%.o=%.d)" }
```
[Back to top](#table-of-contents)

---
### prebuildcommands({_commands_...})
Specifies shell commands to run before each build

**Scope:** solutions, projects, configurations

#### Arguments
_commands_ - one or more shell commands

#### Examples
```lua
configuration "windows"
    prebuildcommands { "copy default.config bin\\project.config" }

configuration "not windows"
    prebuildcommands { "cp default.config bin/project.config" }
```
[Back to top](#table-of-contents)

---
### prelinkcommands({_commands_...})
Specifies shell commands to run after source files have been compiled, but before the link step

**Scope:** solutions, projects, configurations

#### Arguments
_commands_ - one or more shell commands

#### Examples
```lua
configuration "windows"
    prelinkcommands { "copy default.config bin\\project.config" }

configuration "not windows"
    prelinkcommands { "cp default.config bin/project.config" }
```
[Back to top](#table-of-contents)


---
### project(_name_)
Creates a new project and makes it active. Projects contain all of the settings necessary to build a single binary target, and are synonymous with a Visual Studio Project. These settings include the list of source code files, the programming language used by those files, compiler flags, include directories, and which libraries to link against.

Every project belongs to a solution.

#### Arguments
_name_ - a unique name for the project. If a project with the given name already exists, it is made active and returned. The project name will be used as the file name of the generated solution file.

#### Return Value
The active project object.

#### The `project` Object
Every project is represented in Lua as a table of key-value pairs. You should treat this object as read-only and use the GENie API to make any changes.

* _basedir_  - directory where the project was originally defined. Root for relative paths.
* _blocks_   - list of configuration blocks
* _language_ - project language, if set
* _location_ - output directory for generated project file
* _name_     - name of the project
* _solution_ - solution which contains the project
* _uuid_     - unique identifier

#### Examples
Create a new project named "MyProject". Note that a solution must exist to contain the project. The indentation is for readability and is optional.
```lua
solution "MySolution"
    configurations { "Debug", "Release" }

    project "MyProject"
```

You can retrieve the currently active project by calling `project` with no parameters.
```lua
local prj = project()
```

You can retrieve the list of projects associated with a solution using the `projects` field of the solution object, which may then be iterated over.
```lua
local prjs = solution().projects
for i, prj in ipairs(prjs) do
    print(prj.name)
end
```
[Back to top](#table-of-contents)

---
### removefiles({_files_...})
Removes files from the project. This is different from [excludes](#excludesfiles) in that it completely removes them from the project, not only from the build. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_files_ - list of files to remove.

[Back to top](#table-of-contents)

---
### removeflags({_flags_...})
Removes flags from the flag list.

**Scope:** solutions, projects, configurations

#### Arguments
_flags_ - list of flags to remove from the flag list. They must be valid flags.

[Back to top](#table-of-contents)

---
### removelinks({_references_...})

Removes flags from the flag list.

**Scope:** solutions, projects, configurations

#### Arguments
_references_ - list of libraries and project names to remove from the links list.

[Back to top](#table-of-contents)

---
### removeplatforms({_platforms_...})

Removes platforms from the platform list.

**Scope:** solutions, projects, configurations

#### Arguments
_platforms_ - list of platforms to remove from the platforms list.

[Back to top](#table-of-contents)

---
### resdefines({_symbols_...})
Specifies preprocessor symbols for the resource compiler. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_symbols_ - list of symbols to be defined

#### Examples
```lua
resdefines { "DEBUG", "TRACE" }
```

```lua
resdefines { "CALLSPEC=__dllexport" }
```
[Back to top](#table-of-contents)

---
### resincludedirs({_paths_...})
Specifies the include file search paths for the resource compiler. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_paths_ - list of include file search directories, relative to the currently executing script file

#### Examples
```lua
resincludedirs { "../lua/include", "../zlib" }
```

May use wildcards
```lua
resincludedirs { "../includes/**" }
```
[Back to top](#table-of-contents)

---
### resoptions({_options_...})
Passes arguments directly to the resource compiler. Multiple calls are concatenated.

**Scope:** solutions, projects, configurations

#### Arguments
_options_ - list of resource compiler flags and options

#### Examples
```lua
configuration { "linux", "gmake" }
    resoptions { "`wx-config --cxxflags`", "-ansi", "-pedantic" }
```
[Back to top](#table-of-contents)

---
### solution(_name_)
Creates a new solution and makes it active. Solutions are the top-level objects in a GENie build script, and are synonymous with a Visual Studio solution. Each solution contains one or more projects, which in turn contain the settings to generate a single binary target.

#### Arguments
_name_ - unique name for the solution. If a solution with the given name already exists, it is made active and returned. This value will be used as the file name of the generated solution file.

#### Return Value
The active `solution` object.

#### The `solution` Object
Represented as a Lua table key-value pairs, containing the following values. You should treat this object as read-only and use the GENie API to make any changes.

* _basedir_        - directory where the original project was defined; acts as a root for relative paths
* _configurations_ - list of valid configuration names
* _blocks_         - list of configuration blocks
* _language_       - solution language, if set
* _location_       - output directory for the generated solution file
* _name_           - name of the solution
* _platforms_      - list of target platforms
* _projects_       - list of projects contained by the solution

#### Examples
```lua
solution "MySolution"
```

You can retrieve the currently active solution object by calling `solution` with no parameters.
```lua
local sln = solution()
```

You can use the global variable `_SOLUTIONS` to list out all of the currently defined solutions.
```lua
for i, sln in ipairs(_SOLUTIONS) do
    print(sln.name)
end
```
[Back to top](#table-of-contents)

---
###  startproject(_name_)
Sets the start (default) project for the solution. Works for VS, QBS and Xcode.

**Scope:** solutions

#### Arguments
_name_ - name of the project to set as the start project.

### Examples
```lua
solution "MySolution"
    startproject "MyProjectFoo"
    -- [...]

project "MyProjectFoo"
-- [...]

project "MyProjectBar"
-- [...]
```
[Back to top](#table-of-contents)

---
### targetdir(_path_)
Sets the destination directory for the compiled binary target. By default, generated project files will place their compiled output in the same directory as the script.

**Scope:** solutions, projects, configurations

#### Arguments
_path_ - file system path to the directory where the compiled target file should be stored, relative to the currently executing script file.

#### Examples
```lua
project "MyProject"

    configuration "Debug"
        targetdir "bin/debug"

    configuration "Release"
        targetdir "bin/release"
```
[Back to top](#table-of-contents)

---
### targetextension(_ext_)
Specifies the file extension for the compiled binary target. By default, the project will use the system's normal naming conventions: ".exe" for Windows executables, ".so" for Linux shared libraries, etc.

**Scope:** solutions, projects, configurations

#### Arguments
_ext_ - new file extension, including leading dot

#### Examples
```lua
targetextension ".zmf"
```
[Back to top](#table-of-contents)

---
### targetname(_name_)
Specifies the base file name for the compiled binary target. By default, the project name will be used as the file name of the compiled binary target.

**Scope:** solutions, projects, configurations

#### Arguments
_name_ - new base file name

#### Examples
```lua
targetname "mytarget"
```
[Back to top](#table-of-contents)

---
### targetprefix(_prefix_)
Specifies the file name prefix for the compiled binary target. By default, system naming conventions will be used: "lib" for POSIX libraries (e.g. "libMyProject.so") and no prefix elsewhere.

**Scope:** solutions, projects, configurations

#### Arguments
_prefix_ - new file name prefix

#### Examples
```lua
targetprefix "plugin"
```

The prefix may also be set to an empty string for no prefix
```lua
targetprefix ""
```
[Back to top](#table-of-contents)

---
### targetsubdir(_path_)
Sets a subdirectory inside the target directory for the compiled binary target.

**Scope:** solutions, projects, configurations

#### Arguments
_path_ - name of the subdirectory.

[Back to top](#table-of-contents)

---
### targetsuffix(_suffix_)
Specifies a file name suffix for the compiled binary target.

**Scope:** solutions, projects, configurations

#### Arguments
_suffix_ - new filename suffix

#### Examples
```lua
--- Add "-d" to debug versions of files
configuration "Debug"
    targetsuffix "-d"
```
[Back to top](#table-of-contents)

---
### uuid(_projectuuid_)
Sets the UUID for a project. GENie automatically assigns a UUID to each project, which is used by the Visual Studio generators to identify the project within a solution. This UUID is essentially random and will change each time the project file is generated. If you are storing the generated Visual Studio project files in a version control system, this will create a lot of unnecessary deltas. Using the `uuid` function, you can assign a fixed UUID to each project which never changes.

**Scope:** projects

#### Arguments
_projectuuid_ - UUID for the current project

### Return Value
Current project UUID or `nil` if no UUID has been set

#### Examples
```lua
uuid "XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXX"
```
[Back to top](#table-of-contents)

---
### vpaths({[_group_] = {_pattern_...}})
Places files into groups for "virtual paths", rather than mirroring the filesystem. This allows you to, for instance, put all header files in a group called "Headers", no matter where they appeared in the source tree.

**Note:** May be set on the solution, project, or configuration, but only project-level file lists are currently supported.

**Scope:** solutions, projects, configurations

#### Arguments
Table of values, where keys (_groups_) are strings and values (_pattern_) are lists of file system patterns.

_group_   - name for the new group  
_pattern_ - file system pattern for matching file names

#### Examples

Place all header files into a virtual path called "Headers". Any directory information is removed, "src/lua/lua.h" will appear in the IDE as "Headers/lua.h"
```lua
vpaths { ["Headers"] = "**.h" }
```

You may specify multiple file patterns using table syntax
```lua
vpaths {
    ["Headers"] = { "**.h", "**.hxx", "**.hpp" }
}
```

It is also possible to include the file's path in the virtual group. Using this rule, "src/lua/lua.h" will appear in the IDE as "Headers/src/lua/lua.h".
```lua
vpaths { ["Headers/*"] = "**.h" }
```

Any directory information explicitly provided in the pattern will be removed from the replacement. Using this rule, "src/lua/lua.h" will appear in the IDE as "Headers/lua/lua.h".
```lua
vpaths { ["Headers/*"] = "src/**.h" }
```

You can also use virtual paths to remove extra directories from the IDE. Using this rule, "src/lua/lua.h" will appear in the IDE as "lua/lua.h".
```lua
vpaths { ["*"] = "src" }
```

You may specify more than one rule at a time
```lua
vpaths {
    ["Headers"]   = "**.h",
    ["Sources/*"] = {"**.c", "**.cpp"},
    ["Docs"]      = "**.txt"
}
```
[Back to top](#table-of-contents)

---
## Utility functions

### iif(_condition_, _trueval_, _falseval_)
Implements an immediate `if` clause, returning one of two possible values.

#### Arguments
_condition_ - logical condition to test  
_trueval_ - value to return if _condition_ evaluates to `true`  
_falseval_ - value to return if _condition_ evaluates to `false`

#### Examples
```lua
result = iif(os.is("windows"), "is windows", "is not windows")
```

Note that all expressions are evaluated before the condition is checked. The following expression cannot be implemented with an `iif` because it may try to concatenate a string value.
```lua
result = iif(x -= nil, "x is " .. x, "x is nil")
```
[Back to top](#table-of-contents)

---
### os.chdir(_path_)
Changes the working directory

#### Arguments
_path_ - path to the new working directory

#### Return Value
`true` if successful, otherwise `nil` and an error message

[Back to top](#table-of-contents)

---
### os.copyfile(_source_, _destination_)
Copies a file from one location to another.

#### Arguments
_source_ - file system path to the file to be copied
_destination_ - path to the copy location

#### Return Value
`true` if successful, otherwise `nil` and an error message

[Back to top](#table-of-contents)

---
### os.findlib(_libname_)
Scans the well-known system locations looking for a binary file.

#### Arguments
_libname_ - name of the library to locate. May be specified with (libX11.so) or without (X11) system-specified decorations.

#### Return Value
The path containing the library file, if found. Otherwise, `nil`.

[Back to top](#table-of-contents)

---
### os.get()
Identifies the currently-targeted operating system.

#### Return Value
One of "bsd", "linux", "macosx", "solaris", or "windows"

**Note:** This function returns the OS being targeted, which is not necessarily the same as the OS on which GENie is being run.

#### Example
```lua
if os.get() == "windows" then
    -- do something windows-specific
end
```
[Back to top](#table-of-contents)

---
### os.getcwd()
Gets the current working directory.

#### Return Value
The current working directory

[Back to top](#table-of-contents)

---
### os.getversion()
Retrieves version information for the host operating system

**Note:** Not implemented for all platforms. On unimplemented platforms, will return `0` for all version numbers, and the platform name as the description.

#### Return Value
Table containing the following key-value pairs:

| Key          | Value                                        |
| ------------ | -------------------------------------------- |
| majorversion | major version number                         |
| minorversion | minor version number                         |
| revision     | bug fix release or service pack number       |
| description  | human-readable description of the OS version |

#### Examples
```lua
local ver = os.getversion()
print(string.format(" %d.%d.%d (%s)",
    ver.majorversion, ver.minorversion, ver.revision,
    ver.description))

-- On Windows XP: "5.1.3 (Windows XP)"
-- On OSX: "10.6.6 (Mac OS X Snow Leopard)"
```
[Back to top](#table-of-contents)

---
### os.is(_id_)
Checks the current operating system identifier against a particular value

#### Arguments
_id_ - one of "bsd", "linux", "macosx", "solaris", or "windows"

**Note:** This function returns the OS being targeted, which is not necessarily the same as the OS on which GENie is being run.

#### Return Value
`true` if the supplied _id_ matches the current operating system identifier, `false` otherwise.

[Back to top](#table-of-contents)

---
### os.is64bit()
Determines if the host is using a 64-bit processor.

#### Return Value
`true` if the host system has a 64-bit processor
`false` otherwise

#### Examples
```lua
if os.is64bit() then
    print("This is a 64-bit system")
else
    print("This is NOT a 64-bit system")
end
```
[Back to top](#table-of-contents)

---
### os.isdir(_path_)
Checks for the existence of a directory.

#### Arguments
_path_ - the file system path to check

#### Return Value
`true` if a matching directory is found  
`false` if there is no such file system path, or if the path points to a file

[Back to top](#table-of-contents)

---
### os.isfile(_path_)
Checks for the existence of a file.

#### Arguments
_path_ - the file system path to check

#### Return Value
`true` if a matching file is found  
`false` if there is no such file system path or if the path points to a directory instead of a file

[Back to top](#table-of-contents)

---
### os.matchdirs(_pattern_)
Performs a wildcard match to locate one or more directories.

#### Arguments
_pattern_ - file system path to search. May [wildcard](#wildcard) patterns.

#### Return Value
List of directories which match the specified pattern. May be empty.

#### Examples
```lua
matches = os.matchdirs("src/*")     -- non-recursive match
matches = os.matchdirs("src/**")    -- recursive match
matches = os.matchdirs("src/test*") -- may also match partial name
```
[Back to top](#table-of-contents)

---
### os.matchfiles(_patterns_)
Performs a wildcard match to locate one or more directories.

#### Arguments
_pattern_ - file system path to search. May contain [wildcard](#wildcard) patterns.

#### Return Value
List of files which match the specified pattern. May be empty.

#### Examples
```lua
matches = os.matchfiles("src/*.c")  -- non-recursive match
matches = os.matchfiles("src/**.c") -- recursive match
```
[Back to top](#table-of-contents)

---
### os.mkdir(_path_)
Creates a new directory.

#### Arguments
_path_ - path to be created

#### Return Value
`true` if successful  
`nil` and an error message otherwise

[Back to top](#table-of-contents)

---
### os.outputof(_command_)
Runs a shell command and returns the output.

#### Arguments
_command_ - shell command to run

#### Return Value
The output of the command

#### Examples
```lua
-- Get the ID for the host processor architecture
local proc = os.outputof("uname -p")
```
[Back to top](#table-of-contents)

---
### os.pathsearch(_fname_, _paths..._)
description

**Scope:** solutions, projects, configurations

#### Arguments
_fname_ - name of the file being searched, followed by one or more path sets to be searched  
_paths_ - the match format of the PATH environment variable: a colon-delimited list of path. On Windows, you may use a semicolon-delimited list if drive letters might be included

#### Return Value
Path to the directory which contains the file, if found
`nil` otherwise

#### Examples
```lua
local p = os.pathsearch("mysystem.config", "./config:/usr/local/etc:/etc")
```
[Back to top](#table-of-contents)

---
### os.rmdir(_path_)
Removes an existing directory as well as any files or subdirectories it contains.

#### Arguments
_path_ - file system path to be removed

#### Return Value
`true` if successful  
`nil` and an error message otherwise

[Back to top](#table-of-contents)

---
### os.stat(_path_)
Retrieves information about a file.

#### Arguments
_path_ - path to file for which to retrieve information

#### Return Value
Table of values:

| Key   | Value                   |
| ----- | ----------------------- |
| mtime | Last modified timestamp |
| size  | File size in bytes      |

[Back to top](#table-of-contents)

---
### userincludedirs({_paths_...})
Specifies the user include file search paths. Multiple calls are concatenated.

For XCode, it maps to setting the USER INCLUDE SEARCH PATH. 

For clang/gcc, it maps to setting the include directory using the iquote option.

On the other build systems, it behaves like [includedirs](#includedirspaths).

**Scope:** solutions, projects, configurations

#### Arguments
_paths_ - list of user include file search directories, relative to the currently-executing script file.

#### Examples
Define two include file search paths
```lua
userincludedirs { "../lua/include", "../zlib" }
```
You can also use [wildcards](#wildcards) to match multiple directories.
```lua
userincludedirs { "../includes/**" }
```
[Back to top](#table-of-contents)

---
### os.uuid(_name_)
Returns a Universally Unique Identifier

#### Arguments
_name_ - (optional) string to be hashed

#### Return Value
A new UUID, a string value with the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, generated from _name_ if it is provided, otherwise generated from random data

[Back to top](#table-of-contents)

---
### path.getabsolute(_path_)
Converts relative path to absolute path

#### Arguments
_path_ - the relative path to be converted

#### Return Value
New absolute path, calculated from the current working directory

[Back to top](#table-of-contents)

---
### path.getbasename(_path_)
Extracts base file portion of a path, with the directory and extension removed.

#### Arguments
_path_ - path to be split

#### Return Value
Base name portion of the path

[Back to top](#table-of-contents)

---
### path.getdirectory(_path_)
Extracts directory portion of a path, with file name removed

#### Arguments
_path_ - path to be split

#### Return Value
Directory portion of the path

[Back to top](#table-of-contents)

---
### path.getdrive(_path_)
Returns drive letter portion of a path

#### Arguments
_path_ - path to be split

#### Return Value
Drive letter portion of the path, or `nil`

[Back to top](#table-of-contents)

---
### path.getextension(_path_)
Returns file extension portion of a path

#### Arguments
_path_ - path to be split

#### Return Value
File extension portion of the path, or an empty string

[Back to top](#table-of-contents)

---
### path.getname(_path_)
Returns file name and extension, removes directory information.

#### Arguments
_path_ - path to be split

#### Return Value
File name and extension without directory information

[Back to top](#table-of-contents)

---
### path.getrelative(_src_, _dest_)
Computes relative path from one directory to another.

#### Arguments
_src_ - originating directory  
_dest_ - target directory

#### Return Value
Relative path from _src_ to _dest_

[Back to top](#table-of-contents)

---
### path.isabsolute(_path_)
Returns whether or not a path is absolute.

#### Arguments
_path_ - path to check

#### Return Value
`true` if path is absolute  
`false` otherwise

[Back to top](#table-of-contents)

---
### path.iscfile(_path_)
Determines whether file is a C source code file, based on extension.

#### Arguments
_path_ - path to check

#### Return Value
`true` if path uses a C file extension  
`false` otherwise

[Back to top](#table-of-contents)

---
### path.isSourceFile(_path_)
Determines whether a file is a C++ source code file, based on extension.

#### Arguments
_path_ - path to check

#### Return Value
`true` if path uses a C++ file extension  
`false` otherwise

[Back to top](#table-of-contents)

---
### path.isresourcefile(_path_)
Determines whether a path represends a Windows resource file, based on extension.

#### Arguments
_path_ - path to check

#### Return Value
`true` if path uses a well-known Windows resource file extension  
`false` otherwise

[Back to top](#table-of-contents)

---
### path.join(_leading_, _trailing_)
Joins two path portions together into a single path.

**Note:** if _trailing_ is an absolute path, then _leading_ is ignored and the absolute path is returned.

#### Arguments
_leading_ - beginning portion of the path  
_trailing_ - ending portion of the path

#### Return Value
Merged path

#### Examples
```lua
-- returns "MySolution/MyProject"
p = path.join("MySolution", "MyProject")

-- returns "/usr/bin", because the trailing path is absolute
p = path.join("MySolution", "/usr/bin")

-- tokens are assumed to be absolute. This returns `${ProjectDir}`
p = path.join("MySolution", "$(ProjectDir)")
```
[Back to top](#table-of-contents)

---
### path.rebase(_path_, _oldbase_, _newbase_)
Takes a relative path and makes it relative to a different location.

#### Arguments
_path_ - path to be modified  
_oldbase_ - original base directory, from which _path_ is relative  
_newbase_ - the new base directory, from where the resulting path should be relative

#### Return Value
Rebased path

[Back to top](#table-of-contents)

---
### path.translate(_path_, _newsep_)
Converts the separators in a path.

#### Arguments
_path_ - path to modify  
_newsep_ - new path separator. Defaults to current environment default.

#### Return Value
Modified path

[Back to top](#table-of-contents)
---

### printf(_format_, _args_...)
Prints a formatted string

#### Arguments
_format_ - formatting string, containing C `printf()` formatting codes  
_args_ - arguments to be substituted into the format string

[Back to top](#table-of-contents)

---
### string.endswith(_haystack_, _needle_)
Checks if the given _haystack_ string ends with _needle_.

#### Arguments
_haystack_ - string to search within  
_needle_   - string to check ending of _haystack_ against

#### Return Value
`true`  - _haystack_ ends with _needle_  
`false` - _haystack_ does not end with _needle_

[Back to top](#table-of-contents)

---
### string.explode(_str_, _pattern_)
Breaks a string into an array of strings, formed by splitting _str_ on _pattern_.

#### Arguments
_str_     - string to be split  
_pattern_ - separator pattern at which to split; may use Lua's pattern matching syntax

#### Return Value
List of substrings

[Back to top](#table-of-contents)

---
### string.findlast(_str_, _pattern_, _plain_)
Finds the last instance of a pattern within a string.

#### Arguments
_str_     - string to be searched  
_pattern_ - pattern to search for; may use Lua's pattern matching syntax  
_plain_   - whether or not plain string comparison should be used (rather than pattern-matching)

#### Return Value
The matching pattern, if found, or `nil`

[Back to top](#table-of-contents)

---
### string.startswith(_haystack_, _needle_)
Checks if the given _haystack_ starts with _needle_.

#### Arguments
_haystack_ - string to search within  
_needle_   - string to check start of _haystack_ against

#### Return Value
`true`  - _haystack_ starts with _needle_  
`false` - _haystack_ does not start with _needle_

[Back to top](#table-of-contents)

---
### table.contains(_array_, _value_)
Determines if a _array_ contains _value_.

#### Arguments
_array_ - table to test for _value_  
_value_ - _value_ being tested for

#### Return Value
`true`  - _array_ contains _value_  
`false` - _array_ does not contain _value_

[Back to top](#table-of-contents)

---
### table.implode(_array_, _before_, _after_, _between_)
Merges an array of items into a single formatted string.

#### Arguments
_array_   - table to be converted into a string  
_before_  - string to be inserted before each item  
_after_   - string to be inserted after each item  
_between_ - string to be inserted between each item

#### Return Value
Formatted string

[Back to top](#table-of-contents)

---

## Additional information

### Wildcards

In some places, wildcards may be used in string values passed to a function. Usually, these strings represent paths. There are two types of wildcards:

* `*` - matches files within a single directory
* `**` - matches files recursively in any child directory