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 Oct 16, 2016
1 parent 6d93fe4 commit b8494c6
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 @@ -385,6 +385,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 [UNSTABLE]" 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 @@ -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

Expand Down Expand Up @@ -89,8 +91,10 @@ typedef Ogre::SharedPtr<StringVector> 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"
Expand Down Expand Up @@ -121,7 +125,9 @@ typedef Ogre::SharedPtr<StringVector> 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"
Expand All @@ -139,12 +145,15 @@ typedef Ogre::SharedPtr<StringVector> StringVectorPtr;
%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 @@ -244,6 +253,7 @@ typedef Ogre::SharedPtr<StringVector> StringVectorPtr;
%include "OgreSceneManager.h"
%include "OgreSceneManagerEnumerator.h"
%include "OgreRoot.h"
#endif
// dont wrap: platform specific
// %include "OgreWindowEventUtilities.h"
// %include "OgreTimer.h"
Expand Down

0 comments on commit b8494c6

Please sign in to comment.