2
0
Эх сурвалжийг харах

One step closer to working windows port

Daniele Bartolini 11 жил өмнө
parent
commit
9adf7d3012

+ 3 - 3
engine/Config.h

@@ -75,10 +75,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 // http://msdn.microsoft.com/en-us/library/6sehtctf.aspx
 	#if !defined(WINVER) && !defined(_WIN32_WINNT)
 // Windows Server 2003 with SP1, Windows XP with SP2 and above
-		#define WINVER 0x0502
-		#define _WIN32_WINNT 0x0502
+		#define WINVER 0x0600
+		#define _WIN32_WINNT 0x0600
 	#endif // !defined(WINVER) && !defined(_WIN32_WINNT)
-	#define CROWN_PLATFORM_WINDOWS _WIN32_WINNT
+	#define CROWN_PLATFORM_WINDOWS 1
 #elif defined(__ANDROID__)
 // Android compiler defines __linux__
 	#undef CROWN_PLATFORM_ANDROID

+ 6 - 6
engine/Device.h

@@ -36,19 +36,19 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class Accelerometer;
+struct Accelerometer;
 class Bundle;
 class BundleCompiler;
 class ConsoleServer;
 class Filesystem;
-class Keyboard;
+struct Keyboard;
 class LuaEnvironment;
-class Mouse;
+struct Mouse;
 class OsWindow;
 class Renderer;
 class ResourceManager;
-class ResourcePackage;
-class Touch;
+struct ResourcePackage;
+struct Touch;
 class World;
 class WorldManager;
 struct Camera;
@@ -69,7 +69,7 @@ struct DisplayMode
 /// the engine subsystems and related stuff.
 ///
 /// @ingroup Device
