Explorar el Código

merge + clean some premake stuff

mikymod hace 11 años
padre
commit
3c3c68ba16
Se han modificado 6 ficheros con 236 adiciones y 35 borrados
  1. 3 0
      CMakeLists.txt
  2. 3 0
      engine/CMakeLists.txt
  3. 5 0
      engine/Config.h.in
  4. BIN
      premake/premake4
  5. 223 35
      premake/premake4.lua
  6. 2 0
      third/CMakeLists.txt

+ 3 - 0
CMakeLists.txt

@@ -60,6 +60,9 @@ elseif (CROWN_BUILD MATCHES "windows-release-64")
 	set (WINDOWS 1)
 	set (CROWN_RELEASE 1)
 	set (CROWN_ARCH "win64")
+elseif (CROWN_PLATFORM MATCHES "android")
+	set (ANDROID 1)
+	set (CROWN_ARCH "android")
 else ()
 	message (FATAL_ERROR "Wrong build configuration")
 endif (CROWN_BUILD MATCHES "linux-debug-32")

+ 3 - 0
engine/CMakeLists.txt

@@ -483,6 +483,7 @@ if (LINUX)
 	set (CROWN_MAIN_SRC os/linux/main.cpp)
 endif (LINUX)
 
+# Windows specific stuff
 if (WINDOWS)
 	list (APPEND CROWN_INCLUDES
 		${CMAKE_SOURCE_DIR}/engine/os/win
@@ -602,6 +603,8 @@ if (WINDOWS)
 	set (CROWN_MAIN_SRC os/win/main.cpp)
 endif(WINDOWS)
 
+
+
 set (CROWN_SOURCES
 	${SRC}
 	${CORE_SRC}

+ 5 - 0
engine/Config.h.in

@@ -31,6 +31,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 #cmakedefine LINUX
 #cmakedefine WINDOWS
 
+#define PRId64 "lld"
+#define PRIu64 "llu"
+#define PRIi64 "lli"
+#define PRIx64 "llx"
+
 #cmakedefine CROWN_DEBUG
 #cmakedefine CROWN_DEVELOPMENT
 #cmakedefine CROWN_RELEASE

BIN
premake/premake4


+ 223 - 35
premake/premake4.lua

@@ -22,17 +22,16 @@
 -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 -- OTHER DEALINGS IN THE SOFTWARE.
 
--------------------------------------------------------------------------------
--- Globals
-
-CROWN_SOURCE_DIR = path.getabsolute("..") .. "/"
-CROWN_THIRD_DIR = CROWN_SOURCE_DIR .. "third/"
-CROWN_BUILD_DIR = "../.build/"
-CROWN_INSTALL_DIR = "../.installation/"
-
--------------------------------------------------------------------------------
+------------------------------------------------------------------------------
 -- Options
 
+newoption
+{
+	trigger = "install-dir",
+	value = "DIR",
+	description = "Output directory"
+}
+
 newoption
 {
 	trigger = "compiler",
@@ -40,7 +39,7 @@ newoption
 	description = "Choose compiler",
 	allowed =
 	{
-		{ "android-arm", "Android - ARM" },			-- gcc
+		{ "android", "Android (ARM only)" },			-- gcc
 		-- { "android-mips", "Android - MIPS" },			-- gcc
 		-- { "android-x86", "Android - x86" },				-- gcc
 		{ "linux-gcc", "Linux (GCC compiler)" },		-- gcc
@@ -51,6 +50,21 @@ newoption
 	}
 }
 
+-- if _OPTIONS["install-dir"] == nil then 
+-- 	print("'install-dir' option must be specified")
+-- 	os.exit(1)
+-- end
+
+-- if not path.isabsolute(_OPTIONS["install-dir"]) then
+-- 	print("'install-dir' must be an absolute path")
+-- 	os.exit(1)
+-- end
+
+CROWN_SOURCE_DIR = path.getabsolute("..") .. "/"
+CROWN_THIRD_DIR = CROWN_SOURCE_DIR .. "third/"
+CROWN_BUILD_DIR = "../.build/"
+CROWN_INSTALL_DIR = _OPTIONS["install-dir"]
+
 -- Avoid error invoking premake4 --help
 if _ACTION == nil then return end
 
@@ -60,36 +74,60 @@ if _ACTION == "gmake" then
 
 	if _OPTIONS["compiler"] == "linux-gcc" then
 		-- dunno
-	elseif _OPTIONS["compiler"] == "android-arm" then
-		if not os.getenv("ANDROID_NDK_ARM") or not os.getenv("ANDROID_NDK_ROOT") then
-			print("Set ANDROID_NDK_ARM and ANDROID_NDK_ROOT environment variables.")
+	elseif _OPTIONS["compiler"] == "android" then
+		if not os.getenv("ANDROID_NDK") then
+			print("Set ANDROID_NDK environment variable.")
 		end
 
-		premake.gcc.cc = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc"
-		premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
-		premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
+		premake.gcc.cc = "$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc"
+		premake.gcc.cxx = "$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++"
+		premake.gcc.ar = "$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar"
 	end
-
 end
 
 -------------------------------------------------------------------------------
 -- Solution
 solution "crown"
 	configurations { "debug", "development", "release" }
-	platforms { "x32", "x64" }
+	platforms { "Native", "x32", "x64" }
 
 	configuration { "debug" }
-		targetsuffix "-debug"
 		defines { "_DEBUG", "CROWN_DEBUG" }
 	configuration { "development" }
 		flags { "OptimizeSpeed" }
-		targetsuffix "-development"
 		defines { "NDEBUG", "CROWN_DEVELOPMENT" }
 	configuration { "release" }
 		flags { "OptimizeSpeed" }
-		targetsuffix "-release"
 		defines { "NDEBUG", "CROWN_RELEASE" }
 
+	configuration { "debug", "x32" }
+		targetsuffix "-debug-32"
+	configuration { "debug", "x64" }
+		targetsuffix "-debug-64"
+
+	configuration { "development", "x32" }
+		targetsuffix "-development-32"
+	configuration { "development", "x64" }
+		targetsuffix "-development-64"
+
+	configuration { "release", "x32" }
+		targetsuffix "-release-32"
+	configuration { "release", "x64" }
+		targetsuffix "-release-64"
+
+
+	flags
+	{
+		"StaticRuntime",
+		"NoMinimalRebuild",
+		"NoPCH",
+		"NativeWChar",
+		"NoRTTI",
+		"NoExceptions",
+		"NoEditAndContinue",
+		"Symbols"
+	}
+
 	-------------------------------------------------------------------------------
 	project "crown"
 		language "C++"
@@ -129,8 +167,10 @@ solution "crown"
 
 		configuration { "linux" }
 			kind "ConsoleApp"
-			location(".build/linux") -- its ok
-			targetdir(".installation/linux") -- must be specified by user -- tmp
+			location(CROWN_BUILD_DIR .. "linux") -- its ok
+			targetdir("../.installation/linux") -- must be specified by user -- tmp
+
+			defines { "CROWN_LINUX" }
 
 			buildoptions
 			{
@@ -154,18 +194,6 @@ solution "crown"
 				"luajit-5.1"
 			}
 
-			flags
-			{
-				"StaticRuntime",
-				"NoMinimalRebuild",
-				"NoPCH",
-				"NativeWChar",
-				"NoRTTI",
-				"NoExceptions",
-				"NoEditAndContinue",
-				"Symbols"
-			}
-
 			includedirs
 			{
 				CROWN_SOURCE_DIR .. "/engine/os/linux",
@@ -243,6 +271,10 @@ solution "crown"
 			}
 
 		configuration { "linux", "x32" }
+			buildoptions
+			{
+				"-m32"
+			}
 			includedirs {
 				CROWN_THIRD_DIR .. "luajit/x86/include/luajit-2.0",
 				CROWN_THIRD_DIR .. "physx/x86/include",
@@ -274,7 +306,12 @@ solution "crown"
 				CROWN_THIRD_DIR .. "luajit/x86/lib",
 				CROWN_THIRD_DIR .. "physx/x86/lib"
 			}
+
 		configuration { "linux", "x64" }
+			buildoptions
+			{
+				"-m64"
+			}
 			includedirs {
 				CROWN_THIRD_DIR .. "luajit/x86_64/include/luajit-2.0",
 				CROWN_THIRD_DIR .. "physx/x86_64/include",
@@ -307,3 +344,154 @@ solution "crown"
 				CROWN_THIRD_DIR .. "physx/x86_64/lib"
 			}
 
+		-- configuration { "android" }
+		-- 	kind "SharedLib"
+		-- 	location(".build/android") -- its ok
+		-- 	targetdir(".installation/android") -- must be specified by user -- tmp
+
+		-- 	defines { "CROWN_ANDROID" }
+
+		-- 	buildoptions
+		-- 	{
+		-- 		"-std=c++03"
+		-- 	}
+			
+		-- 	linkoptions
+		-- 	{
+		-- 		"-Wl,-rpath=\\$$ORIGIN",
+		-- 		-- "-llog -landroid -lEGL -lGLESv2 -lz -lOpenSLES"
+		-- 		"-Wl,--start-group $(addprefix -l," ..
+		-- 		"	LowLevelClothCHECKED" ..
+		-- 		"	PhysX3CHECKED " ..
+		-- 		"	PhysX3CommonCHECKED" ..
+		-- 		"	PxTaskCHECKED" ..
+		-- 		"	LowLevelCHECKED" ..
+		-- 		"	PhysX3CharacterKinematicCHECKED" ..
+		-- 		"	PhysX3CookingCHECKED" ..
+		-- 		"	PhysX3ExtensionsCHECKED" ..
+		-- 		"	PhysX3VehicleCHECKED" ..
+		-- 		"	PhysXProfileSDKCHECKED" ..
+		-- 		"	PhysXVisualDebuggerSDKCHECKED" ..
+		-- 		"	PvdRuntimeCHECKED" ..
+		-- 		"	SceneQueryCHECKED" ..
+		-- 		"	SimulationControllerCHECKED" ..
+		-- 		") -Wl,--end-group"
+		-- 	}
+
+		-- 	links
+		-- 	{
+		-- 		"log",
+		-- 		"android",
+		-- 		"EGL",
+		-- 		"GLESv2",
+		-- 		"z",
+		-- 		"OpenSLES",
+		-- 	}
+
+		-- 	includedirs {
+		-- 		CROWN_SOURCE_DIR .. "engine/os/android",
+		-- 		CROWN_THIRD_DIR .. "luajit/android/include/luajit-2.0",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/common",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/characterkinematic",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/cloth",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/common",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/cooking",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/extensions",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/foundation",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/geometry",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/particles",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/physxprofilesdk",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/physxvisualdebuggersdk",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/pvd",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/pxtask",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/RepX",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/RepXUpgrader",
+		-- 		CROWN_THIRD_DIR .. "physx/android/include/vehicle",
+		-- 		CROWN_THIRD_DIR .. "opengl",
+		-- 		CROWN_THIRD_DIR .. "openal/include",
+		-- 		CROWN_THIRD_DIR .. "freetype",
+		-- 		CROWN_THIRD_DIR .. "stb_image",
+		-- 		CROWN_THIRD_DIR .. "stb_vorbis",
+		-- 		"$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.8/include",
+		-- 		-- "$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include",
+		-- 		"$(ANDROID_NDK)/sources/android/native_app_glue",
+		-- 	}
+
+		-- 	libdirs
+		-- 	{
+		-- 		CROWN_THIRD_DIR .. "luajit/android/lib",
+		-- 		CROWN_THIRD_DIR .. "physx/android/lib",
+		-- 		"$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a",
+		-- 		"$(ANDROID_NDK)/platforms/android-18/arch-arm/usr/lib"
+		-- 	}
+
+		-- 	excludes
+		-- 	{
+		-- 		CROWN_SOURCE_DIR .. "engine/os/linux/*",
+		-- 		CROWN_SOURCE_DIR .. "engine/os/win/*",
+		-- 		CROWN_SOURCE_DIR .. "engine/renderers/backend/gl/glx/*",
+		-- 		CROWN_SOURCE_DIR .. "engine/renderers/backend/gl/wgl/*",
+		-- 		CROWN_SOURCE_DIR .. "engine/audio/backend/ALSoundWorld.cpp"
+		-- 	}
+
+		-- configuration { "debug", "android" }
+		-- 	linkoptions
+		-- 	{
+		-- 		"-Wl,--start-group $(addprefix -l," ..
+		-- 		"	LowLevelClothCHECKED" ..
+		-- 		"	PhysX3CHECKED " ..
+		-- 		"	PhysX3CommonCHECKED" ..
+		-- 		"	PxTaskCHECKED" ..
+		-- 		"	LowLevelCHECKED" ..
+		-- 		"	PhysX3CharacterKinematicCHECKED" ..
+		-- 		"	PhysX3CookingCHECKED" ..
+		-- 		"	PhysX3ExtensionsCHECKED" ..
+		-- 		"	PhysX3VehicleCHECKED" ..
+		-- 		"	PhysXProfileSDKCHECKED" ..
+		-- 		"	PhysXVisualDebuggerSDKCHECKED" ..
+		-- 		"	PvdRuntimeCHECKED" ..
+		-- 		"	SceneQueryCHECKED" ..
+		-- 		"	SimulationControllerCHECKED" ..
+		-- 		") -Wl,--end-group"
+		-- 	}
+		-- configuration { "development", "android"}
+		-- 	linkoptions
+		-- 	{ 
+		-- 		"-Wl,--start-group $(addprefix -l," ..
+		-- 		"	LowLevelClothPROFILE" ..
+		-- 		"	PhysX3PROFILE " ..
+		-- 		"	PhysX3CommonPROFILE" ..
+		-- 		"	PxTaskPROFILE" ..
+		-- 		"	LowLevelPROFILE" ..
+		-- 		"	PhysX3CharacterKinematicPROFILE" ..
+		-- 		"	PhysX3CookingPROFILE" ..
+		-- 		"	PhysX3ExtensionsPROFILE" ..
+		-- 		"	PhysX3VehiclePROFILE" ..
+		-- 		"	PhysXProfileSDKPROFILE" ..
+		-- 		"	PhysXVisualDebuggerSDKPROFILE" ..
+		-- 		"	PvdRuntimePROFILE" ..
+		-- 		"	SceneQueryPROFILE" ..
+		-- 		"	SimulationControllerPROFILE" ..
+		-- 		") -Wl,--end-group"
+		-- 	}		
+		-- configuration { "release", "android"}
+		-- 	linkoptions
+		-- 	{ 
+		-- 		"-Wl,--start-group $(addprefix -l," ..
+		-- 		"	LowLevelCloth" ..
+		-- 		"	PhysX3 " ..
+		-- 		"	PhysX3Common" ..
+		-- 		"	PxTask" ..
+		-- 		"	LowLevel" ..
+		-- 		"	PhysX3CharacterKinematic" ..
+		-- 		"	PhysX3Cooking" ..
+		-- 		"	PhysX3Extensions" ..
+		-- 		"	PhysX3Vehicle" ..
+		-- 		"	PhysXProfileSDK" ..
+		-- 		"	PhysXVisualDebuggerSDK" ..
+		-- 		"	PvdRuntime" ..
+		-- 		"	SceneQuery" ..
+		-- 		"	SimulationController" ..
+		-- 		") -Wl,--end-group"
+		-- 	}

+ 2 - 0
third/CMakeLists.txt

@@ -13,6 +13,8 @@ elseif (WINDOWS)
 	install (DIRECTORY luajit/${CROWN_ARCH}/share/luajit-2.0.1/jit DESTINATION bin)
 
 	install (FILES     openAL/lib/OpenAL32.dll DESTINATION bin)
+elseif (ANDROID)
+
 else ()
 	message (FATAL_ERROR "Wrong build configuration")
 endif (LINUX)