Переглянути джерело

Add MinGW support for tools

Daniele Bartolini 9 роки тому
батько
коміт
0f13cef4a7
3 змінених файлів з 68 додано та 17 видалено
  1. 14 6
      makefile
  2. 52 9
      scripts/tools.lua
  3. 2 2
      tools/config.vala

+ 14 - 6
makefile

@@ -53,13 +53,21 @@ engine-windows-development64: build/engine/projects/vs2013
 engine-windows-release64: build/engine/projects/vs2013
 	devenv build/engine/projects/vs2013/crown.sln /Build "release|x64"
 
-build/tools/projects:
-	$(GENIE) --file=scripts/tools.lua gmake
+build/tools/projects/linux:
+	$(GENIE) --file=scripts/tools.lua --compiler=linux-gcc gmake
 	make -R -C tools/ui
-tools-linux-debug64: build/tools/projects engine-linux-development64
-	make -R -C build/tools/projects config=debug
-tools-linux-release64: build/tools/projects engine-linux-development64
-	make -R -C build/tools/projects config=release
+tools-linux-debug64: build/tools/projects/linux engine-linux-development64
+	make -R -C build/tools/projects/linux config=debug
+tools-linux-release64: build/tools/projects/linux engine-linux-development64
+	make -R -C build/tools/projects/linux config=release
+
+build/tools/projects/mingw:
+	$(GENIE) --file=scripts/tools.lua --compiler=mingw gmake
+	make -R -C tools/ui
+tools-mingw-debug64: build/tools/projects/mingw
+	make -R -C build/tools/projects/mingw config=debug
+tools-mingw-release64: build/tools/projects/mingw
+	make -R -C build/tools/projects/mingw config=release
 
 .PHONY: docs
 docs:

+ 52 - 9
scripts/tools.lua

@@ -3,26 +3,69 @@
 -- License: https://github.com/taylor001/crown/blob/master/LICENSE
 --
 
+solution "tools"
+language "Vala"
+
+configurations {
+	"debug",
+	"release",
+}
+
 local CROWN_DIR = (path.getabsolute("..") .. "/")
 local CROWN_BUILD_DIR = (CROWN_DIR .. "build/")
 local CROWN_TOOLS_DIR = (CROWN_BUILD_DIR .. "tools/")
 
-solution "tools"
-	language "Vala"
-
-	configurations {
-		"debug",
-		"release",
+newoption
+{
+	trigger = "compiler",
+	value = "COMPILER",
+	description = "Choose compiler",
+	allowed =
+	{
+		{ "linux-gcc", "Linux (GCC compiler)" },
+		{ "mingw",     "MinGW"                },
 	}
+}
+
+if _ACTION == "gmake" then
+
+	if nil == _OPTIONS["compiler"] then
+		print("Choose a compiler!")
+		os.exit(1)
+	end
+
+	if "linux-gcc" == _OPTIONS["compiler"] then
+
+		if not os.is("linux") then
+			print("Action not valid in current OS.")
+		end
+
+		location(CROWN_TOOLS_DIR .. "projects/" .. "linux")
+
+	elseif "mingw" == _OPTIONS["compiler"] then
+
+		location(CROWN_TOOLS_DIR .. "projects/" .. "mingw")
+	end
+else
+	print("Invalid action.")
+	os.exit(1)
+end
 
 	-- FIXME: Fix this in GENie
 	premake.valac.valac = premake.valac.valac .. " --gresources=" .. CROWN_DIR .. "tools/ui/resources.xml" .. " --target-glib=2.38"
 
-	location(CROWN_TOOLS_DIR .. "projects/")
-	targetdir(CROWN_TOOLS_DIR)
+	configuration { "linux-*" }
+		targetdir (CROWN_TOOLS_DIR .. "linux64" .. "/bin")
+		objdir (CROWN_TOOLS_DIR .. "linux64" .. "/obj")
+
+	configuration { "mingw" }
+		targetdir (CROWN_TOOLS_DIR .. "mingw64" .. "/bin")
+		objdir (CROWN_TOOLS_DIR .. "mingw64" .. "/obj")
 
 	configuration { "debug" }
-		targetsuffix "-debug"
+		targetsuffix "-debug64"
+	configuration { "release" }
+		targetsuffix "-release64"
 
 	project "level-editor"
 		kind "ConsoleApp"

+ 2 - 2
tools/config.vala

@@ -8,11 +8,11 @@ namespace Crown
 	const string CROWN_VERSION = "0.0.26";
 
 #if CROWN_PLATFORM_LINUX
-	const string ENGINE_DIR = "../engine/linux64/bin";
+	const string ENGINE_DIR = "../../../engine/linux64/bin";
 	const string EXE_PREFIX = "./";
 	const string EXE_SUFFIX = "";
 #elif CROWN_PLATFORM_WINDOWS
-	const string ENGINE_DIR = "../engine/win64/bin";
+	const string ENGINE_DIR = "../../../engine/win64/bin";
 	const string EXE_PREFIX = "";
 	const string EXE_SUFFIX = ".exe";
 #endif