1
- newoption
2
- {
3
- trigger = " opengl43" ,
4
- description = " use OpenGL 4.3"
5
- }
6
1
7
- function platform_defines ()
8
- defines {" PLATFORM_DESKTOP" }
9
- if (_OPTIONS [" opengl43" ]) then
10
- defines {" GRAPHICS_API_OPENGL_43" }
11
- else
12
- defines {" GRAPHICS_API_OPENGL_33" }
13
- end
2
+ function define_C ()
3
+ language " C"
14
4
end
15
5
16
- function define_project (project_folder )
17
- kind " ConsoleApp"
18
- location (project_folder )
19
- language " C++"
20
- targetdir " bin/%{cfg.buildcfg}"
21
- cppdialect " C++17"
22
-
23
- vpaths
24
- {
25
- [" Header Files" ] = { " **.h" },
26
- [" Source Files" ] = {" **.c" , " **.cpp" },
27
- }
28
- files {project_folder .. " /**.c" , project_folder .. " /**.cpp" , project_folder .. " /**.h" }
29
-
30
- links {" raylib" }
31
-
32
- includedirs { project_folder , " raylib/src" }
33
- platform_defines ()
34
-
35
- filter " action:vs*"
36
- defines {" _WINSOCK_DEPRECATED_NO_WARNINGS" , " _CRT_SECURE_NO_WARNINGS" }
37
- dependson {" raylib" }
38
- links {" raylib.lib" }
39
- characterset (" MBCS" )
40
-
41
- filter " system:windows"
42
- defines {" _WIN32" }
43
- links {" winmm" , " kernel32" , " opengl32" , " kernel32" , " gdi32" }
44
- libdirs {" bin/%{cfg.buildcfg}" }
45
-
46
- filter " system:linux"
47
- links {" pthread" , " GL" , " m" , " dl" , " rt" , " X11" }
48
-
49
- filter {}
6
+ function define_Cpp ()
7
+ language " C++"
50
8
end
51
9
52
- workspace " Examples-CPP"
53
- configurations { " Debug" ," Debug.DLL" , " Release" , " Release.DLL" }
54
- platforms { " x64" , " x86" }
55
-
56
- filter " configurations:Debug"
57
- defines { " DEBUG" }
58
- symbols " On"
59
-
60
- filter " configurations:Debug.DLL"
61
- defines { " DEBUG" }
62
- symbols " On"
63
-
64
- filter " configurations:Release"
65
- defines { " NDEBUG" }
66
- optimize " On"
67
-
68
- filter " configurations:Release.DLL"
69
- defines { " NDEBUG" }
70
- optimize " On"
71
-
72
- filter { " platforms:x64" }
73
- architecture " x86_64"
74
-
75
- targetdir " bin/%{cfg.buildcfg}/"
76
-
77
- project " raylib"
78
- filter " configurations:Debug.DLL OR Release.DLL"
79
- kind " SharedLib"
80
- defines {" BUILD_LIBTYPE_SHARED" }
81
-
82
- filter " configurations:Debug OR Release"
83
- kind " StaticLib"
84
-
85
- filter " system:windows"
86
- defines {" _WINSOCK_DEPRECATED_NO_WARNINGS" , " _CRT_SECURE_NO_WARNINGS" , " _WIN32" }
87
- links {" winmm" , " kernel32" , " opengl32" , " kernel32" , " gdi32" }
88
-
89
- filter " system:linux"
90
- links {" pthread" , " GL" , " m" , " dl" , " rt" , " X11" }
91
-
92
- filter {}
93
- platform_defines ()
94
-
95
- location " build"
96
- language " C"
97
- targetdir " bin/%{cfg.buildcfg}"
98
-
99
- includedirs { " raylib/src" , " raylib/src/external/glfw/include" }
100
- vpaths
101
- {
102
- [" Header Files" ] = { " raylib/src/**.h" },
103
- [" Source Files/*" ] = {" raylib/src/**.c" },
104
- }
105
- files {" raylib/src/*.h" , " raylib/src/*.c" }
106
-
107
- project " box2d"
108
- kind " StaticLib"
109
-
110
- location " build"
111
- language " C++"
112
- targetdir " bin/%{cfg.buildcfg}"
113
- cppdialect " C++17"
114
-
115
- includedirs { " box2d/src" , " box2d/include" }
116
- vpaths
117
- {
118
- [" Header Files" ] = { " box2d/include/**.h" , " box2d/src/**.h" },
119
- [" Source Files/*" ] = {" box2d/src/**.cpp" },
120
- }
121
- files {" box2d/src/**.h" ," box2d/src/**.cpp" , " box2d/include/**.h" }
122
-
123
- project " Pew"
124
- define_project (" pew" )
125
-
126
- project " Cards"
127
- define_project (" cards" )
128
-
129
- project " LightCaster"
130
- define_project (" light_caster" )
131
-
132
- project " StencilReflection"
133
- define_project (" stencil_reflection" )
10
+ function string .starts (String ,Start )
11
+ return string.sub (String ,1 ,string.len (Start ))== Start
12
+ end
134
13
135
- project " PlatformMovement"
136
- define_project (" platform_example" )
14
+ function link_to (lib )
15
+ links (lib )
16
+ includedirs (" ../" .. lib )
17
+ end
137
18
138
- project " UnsortedBilboards"
139
- define_project (" unsorted_bilboards" )
140
-
141
- project " Box2dRaylib"
142
- define_project (" box2d_raylib" )
143
- links {" box2d" }
144
- includedirs { " box2d/include" }
145
-
146
- project " Box2dRaylibObjects"
147
- define_project (" box2d_raylib_objects" )
148
- links {" box2d" }
149
- includedirs { " box2d/include" }
19
+ baseName = path .getbasename (os .getcwd ())
20
+
21
+ workspace (baseName )
22
+ configurations { " Debug" ," Debug.DLL" , " Release" , " Release.DLL" }
23
+ platforms { " x64" , " x86" }
24
+
25
+ filter " configurations:Debug"
26
+ defines { " DEBUG" }
27
+ symbols " On"
28
+
29
+ filter " configurations:Debug.DLL"
30
+ defines { " DEBUG" }
31
+ symbols " On"
32
+
33
+ filter " configurations:Release"
34
+ defines { " NDEBUG" }
35
+ optimize " On"
36
+
37
+ filter " configurations:Release.DLL"
38
+ defines { " NDEBUG" }
39
+ optimize " On"
40
+
41
+ filter { " platforms:x64" }
42
+ architecture " x86_64"
43
+
44
+ targetdir " bin/%{cfg.buildcfg}/"
45
+
46
+ include (" raylib_premake5.lua" )
47
+
48
+ folders = os .matchdirs (" *" )
49
+
50
+ for _ , folderName in ipairs (folders ) do
51
+ if (folderName ~= " raylib"
52
+ and folderName ~= " resources"
53
+ and folderName ~= " build"
54
+ and folderName ~= " bin"
55
+ and folderName ~= " box2d"
56
+ and string .starts (folderName , " _" ) == false
57
+ and string .starts (folderName , " ." ) == false )
58
+ then
59
+ print (folderName )
60
+ include (folderName )
61
+ end
62
+ end
0 commit comments