Browse Source

Cmake precompiled header for MSVC.

Michael 7 years ago
parent
commit
6403e13fe4

+ 11 - 11
Build/CMakeLists.txt

@@ -173,17 +173,6 @@ if(NOT BUILD_SHARED_LIBS)
 	add_definitions(-DROCKET_STATIC_LIB)
 endif()
 
-#on windows, check for VC10 and fix the multiple compile target issue.
-IF(WIN32)
-  if(MSVC)
-    if(${MSVC_VERSION} STREQUAL 1600 OR ${MSVC_VERSION} STRGREATER 1600)
-      message("Visual Studio 2010 (${MSVC_VERSION}) build fix at play (/FORCE:MULTIPLE)")
-      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /FORCE:MULTIPLE")
-    endif()
-  endif() 
-ENDIF(WIN32)
-
-
 #===================================
 # Find dependencies ================
 #===================================
@@ -276,6 +265,10 @@ foreach(library ${LIBRARIES})
                            SOVERSION ${LIBROCKET_VERSION_MAJOR}
     )
 	
+	if (MSVC)
+		target_compile_options(${NAME} PUBLIC "/MP")
+	endif(MSVC)
+	
 	set_property(TARGET ${NAME} PROPERTY CXX_STANDARD 17)
 	set_property(TARGET ${NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
     
@@ -285,9 +278,16 @@ foreach(library ${LIBRARIES})
             ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
             RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     )
+	
 
     set(ROCKET_EXPORTED_TARGETS ${ROCKET_EXPORTED_TARGETS} ${NAME})
 endforeach(library)
+
+if (MSVC)
+	target_compile_options(RocketCore PRIVATE "/Yuprecompiled.h")
+	set_source_files_properties(${PROJECT_SOURCE_DIR}/Source/Core/precompiled.cpp PROPERTIES COMPILE_FLAGS "/Ycprecompiled.h")
+endif(MSVC)
+
 else(NOT BUILD_FRAMEWORK)
 	#===================================
 	# Build combined Framework =========

+ 2 - 0
Build/cmake/FileList.cmake

@@ -42,12 +42,14 @@ set(Core_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFace.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFaceHandle.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFamily.h
+    ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/precompiled.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/BitmapFontDefinitions.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontParser.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontFace.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontFaceHandle.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontFaceLayer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontFamily.h
+    ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/precompiled.h
     ${PROJECT_SOURCE_DIR}/Source/Core/GeometryDatabase.h
     ${PROJECT_SOURCE_DIR}/Source/Core/LayoutBlockBox.h
     ${PROJECT_SOURCE_DIR}/Source/Core/LayoutBlockBoxSpace.h

+ 1 - 1
Samples/tutorial/datagrid_tree/src/HighScores.cpp

@@ -115,7 +115,7 @@ void HighScores::SubmitScore(const Rocket::Core::String& name, const Rocket::Cor
 				scores[i].alien_kills[j] = alien_kills[j];
 			}
 
-			NotifyRowAdd("scores", i, 1);
+			NotifyRowAdd("scores", (int)i, 1);
 
 			return;
 		}

+ 1 - 1
Source/Core/BitmapFont/FontFace.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include "FontFace.h"
 #include "FontFaceHandle.h"
 #include <Rocket/Core/Log.h>

+ 9 - 2
Source/Core/BitmapFont/FontFaceHandle.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include "FontFaceHandle.h"
 #include "FontFaceLayer.h"
 #include <algorithm>
@@ -292,7 +292,14 @@ void FontFaceHandle::GenerateLine(Geometry* geometry, const Vector2f& position,
 
 	line_vertices.resize(line_vertices.size() + 4);
 	line_indices.resize(line_indices.size() + 6);
-	GeometryUtilities::GenerateQuad(&line_vertices[0] + (line_vertices.size() - 4), &line_indices[0] + (line_indices.size() - 6), Vector2f(position.x, position.y + offset), Vector2f((float) width, underline_thickness), colour, line_vertices.size() - 4);
+	GeometryUtilities::GenerateQuad(
+		&line_vertices[0] + ((int)line_vertices.size() - 4),
+		&line_indices[0] + ((int)line_indices.size() - 6),
+		Vector2f(position.x, position.y + offset), 
+		Vector2f((float) width, underline_thickness), 
+		colour,
+		(int)line_vertices.size() - 4
+	);
 }
 
 // Destroys the handle.

+ 1 - 1
Source/Core/BitmapFont/FontFaceLayer.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include "FontFaceLayer.h"
 #include "FontFaceHandle.h"
 

+ 1 - 1
Source/Core/BitmapFont/FontFamily.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include "FontFamily.h"
 #include "FontFace.h"
 

+ 1 - 1
Source/Core/BitmapFont/FontParser.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include "FontParser.h"
 
 namespace Rocket {

+ 1 - 1
Source/Core/BitmapFont/FontProvider.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include <Rocket/Core/BitmapFont/FontProvider.h>
 #include "../FontFaceHandle.h"
 #include <Rocket/Core/FontDatabase.h>

+ 33 - 0
Source/Core/BitmapFont/precompiled.h

@@ -0,0 +1,33 @@
+/*
+ * This source file is part of libRocket, the HTML/CSS Interface Middleware
+ *
+ * For the latest information, see http://www.librocket.com
+ *
+ * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#ifndef ROCKETCOREBITMAPFONTPRECOMPILED_H
+#define ROCKETCOREBITMAPFONTPRECOMPILED_H
+
+#include "../precompiled.h"
+
+#endif

+ 1 - 0
Source/Core/FontProvider.cpp

@@ -25,6 +25,7 @@
  *
  */
 
+#include "precompiled.h"
 #include <Rocket/Core/FontProvider.h>
 #include <Rocket/Core/FontFamily.h>
 

+ 1 - 1
Source/Core/FreeType/FontFace.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include "FontFace.h"
 #include "FontFaceHandle.h"
 #include "../../../Include/Rocket/Core/Log.h"

+ 1 - 1
Source/Core/FreeType/FontFaceHandle.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include "FontFaceHandle.h"
 #include <algorithm>
 #include "../../../Include/Rocket/Core.h"

+ 1 - 1
Source/Core/FreeType/FontFamily.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include "FontFamily.h"
 #include "FontFace.h"
 

+ 1 - 1
Source/Core/FreeType/FontProvider.cpp

@@ -25,7 +25,7 @@
  *
  */
 
-#include "../precompiled.h"
+#include "precompiled.h"
 #include <Rocket/Core/FreeType/FontProvider.h>
 #include "FontFaceHandle.h"
 #include <Rocket/Core/FontDatabase.h>

+ 33 - 0
Source/Core/FreeType/precompiled.h

@@ -0,0 +1,33 @@
+/*
+ * This source file is part of libRocket, the HTML/CSS Interface Middleware
+ *
+ * For the latest information, see http://www.librocket.com
+ *
+ * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#ifndef ROCKETCOREFREETYPEFONTPRECOMPILED_H
+#define ROCKETCOREFREETYPEFONTPRECOMPILED_H
+
+#include "../precompiled.h"
+
+#endif

+ 1 - 1
Source/Core/PropertyParserTransform.cpp

@@ -208,7 +208,7 @@ int PropertyParserTransform::Scan(const char* str, const char* keyword, const Pr
 	/* find the keyword */
 	if (!memcmp(str, keyword, strlen(keyword)))
 	{
-		bytes_read = strlen(keyword);
+		bytes_read = (int)strlen(keyword);
 		str += bytes_read;
 		total_bytes_read += bytes_read;
 	}