Skip to content

Commit

Permalink
WIP: add C# bindings component
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Jan 5, 2017
1 parent 04f4a7d commit 822b985
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions Components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ endif ()
if (OGRE_BUILD_COMPONENT_PYTHON)
add_subdirectory(Python)
endif()

if (OGRE_BUILD_COMPONENT_CSHARP)
add_subdirectory(Csharp)
endif()
14 changes: 14 additions & 0 deletions Components/Csharp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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/)
10 changes: 10 additions & 0 deletions OgreMain/include/Ogre.i
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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<Ogre::HardwareVertexBuffer>;
%include "OgreHardwareVertexBuffer.h"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 822b985

Please sign in to comment.