Selaa lähdekoodia

Simplified example premake script.

bkaradzic 13 vuotta sitten
vanhempi
sitoutus
a674d734d3

+ 0 - 51
premake/example-00-helloworld.lua

@@ -1,51 +0,0 @@
-project "example-00-helloworld"
-	uuid "ff2c8450-ebf4-11e0-9572-0800200c9a66"
-	kind "WindowedApp"
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/00-helloworld/**.cpp",
-		BGFX_DIR .. "examples/00-helloworld/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "emscripten" }
-		targetextension ".bc"
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 0 - 53
premake/example-01-cubes.lua

@@ -1,53 +0,0 @@
-project "example-01-cubes"
-	uuid "fec3bc94-e1e5-11e1-9c59-c7eeec2c1c51"
-	kind "WindowedApp"
-
-	debugdir (BGFX_DIR .. "examples/runtime/")
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/01-cubes/**.cpp",
-		BGFX_DIR .. "examples/01-cubes/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "emscripten" }
-		targetextension ".bc"
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 0 - 53
premake/example-02-metaballs.lua

@@ -1,53 +0,0 @@
-project "example-02-metaballs"
-	uuid "413b2cb4-f7db-11e1-bf5f-a716de6a022f"
-	kind "WindowedApp"
-
-	debugdir (BGFX_DIR .. "examples/runtime/")
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/02-metaballs/**.cpp",
-		BGFX_DIR .. "examples/02-metaballs/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "emscripten" }
-		targetextension ".bc"
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 0 - 53
premake/example-03-raymarch.lua

@@ -1,53 +0,0 @@
-project "example-03-raymarch"
-	uuid "1cede802-0220-11e2-91ba-e108de6a022f"
-	kind "WindowedApp"
-
-	debugdir (BGFX_DIR .. "examples/runtime/")
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/03-raymarch/**.cpp",
-		BGFX_DIR .. "examples/03-raymarch/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "emscripten" }
-		targetextension ".bc"
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 0 - 53
premake/example-04-mesh.lua

@@ -1,53 +0,0 @@
-project "example-04-mesh"
-	uuid "546bbc76-0c4a-11e2-ab09-debcdd6a022f"
-	kind "WindowedApp"
-
-	debugdir (BGFX_DIR .. "examples/runtime/")
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/04-mesh/**.cpp",
-		BGFX_DIR .. "examples/04-mesh/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "emscripten" }
-		targetextension ".bc"
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 0 - 53
premake/example-05-instancing.lua

@@ -1,53 +0,0 @@
-project "example-05-instancing"
-	uuid "5d3da660-1105-11e2-aece-71e4dd6a022f"
-	kind "WindowedApp"
-
-	debugdir (BGFX_DIR .. "examples/runtime/")
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/05-instancing/**.cpp",
-		BGFX_DIR .. "examples/05-instancing/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "emscripten" }
-		targetextension ".bc"
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 0 - 50
premake/example-06-bump.lua

@@ -1,50 +0,0 @@
-project "example-06-bump"
-	uuid "ffb23e6c-167b-11e2-81df-94c4dd6a022f"
-	kind "WindowedApp"
-
-	debugdir (BGFX_DIR .. "examples/runtime/")
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/06-bump/**.cpp",
-		BGFX_DIR .. "examples/06-bump/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 0 - 50
premake/example-07-callback.lua

@@ -1,50 +0,0 @@
-project "example-07-callback"
-	uuid "acc53bbc-52f0-11e2-9781-ad8edd4b7d02"
-	kind "WindowedApp"
-
-	debugdir (BGFX_DIR .. "examples/runtime/")
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/07-callback/**.cpp",
-		BGFX_DIR .. "examples/07-callback/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 0 - 53
premake/example-08-update.lua

@@ -1,53 +0,0 @@
-project "example-08-update"
-	uuid "e011e246-5862-11e2-b202-b7cb257a7926"
-	kind "WindowedApp"
-
-	debugdir (BGFX_DIR .. "examples/runtime/")
-
-	includedirs {
-		BX_DIR .. "include",
-		BGFX_DIR .. "include",
-	}
-
-	files {
-		BGFX_DIR .. "examples/common/**.cpp",
-		BGFX_DIR .. "examples/common/**.h",
-		BGFX_DIR .. "examples/08-update/**.cpp",
-		BGFX_DIR .. "examples/08-update/**.h",
-	}
-
-	links {
-		"bgfx",
-	}
-
-	configuration { "emscripten" }
-		targetextension ".bc"
-
-	configuration { "nacl or nacl-arm or pnacl" }
-		targetextension ".nexe"
-		links {
-			"ppapi",
-			"ppapi_gles2",
-			"pthread",
-		}
-
-	configuration { "nacl", "Release" }
-		postbuildcommands {
-			"@echo Stripping symbols.",
-			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
-		}
-
-	configuration { "linux" }
-		links {
-			"GL",
-			"pthread",
-		}
-
-	configuration { "macosx" }
-		files {
-			BGFX_DIR .. "examples/common/**.mm",
-		}
-		links {
-			"Cocoa.framework",
-			"OpenGL.framework",
-		}

+ 68 - 9
premake/premake4.lua

@@ -28,16 +28,75 @@ toolchain(BGFX_BUILD_DIR, BGFX_THIRD_PARTY_DIR)
 function copyLib()
 end
 
+function exampleProject(_name, _uuid)
+
+	project ("example-" .. _name)
+		uuid (_uuid)
+		kind "WindowedApp"
+
+	configuration {}
+
+	debugdir (BGFX_DIR .. "examples/runtime/")
+
+	includedirs {
+		BX_DIR .. "include",
+		BGFX_DIR .. "include",
+	}
+
+	files {
+		BGFX_DIR .. "examples/common/**.cpp",
+		BGFX_DIR .. "examples/common/**.h",
+		BGFX_DIR .. "examples/" .. _name .. "/**.cpp",
+		BGFX_DIR .. "examples/" .. _name .. "/**.h",
+	}
+
+	links {
+		"bgfx",
+	}
+
+	configuration { "emscripten" }
+		targetextension ".bc"
+
+	configuration { "nacl or nacl-arm or pnacl" }
+		targetextension ".nexe"
+		links {
+			"ppapi",
+			"ppapi_gles2",
+			"pthread",
+		}
+
+	configuration { "nacl", "Release" }
+		postbuildcommands {
+			"@echo Stripping symbols.",
+			"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
+		}
+
+	configuration { "linux" }
+		links {
+			"GL",
+			"pthread",
+		}
+
+	configuration { "macosx" }
+		files {
+			BGFX_DIR .. "examples/common/**.mm",
+		}
+		links {
+			"Cocoa.framework",
+			"OpenGL.framework",
+		}
+end
+
 dofile "bgfx.lua"
-dofile "example-00-helloworld.lua"
-dofile "example-01-cubes.lua"
-dofile "example-02-metaballs.lua"
-dofile "example-03-raymarch.lua"
-dofile "example-04-mesh.lua"
-dofile "example-05-instancing.lua"
-dofile "example-06-bump.lua"
-dofile "example-07-callback.lua"
-dofile "example-08-update.lua"
+exampleProject("00-helloworld", "ff2c8450-ebf4-11e0-9572-0800200c9a66")
+exampleProject("01-cubes",      "fec3bc94-e1e5-11e1-9c59-c7eeec2c1c51")
+exampleProject("02-metaballs",  "413b2cb4-f7db-11e1-bf5f-a716de6a022f")
+exampleProject("03-raymarch",   "1cede802-0220-11e2-91ba-e108de6a022f")
+exampleProject("04-mesh",       "546bbc76-0c4a-11e2-ab09-debcdd6a022f")
+exampleProject("05-instancing", "5d3da660-1105-11e2-aece-71e4dd6a022f")
+exampleProject("06-bump",       "ffb23e6c-167b-11e2-81df-94c4dd6a022f")
+exampleProject("07-callback",   "acc53bbc-52f0-11e2-9781-ad8edd4b7d02")
+exampleProject("08-update",     "e011e246-5862-11e2-b202-b7cb257a7926")
 dofile "makedisttex.lua"
 dofile "shaderc.lua"
 dofile "texturec.lua"