Skip to content
Snippets Groups Projects
Commit 70c48408 authored by Andrew Wilson's avatar Andrew Wilson :elephant:
Browse files

Merge branch 'CSharpWorkingDirectoryFix' into 'master'

BUG: Fix csharp example working directory setting

See merge request iMSTK/iMSTK!694
parents ed5501e5 824e07c6
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,27 @@ swig_add_library(iMSTKCWrapper
TYPE SHARED
OUTPUT_DIR "${CMAKE_BINARY_DIR}/Source/Wrappers/csharp"
LANGUAGE csharp
SOURCES SwigInterface/imstkCWrapper.i)
SOURCES
SwigInterface/imstkCWrapper.i)
if (MSVC)
# These files should not be provided via swig_add_library SOURCES
# But still displayed in visual studios
set(NOTGENERATED_FILES
SwigInterface/callback.i
SwigInterface/common.i
SwigInterface/debug.i
SwigInterface/ignored.i
SwigInterface/modifiers.i
SwigInterface/shared_ptr_instantiation.i
SwigInterface/std_function.i
SwigInterface/type_cast.i
SwigInterface/weak_ptr.i)
target_sources(iMSTKCWrapper PRIVATE ${NOTGENERATED_FILES})
set_source_files_properties(${NOTGENERATED_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set_target_properties(iMSTKCWrapper PROPERTIES SWIG_COMPILE_OPTIONS "-namespace;imstk")
if(iMSTK_SWIG_PINNED_ARRAY)
......
......@@ -10,11 +10,14 @@ function(add_example example_name sources)
set_property(TARGET ${target} PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.6.1")
set_property(TARGET ${target} PROPERTY VS_DOTNET_REFERENCES "System;iMSTKCSharp")
set_property(TARGET ${target} PROPERTY FOLDER Examples/CSharp)
# Neither of these actually work, has to be set in the project explicitely
set_property(TARGET ${target} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/bin")
set_property(TARGET ${target} PROPERTY VS_DEBUGGER_ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX}/bin;%PATH%")
if (MSVC)
set(BIN_PATH "${CMAKE_INSTALL_PREFIX}/bin/")
# csproj files picky about slashes
string(REPLACE "/" "\\" BIN_PATH "${BIN_PATH}")
set_property(TARGET ${target} PROPERTY VS_GLOBAL_StartWorkingDirectory ${BIN_PATH})
endif()
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${target}> ${CMAKE_INSTALL_PREFIX}/bin)
......
......@@ -32,12 +32,11 @@ The output of this step is a shared library `iMSTKCWrapper.[dll|sh]` (located in
Some people like to compile all the `.cs` files into a separate library, the Visual Studio build does that in a separate target.
# How ro run C# examples on Windows
# How to run C# examples on Windows
## Via Visual Studio .NET
- The superbuild needs to be run twice for the C# Examples to be run from the install folder
- If you are looking at the inner build, after building `iMSTKCWrapper`, you will need to run CMake "Configure" and "Generate" again to load the example projects.
- Due to the dependency relation ship noted above you can't immediately run the example out of visual studio at the moment but you need to make sure that the "Working Directory" under each examples' project settings is set to the iMSTK install folder
## Via Mono
- Install mono. See [https://www.mono-project.com/docs/getting-started/install/windows/](https://www.mono-project.com/docs/getting-started/install/windows/)
......
......@@ -75,7 +75,6 @@
#include "imstkPbdFEMConstraint.h"
#include "imstkPbdCollisionConstraint.h"
#include "imstkSPHBoundaryConditions.h"
/* #include "imstkSPHHemorrhage.h" */
#include "imstkInternalForceModelTypes.h"
#include "imstkFEMDeformableBodyModel.h"
#include "imstkRigidBodyState2.h"
......@@ -114,7 +113,6 @@
/*
* CollisionDetection
*/
/* #include "imstkCollisionDetection.h" */
#include "imstkCollisionData.h"
#include "imstkCollisionDetectionAlgorithm.h"
#include "imstkBidirectionalPlaneToSphereCD.h"
......@@ -200,7 +198,7 @@
namespace std {
%template(VectorInt) vector<int>;
%template(VectorSizet) vector<std::size_t>;
%template(VectorCollisionData) vector<imstk::CollisionElement>;
%template(VectorCollisionElement) vector<imstk::CollisionElement>;
}
%include "shared_ptr_instantiation.i"
......@@ -211,6 +209,7 @@ namespace std {
%include "std_function.i"
%include "callback.i"
/* rename these operators to "compute" due to lack of operator overloading */
%rename(compute) imstk::ImplicitFunctionGradient::operator();
%rename(compute) imstk::ImplicitFunctionCentralGradient::operator();
......@@ -271,6 +270,7 @@ namespace std {
*/
%include "../../../MeshIO/imstkMeshIO.h";
%template(readImageData) imstk::MeshIO::read<imstk::ImageData>;
%template(readPointSet) imstk::MeshIO::read<imstk::PointSet>;
%template(readSurfaceMesh) imstk::MeshIO::read<imstk::SurfaceMesh>;
%template(readTetrahedralMesh) imstk::MeshIO::read<imstk::TetrahedralMesh>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment