From fa88c413b901410d757e019e4b4536d41aeeee47 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Fri, 6 May 2016 14:08:16 +0200 Subject: [PATCH] WIP: add C# bindings component --- CMakeLists.txt | 1 + Components/CMakeLists.txt | 4 ++++ Components/Csharp/CMakeLists.txt | 14 ++++++++++++++ OgreMain/include/Ogre.i | 11 ++++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 Components/Csharp/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 47e6606d2992..cdd4b650b751 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -393,6 +393,7 @@ cmake_dependent_option(OGRE_BUILD_PLUGIN_CG "Build Cg plugin" TRUE "Cg_FOUND;NOT cmake_dependent_option(OGRE_BUILD_COMPONENT_OVERLAY "Build Overlay component" TRUE "FREETYPE_FOUND" FALSE) option(OGRE_BUILD_COMPONENT_HLMS "Build HLMS component" TRUE) option(OGRE_BUILD_COMPONENT_PYTHON "Build Python bindings" TRUE) +option(OGRE_BUILD_COMPONENT_CSHARP "Build Csharp bindings" TRUE) option(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM "Build RTShader System component" TRUE) cmake_dependent_option(OGRE_BUILD_RTSHADERSYSTEM_CORE_SHADERS "Build RTShader System FFP core shaders" TRUE "OGRE_BUILD_COMPONENT_RTSHADERSYSTEM" FALSE) cmake_dependent_option(OGRE_BUILD_RTSHADERSYSTEM_EXT_SHADERS "Build RTShader System extensions shaders" TRUE "OGRE_BUILD_COMPONENT_RTSHADERSYSTEM" FALSE) diff --git a/Components/CMakeLists.txt b/Components/CMakeLists.txt index d9214062409c..c44aed513f69 100644 --- a/Components/CMakeLists.txt +++ b/Components/CMakeLists.txt @@ -47,3 +47,7 @@ endif () if (OGRE_BUILD_COMPONENT_PYTHON) add_subdirectory(Python) endif() + +if (OGRE_BUILD_COMPONENT_CSHARP) + add_subdirectory(Csharp) +endif() diff --git a/Components/Csharp/CMakeLists.txt b/Components/Csharp/CMakeLists.txt new file mode 100644 index 000000000000..ff0a57d931ee --- /dev/null +++ b/Components/Csharp/CMakeLists.txt @@ -0,0 +1,14 @@ +find_package(SWIG) + +if(NOT SWIG_FOUND) + return() +endif() + +include(${SWIG_USE_FILE}) + +set(CMAKE_SWIG_FLAGS "-DSWIG_CSHARP") +add_definitions(-Wno-cast-qual -Wno-shadow -Wno-maybe-uninitialized) +set_source_files_properties(../../OgreMain/include/Ogre.i PROPERTIES CPLUSPLUS ON) +swig_add_module(Ogre csharp ../../OgreMain/include/Ogre.i) +SWIG_LINK_LIBRARIES(Ogre OgreMain) +install(TARGETS ${SWIG_MODULE_Ogre_REAL_NAME} LIBRARY DESTINATION lib/) diff --git a/OgreMain/include/Ogre.i b/OgreMain/include/Ogre.i index 3037b02d47c6..4d0300e1b454 100644 --- a/OgreMain/include/Ogre.i +++ b/OgreMain/include/Ogre.i @@ -18,7 +18,9 @@ %include std_string.i %include std_pair.i %include std_map.i +#ifndef SWIG_CSHARP %include std_multimap.i +#endif %include std_vector.i %include exception.i @@ -89,8 +91,10 @@ typedef Ogre::SharedPtr StringVectorPtr; %include "OgrePlaneBoundedVolume.h" // I/O %include "OgreConfigOptionMap.h" +#ifndef SWIG_CSHARP // generates to long filenames due to allocator types %ignore Ogre::ConfigFile::load; // conflicting overloads %include "OgreConfigFile.h" +#endif %feature("valuewrapper") Ogre::Log::Stream; %include "OgreLog.h" %include "OgreLogManager.h" @@ -121,7 +125,9 @@ typedef Ogre::SharedPtr StringVectorPtr; %include "OgreNameGenerator.h" %include "OgreController.h" %include "OgreRenderSystemCapabilities.h" +#ifndef SWIG_CSHARP %include "OgreGpuProgramParams.h" +#endif %include "OgreImage.h" %include "OgreBillboard.h" %include "OgreParticle.h" @@ -138,13 +144,15 @@ typedef Ogre::SharedPtr StringVectorPtr; %include "OgreTexture.h" %include "OgreGpuProgram.h" %include "OgreHighLevelGpuProgram.h" -%include "OgreScriptCompiler.h" +#ifndef SWIG_CSHARP %include "OgreTextureUnitState.h" +#endif %include "OgreControllerManager.h" %include "OgreCompositor.h" %include "OgreCompositionTechnique.h" %include "OgreCompositionTargetPass.h" %include "OgreResourceBackgroundQueue.h" +#ifndef SWIG_CSHARP // instantiated in c++ code // %template(HardwareVertexBufferPtr) Ogre::SharedPtr; %include "OgreHardwareVertexBuffer.h" @@ -244,6 +252,7 @@ typedef Ogre::SharedPtr StringVectorPtr; %include "OgreSceneManager.h" %include "OgreSceneManagerEnumerator.h" %include "OgreRoot.h" +#endif // dont wrap: platform specific // %include "OgreWindowEventUtilities.h" // %include "OgreTimer.h"