Skip to content

Commit

Permalink
Merge pull request #48 from nicolas-f/fix_linux_path
Browse files Browse the repository at this point in the history
Switch from static linking to dynamic linking
Fix path creation on SPPS
  • Loading branch information
nicolas-f authored Sep 22, 2016
2 parents 501886c + d540a52 commit da060c0
Show file tree
Hide file tree
Showing 28 changed files with 254 additions and 202 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.6.0)

# Maps to a solution file (isimpa.sln). The solution will
# have all targets (exe, lib, dll) as projects (.vcproj)
project (isimpa VERSION 1.3.1)
project (isimpa VERSION 1.3.2)


macro(COPY_LIB LIBPATH DESTINATION)
get_filename_component(UT_SHARED_FILE ${LIBPATH} NAME)
configure_file(${LIBPATH}
${DESTINATION}/${UT_SHARED_FILE} COPYONLY)
endmacro(COPY_LIB)

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/bin" CACHE PATH "default install path" FORCE )
Expand Down
3 changes: 3 additions & 0 deletions src/VolumetricMeshRepair/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set(VMR_SOURCE_FILES
# DEPENDENCY & EXECUTABLE (OR LIB)
#---------------------------------------#

find_package(Boost COMPONENTS system filesystem regex REQUIRED)
link_directories( ${Boost_LIBRARY_DIRS} )

# Set Properties->General->Configuration Type to Application
# Creates spps with the listed sources
# Adds sources to the Solution Explorer
Expand Down
4 changes: 1 addition & 3 deletions src/VolumetricMeshRepair/main_remesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ int MainRemesh(int argc, char* argv[])
//if(FromTriangleRemesh.GetVolumeValue(i)>volumeSelectionInfo.minimalVol && (!(volumeSelectionInfo.selectionFilter==VolumeSelectionInfo_t::FILTER_SKIP_EXT) || i!=2) && (!(volumeSelectionInfo.selectionFilter==VolumeSelectionInfo_t::FILTER_EXT_ONLY) || i==2))
if(i>1 && i<FromTriangleRemesh.GetVolumeCount())
{
std::size_t lastPathSeparatorPosition(fileOutput.rfind("\\"));
if(lastPathSeparatorPosition==std::string::npos)
lastPathSeparatorPosition=fileOutput.rfind("/");
std::size_t lastPathSeparatorPosition(fileOutput.rfind(st_path_separator()));
std::string basePath;
std::string fileName;
if(lastPathSeparatorPosition!=std::string::npos)
Expand Down
38 changes: 33 additions & 5 deletions src/isimpa/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
include_directories (./ "${PROJECT_SOURCE_DIR}/src/lib_interface")


# convert path of a .lib file into a .dll file
# findboost does not store .dll locations
macro(LIB_TO_DLL LIBPATH DLL_PATH)
get_filename_component(DLL_FILENAME ${LIBPATH} NAME_WE)
get_filename_component(DLL_DIR ${LIBPATH} DIRECTORY)
set(${DLL_PATH} "${DLL_DIR}/${DLL_FILENAME}.dll")
if(NOT EXISTS "${DLL_DIR}/${DLL_FILENAME}.dll")
MESSAGE(ERROR " Dll file does not exists ${DLL_DIR}/${DLL_FILENAME}.dll")
endif()
endmacro(LIB_TO_DLL)

#--------------#
# SOURCES
#--------------#
Expand Down Expand Up @@ -373,6 +385,10 @@ set_property(SOURCE data_manager/python_interface/py_ui_module/element_pywrap.cp

configure_file(data_manager/appconfig_version.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/generated/appconfig_version.cpp )

set(Boost_USE_STATIC_LIBS OFF)
find_package(Boost REQUIRED COMPONENTS system python filesystem regex)
link_directories( ${Boost_LIBRARY_DIRS} )

# Set Properties->General->Configuration Type to Application
# Creates isimpa with the listed sources
# Adds sources to the Solution Explorer
Expand Down Expand Up @@ -403,9 +419,6 @@ add_executable(isimpa
# project (isimpa.vcproj) under it
set_property(TARGET isimpa PROPERTY FOLDER "executables")

set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS system python)

IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(wxWidgets_USE_DEBUG ON)
SET(wxWidgets_USE_STATIC ON)
Expand Down Expand Up @@ -464,7 +477,10 @@ ${ISIMPA_RESSOURCES}/appconst.xml
${ISIMPA_RESSOURCES}/isimpa.ico
${ISIMPA_RESSOURCES}/Licence.pdf
${ISIMPA_RESSOURCES}/Licence.rtf
DESTINATION .)
#${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL}
#${Boost_SYSTEM_LIBRARY_RELEASE_REAL}
#${Boost_PYTHON_LIBRARY_RELEASE_REAL}
DESTINATION .)

install(DIRECTORY
${ISIMPA_RESSOURCES}/Bitmaps
Expand All @@ -491,9 +507,19 @@ if(WIN32) # Check if we are on Windows
install(DIRECTORY
${PYTHON_ROOT_FOLDER}/Lib
DESTINATION .)

# Resolve symbolic link
LIB_TO_DLL(${Boost_FILESYSTEM_LIBRARY_RELEASE} Boost_FILESYSTEM_LIBRARY_RELEASE_REAL)
LIB_TO_DLL(${Boost_SYSTEM_LIBRARY_RELEASE} Boost_SYSTEM_LIBRARY_RELEASE_REAL)
LIB_TO_DLL(${Boost_PYTHON_LIBRARY_RELEASE} Boost_PYTHON_LIBRARY_RELEASE_REAL)
LIB_TO_DLL(${Boost_REGEX_LIBRARY_RELEASE} Boost_REGEX_LIBRARY_RELEASE_REAL)

install (FILES
${PYTHON_DLL}
${PYTHON_DLL}
${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL}
${Boost_SYSTEM_LIBRARY_RELEASE_REAL}
${Boost_PYTHON_LIBRARY_RELEASE_REAL}
${Boost_REGEX_LIBRARY_RELEASE_REAL}
DESTINATION .)
endif()

Expand Down Expand Up @@ -530,4 +556,6 @@ ELSE(WIN32 AND NOT UNIX)
SET(CPACK_SOURCE_STRIP_FILES "")
ENDIF(WIN32 AND NOT UNIX)
SET(CPACK_PACKAGE_EXECUTABLES "isimpa" "I-SIMPA")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Nicolas Fortin")

INCLUDE(CPack)
13 changes: 2 additions & 11 deletions src/isimpa/IHM/pyConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BEGIN_EVENT_TABLE( PyConsole, wxTextCtrl )
END_EVENT_TABLE()

PyConsole::PyConsole(wxWindow* parent)
: wxTextCtrl(parent,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_RICH | wxNO_BORDER | wxTE_MULTILINE | wxTE_PROCESS_TAB )
: wxTextCtrl(parent,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_RICH | wxNO_BORDER | wxTE_MULTILINE | wxTE_PROCESS_TAB | wxTE_PROCESS_ENTER )
{
waitingForNextPrompt=true;
promptSize=0;
Expand Down Expand Up @@ -93,17 +93,8 @@ void PyConsole::OnTextEnter(wxCommandEvent& txtEvent)
command.Replace("\n","\\n");
PostPythonCodeUpdate.SetString(command);
wxPostEvent(this, PostPythonCodeUpdate);
AppendText("\n");
waitingForNextPrompt=true;
/*
wxArrayString commands;
SplitString(command,"\n",commands);
for(size_t i=0;i<commands.size();i++)
{
PostPythonCodeUpdate.SetString(commands[i]);
wxPostEvent(this, PostPythonCodeUpdate);
waitingForNextPrompt=true;
}
*/
}
void PyConsole::OnKeyDown(wxKeyEvent& txtEvent)
{
Expand Down
15 changes: 13 additions & 2 deletions src/isimpa/IHM/uiTreeCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "data_manager/appconfig.h"
#include "last_cpp_include.hpp"

wxDEFINE_EVENT(MENU_ITEM_SELECTED, wxCommandEvent);

BEGIN_EVENT_TABLE(uiTreeCtrl, wxTreeCtrl)
EVT_TREE_BEGIN_DRAG(-1, uiTreeCtrl::BeginDrag)
EVT_TREE_END_DRAG(-1, uiTreeCtrl::EndDrag)
Expand All @@ -46,6 +48,7 @@ BEGIN_EVENT_TABLE(uiTreeCtrl, wxTreeCtrl)
EVT_TREE_ITEM_EXPANDING(-1, uiTreeCtrl::OnExpanding)
EVT_TREE_ITEM_COLLAPSED(-1, uiTreeCtrl::OnCollapsing)
EVT_MENU(-1, uiTreeCtrl::OnElementEvent)
EVT_COMMAND(wxID_ANY, MENU_ITEM_SELECTED, uiTreeCtrl::OnMenuItemClosed)
EVT_TIMER(100, uiTreeCtrl::OnTimer)
EVT_MOTION(uiTreeCtrl::OnMouseMove)
EVT_KEY_UP(uiTreeCtrl::OnKeyUp)
Expand Down Expand Up @@ -399,6 +402,12 @@ uiTreeCtrl::uiTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, cons
{
InitTree();
}

void uiTreeCtrl::OnMenuItemClosed(wxCommandEvent& commandEvent) {
if (this->pointeurElementEvent)
this->pointeurElementEvent(commandEvent);
}

uiTreeCtrl::uiTreeCtrl()
:wxTreeCtrl(),alive(new bool(true))
{
Expand Down Expand Up @@ -494,8 +503,10 @@ void uiTreeCtrl::OnCollapsing(wxTreeEvent& treeEvent)

void uiTreeCtrl::OnElementEvent(wxCommandEvent& eventElement)
{
if(this->pointeurElementEvent)
this->pointeurElementEvent(eventElement);
wxThreadEvent evt;
evt.SetId(eventElement.GetId());
evt.SetEventType(MENU_ITEM_SELECTED);
QueueEvent(evt.Clone());
}

void uiTreeCtrl::BindElementEvent(void (*fevent)(wxCommandEvent&))
Expand Down
5 changes: 4 additions & 1 deletion src/isimpa/IHM/uiTreeCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* ----------------------------------------------------------------------*/

#include "first_header_include.hpp"

#include <wx/window.h>
#include <wx/imaglist.h>
#include <wx/artprov.h>
Expand All @@ -53,6 +52,8 @@
*
* Surcharge de wxTreeCtrl afin d'intéragir avec les instances de la classe Element
*/
wxDECLARE_EVENT(MENU_ITEM_SELECTED, wxCommandEvent);

class uiTreeCtrl : public wxTreeCtrl
{
private :
Expand All @@ -73,6 +74,7 @@ class uiTreeCtrl : public wxTreeCtrl
void InitTree();
smart_ptr<bool> alive;
protected :

DECLARE_EVENT_TABLE()

Element* rootItem;
Expand All @@ -87,6 +89,7 @@ class uiTreeCtrl : public wxTreeCtrl
void OnExpanding(wxTreeEvent& treeEvent);
void OnCollapsing(wxTreeEvent& treeEvent);
void OnKeyUp(wxKeyEvent&);
void OnMenuItemClosed(wxCommandEvent& commandEvent);
public :
/**
* Constructeur de la fenêtre
Expand Down
14 changes: 13 additions & 1 deletion src/isimpa/data_manager/projet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,19 @@ void ProjectManager::RunCoreCalculation(Element* coreCalculation)
///////////////////////////////////////////
wxLogInfo(_("Refreshing onglet 'Report'"));

bool resetHistoryBackup = false;
// Refresh of report folder is not a user action and should not trigger tree backup
if(rootUserConfig->GetElementByLibelle("mainpref")->GetElementByLibelle("history")->GetBoolConfig("keep_modification_history")) {
rootUserConfig->GetElementByLibelle("mainpref")->GetElementByLibelle("history")->UpdateBoolConfig("keep_modification_history", false);
resetHistoryBackup = true;
}

RefreshReportFolder();

if(resetHistoryBackup) {
rootUserConfig->GetElementByLibelle("mainpref")->GetElementByLibelle("history")->UpdateBoolConfig("keep_modification_history", true);
}

wxLongLong durationOperation=wxDateTime::UNow().GetValue()-timeDebOperation.GetValue();
wxLogInfo(_("Total time calculation: %i ms"),durationOperation.GetValue());

Expand Down Expand Up @@ -1374,6 +1385,7 @@ void ProjectManager::OnMenuCopy(uiTreeCtrl* fromCtrl,Element* eRoot)
tmpDocXml.Save(tmpStr);
wxTextDataObject* data=new wxTextDataObject;
data->SetText(tmpStr.GetString());
wxTheClipboard->Open();
wxTheClipboard->SetData(data);
wxTheClipboard->Flush();
wxTheClipboard->Close();
Expand Down Expand Up @@ -1933,7 +1945,7 @@ void ProjectManager::Init( )
{
if(this->rootCore==NULL || this->rootScene==NULL || this->rootResult==NULL)
return;

treeCore->Init(this->rootCore);
treeScene->Init(this->rootScene);
treeResult->Init(this->rootResult);
Expand Down
3 changes: 1 addition & 2 deletions src/isimpa/data_manager/projet_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
*/
#include "python_interface/pythonshell.hpp"
#include "projet.h"
#include <wx/arrstr.h>
#include "last_cpp_include.hpp"


Expand Down Expand Up @@ -90,7 +89,7 @@ void ProjectManager::InitPythonEngine()
{
Py_Initialize();

pyShell=new PythonShell(shellControl);
pyShell = new PythonShell(shellControl);

pyShell->Init();

Expand Down
11 changes: 5 additions & 6 deletions src/isimpa/data_manager/python_interface/pythonshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@ PythonShell::PythonShell(PyConsole* pyCtrl)
outputRedirectIn=NULL;

main_module = import("__main__");
inspect_module = import("inspect");
main_namespace = main_module.attr("__dict__");

//Enregistrement des modules
PyImport_AppendInittab("uictrl", inituictrl);
//throw std::runtime_error(_("Impossible d'importer le module de psps dans l'interpreteur python.").t_str());

//Python va copier les objets passés en paramètre
//

main_namespace["PythonStdIoRedirect"] = class_<PythonStdIoRedirect>("PythonStdIoRedirect", no_init)
.def("write", &PythonStdIoRedirect::Write)
Expand All @@ -86,6 +83,7 @@ PythonShell::PythonShell(PyConsole* pyCtrl)
outputRedirectIn=extract<PythonStdIoRedirect*>(sys.attr("stdin"));

//Ajout du dossier de script
boost::python::import("site").attr("addsitedir")("");
boost::python::import("site").attr("addsitedir")("UserScript");
boost::python::import("site").attr("addsitedir")("SystemScript");
}
Expand Down Expand Up @@ -249,13 +247,14 @@ void PythonShell::call_event(const int& eventid,const int& elementid)
//Il faut définir si la méthode attent 1 ou 2 argument
//On utilise le module inspect afin d'obtenir le nombre d'argument
boost::python::object event_function=event_lst[eventid];
boost::python::list arglist=extract_or_throw<boost::python::list>(inspect_module.attr("getargspec")(event_function).attr("args"));
boost::python::list arglist=extract_or_throw<boost::python::list>(event_function.attr("func_code").
attr("co_argnames"));
boost::python::ssize_t argCount=len(arglist);
//Self ne doit pas être pris en compte dans le nombre d'argument
if(extract_or_throw<bool>(arglist.attr("__contains__")("self")))
argCount--;
if(argCount==2)
event_function(elementid,eventid);
event_function(elementid, eventid);
else
event_function(elementid);
} catch( error_already_set ) {
Expand Down
1 change: 0 additions & 1 deletion src/isimpa/data_manager/python_interface/pythonshell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class PythonShell
protected:
boost::python::object main_module;
boost::python::object main_namespace;
boost::python::object inspect_module;
wxString cmd;
wxString oldcmd;
wxString promptNewCmd;
Expand Down
2 changes: 1 addition & 1 deletion src/isimpa/data_manager/tree_rapport/e_report_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void E_Report_File::RefreshFolderContents()
wxArrayString dirs=childFile.GetDirs();
wxString dirName=dirs[dirs.size()-1];
//Type inconnue, création d'un élément dossier générique
E_Report_Folder* newFolder=new E_Report_Folder(this,dirName,dirName+"\\");
E_Report_Folder* newFolder=new E_Report_Folder(this,dirName,dirName+wxFileName::GetPathSeparator());
this->AppendFils(newFolder);
newFolder->RefreshFolderContents();
} else if(wxFileExists(childFile.GetFullPath()))
Expand Down
17 changes: 0 additions & 17 deletions src/isimpa/main/i_simpa_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,6 @@ MainUiFrame::MainUiFrame(wxLocale &lang) : wxFrame(NULL, -1, _("Interface ")+APP
view_line_menu->Check(ID_wireframe_none,true);
view_menu->Append(ID_fold_wireframe, _("Lines"),view_line_menu);



/*
view_menu->AppendSeparator();
wxMenu* affichage_simulation_menu = new wxMenu;
LinkMenuItemWithElement(affichage_simulation_menu->Append(ID_simulation_particle, _("Rendu des particules"),"",wxITEM_CHECK),
Element::ELEMENT_TYPE_SCENE_PROJET_RENDU_PARTICULES,
"showparticle");
LinkMenuItemWithElement(affichage_simulation_menu->Append(ID_simulation_recepteurss, _("Rendu des récepteurs surfaciques"),"",wxITEM_CHECK),
Element::ELEMENT_TYPE_SCENE_PROJET_RENDU_PARTICULES,
"showrecepteurss");
view_menu->Append(ID_fold_simulation, _("Simulation"),affichage_simulation_menu);
*/


view_menu->AppendSeparator();

view_menu->Append(ID_ShowHideMailler, _("Hide meshing"),"Hide meshing",wxITEM_CHECK);
Expand Down
Loading

0 comments on commit da060c0

Please sign in to comment.