!XT (Git) Synchronizing Git repositories to Perforce
[CRYENGINE.git] / Code / CryManaged / CMakeLists.txt
blobd6796161599d57231330af5acdd9bd19db86df95
1 cmake_minimum_required(VERSION 3.5)
3 option(OPTION_BUILD_CSHARP_WITH_CSC "Build C# with Roslyn Compiler" ON)
4 set(CSC_PATH "${SDK_DIR}/Mono/bin/csc.bat")
5 set(MSBUILD_PATH "${SDK_DIR}/Mono/bin/msbuild.bat")
7 macro(create_mono_compiler_settings)
8         set(MONO_LANGUAGE_VERSION 7)
9         if("${BUILD_PLATFORM}" STREQUAL "Win32")
10                 set(MONO_CPU_PLATFORM x86)
11                 set(MONO_PREPROCESSOR_DEFINE WIN32)
12         elseif("${BUILD_PLATFORM}" STREQUAL "Win64")
13                 set(MONO_CPU_PLATFORM anycpu)
14                 set(MONO_PREPROCESSOR_DEFINE WIN64)
15         endif()
16         set(MONO_PREPROCESSOR_DEFINE ${MONO_PREPROCESSOR_DEFINE}$<SEMICOLON>$<UPPER_CASE:$<CONFIG>>)
17 endmacro()
19 # .Compiler options for net assemblies (dll) using mono are similar to ms c# compiler options
20 # currently .net assemblies are compiled to "anycpu"
21 # From microsoft :
22 # On a 64-bit Windows operating system:
23 # Assemblies compiled with /platform:x86 execute on the 32-bit CLR running under WOW64.
24 # A DLL compiled with the /platform:anycpu executes on the same CLR as the process into which it is loaded.
25 # Executables that are compiled with the /platform:anycpu execute on the 64-bit CLR.
26 # Executables compiled with /platform:anycpu32bitpreferred execute on the 32-bit CLR.
27 # The anycpu32bitpreferred setting is valid only for executable (.EXE) files, and it requires the .NET Framework 4.5.
28 if(OPTION_BUILD_CSHARP_WITH_CSC)
29         create_mono_compiler_settings()
30         message(STATUS "C# Mono platform ${MONO_CPU_PLATFORM}")
31         message(STATUS "C# Mono preprocessor define ${MONO_PREPROCESSOR_DEFINE}")
32         message(STATUS "C# Language Version : ${MONO_LANGUAGE_VERSION}")
33 endif()
35 if (OPTION_CRYMONO_SWIG)
36         set(MONO_SWIG_OUTPUT_ASSEMBLY_NAME "CryEngine.Common")
37         set(MONO_SWIG_OUTPUT_ASSEMBLY_REFERENCE "/reference:${OUTPUT_DIRECTORY}/${MONO_SWIG_OUTPUT_ASSEMBLY_NAME}.dll")
38 else()
39         set(MONO_SWIG_OUTPUT_ASSEMBLY_REFERENCE "")
40 endif()
42 add_subdirectory(CESharp)
43 add_subdirectory(CryMonoBridge)