Просмотр исходного кода

Use msbuild for MBansheeEditor csproj for MSVC without MSVC generator

This resolves issues with Ninja builds inside MSVC (The default build type for using MSVC 'open folder')
James Mitchell 6 лет назад
Родитель
Сommit
1e40dc7d93
1 измененных файлов с 14 добавлено и 3 удалено
  1. 14 3
      Source/EditorManaged/CMakeLists.txt

+ 14 - 3
Source/EditorManaged/CMakeLists.txt

@@ -5,10 +5,21 @@ generate_csharp_project(${PROJECT_SOURCE_DIR}/Source/EditorManaged MBansheeEdito
 set(BS_CS_PROJ "MBansheeEditor.csproj")
 set(BS_CS_PROJ "MBansheeEditor.csproj")
 
 
 if(MSVC)
 if(MSVC)
-	include_external_msproject(MBansheeEditor ${CMAKE_CURRENT_SOURCE_DIR}/${BS_CS_PROJ})
+	if(CMAKE_GENERATOR MATCHES "Visual Studio")
+		include_external_msproject(MBansheeEditor ${CMAKE_CURRENT_SOURCE_DIR}/${BS_CS_PROJ})
 	
 	
-	add_dependencies(MBansheeEditor MBansheeEngine)
-	set_property(TARGET MBansheeEditor PROPERTY FOLDER Script)
+		add_dependencies(MBansheeEditor MBansheeEngine)
+		set_property(TARGET MBansheeEditor PROPERTY FOLDER Script)
+	else()
+		# Generator expressions don't support 'A' else 'B', otherwise
+		# this could be simplified to 'Debug' else 'Release'.
+		# Another possible improvement for this would be if we support
+		# all configuration types (e.g. RelWithDebInfo, etc) in MBansheeEditor
+		# then we could use $<CONFIG>
+		add_custom_target(MBansheeEditor
+				COMMAND msbuild /p:Configuration=$<$<CONFIG:Debug>:Debug>$<$<NOT:$<CONFIG:Debug>>:Release> ${CMAKE_CURRENT_SOURCE_DIR}/${BS_CS_PROJ}
+				COMMENT "Building managed assembly \"MBansheeEditor\"")
+	endif()
 else()
 else()
 	find_package(mcs)
 	find_package(mcs)