From 822b985e9afded7cdc52cc59a0017f8882268cd8 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 | 10 ++++++++++ 4 files changed, 29 insertions(+) create mode 100644 Components/Csharp/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e02cd94d58..70a852a0090 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -377,6 +377,7 @@ cmake_dependent_option(OGRE_BUILD_COMPONENT_OVERLAY "Build Overlay component" TR option(OGRE_BUILD_COMPONENT_HLMS "Build HLMS component" TRUE) cmake_dependent_option(OGRE_BUILD_COMPONENT_BITES "Build OgreBites component" TRUE "OGRE_BUILD_COMPONENT_OVERLAY" FALSE) cmake_dependent_option(OGRE_BUILD_COMPONENT_PYTHON "Build Python bindings" TRUE "NOT OGRE_STATIC" FALSE) +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 1b6196aab0a..4ea2cfa4c56 100644 --- a/Components/CMakeLists.txt +++ b/Components/CMakeLists.txt @@ -51,3 +51,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 00000000000..ff0a57d931e --- /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 627e958e2fb..f772c9290f3 100644 --- a/OgreMain/include/Ogre.i +++ b/OgreMain/include/Ogre.i @@ -19,7 +19,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 @@ -136,8 +138,10 @@ ADD_REPR(Plane) %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" @@ -169,7 +173,9 @@ ADD_REPR(ColourValue) %include "OgreNameGenerator.h" %include "OgreController.h" %include "OgreRenderSystemCapabilities.h" +#ifndef SWIG_CSHARP %include "OgreGpuProgramParams.h" +#endif %ignore Ogre::Image::loadDynamicImage(uchar*, uint32, uint32, PixelFormat); // deprecated %ignore Ogre::Image::loadRawData(DataStreamPtr&, uint32, uint32, PixelFormat); // deprecated %include "OgreImage.h" @@ -189,12 +195,15 @@ ADD_REPR(ColourValue) %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" @@ -299,6 +308,7 @@ ADD_REPR(ColourValue) %include "OgreConfigDialog.h" %ignore Ogre::Root::showConfigDialog(); // deprecated %include "OgreRoot.h" +#endif // dont wrap: platform specific // %include "OgreWindowEventUtilities.h" // %include "OgreTimer.h"