Browse Source

Various required CMake bits and patches to get the code to compile

David Wimsey 11 years ago
parent
commit
ea4ecc7765

+ 26 - 0
Build/CMakeLists.txt

@@ -60,6 +60,7 @@ option(BUILD_SAMPLES "Build samples" OFF)
 if(WIN32)
 if(WIN32)
 	option(SKIP_DIRECTX_SAMPLES "Skip build of all DirectX related samples.  Only applies if BUILD_SAMPLES is ON" OFF)
 	option(SKIP_DIRECTX_SAMPLES "Skip build of all DirectX related samples.  Only applies if BUILD_SAMPLES is ON" OFF)
 	option(SKIP_DIRECTX9_SAMPLE "Skip build of DirectX 9 related sample.  Only applies if BUILD_SAMPLES is ON and SKIP_DIRECTX_SAMPLES is OFF" OFF)
 	option(SKIP_DIRECTX9_SAMPLE "Skip build of DirectX 9 related sample.  Only applies if BUILD_SAMPLES is ON and SKIP_DIRECTX_SAMPLES is OFF" OFF)
+	option(SKIP_DIRECTX10_SAMPLE "Skip build of DirectX 10 related sample.  Only applies if BUILD_SAMPLES is ON and SKIP_DIRECTX_SAMPLES is OFF" OFF)
 endif()
 endif()
 
 
 if(IOS)
 if(IOS)
@@ -285,6 +286,19 @@ if(BUILD_SAMPLES)
 					endif()
 					endif()
 				endif()
 				endif()
 
 
+				if(SKIP_DIRECTX10_SAMPLE)
+					message("-- Skipping build of DirectX 10 sample: User disabled")
+					list(APPEND DIRECTX_SKIPPED_SAMPLE_LIST "DirectX10 ")
+				else()
+					if(DirectX_D3D10_FOUND)
+						list(APPEND DIRECTX_SAMPLE_LIST "DirectX10 ")
+					else()
+						set(SKIP_DIRECTX10_SAMPLE ON)
+						message("-- Skipping build of DirectX 10 sample: Missing DirectX_D3D10_INCLUDE_DIR, DirectX_D3D10_LIBRARY or DirectX_D3DX10_LIBRARY")
+						list(APPEND DIRECTX_SKIPPED_SAMPLE_LIST "DirectX10 ")
+					endif()
+				endif()
+
 
 
 				if(DIRECTX_SAMPLE_LIST)
 				if(DIRECTX_SAMPLE_LIST)
 					message("-- Enabled DirectX samples: " ${DIRECTX_SAMPLE_LIST})
 					message("-- Enabled DirectX samples: " ${DIRECTX_SAMPLE_LIST})
@@ -359,6 +373,18 @@ if(BUILD_SAMPLES)
 				RUNTIME DESTINATION ${SAMPLES_DIR}/directx
 				RUNTIME DESTINATION ${SAMPLES_DIR}/directx
 				BUNDLE DESTINATION ${SAMPLES_DIR})
 				BUNDLE DESTINATION ${SAMPLES_DIR})
 		endif()
 		endif()
+
+		if(NOT SKIP_DIRECTX10_SAMPLE)
+			include_directories(${DirectX_INCLUDE_DIR} ${DirectX_D3D10_INCLUDE_DIRS})
+
+			bl_sample(directx10 ${sample_LIBRARIES}  ${DirectX_D3D10_LIBRARIES})
+
+			# The samples always set this as their current working directory
+			install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/directx10)
+			install(TARGETS directx10 
+				RUNTIME DESTINATION ${SAMPLES_DIR}/directx10
+				BUNDLE DESTINATION ${SAMPLES_DIR})
+		endif()
 	endif()
 	endif()
 
 
     # Build and install the tutorials
     # Build and install the tutorials

+ 10 - 0
Build/cmake/SampleFileList.cmake

@@ -18,6 +18,16 @@ set(directx_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Samples/basic/directx/src/RenderInterfaceDirectX.cpp
     ${PROJECT_SOURCE_DIR}/Samples/basic/directx/src/RenderInterfaceDirectX.cpp
 )
 )
 
 
