Commit 70edc856 authored by promayon's avatar promayon
Browse files

FIXED MacOS/X support: dylib automatically loaded on startup

FIXED various Sofa link problem
FIXED various warnings

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@27 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 9956106d
if(MML_SOFA_SUPPORT)
add_subdirectory(tetgen1.4.3)
#FIXME Sofa support => fix sofa dependency properly
if(WIN32)
link_directories(${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib)
else(WIN32)
link_directories(${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif(WIN32)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/win32/ReleaseVC9 ${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib ${MML_SOFA_DIR}/bin)
else()
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif()
link_directories(${MML_SOFA_LIB_DIR})
#FIXME xerces-c/xsd dependency properly (if mml is needed, xerces-c and xsd are needed)
include_directories(${XERCESC_ROOT_DIR}/include)
......
......@@ -190,7 +190,7 @@ void Tetrahedralize::apply(ComponentList compList) {
// generates all facets, use only triangles
unsigned nrOfTriangles = 0;
for (unsigned int i = 0;i < everything->GetNumberOfCells(); i++) {
for (int i = 0;i < everything->GetNumberOfCells(); i++) {
if (everything->GetCell(i)->GetNumberOfPoints() == 3)
nrOfTriangles++;
}
......@@ -241,14 +241,14 @@ void Tetrahedralize::apply(ComponentList compList) {
// save Output elements
//out.save_elements ((char *) QString(QFileInfo(myComponent->getFileName()).completeBaseName() + "_out").toStdString().c_str());
vtkSmartPointer<vtkPoints> thePoints = vtkSmartPointer<vtkPoints>::New();
for (unsigned int i = 0;i < out.numberofpoints;i++) {
for (int i = 0;i < out.numberofpoints;i++) {
thePoints->InsertNextPoint(out.pointlist[i*3], out.pointlist[i*3+1], out.pointlist[i*3+2]);
}
// -- 5. export to VTK
// 5.1 import the cells
vtkSmartPointer<vtkCellArray> theCells = vtkSmartPointer<vtkCellArray>::New();
for (unsigned int i = 0; i < out.numberoftetrahedra; i++) {
for (int i = 0; i < out.numberoftetrahedra; i++) {
vtkSmartPointer<vtkCell> c = vtkSmartPointer<vtkTetra>::New();
/* Vtk/Pml tetrahedron Tetgen tetrahedron
......@@ -356,7 +356,7 @@ void Tetrahedralize::apply(ComponentList compList) {
mshFile << "$ELM" << endl;
mshFile << newPointSet->GetCells()->GetNumberOfCells() << endl;
for ( unsigned int i = 0; i < newPointSet->GetCells()->GetNumberOfCells() ; i++ ) {
for (int i = 0; i < newPointSet->GetCells()->GetNumberOfCells() ; i++ ) {
unsigned int nPoints = newPointSet->GetCell(i)->GetNumberOfPoints();
// just to make sure this is a tetra
if (nPoints == 4) {
......
if(COMPONENT_MML)
set(MML_GENERATE_GUI ON CACHE BOOL "Forced by COMPONENT_MML" FORCE)
if(WIN32)
link_directories(${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib)
else(WIN32)
link_directories(${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif(WIN32)
set(MML_GENERATE_GUI ON CACHE BOOL "Forced by COMPONENT_MML" FORCE)
#FIXME Sofa support => fix sofa dependency properly
if(MML_SOFA_SUPPORT)
if(WIN32)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/win32/ReleaseVC9 ${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib ${MML_SOFA_DIR}/bin)
else()
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif()
link_directories(${MML_SOFA_LIB_DIR})
endif()
#FIXME xerces-c/xsd dependency properly (if mml is needed, xerces-c and xsd are needed)
include_directories(${XERCESC_ROOT_DIR}/include)
endif()
if(MML_SOFA_SUPPORT)
if(WIN32)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib)
else()
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif()
link_directories(${MML_SOFA_LIB_DIR})
endif()
component_extension(NEEDS_LIBXML2
NEEDS_TOOL pml lml mml monitoringgui monitoring
NEEDS_COMPONENT_EXTENSION vtkmesh physicalmodel
......@@ -32,11 +32,11 @@ component_extension(NEEDS_LIBXML2
)
if(COMPONENT_MML)
#FIXME this is just to avoid link error for MSVC:
# msvc2008 (v9) cannot link mml.dll (the component) with the mml.lib (the tool)
# it complains it can not link with mml with itself, without considering it
# can be two different libs
if(WIN32)
#FIXME this is just to avoid link error for MSVC:
# msvc2008 (v9) cannot link mml.dll (the component) with the mml.lib (the tool)
# it complains it can not link with mml with itself, without considering it
# can be two different libs
set_target_properties(component-mml PROPERTIES OUTPUT_NAME component-mml)
set_target_properties(component-mml PROPERTIES OUTPUT_NAME component-mml)
endif()
endif()
\ No newline at end of file
endif()
\ No newline at end of file
......@@ -105,11 +105,11 @@ void MMLDisplay::connectMonitor()
{
Monitor* m=NULL;
std:string s="";
std::string s="";
QTableWidget* table=mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
for (unsigned int i = 0;i < table->rowCount();i++) {
for (int i = 0;i < table->rowCount();i++) {
QRadioButton* qrb=(QRadioButton*)(table->cellWidget(i,5));
if (qrb->isChecked()){
m=mmlManager->getMonitoringGuiManager()->getMonitoringManager()->getMonitor(i);
......@@ -135,7 +135,7 @@ void MMLDisplay::updateMonitorsTable()
{
QTableWidget* table=mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
for (unsigned int i = 0;i < table->rowCount();i++) {
for (int i = 0;i < table->rowCount();i++) {
QRadioButton* r=new QRadioButton();
table->setCellWidget(i ,5 , r);
connect(r,SIGNAL(toggled(bool)),this,SLOT(connectMonitor()));
......@@ -159,7 +159,7 @@ Monitor* MMLDisplay::getDisplayedMonitor()
{
QTableWidget* table=mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
for (unsigned int i = 0;i < table->rowCount();i++) {
for (int i = 0;i < table->rowCount();i++) {
QRadioButton* qrb=(QRadioButton*)(table->cellWidget(i,5));
if (qrb->isChecked())
return mmlManager->getMonitoringGuiManager()->getMonitoringManager()->getMonitor(i);
......@@ -171,7 +171,7 @@ int MMLDisplay::getDisplayedMonitorLine()
{
QTableWidget* table=mmlManager->getMonitoringGuiManager()->getDialog()->getMonitorsTableWidget();
for (unsigned int i = 0;i < table->rowCount();i++) {
for (int i = 0;i < table->rowCount();i++) {
QRadioButton* qrb=(QRadioButton*)(table->cellWidget(i,5));
if (qrb->isChecked())
return i;
......
......@@ -210,7 +210,7 @@ class PHYSICALMODEL_COMPONENT_API LoadsManager {
/// get the current physical model
PMManagerDC * getPMManagerDC();
/// get the animation motor add-onlocation (dll / .so)
/// get the animation motor add-onlocation (.dll / .so / .dylib)
QString getAnimationMotorAddonLocation();
/// set the animation motor add-on location
......
......@@ -480,7 +480,7 @@ void LoadsSimulation::addAnimationMotorAddon() {
settings.beginGroup("physicalModelComponent");
QString lastOpened = QFileInfo(settings.value("animationMotorAddOn/location").toString()).absoluteDir().absolutePath();
settings.endGroup();
QString addonFile = QFileDialog::getOpenFileName(NULL, "Open an Animation Motor Add-on", lastOpened, "(*.so *.dll)");
QString addonFile = QFileDialog::getOpenFileName(NULL, "Open an Animation Motor Add-on", lastOpened, "(*.so *.dll *.dylib)");
if (!addonFile.isNull()) {
loadAddon(addonFile);
......
......@@ -186,7 +186,7 @@ void VtkMeshComponentPopup::loadTextureFromBMPFile() {
void VtkMeshComponentPopup::meshRegistration( ) {
// Search for the calibration library using a dialog box
QString libraryName = QFileDialog::getOpenFileName(this, "Open an mesh registration library",0, "Add-on (*.so *.dll)" );
QString libraryName = QFileDialog::getOpenFileName(this, "Open an mesh registration library",0, "Add-on (*.so *.dll *.dylib)" );
// Process library
if( libraryName != "" ) { processLibrary( libraryName ); }
......
......@@ -222,7 +222,7 @@ const QString Core::getRootDir() {
// ------------- checkCoreLibDir (static) -----------------
bool Core::checkCoreLibDir(QString dir) {
QStringList coreLibFilter;
coreLibFilter << "*camitkcore.so" << "*camitkcore.dll";
coreLibFilter << "*camitkcore.so" << "*camitkcore.dll" << "*camitkcore.dylib";
QStringList coreLibs = QDir(dir).entryList(coreLibFilter, QDir::Files);
return (coreLibs.size()==1);
}
......
......@@ -68,7 +68,7 @@ public:
/// @return a null QString, checkable with isNull(), if no test data directory found
static const QString getTestDataDir();
/// get the camitk core lib directory name (where the camitkcore dll/shared lib is)
/// get the camitk core lib directory name (where the camitkcore dll/shared/dynamic lib is)
static const QString getCoreLibDir();
///@}
......@@ -100,11 +100,11 @@ private:
/// @return true only if the camitk core lib is in the given directory
static bool checkCoreLibDir(QString dir);
/// name of main directory where the shared lib (dll or so) can be found
/// name of main directory where the shared lib (dll, so or dylib) can be found
/// It is "bin" on windows, "lib" on unix (unless isInstalled() is true, then it is still in bin)
static const QString sharedDirectory();
/// does this plateform puts all dll in a CamiTK::shortVersion directory
/// does this plateform puts all dll/so/dylib in a CamiTK::shortVersion directory
static const bool hasBinaryVersionSubdir();
};
......
......@@ -138,7 +138,7 @@ void ActionManager::autoloadActions() {
else {
// try to load all Components in the directory
QStringList extensionFile;
extensionFile << "*.so" << "*.dll";
extensionFile << "*.so" << "*.dll" << ".dylib";
// loop to load component extension, taking into account internal dependencies (i.e. dependency between
// one component and another one.
......
......@@ -92,7 +92,7 @@ public :
/// autoload all the Action extensions (use applicationDirPath/actions)
static void autoloadActions();
/// load an action extension using a .dll/.so filename
/// load an action extension using a .dll/.so/.dylib filename
/// @return false if it cannot be loaded
static bool loadAction(QString);
......
......@@ -240,7 +240,7 @@ void SettingsDialog::on_resetConfigurationButton_released() {
// ------------------------------ on_addComponentExtensionButton_released -------------------------------
void SettingsDialog::on_addComponentExtensionButton_released() {
QStringList files = QFileDialog::getOpenFileNames(0, "Add a ComponentExtension (Component) Plugin", Core::getComponentDir(), "Component Plugin (*.so *.dll)");
QStringList files = QFileDialog::getOpenFileNames(0, "Add a ComponentExtension (Component) Plugin", Core::getComponentDir(), "Component Plugin (*.so *.dll *.dylib)");
QStringList pluginFile = files;
QStringList::Iterator it = pluginFile.begin();
......@@ -289,7 +289,7 @@ void SettingsDialog::on_componentExtensionList_cellClicked(int row, int column)
// ------------------------------ on_addActionExtensionButton_released -------------------------------
void SettingsDialog::on_addActionExtensionButton_released() {
QStringList files = QFileDialog::getOpenFileNames(0, "Add an Action Extension", Core::getActionDir(), "Action Extension (*.so *.dll)");
QStringList files = QFileDialog::getOpenFileNames(0, "Add an Action Extension", Core::getActionDir(), "Action Extension (*.so *.dll *.dylib)");
QStringList pluginFile = files;
QStringList::Iterator it = pluginFile.begin();
......
......@@ -84,7 +84,7 @@ class CAMITK_API ComponentExtension : public QObject {
/// return true if this component manages directory instead of individual files (e.g. Dicom series are stored in directories, not files)
virtual bool hasDataDirectory() const { return false; }
/// get the file path (location of the .dll/.so) of this plugin
/// get the file path (location of the .dll/.so/.dylib) of this plugin
QString getLocation() const { return dynamicLibraryFileName; }
/// set the file path (once loaded as a dynamic library)
......@@ -107,7 +107,7 @@ class CAMITK_API ComponentExtension : public QObject {
///@}
private:
/// the shared lib (.so or .dll) used to instanciate the ComponentExtension subclass instance
/// the shared lib (.so, .dll or .dylib) used to instanciate the ComponentExtension subclass instance
QString dynamicLibraryFileName;
};
......
......@@ -76,7 +76,8 @@ void ExtensionsManager::autoloadExtensions() {
// try to load all Components in the directory
QStringList pluginFile;
pluginFile << "*.so" << "*.dll";
// linux: .so, windows: .dll, macOs: .dylib
pluginFile << "*.so" << "*.dll" << ".dylib";
// loop to load component plugin, taking into account internal dependencies (i.e. dependency between
// one component and another one.
......
......@@ -51,7 +51,7 @@ public:
/// autoload all the ComponentExtension plugins (use applicationDirPath/components)
static void autoloadExtensions();
/// load a ComponentExtension plugin using a .dll/.so filename
/// load a ComponentExtension plugin using a .dll/.so/.dylib filename
/// @return false if it cannot be loaded
static bool loadExtension(QString);
......
......@@ -47,7 +47,7 @@ void ImageProcessingPlugin::autoloadExtensions() {
if (!moduleDir.isNull()) {
QDir modulePath(moduleDir);
QStringList pluginFile;
pluginFile << "*.so" << "*.dll";
pluginFile << "*.so" << "*.dll" << ".dylib";
foreach(QString fileName, modulePath.entryList(pluginFile,QDir::Files)) {
loadExtension(modulePath.absoluteFilePath(fileName));
}
......@@ -78,7 +78,7 @@ bool ImageProcessingPlugin::loadExtension(QString fileName) {
}
}
else {
QMessageBox::warning(NULL, "ImageProcessingPlugin Opening Error...", "Load plugin failed:<br>" + pluginLoader->errorString() + "<p>Cannot load the DLL/.so:<br>" + fileName + "<p>To solve this problem, make sure that: <ul><li>This file is a valid ImageProcessing</li><li>Your application called <tt>ImageProcessingPlugin::autoloadExtensions()</tt> before calling <tt>ImageProcessingPlugin::applyPlugin(...)</tt></li></ul>");
QMessageBox::warning(NULL, "ImageProcessingPlugin Opening Error...", "Load plugin failed:<br>" + pluginLoader->errorString() + "<p>Cannot load the DLL/.so/.dylib:<br>" + fileName + "<p>To solve this problem, make sure that: <ul><li>This file is a valid ImageProcessing</li><li>Your application called <tt>ImageProcessingPlugin::autoloadExtensions()</tt> before calling <tt>ImageProcessingPlugin::applyPlugin(...)</tt></li></ul>");
}
delete pluginLoader;
......
......@@ -55,7 +55,7 @@ class CAMITK_API ImageProcessingPlugin : public QObject {
/// get the plugin description (can be html)
virtual QString getDescription() const = 0;
/// get the file path (location of the .dll/.so) of this plugin
/// get the file path (location of the .dll/.so/.dylib) of this plugin
QString getLocation() const { return pluginLoader->fileName(); }
///@}
......
......@@ -13,33 +13,14 @@ set(SRCS
${HEADERS}
)
if(MML_SOFA_SUPPORT)
#
# # compilation flag
# add_definitions(-DSOFA_SUPPORT)
# add_definitions(-DSOFA_PATH="${MML_SOFA_DIR}")
# library settings
if(WIN32)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib)
else()
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif()
# # set(MML_SOFA_LIBS sofacore sofacomponent sofatree)
# set(MML_SOFA_LIBS sofa_component_dev sofa_component_advanced_dev sofa_component_misc_dev sofa_component sofa_non_uniform_fem_dev sofa_advanced_fem sofa_mjed_fem sofa_advanced_constraint sofa_advanced_interaction sofa_misc_topology_dev sofa_misc_mapping_dev sofa_misc_forcefield_dev sofa_misc_fem_dev sofa_misc_collision_dev sofa_misc_solver_dev sofa_misc_dev sofa_exporter sofa_loader sofa_misc_forcefield sofa_component_base sofa_component_common sofa_component_general sofa_component_advanced sofa_component_misc sofahelper sofa_engine sofa_sph_fluid sofa_non_uniform_fem sofa_base_topology sofa_boundary_condition sofa_haptics sofa_constraint sofatree sofa_base_linear_solver sofa_implicit_ode_solver sofa_simple_fem sofa_topology_mapping sofa_user_interaction sofa_misc_collision sofa_preconditioner sofa_misc_topology sofa_mesh_collision sofa_volumetric_data sofabgl sofa_base_collision sofa_deformable sofa_graph_component sofa_base_mechanics sofa_rigid sofa_base_animation_loop sofa_object_interaction sofa_explicit_ode_solver sofa_eigen2_solver sofa_validation sofa_dense_solver sofa_eulerian_fluid sofa_misc_mapping sofa_misc_fem sofa_misc_engine sofa_misc_solver sofa_misc #-lnewmat -lGLEW -lpng
# sofasimulation #-lminiFlowVR
# sofacore #-ltinyxml
# sofadefaulttype #-lQt3Support -lQtOpenGL -lQtGui -lQtCore -lGLU -lGL -lpthread
# )
# # includes
# set(MML_SOFA_INCLUDE_DIR ${MML_SOFA_DIR}/modules ${MML_SOFA_DIR}/framework
# ${MML_SOFA_DIR}/extlibs/miniBoost ${MML_SOFA_DIR}/include/modules
# ${MML_SOFA_DIR}/include/framework ${MML_SOFA_DIR}/include/extlibs/miniBoost )
# set(benchmark_LIBRARIES
# ${benchmark_LIBRARIES}
# ${MML_SOFA_LIBS}
# )
set(benchmark_link ${benchmark_link} ${MML_SOFA_LIB_DIR})
#FIXME Sofa support => fix sofa dependency properly
if(WIN32)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/win32/ReleaseVC9 ${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib ${MML_SOFA_DIR}/bin)
else()
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif()
link_directories(${MML_SOFA_LIB_DIR})
endif(MML_SOFA_SUPPORT)
include_directories(${MML_INCLUDE_DIRECTORIES})
......
......@@ -49,9 +49,20 @@ set(gui_SRCS
${gui_MOC_UI}
)
add_executable(benchmarkgui ${gui_SRCS})
add_library(monitoringgui STATIC ${gui_SRCS})
if(MML_SOFA_SUPPORT)
#FIXME Sofa support => fix sofa dependency properly
if(WIN32)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/win32/ReleaseVC9 ${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib ${MML_SOFA_DIR}/bin)
else()
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif()
link_directories(${MML_SOFA_LIB_DIR})
endif(MML_SOFA_SUPPORT)
add_executable(benchmarkgui ${gui_SRCS})
target_link_libraries(benchmarkgui ${gui_LIBRARIES})
#add_custom_target(monitoringgui ALL)
......
......@@ -28,7 +28,7 @@ if(MML_SOFA_SUPPORT)
add_definitions(-DSOFA_PATH="${MML_SOFA_DIR}")
# library settings
if(WIN32)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/win32/ReleaseVC9 ${MML_SOFA_DIR}/lib/win32 ${MML_SOFA_DIR}/lib ${MML_SOFA_DIR}/bin )
else(WIN32)
set(MML_SOFA_LIB_DIR ${MML_SOFA_DIR}/lib/linux ${MML_SOFA_DIR}/lib)
endif(WIN32)
......
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