CMakeLists.txt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Generate the assembly info file
  2. configure_file("${PROJECT_SOURCE_DIR}/Source/EditorManaged/Properties/AssemblyInfo.cs.in" "${PROJECT_SOURCE_DIR}/Source/EditorManaged/Properties/AssemblyInfo.cs")
  3. # Project refs
  4. if(MSVC)
  5. set(BS_CS_PROJECT_REFS " \
  6. <ProjectReference Include=\"..\\bsf\\Source\\Scripting\\bsfSharp\\MBansheeEngine.csproj\">\n \
  7. <Project>{876EB338-489E-4727-84DA-8CBBF0DA5B5E}</Project>\n \
  8. <Name>MBansheeEngine</Name>\n \
  9. </ProjectReference>\n")
  10. set(BS_CS_REFS " ")
  11. else()
  12. set(BS_CS_PROJECT_REFS " ")
  13. set(BS_CS_REFS " <Reference Include=\"MBansheeEngine.dll\"/>")
  14. endif()
  15. # Generate the CS project file
  16. generate_csharp_project(
  17. ${PROJECT_SOURCE_DIR}/Source/EditorManaged
  18. MBansheeEditor
  19. bs.Editor
  20. MBansheeEditor
  21. ${BS_CS_REFS}
  22. ${BS_CS_PROJECT_REFS})
  23. # Include the CS project in the build
  24. set(BS_CS_PROJ "MBansheeEditor.csproj")
  25. if(MSVC)
  26. if(CMAKE_GENERATOR MATCHES "Visual Studio")
  27. include_external_msproject(MBansheeEditor ${CMAKE_CURRENT_SOURCE_DIR}/${BS_CS_PROJ})
  28. set_property(TARGET MBansheeEditor PROPERTY FOLDER Script)
  29. else()
  30. # Generator expressions don't support 'A' else 'B', otherwise
  31. # this could be simplified to 'Debug' else 'Release'.
  32. # Another possible improvement for this would be if we support
  33. # all configuration types (e.g. RelWithDebInfo, etc) in MBansheeEditor
  34. # then we could use $<CONFIG>
  35. add_custom_target(MBansheeEditor
  36. COMMAND msbuild /p:Configuration=$<$<CONFIG:Debug>:Debug>$<$<NOT:$<CONFIG:Debug>>:Release> ${CMAKE_CURRENT_SOURCE_DIR}/${BS_CS_PROJ}
  37. COMMENT "Building managed assembly \"MBansheeEditor\"")
  38. endif()
  39. else()
  40. find_package(mcs)
  41. if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
  42. set(CS_PROJ_CONFIG Debug)
  43. else()
  44. set(CS_PROJ_CONFIG Release)
  45. endif()
  46. add_custom_target(MBansheeEditor
  47. COMMAND ${msbuild_EXECUTABLE} /p:Configuration=${CS_PROJ_CONFIG} ${CMAKE_CURRENT_SOURCE_DIR}/${BS_CS_PROJ}
  48. COMMENT "Building managed assembly \"MBansheeEditor\"")
  49. endif()
  50. add_dependencies(MBansheeEditor MBansheeEngine)