diff --git a/src/tools/visualStates/CMakeLists.txt b/src/tools/visualStates/CMakeLists.txt index 9f49a5389..5ea33e73a 100644 --- a/src/tools/visualStates/CMakeLists.txt +++ b/src/tools/visualStates/CMakeLists.txt @@ -49,6 +49,7 @@ link_directories( ) include_directories ( + ${CMAKE_CURRENT_BINARY_DIR} ${INTERFACES_CPP_DIR} ${LIBS_DIR} ${CMAKE_CURRENT_SOURCE_DIR} @@ -81,29 +82,34 @@ TARGET_LINK_LIBRARIES ( visualStateslib ${GLOG_LIBRARIES} ) +configure_file( + cmakevars.hpp.in + cmakevars.hpp + @ONLY +) + add_custom_command(TARGET visualStates POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/gui $/gui) - install(TARGETS visualStates DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/ - COMPONENT tools - ) + COMPONENT tools) + + install(TARGETS visualStateslib + DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ + COMPONENT tools) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/getinterfaces.sh PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) - INSTALL (FILES ${GLADE_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/jderobot/glade/visualStates) - # Install Glade FILE(GLOB_RECURSE GLADE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/gui/*.glade) - INSTALL (FILES ${GLADE_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/jderobot/glade/visualStates) + INSTALL (FILES ${GLADE_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/jderobot/glade) # install resources (jderobot logo) INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/jderobot.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/jderobot/resources) - # Install C++ Headers FILE(GLOB h_files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") INSTALL(FILES ${h_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/jderobot/visualStates) @@ -111,13 +117,8 @@ add_custom_command(TARGET visualStates POST_BUILD FILE(GLOB h_files "${CMAKE_CURRENT_SOURCE_DIR}/popups/*.h") INSTALL(FILES ${h_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/jderobot/visualStates/popups) - # Install Python Files FILE(GLOB p_files "${CMAKE_CURRENT_SOURCE_DIR}/*.py") INSTALL(FILES ${p_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/jderobot/python/visualStates_py) -ENDIF() - - - - +ENDIF() \ No newline at end of file diff --git a/src/tools/visualStates/cmakevars.hpp.in b/src/tools/visualStates/cmakevars.hpp.in new file mode 100644 index 000000000..4b71adbe2 --- /dev/null +++ b/src/tools/visualStates/cmakevars.hpp.in @@ -0,0 +1,18 @@ +// +// Created by okan on 11.09.2017. +// + +#ifndef JDEROBOT_CMAKEVARS_H +#define JDEROBOT_CMAKEVARS_H + +#include + +class CMakeVars { +public: + static const std::string& getInstallPrefix() { + static std::string installPrefix("@CMAKE_INSTALL_PREFIX@"); + return installPrefix; + } +}; + +#endif //JDEROBOT_CMAKEVARS_H diff --git a/src/tools/visualStates/generate.cpp b/src/tools/visualStates/generate.cpp index 8489819ee..093d05c7f 100644 --- a/src/tools/visualStates/generate.cpp +++ b/src/tools/visualStates/generate.cpp @@ -21,6 +21,7 @@ */ #include "generate.h" +#include "cmakevars.hpp" /************************************************************* * CONSTRUCTOR @@ -637,10 +638,10 @@ void Generate::generateCmake () { this->fs << std::endl; this->fs << "pkg_check_modules(GTKMM REQUIRED gtkmm-3.0)" << std::endl; this->fs << std::endl; - this->fs << "SET( INTERFACES_CPP_DIR /opt/jderobot/include )" << std::endl; - this->fs << "SET( LIBS_DIR /usr/local/lib )" << std::endl; - this->fs << "SET( JDEROBOT_LIBS_DIR /opt/jderobot/lib )" << std::endl; - this->fs << "SET( easyiceconfig_LIBRARIES ${JDEROBOT_LIBS_DIR}/jderobot/libeasyiceconfig.so)" << std::endl; + this->fs << "SET( INTERFACES_CPP_DIR "<< CMakeVars::getInstallPrefix() << "/include )" << std::endl; + this->fs << "SET( LIBS_DIR "<< CMakeVars::getInstallPrefix() << "/lib )" << std::endl; + this->fs << "SET( JDEROBOT_LIBS_DIR " << CMakeVars::getInstallPrefix() << "/lib )" << std::endl; + this->fs << "SET( easyiceconfig_LIBRARIES ${JDEROBOT_LIBS_DIR}/libeasyiceconfig.so)" << std::endl; this->fs << std::endl; this->fs << "SET( CMAKE_CXX_FLAGS \"-pthread\" ) # Opciones para el compilador" << std::endl; this->fs << std::endl; @@ -653,7 +654,7 @@ void Generate::generateCmake () { this->fs << ")" << std::endl; this->fs << std::endl; this->fs << "include_directories (" << std::endl; - this->fs << "\t/opt/jderobot/include/jderobot" << std::endl; + this->fs << "\t" << CMakeVars::getInstallPrefix() << "/include/jderobot" << std::endl; this->fs << "\t${INTERFACES_CPP_DIR}" << std::endl; this->fs << "\t${easyiceconfig_INCLUDE_DIRS}" << std::endl; this->fs << "\t${LIBS_DIR}" << std::endl; @@ -675,9 +676,9 @@ void Generate::generateCmake () { this->fs << "\t${GTKMM_LIBRARIES}" << std::endl; this->fs << "\t${easyiceconfig_LIBRARIES}" << std::endl; this->fs << "\t${goocanvasmm_LIBRARIES}" <fs << "\t${JDEROBOT_LIBS_DIR}/jderobot/libvisualStateslib.so" << std::endl; - this->fs << "\t${JDEROBOT_LIBS_DIR}/jderobot/libJderobotInterfaces.so" << std::endl; - this->fs << "\t${JDEROBOT_LIBS_DIR}/jderobot/libjderobotutil.so" << std::endl; + this->fs << "\t${JDEROBOT_LIBS_DIR}/libvisualStateslib.so" << std::endl; + this->fs << "\t${JDEROBOT_LIBS_DIR}/libJderobotInterfaces.so" << std::endl; + this->fs << "\t${JDEROBOT_LIBS_DIR}/libjderobotutil.so" << std::endl; this->fs << "\tIce" << std::endl; this->fs << "\tIceUtil" << std::endl; this->fs << ")" << std::endl; @@ -705,7 +706,7 @@ void Generate::generateGenericHeaders_py(){ import Ice\n\ import easyiceconfig as EasyIce\n\ import sys, signal\n\ -sys.path.append('/opt/jderobot/share/jderobot/python/visualStates_py')\n\ +sys.path.append('" << CMakeVars::getInstallPrefix() << "/share/jderobot/python/visualStates_py')\n\ import traceback, threading, time\n\ from automatagui import AutomataGui, QtGui, GuiSubautomata\n\n";