Commit 0e994fca authored by Timothee Habra's avatar Timothee Habra
Browse files

1st working of windows dll (to be cleaned)

parent 5525ace0
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required(VERSION 2.8.7)
project(project_symbolic)
# project configuration
set( CMAKE_C_FLAGS_RELEASE "-O3" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3" )
# release of debug
release_debug()
# list source files to compile
init_src()
increment_src( ${PROJECT_SOURCE_DIR} )
# list include directories (to find headers)
init_include()
set(INCLUDE_DIR ${INCLUDE_DIR} ${PROJECT_SOURCE_DIR} PARENT_SCOPE)
increment_void_symbolic( symbolicR )
include (GenerateExportHeader)
add_library(project_symbolic ${SOURCE_FILES} ${INCLUDE_DIR})
target_link_libraries(MBsysC_struct)
GENERATE_EXPORT_HEADER( project_symbolic )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
install (TARGETS project_symbolic DESTINATION bin)
# include directories
include_directories("./")
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_struct)
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_module) #where the prototypes of the user functions are
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_utilities) #where the mbs_buffer used by dirdyn is
\ No newline at end of file
#ifndef PROJECT_SYMBOLIC_EXPORT_H
#define PROJECT_SYMBOLIC_EXPORT_H
#ifdef PROJECT_SYMBOLIC_STATIC_DEFINE
# define PROJECT_SYMBOLIC_EXPORT
# define PROJECT_SYMBOLIC_NO_EXPORT
#else
# ifndef PROJECT_SYMBOLIC_EXPORT
# ifdef project_symbolic_EXPORTS
/* We are building this library */
# define PROJECT_SYMBOLIC_EXPORT
# else
/* We are using this library */
# define PROJECT_SYMBOLIC_EXPORT
# endif
# endif
# ifndef PROJECT_SYMBOLIC_NO_EXPORT
# define PROJECT_SYMBOLIC_NO_EXPORT
# endif
#endif
#ifndef PROJECT_SYMBOLIC_DEPRECATED
# define PROJECT_SYMBOLIC_DEPRECATED __declspec(deprecated)
# define PROJECT_SYMBOLIC_DEPRECATED_EXPORT PROJECT_SYMBOLIC_EXPORT __declspec(deprecated)
# define PROJECT_SYMBOLIC_DEPRECATED_NO_EXPORT PROJECT_SYMBOLIC_NO_EXPORT __declspec(deprecated)
#endif
#define DEFINE_NO_DEPRECATED 0
#if DEFINE_NO_DEPRECATED
# define PROJECT_SYMBOLIC_NO_DEPRECATED
#endif
#endif
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required(VERSION 2.8.7)
project(Project_userfct)
# project configuration
set( CMAKE_C_FLAGS_RELEASE "-O3" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3" )
# release of debug
release_debug()
# list source files to compile
init_src()
increment_src( ${PROJECT_SOURCE_DIR} )
# list include directories (to find headers)
init_include()
set(INCLUDE_DIR ${INCLUDE_DIR} ${PROJECT_SOURCE_DIR} PARENT_SCOPE)
include (GenerateExportHeader)
add_library(Project_userfct ${SOURCE_FILES} ${INCLUDE_DIR})
GENERATE_EXPORT_HEADER( Project_userfct )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
install (TARGETS Project_userfct DESTINATION bin)
# include directories
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_realtime)
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_realtime/realtime)
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_struct)
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_utilities)
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_utilities/auto_output)
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_load_xml)
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_module)
if (FLAG_PLOT)
sdl_header_lib(userfct)
include_directories(${ROBOTRAN_SOURCE_DIR}/mbs_common/mbs_realtime/sdl)
endif ( )
\ No newline at end of file
......@@ -109,13 +109,15 @@ include_directories (${PROJECT_BINARY_DIR}/conf)
init_src()
increment_src( ${PROJECT_SOURCE_DIR}/src )
increment_src( ${PROJECT_SOURCE_DIR}/../userfctR )
#increment_src( ${PROJECT_SOURCE_DIR}/../userfctR )
add_subdirectory( ${PROJECT_SOURCE_DIR}/../userfctR ${CMAKE_CURRENT_BINARY_DIR}/userfctR)
if (NOT FLAG_SEPARATE_SYMBOLIC)
increment_src( ${PROJECT_SOURCE_DIR}/../symbolicR )
#increment_src( ${PROJECT_SOURCE_DIR}/../symbolicR )
add_subdirectory( ${PROJECT_SOURCE_DIR}/../symbolicR ${CMAKE_CURRENT_BINARY_DIR}/symbolicR)
endif ( )
increment_void_symbolic( symbolicR )
#increment_void_symbolic( symbolicR )
# list include directories (to find headers)
......@@ -161,7 +163,10 @@ else ( )
# find MBSysC static libraries
target_link_libraries( ${Executable} MBsysC_struct MBsysC_numerics MBsysC_realtime MBsysC_utilities )
#user functions library
target_link_libraries ( ${Executable} Project_userfct )
#Libxml2 and GSL external libraries
target_link_libraries ( ${Executable} ${LIBXML2_LIBRARIES} ${GSL_LIBRARIES} )
......
......@@ -26,8 +26,13 @@ init_include()
set(INCLUDE_DIR ${INCLUDE_DIR} ${PROJECT_SOURCE_DIR} PARENT_SCOPE)
if(FLAG_SHARED_LIB)
include (GenerateExportHeader)
add_library(MBsysC_loadXML SHARED ${SOURCE_FILES} ${INCLUDE_DIR})
target_link_libraries(MBsysC_loadXML ${LIBXML2_LIBRARIES})
target_link_libraries(MBsysC_loadXML ${LIBXML2_LIBRARIES} MBsysC_utilities)
target_link_libraries(MBsysC_loadXML Project_userfct )
GENERATE_EXPORT_HEADER( MBsysC_loadXML )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
install (TARGETS MBsysC_loadXML DESTINATION bin)
else( )
add_library(MBsysC_loadXML STATIC ${SOURCE_FILES} ${INCLUDE_DIR})
endif( )
......
......@@ -5,12 +5,13 @@
#include "mbs_xml_reader.h"
#include "mbs_data.h"
#include "mbsysc_loadxml_export.h"
/**
* Load the data from the given *.mbs file (data in the xml
* format). The memory of a new MbsData is allocated.
*/
MbsData* mbs_load(const char* mbs_filename);
MBSYSC_LOADXML_EXPORT MbsData* mbs_load(const char* mbs_filename);
/**
......@@ -22,7 +23,7 @@ void mbs_load_user_model_xml(MDS_gen_strct* gen, UserModel* ums);
/**
* Free the memory used by the given MbsData structure.
*/
void mbs_delete_data(MbsData *s);
MBSYSC_LOADXML_EXPORT void mbs_delete_data(MbsData *s);
/**
......
......@@ -35,13 +35,20 @@ if (UNIX)
endif( )
if(FLAG_SHARED_LIB)
include (GenerateExportHeader)
add_library(MBsysC_module SHARED ${SOURCE_FILES} ${INCLUDE_DIR})
target_link_libraries(MBsysC_module MBsysC_struct MBsysC_numerics MBsysC_utilities MBsysC_realtime ${LIBXML2_LIBRARIES} ${GSL_LIBRARIES})
target_link_libraries(MBsysC_module Project_userfct project_symbolic)
GENERATE_EXPORT_HEADER( MBsysC_module )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
install (TARGETS MBsysC_module DESTINATION bin)
else( )
add_library(MBsysC_module STATIC ${SOURCE_FILES} ${INCLUDE_DIR})
endif( )
# include directories
include_directories("./")
include_directories(../mbs_struct)
include_directories(../mbs_numerics)
include_directories(../mbs_utilities)
......
......@@ -18,6 +18,8 @@
#include "mbs_dirdyn_struct.h"
#include "mbs_data.h"
#include "mbsysc_module_export.h"
/**
* Create a new direct dynamic structure.
* This function also initialize the options structures and
......@@ -27,7 +29,7 @@
* the time integration will be computed
*/
MbsDirdyn* mbs_new_dirdyn(MbsData* mbs_data);
MBSYSC_MODULE_EXPORT MbsDirdyn* mbs_new_dirdyn(MbsData* mbs_data);
/**
* Create a new direct dynamic structure.
......@@ -50,7 +52,7 @@ MbsDirdyn* mbs_new_dirdyn_aux(MbsData* mbs_data, MbsAux* mbs_aux);
*
*/
void mbs_run_dirdyn(MbsDirdyn* dirdyn, MbsData* mbs_data);
MBSYSC_MODULE_EXPORT void mbs_run_dirdyn(MbsDirdyn* dirdyn, MbsData* mbs_data);
/**
......@@ -80,7 +82,7 @@ void mbs_dirdyn_finish(MbsDirdyn* dirdyn, MbsData* mbs_data);
* The options (MbsDirdynOptions) and MbsAux structures are also freed
*/
void mbs_delete_dirdyn(MbsDirdyn* dirdyn, MbsData* mbs_data);
MBSYSC_MODULE_EXPORT void mbs_delete_dirdyn(MbsDirdyn* dirdyn, MbsData* mbs_data);
/**
* Compute the derivatives of the system
......
......@@ -229,7 +229,7 @@ int EQUIL_fct_equil(double *x, int n_x, double *Fu, MDS_gen_strct *mds_gen_strct
{
equil_gen_strct->xeq_ptr[i][0] = x[i];
}
MDS_opti_relate_data(mds_gen_strct);
//MDS_opti_relate_data(mds_gen_strct);
fail = compute_Fr_uc( Fr_uc, mds_gen_strct,mbs_part, mbs_aux, mbs_data );
......
......@@ -7,6 +7,8 @@
#include "mbs_data.h"
#include "MBSfun.h"
#include "mbsysc_module_export.h"
/**
* Structure defining the options of the coordinate
......@@ -63,21 +65,21 @@ typedef struct MbsPart
*
*/
int mbs_run_part(MbsPart* mbs_part, MbsData* mbs_data);
MBSYSC_MODULE_EXPORT int mbs_run_part(MbsPart* mbs_part, MbsData* mbs_data);
/**
* Allocate a new MbsPart structure.
* A new MbsPartOptions is also allocated and a pointer
* to this structure is kept from the new MbsPart.
*/
MbsPart* mbs_new_part(MbsData* mbs_data);
MBSYSC_MODULE_EXPORT MbsPart* mbs_new_part(MbsData* mbs_data);
/**
* Free the memory of the given MbsPart structure.
* Th memory of the associated options (mbs_part->options)
* is also freed.
*/
void mbs_delete_part(MbsPart* mbs_part);
MBSYSC_MODULE_EXPORT void mbs_delete_part(MbsPart* mbs_part);
/**
* Allocate a new MbsPartOptions structure and intialize
......
......@@ -9,6 +9,8 @@
#include "mbs_aux.h"
#include "mbs_dirdyn.h"
#include "project_userfct_export.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/* User functions *
......@@ -20,7 +22,7 @@ void user_loop(MbsData *MBSdata, MbsDirdyn *mbs_dd);
void user_finish(MbsData *MBSdata, MbsDirdyn *mbs_dd);
void user_cons_hJ(double *h, double **Jac, MbsData *s, double tsim);
PROJECT_USERFCT_EXPORT void user_cons_hJ(double *h, double **Jac, MbsData *s, double tsim);
void user_cons_jdqd(double *jdqd, MbsData *s, double tsim);
......@@ -38,7 +40,7 @@ double* user_GenExtForces(double PxF[4], double RxF[4][4],
double AxF[4], double OMPxF[4],
MbsData *s, double tsim,int iBody);
double* user_JointForces(MbsData *s, double tsim);
PROJECT_USERFCT_EXPORT double* user_JointForces(MbsData *s, double tsim);
double user_LinkForces(double Z, double Zd, MbsData *s, double tsim, int ilnk);
......
#ifndef MBSYSC_MODULE_EXPORT_H
#define MBSYSC_MODULE_EXPORT_H
#ifdef MBSYSC_MODULE_STATIC_DEFINE
# define MBSYSC_MODULE_EXPORT
# define MBSYSC_MODULE_NO_EXPORT
#else
# ifndef MBSYSC_MODULE_EXPORT
# ifdef MBsysC_module_EXPORTS
/* We are building this library */
# define MBSYSC_MODULE_EXPORT __declspec(dllexport)
# else
/* We are using this library */
# define MBSYSC_MODULE_EXPORT __declspec(dllimport)
# endif
# endif
# ifndef MBSYSC_MODULE_NO_EXPORT
# define MBSYSC_MODULE_NO_EXPORT
# endif
#endif
#ifndef MBSYSC_MODULE_DEPRECATED
# define MBSYSC_MODULE_DEPRECATED __declspec(deprecated)
# define MBSYSC_MODULE_DEPRECATED_EXPORT MBSYSC_MODULE_EXPORT __declspec(deprecated)
# define MBSYSC_MODULE_DEPRECATED_NO_EXPORT MBSYSC_MODULE_NO_EXPORT __declspec(deprecated)
#endif
#define DEFINE_NO_DEPRECATED 0
#if DEFINE_NO_DEPRECATED
# define MBSYSC_MODULE_NO_DEPRECATED
#endif
#endif
#ifndef PROJECT_USERFCT_EXPORT_H
#define PROJECT_USERFCT_EXPORT_H
#ifdef PROJECT_USERFCT_STATIC_DEFINE
# define PROJECT_USERFCT_EXPORT
# define PROJECT_USERFCT_NO_EXPORT
#else
# ifndef PROJECT_USERFCT_EXPORT
# ifdef Project_userfct_EXPORTS
/* We are building this library */
# define PROJECT_USERFCT_EXPORT
# else
/* We are using this library */
# define PROJECT_USERFCT_EXPORT
# endif
# endif
# ifndef PROJECT_USERFCT_NO_EXPORT
# define PROJECT_USERFCT_NO_EXPORT
# endif
#endif
#ifndef PROJECT_USERFCT_DEPRECATED
# define PROJECT_USERFCT_DEPRECATED __declspec(deprecated)
# define PROJECT_USERFCT_DEPRECATED_EXPORT PROJECT_USERFCT_EXPORT __declspec(deprecated)
# define PROJECT_USERFCT_DEPRECATED_NO_EXPORT PROJECT_USERFCT_NO_EXPORT __declspec(deprecated)
#endif
#define DEFINE_NO_DEPRECATED 0
#if DEFINE_NO_DEPRECATED
# define PROJECT_USERFCT_NO_DEPRECATED
#endif
#endif
......@@ -23,8 +23,13 @@ set(INCLUDE_DIR ${INCLUDE_DIR} ${PROJECT_SOURCE_DIR} PARENT_SCOPE)
set(INCLUDE_DIR ${INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/auto_output PARENT_SCOPE)
if(FLAG_SHARED_LIB)
include (GenerateExportHeader)
add_library(MBsysC_utilities SHARED ${SOURCE_FILES} ${INCLUDE_DIR})
target_link_libraries(MBsysC_struct)
GENERATE_EXPORT_HEADER( MBsysC_utilities )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
install (TARGETS MBsysC_utilities DESTINATION bin)
else( )
add_library(MBsysC_utilities STATIC ${SOURCE_FILES} ${INCLUDE_DIR})
endif( )
......
......@@ -7,17 +7,19 @@
#ifndef _SET_OUTPUT_H_
#define _SET_OUTPUT_H_
#include "MBsysC_utilities_export.h"
// funcions prototype
#ifdef __cplusplus // in case the function is called from a C++ file
extern "C" {
void set_output(double value, const char* label);
MBSYSC_UTILITIES_EXPORT void set_output(double value, const char* label);
}
#else
void set_output(double value, char* label);
MBSYSC_UTILITIES_EXPORT void set_output(double value, char* label);
#endif
void init_set_output(int max_nb_curves);
void free_set_output();
MBSYSC_UTILITIES_EXPORT void init_set_output(int max_nb_curves);
MBSYSC_UTILITIES_EXPORT void free_set_output();
double get_output_value(int index);
char* get_output_label(int index);
......
......@@ -13,6 +13,7 @@
#ifndef MBS_BUFFER_h
#define MBS_BUFFER_h
#include "MBsysC_utilities_export.h"
/**
*
......@@ -77,7 +78,7 @@ typedef struct MbsGrowingBuffer{
* @param nx the size of the array to be tracked by this buffer
* @param size the size of the buffer
*/
MbsBuffer* mbs_new_buffer(char* filename, int nx, int size);
MBSYSC_UTILITIES_EXPORT MbsBuffer* mbs_new_buffer(char* filename, int nx, int size);
/*! \brief create a new growing buffer for the user inputs to save
*
......@@ -85,19 +86,19 @@ MbsBuffer* mbs_new_buffer(char* filename, int nx, int size);
* \param[in] size size of the buffer
* \return new growing buffer initialized
*/
MbsGrowingBuffer* mbs_new_growing_buffer(int max_nx, int size, const char *respath);
MBSYSC_UTILITIES_EXPORT MbsGrowingBuffer* mbs_new_growing_buffer(int max_nx, int size, const char *respath);
/**
* Free memory of the specified MbsBuffer
*
*/
void mbs_delete_buffer(MbsBuffer* b);
MBSYSC_UTILITIES_EXPORT void mbs_delete_buffer(MbsBuffer* b);
/*! \brief release memory for growing buffer
*
* \param[out] b growing buffer to release
*/
void mbs_delete_growing_buffer(MbsGrowingBuffer *b);
MBSYSC_UTILITIES_EXPORT void mbs_delete_growing_buffer(MbsGrowingBuffer *b);
/**
* Save the given array to the specified buffer with the specified time.
......@@ -110,7 +111,7 @@ void mbs_delete_growing_buffer(MbsGrowingBuffer *b);
* @param x the array to save (value are copied)
*
*/
void mbs_buffer_save(MbsBuffer* b, double t, double *x);
MBSYSC_UTILITIES_EXPORT void mbs_buffer_save(MbsBuffer* b, double t, double *x);
/**
* Save the given values of auto_output to the specified buffer with the specified time.
......@@ -121,7 +122,7 @@ void mbs_buffer_save(MbsBuffer* b, double t, double *x);
* The content of the buffer is automatically written to the associated
* file when the buffer is full. The buffer index is then reset to 0.
*/
void mbs_growing_buffer_save(MbsGrowingBuffer* b, double t);
MBSYSC_UTILITIES_EXPORT void mbs_growing_buffer_save(MbsGrowingBuffer* b, double t);
/**
......@@ -130,13 +131,13 @@ void mbs_growing_buffer_save(MbsGrowingBuffer* b, double t);
* associated with this buffer.
*
*/
void mbs_buffer_write(MbsBuffer* b);
MBSYSC_UTILITIES_EXPORT void mbs_buffer_write(MbsBuffer* b);
/*! \brief write the content of the growing buffer to disk
*
* \param[in] b growing buffer
*/
void mbs_growing_buffer_write(MbsGrowingBuffer* b);
MBSYSC_UTILITIES_EXPORT void mbs_growing_buffer_write(MbsGrowingBuffer* b);
#endif
......
......@@ -15,6 +15,7 @@
#include "stdio.h"
#include "stdlib.h"
#include "mbs_tool.h"
#ifdef MATLAB_MEX_FILE
void put_vector(double *v, int size, char *name)
......
......@@ -11,20 +11,22 @@
#define mbs_mxtool_h
/*--------------------*/
#include "MBsysC_utilities_export.h"
void put_vector(double *v, int size, char *name);
void put_ivector(int *v, int size, char *name);
void put_matrix(double **m, int nL, int nC, char *name);
double *mbs_vector(int n);
void free_mbs_vector(double *v);
MBSYSC_UTILITIES_EXPORT double *mbs_vector(int n);
MBSYSC_UTILITIES_EXPORT void free_mbs_vector(double *v);
int *mbs_ivector(int n);
void free_mbs_ivector(int *v);
MBSYSC_UTILITIES_EXPORT int *mbs_ivector(int n);
MBSYSC_UTILITIES_EXPORT void free_mbs_ivector(int *v);
double **mbs_matrix(int nr, int nc);
void free_mbs_matrix(double **m, int nr);
MBSYSC_UTILITIES_EXPORT double **mbs_matrix(int nr, int nc);
MBSYSC_UTILITIES_EXPORT void free_mbs_matrix(double **m, int nr);
/*--------------------*/
......
#ifndef MBSYSC_UTILITIES_EXPORT_H
#define MBSYSC_UTILITIES_EXPORT_H
#ifdef MBSYSC_UTILITIES_STATIC_DEFINE
# define MBSYSC_UTILITIES_EXPORT
# define MBSYSC_UTILITIES_NO_EXPORT
#else
# ifndef MBSYSC_UTILITIES_EXPORT
# ifdef MBsysC_utilities_EXPORTS
/* We are building this library */
# define MBSYSC_UTILITIES_EXPORT __declspec(dllexport)
# else
/* We are using this library */
# define MBSYSC_UTILITIES_EXPORT __declspec(dllimport)
# endif
# endif
# ifndef MBSYSC_UTILITIES_NO_EXPORT
# define MBSYSC_UTILITIES_NO_EXPORT
# endif
#endif
#ifndef MBSYSC_UTILITIES_DEPRECATED
# define MBSYSC_UTILITIES_DEPRECATED __declspec(deprecated)
# define MBSYSC_UTILITIES_DEPRECATED_EXPORT MBSYSC_UTILITIES_EXPORT __declspec(deprecated)
# define MBSYSC_UTILITIES_DEPRECATED_NO_EXPORT MBSYSC_UTILITIES_NO_EXPORT __declspec(deprecated)
#endif
#define DEFINE_NO_DEPRECATED 0
#if DEFINE_NO_DEPRECATED
# define MBSYSC_UTILITIES_NO_DEPRECATED
#endif
#endif
......@@ -9,6 +9,8 @@
#include <math.h>
#include "MBsysC_utilities_export.h"
double norm_vector(double *v, int n)
{
double norm = 0.0;
......@@ -19,7 +21,7 @@ double norm_vector(double *v, int n)
return sqrt(norm);
}
double norminf_vector(double *v, int n)
MBSYSC_UTILITIES_EXPORT double norminf_vector(double *v, int n)
{
double norm = 0.0;
int i;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment