Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

[visualStates] get cmake variables and use in the code and solves #904 #905

Merged
merged 3 commits into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions src/tools/visualStates/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ link_directories(
)

include_directories (
${CMAKE_CURRENT_BINARY_DIR}
${INTERFACES_CPP_DIR}
${LIBS_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -81,43 +82,43 @@ 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 $<TARGET_FILE_DIR:visualStates>/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)

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()
18 changes: 18 additions & 0 deletions src/tools/visualStates/cmakevars.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Created by okan on 11.09.2017.
//

#ifndef JDEROBOT_CMAKEVARS_H
#define JDEROBOT_CMAKEVARS_H

#include <string>

class CMakeVars {
public:
static const std::string& getInstallPrefix() {
static std::string installPrefix("@CMAKE_INSTALL_PREFIX@");
return installPrefix;
}
};

#endif //JDEROBOT_CMAKEVARS_H
19 changes: 10 additions & 9 deletions src/tools/visualStates/generate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

#include "generate.h"
#include "cmakevars.hpp"

/*************************************************************
* CONSTRUCTOR
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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}" <<std::endl;
this->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;
Expand Down Expand Up @@ -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";

Expand Down