Major changes: build static and dyn library. the first is for C example, the latter for CS example. The CS example is also ran in the action
This commit is contained in:
@@ -25,12 +25,12 @@ project(example_lib_opengjk_ce
|
||||
VERSION 1.0.0
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/main.c)
|
||||
target_link_libraries(${PROJECT_NAME} lib_opengjk_ce)
|
||||
add_executable(example_lib_opengjk_ce ${CMAKE_CURRENT_SOURCE_DIR}/main.c)
|
||||
target_link_libraries(example_lib_opengjk_ce obj_openGJK m)
|
||||
|
||||
# Copy input files for this example after build
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME} POST_BUILD
|
||||
TARGET example_lib_opengjk_ce POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/userP.dat
|
||||
${CMAKE_CURRENT_BINARY_DIR}/userP.dat
|
||||
|
||||
@@ -34,10 +34,13 @@ using System.Runtime.InteropServices;
|
||||
|
||||
public class Tester
|
||||
{
|
||||
|
||||
[DllImport("libopenGJKlib", EntryPoint="csFunction", CallingConvention = CallingConvention.StdCall)]
|
||||
#if UNIX
|
||||
[DllImport("libopengjk_ce.so", EntryPoint="csFunction", CallingConvention = CallingConvention.StdCall)]
|
||||
#else
|
||||
[DllImport("libopengjk_ce", EntryPoint = "csFunction", CallingConvention = CallingConvention.StdCall)]
|
||||
#endif
|
||||
|
||||
static extern double gjk(int na, double [,] ia, int nb, double [,] ib);
|
||||
static extern double compute_minimum_distance(int na, double [,] ia, int nb, double [,] ib);
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
@@ -51,13 +54,12 @@ public class Tester
|
||||
var inCoordsB = new double[3,9] { {-0.0 , -2.3 , -8.1 , -4.3 ,-2.5 , -7.1 , -1.0 , -3.3 , -6.0} , { -5.5 , -1.0 ,- 4.0 ,- 5.0 ,-1.0, -1.0, -1.5, -0.5 , -1.4} ,{ -0.0 , 2.0, -2.4, -2.2, -2.3 , -2.4 , -0.3 , -0.3 , -0.2} };
|
||||
|
||||
// Invoke GJK to compute distance
|
||||
dist = gjk( nCoordsA, inCoordsA, nCoordsB, inCoordsB );
|
||||
dist = compute_minimum_distance( nCoordsA, inCoordsA, nCoordsB, inCoordsB );
|
||||
|
||||
// Output results
|
||||
var s = string.Format("{0:0.##}", dist);
|
||||
var message = string.Format("The distance between {0} is {1}","A and B",s);
|
||||
Console.WriteLine(message);
|
||||
Console.WriteLine("Press any key to exit");
|
||||
Console.ReadLine();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user