Skip to content

Commit

Permalink
dev: cmake variables for plugins
Browse files Browse the repository at this point in the history
test on regmap

Signed-off-by: Ionut Muthi <[email protected]>
  • Loading branch information
IonutMuthi committed Jun 12, 2024
1 parent 9d132d8 commit e54301a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 11 deletions.
35 changes: 29 additions & 6 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ function(ConfigureInstallerSettings PLUGIN_NAME PLUGIN_DESCRIPTION FIXED)

set(PLUGIN_COMPONENTS
${PLUGIN_COMPONENTS}
"\n Name: \"plugins/${AUX_PLUGIN}\"; Description: ${PLUGIN_DESCRIPTION} ; Types: full plugins; Flags: ${FIXED} "
"\n Name: \"plugins/${PROJECT_NAME}\"; Description: ${ARGN} ; Types: full plugins; Flags: ${FIXED} "
PARENT_SCOPE
)
set(PLUGIN_COMPONENTS_FILES
${PLUGIN_COMPONENTS_FILES}
"\n Source:\"{#DestFolder}\\plugins\\plugins\\libscopy-${AUX_PLUGIN}.dll\"; DestDir: \"{app}\\plugins\\plugins\"; Components: plugins\\${AUX_PLUGIN}; Flags: ignoreversion skipifsourcedoesntexist onlyifdoesntexist"
"\n Source:\"{#DestFolder}\\plugins\\plugins\\libscopy-${PROJECT_NAME}.dll\"; DestDir: \"{app}\\plugins\\plugins\"; Components: plugins\\${PROJECT_NAME}; Flags: ignoreversion skipifsourcedoesntexist onlyifdoesntexist"
PARENT_SCOPE
)
endfunction()
Expand Down Expand Up @@ -77,8 +77,8 @@ endif()

if(ENABLE_PLUGIN_REGMAP)
add_subdirectory(regmap)
list(APPEND PLUGINS ${PLUGIN_NAME})
configureinstallersettings(${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} "fixed")
list(APPEND PLUGINS ${PROJECT_NAME})
configureinstallersettings(${PLUGIN_SHORT_NAME} "fixed" ${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} )
endif()

if(ENABLE_PLUGIN_DEBUGGER)
Expand Down Expand Up @@ -127,8 +127,31 @@ if(ENABLE_PLUGIN_M2K)
endif()
endif()

message(STATUS "Building plugins:" ${PLUGINS})
message("PLUGIN_COMPONENTS" ${PLUGIN_COMPONENTS})
if(ENABLE_PLUGIN_REGMAP)
add_subdirectory(regmap)
list(APPEND PLUGINS ${LIBRARY_NAME})
endif()

if(ENABLE_PLUGIN_DEBUGGER)
add_subdirectory(debugger)
list(APPEND PLUGINS ${PLUGIN_NAME})
endif()

if(ENABLE_PLUGIN_DATALOGGER)
add_subdirectory(datalogger)
list(APPEND PLUGINS ${PLUGIN_NAME})
endif()

if(ENABLE_PLUGIN_DATAMONITOR)
add_subdirectory(datamonitor)
list(APPEND PLUGINS ${PLUGIN_NAME})
endif()

if(ENABLE_PLUGIN_IIODEBUGPLUGIN)
add_subdirectory(iiodebugplugin)
list(APPEND PLUGINS ${PLUGIN_NAME})
endif()

set(PLUGINS ${PLUGINS} PARENT_SCOPE)
set(PLUGIN_COMPONENTS ${PLUGIN_COMPONENTS} PARENT_SCOPE)
set(PLUGIN_COMPONENTS_FILES ${PLUGIN_COMPONENTS_FILES} PARENT_SCOPE)
Expand Down
8 changes: 7 additions & 1 deletion plugins/regmap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ message(STATUS "building plugin: " ${SCOPY_MODULE})

project(scopy-${SCOPY_MODULE} VERSION 0.1 LANGUAGES CXX)

set(PLUGIN_NAME "Register map")
set(PLUGIN_DESCRIPTION "Register map of connected device with detailed register table for available XML templates")

include(GenerateExportHeader)

# TODO: split stylesheet/resources and add here TODO: export header files correctly
Expand Down Expand Up @@ -101,5 +104,8 @@ target_link_libraries(
Qt5::Test
)

set(PLUGIN_NAME ${PROJECT_NAME} PARENT_SCOPE)
set(PROJECT_NAME ${PROJECT_NAME} PARENT_SCOPE)
set(PLUGIN_NAME ${PLUGIN_NAME} PARENT_SCOPE)
set(PLUGIN_SHORT_NAME ${SCOPY_MODULE} PARENT_SCOPE)
set(PLUGIN_DESCRIPTION "Register map plugin" PARENT_SCOPE)

6 changes: 6 additions & 0 deletions plugins/regmap/include/regmap/scopy-regmap_config.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
#define REGMAP_XML_SYSTEM_PATH "@REGMAP_XML_SYSTEM_PATH@"
#define REGMAP_XML_BUILD_PATH "@REGMAP_XML_BUILD_PATH@"


#define REGMAP_LIBRARY_NAME "@LIBRARY_NAME@"
#define REGMAP_PLUGIN_NAME "@PLUGIN_NAME@"
#define REGMAP_PLUGIN_SHORT_NAME "@PLUGIN_SHORT_NAME@"
#define REGMAP_PLUGIN_DESCRIPTION "@PLUGIN_DESCRIPTION@"

#cmakedefine ENABLE_SCOPYJS

#endif // SCOPY_REGMAP_CONFIG_H_CMAKEIN
Expand Down
8 changes: 4 additions & 4 deletions plugins/regmap/src/regmapplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ bool RegmapPlugin::loadIcon()

void RegmapPlugin::loadToolList()
{
m_toolList.append(
SCOPY_NEW_TOOLMENUENTRY("regmap", "Register Map", ":/gui/icons/scopy-default/icons/RegMap.svg"));
m_toolList.append(SCOPY_NEW_TOOLMENUENTRY(REGMAP_PLUGIN_SHORT_NAME, REGMAP_PLUGIN_NAME,
":/gui/icons/scopy-default/icons/RegMap.svg"));
}

void RegmapPlugin::unload()
Expand All @@ -68,7 +68,7 @@ void RegmapPlugin::unload()

bool RegmapPlugin::compatible(QString m_param, QString category)
{
m_name = "REGMAP";
m_name = REGMAP_PLUGIN_SHORT_NAME;
auto &&cp = ConnectionProvider::GetInstance();
Connection *conn = cp->open(m_param);

Expand Down Expand Up @@ -219,7 +219,7 @@ void RegmapPlugin::initMetadata()
)plugin");
}

QString RegmapPlugin::description() { return "Register map tool"; }
QString RegmapPlugin::description() { return REGMAP_PLUGIN_DESCRIPTION; }

QWidget *RegmapPlugin::getTool() { return m_registerMapWidget; }

Expand Down

0 comments on commit e54301a

Please sign in to comment.