-class CE_EXPORT Device
+class Device
 {
 public:
 

+ 1 - 1
engine/core/filesystem/DiskFilesystem.h

@@ -40,7 +40,7 @@ namespace crown
 /// but platform-specific and thus generally not recommended.
 ///
 /// @ingroup Filesystem
-class CE_EXPORT  DiskFilesystem : public Filesystem
+class DiskFilesystem : public Filesystem
 {
 public:
 

+ 1 - 1
engine/core/mem/ProxyAllocator.h

@@ -37,7 +37,7 @@ namespace crown
 /// so that it is possible to later visit that list for debugging purposes.
 ///
 /// @ingroup Memory
-class CE_EXPORT ProxyAllocator : public Allocator
+class ProxyAllocator : public Allocator
 {
 public:
 

+ 1 - 1
engine/input/Mouse.h

@@ -51,7 +51,7 @@ struct MouseButton
 /// Interface for accessing mouse input device.
 ///
 /// @ingroup Input
-class Mouse
+struct Mouse
 {
 public:
 

+ 1 - 1
engine/input/Touch.h

@@ -40,7 +40,7 @@ const uint32_t MAX_POINTER_IDS = 4;
 /// Interface for accessing mouse input device.
 ///
 /// @ingroup Input
-class Touch
+struct Touch
 {
 public:
 

+ 1 - 1
engine/lua/LuaStack.h

@@ -136,7 +136,7 @@ public:
 	//-----------------------------------------------------------------------------
 	bool is_number(int32_t index)
 	{
-		return lua_isnumber(m_L, index);
+		return (bool) lua_isnumber(m_L, index);
 	}
 
 	/// Wraps lua_type.

+ 1 - 4
engine/os/OS.h

@@ -26,12 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include <cstdarg>
-
 #include "Config.h"
 #include "Types.h"
 #include "Vector.h"
 #include "DynamicString.h"
+#include <cstdarg>
 
 namespace crown
 {
@@ -47,8 +46,6 @@ namespace crown
 #elif CROWN_PLATFORM_ANDROID
 	const size_t	MAX_PATH_LENGTH = 1024;
 	const char		PATH_SEPARATOR = '/';
-#else
-	#error "Oops, invalid platform!"
 #endif
 
 namespace os

+ 2 - 0
engine/os/win/Cond.h

@@ -27,6 +27,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "WinHeaders.h"
+#include <WinBase.h>
+#include <Synchapi.h>
 #include "Types.h"
 #include "Mutex.h"
 #include "OS.h"

+ 2 - 2
engine/os/win/OsSocket.h

@@ -290,7 +290,7 @@ public:
 
 public:
 
-	int m_socket;
+	SOCKET m_socket;
 };
 
 class TCPServer
@@ -543,7 +543,7 @@ public:
 
 public:
 
-	int m_socket;
+	SOCKET m_socket;
 };
 
 } // namespace crown

+ 2 - 2
engine/os/win/WinHeaders.h

@@ -27,10 +27,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
+	#define WIN32_LEAN_AND_MEAN
 #endif
 
-#include "Windows.h"
+#include "windows.h"
 
 #undef NEAR
 #undef FAR

+ 1 - 1
engine/os/win/main.cpp

@@ -117,7 +117,7 @@ static KeyboardButton::Enum win_translate_key(int32_t winKey)
 }
 
 //-----------------------------------------------------------------------------
-class CE_EXPORT WindowsDevice : public Device
+class WindowsDevice : public Device
 {
 public:
 

+ 1 - 1
engine/physics/Actor.cpp

@@ -180,7 +180,7 @@ void Actor::create_objects()
 
 				PxDefaultMemoryOutputStream buf;
 				if(!m_world.physx_cooking()->cookConvexMesh(convex_mesh_desc, buf))
-					CE_FATAL();
+					CE_FATAL("");
 				PxDefaultMemoryInputData input(buf.getData(), buf.getSize());
 				PxConvexMesh* convex_mesh = physics->createConvexMesh(input);
 

+ 1 - 1
engine/physics/Controller.h

@@ -41,7 +41,7 @@ namespace crown
 
 struct PhysicsResource;
 struct Vector3;
-class SceneGraph;
+struct SceneGraph;
 class PhysicsControllerCallback;
 
 ///

+ 1 - 1
engine/physics/Joint.h

@@ -42,7 +42,7 @@ namespace crown
 {
 
 struct PhysicsResource;
-class Actor;
+struct Actor;
 
 ///
 /// @ingroup Physics

+ 1 - 1
engine/physics/PhysicsWorld.h

@@ -71,7 +71,7 @@ namespace physics_system
 } // namespace physics_system
 
 //-----------------------------------------------------------------------------
-class SceneGraph;
+struct SceneGraph;
 class World;
 struct PhysicsResource;
 struct PhysicsConfigResource;

+ 1 - 1
engine/renderers/Mesh.h

@@ -32,7 +32,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class SceneGraph;
+struct SceneGraph;
 struct MeshResource;
 struct Quaternion;
 struct Unit;

+ 1 - 1
engine/renderers/Sprite.h

@@ -38,7 +38,7 @@ namespace crown
 
 class Renderer;
 class RenderWorld;
-class SceneGraph;
+struct SceneGraph;
 struct Unit;
 
 //-----------------------------------------------------------------------------

+ 1 - 1
engine/resource/ResourceManager.h

@@ -120,7 +120,7 @@ private:
 
 private:
 
-	friend class ResourcePackage;
+	friend struct ResourcePackage;
 	friend class Device;
 };
 

+ 1 - 1
engine/resource/ResourcePackage.h

@@ -36,7 +36,7 @@ namespace crown
 {
 
 /// Collection of resources to load in a batch.
-class ResourcePackage
+struct ResourcePackage
 {
 public:
 

+ 1 - 1
engine/world/Camera.h

@@ -44,7 +44,7 @@ struct ProjectionType
 
 struct Quaternion;
 struct Unit;
-class SceneGraph;
+struct SceneGraph;
 
 /// Represents the point of view into the game world.
 ///

+ 1 - 1
engine/world/SceneGraphManager.h

@@ -31,7 +31,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class SceneGraph;
+struct SceneGraph;
 
 /// Manages a collection of scene graphs.
 ///

+ 15 - 3
makefile

@@ -11,6 +11,10 @@ luajit-linux32:
 	make -R -C third/luajit CC="gcc -m32"
 luajit-linux64:
 	make -R -C third/luajit
+luajit-windows32:
+	cd third/luajit/src && msvcbuild
+luajit-windows64:
+	cd third/luajit/src && msvcbuild
 luajit-arm:
 	make -R -C third/luajit HOST_CC="gcc -m32" \
 	CROSS=$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi- \
@@ -46,12 +50,20 @@ android-release: luajit-arm android-build
 	make -R -C .build/android config=release
 android: android-debug android-development android-release
 
-
 windows-build:
 	$(PREMAKE) --file=premake\premake4.lua vs2008
+windows-debug32: windows-build
+	devenv .build/windows/crown.sln /Build "debug|x32"
+windows-development32: windows-build
+	devenv .build/windows/crown.sln /Build "development|x32"
+windows-release32: windows-build
+	devenv .build/windows/crown.sln /Build "release|x32"
 windows-debug64: windows-build
-	devenv .build/windows/crown.sln /Build "Debug|x64"
-
+	devenv .build/windows/crown.sln /Build "debug|x64"
+windows-development64: windows-build
+	devenv .build/windows/crown.sln /Build "development|x64"
+windows-release64: windows-build
+	devenv .build/windows/crown.sln /Build "release|x64"
 
 # docs:
 # 	doxygen premake/crown.doxygen

+ 24 - 45
premake/premake4.lua

@@ -47,7 +47,6 @@ newoption
 CROWN_SOURCE_DIR = path.getabsolute("..") .. "/"
 CROWN_THIRD_DIR = CROWN_SOURCE_DIR .. "third/"
 CROWN_BUILD_DIR = CROWN_SOURCE_DIR .. ".build/"
-
 CROWN_INSTALL_DIR = os.getenv("CROWN_INSTALL_DIR")
 if not CROWN_INSTALL_DIR then
 	if not path.isabsolute(CROWN_INSTALL_DIR) then
@@ -61,7 +60,7 @@ CROWN_INSTALL_DIR = CROWN_INSTALL_DIR .. "/" -- Add slash to end string
 -- Solution
 solution "crown"
 	configurations { "debug", "development", "release" }
-	platforms { "native", "x32", "x64" }
+	platforms { "x32", "x64", "native" }
 
 	-- Avoid error invoking premake4 --help
 	if _ACTION == nil then return end
@@ -92,7 +91,6 @@ solution "crown"
 	if _ACTION == "vs2010" or _ACTION == "vs2008" then
 
 		if not os.is("windows") then print("Action not valid in current OS.") end
-		if not os.getenv("DXSDK_DIR") then print("Environment variable DXSDK_DIR must be set.") end
 		location(CROWN_BUILD_DIR .. "windows")
 
 	end
@@ -604,15 +602,12 @@ solution "crown"
 				"lua51",
 				"OpenAL32"
 			}
+
 			includedirs {
 				CROWN_SOURCE_DIR .. "/engine/os/win",
 				CROWN_SOURCE_DIR .. "/engine/renderers/backend/gl/wgl"
 			}
 
-			libdirs {
-				CROWN_THIRD_DIR .. "openal/lib"
-			}
-
 			excludes {
 				CROWN_SOURCE_DIR .. "engine/os/android/*",
 				CROWN_SOURCE_DIR .. "engine/os/linux/*",
@@ -628,33 +623,9 @@ solution "crown"
 				"/DELAYLOAD:\"libGLESv2.dll\""
 			}
 
-		configuration { "vs*", "debug" }
-			links {
-				"PhysX3ExtensionsCHECKED",
-				"PhysXProfileSDKCHECKED",
-				"PhysXVisualDebuggerSDKCHECKED",
-				"PxTaskCHECKED"
-			}
-
-		configuration { "vs*", "development" }
-			links {
-				"PhysX3ExtensionsPROFILE",
-				"PhysXProfileSDKPROFILE",
-				"PhysXVisualDebuggerSDKPROFILE",
-				"PxTaskPROFILE"
-			}
-
-		configuration { "vs*", "release" }
-			links {
-				"PhysX3Extensions",
-				"PhysXProfileSDK",
-				"PhysXVisualDebuggerSDK",
-				"PxTask",
-			}
-
 		configuration { "x32", "vs*" }
 			includedirs {
-				CROWN_THIRD_DIR .. "luajit/win32/include/luajit-2.0",
+				CROWN_THIRD_DIR .. "luajit/src",
 				CROWN_THIRD_DIR .. "physx/win32/include",
 				CROWN_THIRD_DIR .. "physx/win32/include/common",
 				CROWN_THIRD_DIR .. "physx/win32/include/characterkinematic",
@@ -680,15 +651,16 @@ solution "crown"
 			}
 
 			libdirs {
-				CROWN_THIRD_DIR .. "luajit/win32/lib",
-				CROWN_THIRD_DIR .. "physx/win32/lib"
+				CROWN_THIRD_DIR .. "luajit/src",
+				CROWN_THIRD_DIR .. "physx/win32/lib",
+				CROWN_THIRD_DIR .. "openal/lib"
 			}
 
 		configuration { "x64", "vs*" }
 			defines { "_WIN64" }
 
 			includedirs {
-				CROWN_THIRD_DIR .. "luajit/win64/include/luajit-2.0",
+				CROWN_THIRD_DIR .. "luajit/src",
 				CROWN_THIRD_DIR .. "physx/win64/include",
 				CROWN_THIRD_DIR .. "physx/win64/include/common",
 				CROWN_THIRD_DIR .. "physx/win64/include/characterkinematic",
@@ -714,8 +686,9 @@ solution "crown"
 			}
 
 			libdirs {
-				CROWN_THIRD_DIR .. "luajit/win64/lib",
-				CROWN_THIRD_DIR .. "physx/win64/lib"
+				CROWN_THIRD_DIR .. "luajit/src",
+				CROWN_THIRD_DIR .. "physx/win64/lib",
+				CROWN_THIRD_DIR .. "openal/lib"
 			}
 
 		configuration { "debug", "x32", "vs*"}
@@ -723,7 +696,8 @@ solution "crown"
 				"PhysX3CharacterKinematicCHECKED_x86",
 				"PhysX3CHECKED_x86",
 				"PhysX3CommonCHECKED_x86",
-				"PhysX3CookingCHECKED_x86"
+				"PhysX3CookingCHECKED_x86",
+				"PhysX3ExtensionsCHECKED"
 			}
 
 		configuration { "debug", "x64", "vs*" }
@@ -731,7 +705,8 @@ solution "crown"
 				"PhysX3CharacterKinematicCHECKED_x64",
 				"PhysX3CHECKED_x64",
 				"PhysX3CommonCHECKED_x64",
-				"PhysX3CookingCHECKED_x64"
+				"PhysX3CookingCHECKED_x64",
+				"PhysX3ExtensionsCHECKED"
 			}
 
 		configuration { "development", "x32", "vs*" }
@@ -739,7 +714,8 @@ solution "crown"
 				"PhysX3CharacterKinematicPROFILE_x86",
 				"PhysX3PROFILE_x86",
 				"PhysX3CommonPROFILE_x86",
-				"PhysX3CookingPROFILE_x86"
+				"PhysX3CookingPROFILE_x86",
+				"PhysX3ExtensionsPROFILE"
 			}
 
 		configuration { "development", "x64", "vs*" }
@@ -747,21 +723,24 @@ solution "crown"
 				"PhysX3CharacterKinematicPROFILE_x64",
 				"PhysX3PROFILE_x64",
 				"PhysX3CommonPROFILE_x64",
-				"PhysX3CookingPROFILE_x64"
+				"PhysX3CookingPROFILE_x64",
+				"PhysX3ExtensionsPROFILE"
 			}
 
-		configuration { "debug", "x32", "vs*" }
+		configuration { "release", "x32", "vs*" }
 			links {
 				"PhysX3CharacterKinematic_x86",
 				"PhysX3_x86",
 				"PhysX3Common_x86",
-				"PhysX3Cooking_x86"
+				"PhysX3Cooking_x86",
+				"PhysX3Extensions"
 			}
 			
-		configuration { "debug", "x64", "vs*" }
+		configuration { "release", "x64", "vs*" }
 			links {
 				"PhysX3CharacterKinematic_x64",
 				"PhysX3_x64",
 				"PhysX3Common_x64",
-				"PhysX3Cooking_x64"
+				"PhysX3Cooking_x64",
+				"PhysX3Extensions"
 			}