Commit d5e76735 authored by Nicolas Van der Noot's avatar Nicolas Van der Noot
Browse files

separate build working

parent cf62b606
......@@ -10,7 +10,7 @@
#include "realtime.h"
#include "events_sdl.h"
#include "plot_sdl.h"
#include "user_realtime.h"
/*! \brief handle inputs comming from the keyboard
*
......
......@@ -8,8 +8,7 @@
#ifdef SDL
#include "plot_sdl.h"
#include "set_plot.h"
#include "user_realtime.h"
/*! \brief assign values for the SDL functions
*
......
......@@ -13,7 +13,7 @@
#ifdef JAVA
#include "java_functions.h"
#include "user_realtime.h"
/*! \brief Java visualization user configuration
*
......
......@@ -135,19 +135,7 @@ set (Executable exe_${PROJECT_NAME})
# generate the executable
add_executable (${Executable} ${SOURCE_FILES})
if (FLAG_SEPARATE_BUILD) # find MBSysC dynamic libraries
find_package(LibRobotranC REQUIRED)
target_link_libraries(${Executable} "${LIB_MBSYSC_MODULES}")
target_link_libraries(${Executable} "${LIB_MBSYSC_LOAD}")
target_link_libraries(${Executable} "${LIB_MBSYSC_UTILITIES}")
else ( )
add_subdirectory("${ROBOTRAN_SOURCE_DIR}/mbs_common" "${CMAKE_CURRENT_BINARY_DIR}/mbs_common")
target_link_libraries(${Executable} MBsysC_loadXML)
target_link_libraries(${Executable} MBsysC_module)
if(NOT FLAG_SHARED_LIB)
target_link_libraries(${Executable} MBsysC_struct MBsysC_numerics MBsysC_utilities MBsysC_realtime)
endif(NOT FLAG_SHARED_LIB)
endif ( )
if (FLAG_VISU)
include_directories(${JNI_INCLUDE_PATH})
......@@ -170,3 +158,17 @@ endif ( )
if (FLAG_VISU)
target_link_libraries (${Executable} ${JNI_LIBRARIES})
endif ( )
if (FLAG_SEPARATE_BUILD) # find MBSysC dynamic libraries
find_package(LibRobotranC REQUIRED)
target_link_libraries(${Executable} "${LIB_MBSYSC_MODULES}")
target_link_libraries(${Executable} "${LIB_MBSYSC_LOAD}")
target_link_libraries(${Executable} "${LIB_MBSYSC_UTILITIES}")
else ( )
add_subdirectory("${ROBOTRAN_SOURCE_DIR}/mbs_common" "${CMAKE_CURRENT_BINARY_DIR}/mbs_common")
target_link_libraries(${Executable} MBsysC_loadXML)
target_link_libraries(${Executable} MBsysC_module)
if(NOT FLAG_SHARED_LIB)
target_link_libraries(${Executable} MBsysC_struct MBsysC_numerics MBsysC_utilities MBsysC_realtime)
endif(NOT FLAG_SHARED_LIB)
endif ( )
......@@ -69,6 +69,8 @@ int main(int argc, char const *argv[])
mbs_dirdyn->options->save2file = 1;
mbs_dirdyn->options->respath = PROJECT_SOURCE_DIR"/../resultsR";
mbs_dirdyn->options->realtime = 1;
mbs_run_dirdyn(mbs_dirdyn, mbs_data);
mbs_delete_dirdyn(mbs_dirdyn, mbs_data);
......
......@@ -20,6 +20,7 @@ set(INCLUDE_DIR ${INCLUDE_DIR} "./" PARENT_SCOPE)
if(FLAG_SHARED_LIB)
add_library(MBsysC_loadXML SHARED ${SOURCE_FILES} ${INCLUDE_DIR})
target_link_libraries (MBsysC_loadXML ${LIBXML2_LIBRARIES})
else(FLAG_SHARED_LIB)
add_library(MBsysC_loadXML STATIC ${SOURCE_FILES} ${INCLUDE_DIR})
endif(FLAG_SHARED_LIB)
......
......@@ -10,6 +10,10 @@ project(MBsysC_module)
xml_lib(mbs_module)
set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} PARENT_SCOPE)
# GSL
gsl_lib(mbs_module)
set(GSL_LIBRARIES ${GSL_LIBRARIES} PARENT_SCOPE)
# list source files to compile
init_src()
increment_src(./)
......@@ -23,7 +27,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result")
if(FLAG_SHARED_LIB)
add_library(MBsysC_module SHARED ${SOURCE_FILES} ${INCLUDE_DIR})
target_link_libraries(MBsysC_module MBsysC_struct MBsysC_numerics MBsysC_utilities MBsysC_realtime)
target_link_libraries(MBsysC_module MBsysC_struct MBsysC_numerics MBsysC_utilities MBsysC_realtime ${LIBXML2_LIBRARIES} ${GSL_LIBRARIES})
else( )
add_library(MBsysC_module STATIC ${SOURCE_FILES} ${INCLUDE_DIR})
endif( )
......
......@@ -6,8 +6,6 @@ cmake_minimum_required(VERSION 2.8.7)
project(MBsysC_numerics)
# list source files to compile
init_src()
increment_src(./)
......
......@@ -176,9 +176,9 @@ nfcnRead Number of function calls.
#include <stdio.h>
#include <limits.h>
// modif: add mbs_data and mbs_aux headers
// modif: add mbs_data and mbs_dirdyn_struct headers
#include "mbs_data.h"
#include "mbs_dirdyn.h"
#include "mbs_dirdyn_struct.h"
// modif: long nr, MbsData *s, MbsDirdyn *dd added
typedef void (*FcnEqDiff)(unsigned n, long nr, double x, double *y, double *f, MbsData *s, MbsDirdyn *dd);
......
......@@ -58,6 +58,17 @@ set(INCLUDE_DIR ${INCLUDE_DIR} "./realtime" PARENT_SCOPE)
add_library(MBsysC_realtime ${SOURCE_FILES} ${INCLUDE_DIR})
# SDL external library: linkage
if (FLAG_PLOT)
target_link_libraries (MBsysC_realtime ${SDL2_LIBRARIES} ${SDL2TTF_LIBRARIES})
endif ( )
# Java external library: linkage
if (FLAG_VISU)
target_link_libraries (MBsysC_realtime ${JNI_LIBRARIES})
endif ( )
include_directories("./")
include_directories("../mbs_struct")
include_directories("../mbs_utilities")
......
......@@ -29,13 +29,6 @@ typedef struct JNI_struct
} JNI_struct;
// functions prototypes
#ifdef __cplusplus
extern "C" {
#endif
void user_realtime_visu(MbsData* mbs_data, int nb_q, double *q_vec);
#ifdef __cplusplus
}
#endif
JNIEnv* create_vm(void);
JNI_struct* init_jni(int nb_q, double *q_vec, char *mbs_file, int start_viewpoint);
......
......@@ -7,14 +7,7 @@
#ifndef _SET_PLOT_H_
#define _SET_PLOT_H_
// funcions prototype
#ifdef __cplusplus // in case the function is called from a C++ file
extern "C" {
void set_plot(double value, const char* label);
}
#else
void set_plot(double value, char* label);
#endif
#include "user_realtime.h"
#ifdef SDL
#include "plot_sdl.h"
......
......@@ -23,6 +23,7 @@
#endif
#include "mbs_data.h"
#include "user_realtime.h"
// y axis: main parts
#define SCREEN_UP_HEIGHT_LOSS 40
......@@ -250,18 +251,6 @@ typedef struct Screen_sdl
// -- Functions prototypes -- //
#ifdef __cplusplus
extern "C" {
#endif
void user_realtime_plot(MbsData* mbs_data);
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates);
void user_joystick_axes(MbsData* mbs_data, Simu_realtime *realtime, int nb_joysticks);
void user_joystick_buttons(MbsData* mbs_data, int buttonID);
void wait_key(Simu_realtime *realtime, int cur_t_usec, double tsim);
#ifdef __cplusplus
}
#endif
void wait_key_generic(Simu_realtime *realtime, int cur_t_usec, double tsim);
Screen_sdl* init_screen_sdl(Realtime_option *options);
......
#ifdef REAL_TIME
#ifndef _USER_REALTIME_H_
#define _USER_REALTIME_H_
#include "mbs_data.h"
#include "realtime.h"
#include <stdint.h>
typedef uint8_t Uint8;
#ifdef __cplusplus
extern "C" {
#endif
void user_realtime_visu(MbsData* mbs_data, int nb_q, double *q_vec);
void user_realtime_plot(MbsData* mbs_data);
void user_keyboard(MbsData* mbs_data, Simu_realtime *realtime, int cur_t_usec, const Uint8 *keystates);
void user_joystick_axes(MbsData* mbs_data, Simu_realtime *realtime, int nb_joysticks);
void user_joystick_buttons(MbsData* mbs_data, int buttonID);
void wait_key(Simu_realtime *realtime, int cur_t_usec, double tsim);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
void set_plot(double value, const char* label);
}
#else
void set_plot(double value, char* label);
#endif
#endif
#endif
Supports Markdown
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