+set(directx10_HDR_FILES
+    ${PROJECT_SOURCE_DIR}/Samples/basic/directx10/src/RenderInterfaceDirectX10.h
+    ${PROJECT_SOURCE_DIR}/Samples/basic/directx10/src/D3D10Effect.h
+)
+
+set(directx10_SRC_FILES
+    ${PROJECT_SOURCE_DIR}/Samples/basic/directx10/src/main.cpp
+    ${PROJECT_SOURCE_DIR}/Samples/basic/directx10/src/RenderInterfaceDirectX10.cpp
+)
+
 set(drag_HDR_FILES
 set(drag_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/DragListener.h
     ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/DragListener.h
     ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/Inventory.h
     ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/Inventory.h

+ 4 - 2
Build/cmake/gen_samplelists.sh

@@ -6,9 +6,11 @@ src='set(sample_SRC_FILES'
 hdr='set(sample_HDR_FILES'
 hdr='set(sample_HDR_FILES'
 srcdir='${PROJECT_SOURCE_DIR}'
 srcdir='${PROJECT_SOURCE_DIR}'
 srcpath=Samples
 srcpath=Samples
-samples=('basic/customlog' 'basic/directx' 'basic/drag' 'basic/loaddocument'
-        'basic/ogre3d' 'basic/treeview' 'invaders' 'pyinvaders' 'shell'
+samples=( 'shell'
+	'basic/customlog' 'basic/drag' 'basic/loaddocument' 'basic/ogre3d' 'basic/treeview'
+	'basic/directx' 'basic/directx10'
 	'tutorial/template' 'tutorial/datagrid' 'tutorial/datagrid_tree' 'tutorial/tutorial_drag'
 	'tutorial/template' 'tutorial/datagrid' 'tutorial/datagrid_tree' 'tutorial/tutorial_drag'
+	'invaders' 'pyinvaders' 
 )
 )
 
 
 printfiles() {
 printfiles() {

+ 8 - 1
Samples/basic/directx10/src/RenderInterfaceDirectx10.cpp

@@ -109,8 +109,15 @@ RenderInterfaceDirectX10::~RenderInterfaceDirectX10()
 }
 }
 
 
 // Called by Rocket when it wants to render geometry that it does not wish to optimise.
 // Called by Rocket when it wants to render geometry that it does not wish to optimise.
-void RenderInterfaceDirectX10::RenderGeometry(Rocket::Core::Vertex* ROCKET_UNUSED(vertices), int ROCKET_UNUSED(num_vertices), int* ROCKET_UNUSED(indices), int ROCKET_UNUSED(num_indices), const Rocket::Core::TextureHandle ROCKET_UNUSED(texture), const Rocket::Core::Vector2f& ROCKET_UNUSED(translation))
+void RenderInterfaceDirectX10::RenderGeometry(Rocket::Core::Vertex* ROCKET_UNUSED_PARAMETER(vertices), int ROCKET_UNUSED_PARAMETER(num_vertices), int* ROCKET_UNUSED_PARAMETER(indices), int ROCKET_UNUSED_PARAMETER(num_indices), const Rocket::Core::TextureHandle ROCKET_UNUSED_PARAMETER(texture), const Rocket::Core::Vector2f& ROCKET_UNUSED_PARAMETER(translation))
 {
 {
+	ROCKET_UNUSED(vertices);
+	ROCKET_UNUSED(num_vertices);
+	ROCKET_UNUSED(indices);
+	ROCKET_UNUSED(num_indices);
+	ROCKET_UNUSED(texture);
+	ROCKET_UNUSED(translation);
+
 	// We've chosen to not support non-compiled geometry in the DirectX renderer. If you wanted to render non-compiled
 	// We've chosen to not support non-compiled geometry in the DirectX renderer. If you wanted to render non-compiled
 	// geometry, for example for very small sections of geometry, you could use DrawIndexedPrimitiveUP or write to a
 	// geometry, for example for very small sections of geometry, you could use DrawIndexedPrimitiveUP or write to a
 	// dynamic vertex buffer which is flushed when either the texture changes or compiled geometry is drawn.
 	// dynamic vertex buffer which is flushed when either the texture changes or compiled geometry is drawn.

+ 6 - 5
Samples/basic/directx10/src/main.cpp

@@ -100,13 +100,14 @@ void GameLoop()
 	pSwapChain->Present( 0, 0 );
 	pSwapChain->Present( 0, 0 );
 }
 }
 
 
-#if defined ROCKET_PLATFORM_WIN32
 #include <windows.h>
 #include <windows.h>
-int APIENTRY WinMain(HINSTANCE ROCKET_UNUSED(instance_handle), HINSTANCE ROCKET_UNUSED(previous_instance_handle), char* ROCKET_UNUSED(command_line), int ROCKET_UNUSED(command_show))
-#else
-int main(int ROCKET_UNUSED(argc), char** ROCKET_UNUSED(argv))
-#endif
+int APIENTRY WinMain(HINSTANCE ROCKET_UNUSED_PARAMETER(instance_handle), HINSTANCE ROCKET_UNUSED_PARAMETER(previous_instance_handle), char* ROCKET_UNUSED_PARAMETER(command_line), int ROCKET_UNUSED_PARAMETER(command_show))
 {
 {
+	ROCKET_UNUSED(instance_handle);
+	ROCKET_UNUSED(previous_instance_handle);
+	ROCKET_UNUSED(command_line);
+	ROCKET_UNUSED(command_show);
+
 	// Generic OS initialisation, creates a window and does not attach OpenGL.
 	// Generic OS initialisation, creates a window and does not attach OpenGL.
 	if (!Shell::Initialise("../Samples/basic/directx/") ||
 	if (!Shell::Initialise("../Samples/basic/directx/") ||
 		!Shell::OpenWindow("DirectX 10 Sample", false))
 		!Shell::OpenWindow("DirectX 10 Sample", false))