Skip to content

Commit

Permalink
generic: changed cmake variables
Browse files Browse the repository at this point in the history
Signed-off-by: Ionut Muthi <[email protected]>
  • Loading branch information
IonutMuthi committed Jun 4, 2024
1 parent a39b23f commit 254a9f6
Show file tree
Hide file tree
Showing 18 changed files with 169 additions and 72 deletions.
14 changes: 14 additions & 0 deletions cmake/Modules/ScopyWindows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,17 @@ macro(duplicate_target ORIGINAL NEW)
target_include_directories(${NEW} PRIVATE ${original_includes})
target_compile_options(${NEW} PRIVATE ${original_options})
endmacro()

function(ConfigureInstallerSettings PROJECT_NAME PLUGIN_INSTALLER_DESCRIPTION FIXED)

set(PLUGIN_COMPONENTS
${PLUGIN_COMPONENTS}
"\n Name: \"plugins/${PROJECT_NAME}\"; Description: ${PLUGIN_INSTALLER_DESCRIPTION} ; Types: full plugins; Flags: ${FIXED} "
PARENT_SCOPE
)
set(PLUGIN_COMPONENTS_FILES
${PLUGIN_COMPONENTS_FILES}
"\n Source:\"{#DestFolder}\\plugins\\plugins\\libscopy-${PROJECT_NAME}.dll\"; DestDir: \"{app}\\plugins\\plugins\"; Components: plugins\\${PROJECT_NAME}; Flags: ignoreversion skipifsourcedoesntexist onlyifdoesntexist"
PARENT_SCOPE
)
endfunction()
35 changes: 7 additions & 28 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ option(ENABLE_PLUGIN_IIODEBUGPLUGIN "Enable IIODEBUGPLUGIN plugin" ON)
set(PLUGIN_COMPONENTS "")
set(PLUGIN_COMPONENTS_FILES "")

function(ConfigureInstallerSettings PROJECT_NAME PLUGIN_NAME PLUGIN_DESCRIPTION FIXED)

set(PLUGIN_COMPONENTS
${PLUGIN_COMPONENTS}
"\n Name: \"plugins/${PROJECT_NAME}\"; Description: ${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} ; Types: full plugins; Flags: ${FIXED} "
PARENT_SCOPE
)
set(PLUGIN_COMPONENTS_FILES
${PLUGIN_COMPONENTS_FILES}
"\n Source:\"{#DestFolder}\\plugins\\plugins\\libscopy-${PROJECT_NAME}.dll\"; DestDir: \"{app}\\plugins\\plugins\"; Components: plugins\\${PROJECT_NAME}; Flags: ignoreversion skipifsourcedoesntexist onlyifdoesntexist"
PARENT_SCOPE
)
endfunction()

# The order the plugins are added here will also affect the installer order. Make sure fixed plugin are before optional
# ones.

Expand Down Expand Up @@ -62,38 +48,32 @@ endif()

if(ENABLE_PLUGIN_ADC)
add_subdirectory(adc)
list(APPEND PLUGINS ${PROJECT_NAME})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} "fixed")
list(APPEND PLUGINS ${ADC_TARGET_NAME})
endif()

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

if(ENABLE_PLUGIN_DEBUGGER)
add_subdirectory(debugger)
list(APPEND PLUGINS ${PROJECT_NAME})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} "fixed")
list(APPEND PLUGINS ${DEBUGGER_TARGET_NAME})
endif()

if(ENABLE_PLUGIN_DATALOGGER)
add_subdirectory(datalogger)
list(APPEND PLUGINS ${PROJECT_NAME})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} "fixed")
list(APPEND PLUGINS ${DATALOGGER_TARGET_NAME})
endif()

if(ENABLE_PLUGIN_SWIOT)
add_subdirectory(swiot)
list(APPEND PLUGINS ${PROJECT_NAME})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} "disablenouninstallwarning" )
list(APPEND PLUGINS ${SWIOT_TARGET_NAME})
endif()

if(ENABLE_PLUGIN_PQM)
add_subdirectory(pqm)
list(APPEND PLUGINS ${PROJECT_NAME})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} "disablenouninstallwarning" )
list(APPEND PLUGINS ${PQM_TARGET_NAME})
endif()

if(ENABLE_PLUGIN_M2K)
Expand All @@ -107,8 +87,7 @@ if(ENABLE_PLUGIN_M2K)

if(WITH_SIGROK AND WITH_PYTHON)
add_subdirectory(m2k)
list(APPEND PLUGINS ${PROJECT_NAME})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${PLUGIN_NAME} ${PLUGIN_DESCRIPTION} "disablenouninstallwarning")
list(APPEND PLUGINS ${M2K_TARGET_NAME})
endif()
endif()

Expand Down
18 changes: 12 additions & 6 deletions plugins/adc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ message(STATUS "building plugin: " ${SCOPY_MODULE})

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

set(PLUGIN_NAME "ADC")
set(PLUGIN_DISPLAY_NAME "ADC")
set(PLUGIN_DESCRIPTION "Analog to Digital Convertor")


include(GenerateExportHeader)

# TODO: split stylesheet/resources and add here TODO: export header files correctly
Expand Down Expand Up @@ -54,6 +53,11 @@ generate_export_header(
${PROJECT_NAME} EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/${PROJECT_NAME}_export.h
)

configure_file(
include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h.cmakein
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h @ONLY
)

target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE})

Expand All @@ -69,9 +73,11 @@ target_link_libraries(
scopy-iio-widgets
)

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 ${PLUGIN_DESCRIPTION} PARENT_SCOPE)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(INSTALLER_DESCRIPTION ${PLUGIN_DISPLAY_NAME}" "${PLUGIN_DESCRIPTION})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${INSTALLER_DESCRIPTION} "fixed")
endif()

set(ADC_TARGET_NAME ${PROJECT_NAME} PARENT_SCOPE)

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${SCOPY_PLUGIN_INSTALL_DIR})
11 changes: 11 additions & 0 deletions plugins/adc/include/adcplugin/scopy-adcplugin_config.h.cmakein
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SCOPY_ADC_CONFIG_H_CMAKEIN
#define SCOPY_ADC_CONFIG_H_CMAKEIN

#define ADC_PLUGIN_DISPLAY_NAME "@PLUGIN_DISPLAY_NAME@"
#define ADC_PLUGIN_SCOPY_MODULE "@SCOPY_MODULE@"
#define ADC_PLUGIN_DESCRIPTION "@PLUGIN_DESCRIPTION@"

#cmakedefine ENABLE_SCOPYJS

#endif // SCOPY_ADC_CONFIG_H_CMAKEIN

18 changes: 12 additions & 6 deletions plugins/datalogger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ message(STATUS "building plugin: " ${SCOPY_MODULE})

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

set(PLUGIN_NAME "Data logger")
set(PLUGIN_DISPLAY_NAME "Data logger")
set(PLUGIN_DESCRIPTION "Used to monitor and log data")


include(GenerateExportHeader)

# TODO: split stylesheet/resources and add here TODO: export header files correctly
Expand Down Expand Up @@ -74,6 +73,11 @@ generate_export_header(
${PROJECT_NAME} EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/${PROJECT_NAME}_export.h
)

configure_file(
include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h.cmakein
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h @ONLY
)

set(INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE} ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/menus
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/datamonitor
Expand All @@ -96,9 +100,11 @@ target_link_libraries(
scopy-iio-widgets
)

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 ${PLUGIN_DESCRIPTION} PARENT_SCOPE)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(INSTALLER_DESCRIPTION ${PLUGIN_DISPLAY_NAME}" "${PLUGIN_DESCRIPTION})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${INSTALLER_DESCRIPTION} "fixed")
endif()

set(DATALOGGER_TARGET_NAME ${PROJECT_NAME} PARENT_SCOPE)

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${SCOPY_PLUGIN_INSTALL_DIR})
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SCOPY_DATALOGGER_CONFIG_H_CMAKEIN
#define SCOPY_DATALOGGER_CONFIG_H_CMAKEIN

#define DATALOGGER_PLUGIN_DISPLAY_NAME "@PLUGIN_DISPLAY_NAME@"
#define DATALOGGER_PLUGIN_SCOPY_MODULE "@SCOPY_MODULE@"
#define DATALOGGER_PLUGIN_DESCRIPTION "@PLUGIN_DESCRIPTION@"

#cmakedefine ENABLE_SCOPYJS

#endif // SCOPY_DATALOGGER_CONFIG_H_CMAKEIN

17 changes: 12 additions & 5 deletions plugins/debugger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ message(STATUS "building plugin: " ${SCOPY_MODULE})

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

set(PLUGIN_NAME "Debuger")
set(PLUGIN_DISPLAY_NAME "Debuger")
set(PLUGIN_DESCRIPTION "Used to debug connected devices")

include(GenerateExportHeader)
Expand Down Expand Up @@ -57,6 +57,11 @@ generate_export_header(
${PROJECT_NAME} EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/${PROJECT_NAME}_export.h
)

configure_file(
include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h.cmakein
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h @ONLY
)

target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE})

Expand All @@ -75,7 +80,9 @@ target_link_libraries(
scopy-core
)

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 ${PLUGIN_DESCRIPTION} PARENT_SCOPE)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(INSTALLER_DESCRIPTION ${PLUGIN_DISPLAY_NAME}" "${PLUGIN_DESCRIPTION})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${INSTALLER_DESCRIPTION} "fixed")
endif()

set(DEBUGGER_TARGET_NAME ${PROJECT_NAME} PARENT_SCOPE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SCOPY_DEBUGGER_CONFIG_H_CMAKEIN
#define SCOPY_DEBUGGER_CONFIG_H_CMAKEIN

#define DEBUGGER_PLUGIN_DISPLAY_NAME "@PLUGIN_DISPLAY_NAME@"
#define DEBUGGER_PLUGIN_SCOPY_MODULE "@SCOPY_MODULE@"
#define DEBUGGER_PLUGIN_DESCRIPTION "@PLUGIN_DESCRIPTION@"

#cmakedefine ENABLE_SCOPYJS

#endif // SCOPY_DEBUGGER_CONFIG_H_CMAKEIN

18 changes: 12 additions & 6 deletions plugins/m2k/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ message(STATUS "building plugin: " ${SCOPY_MODULE})

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

set(PLUGIN_NAME "ADALM2000")
set(PLUGIN_DISPLAY_NAME "ADALM2000")
set(PLUGIN_DESCRIPTION "Plugin for ADALM2000 (M2K)")


include(GenerateExportHeader)

set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -91,6 +90,11 @@ generate_export_header(
${PROJECT_NAME} EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/${PROJECT_NAME}_export.h
)

configure_file(
include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h.cmakein
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h @ONLY
)

target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(
${PROJECT_NAME}
Expand Down Expand Up @@ -130,7 +134,9 @@ target_link_libraries(
gnuradio::gnuradio-m2k
)

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 ${PLUGIN_DESCRIPTION} PARENT_SCOPE)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(INSTALLER_DESCRIPTION ${PLUGIN_DISPLAY_NAME}" "${PLUGIN_DESCRIPTION})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${INSTALLER_DESCRIPTION} "fixed")
endif()

set(M2K_TARGET_NAME ${PROJECT_NAME} PARENT_SCOPE)
11 changes: 11 additions & 0 deletions plugins/m2k/include/m2kplugin/scopy-m2kplugin_config.h.cmakein
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SCOPY_M2K_CONFIG_H_CMAKEIN
#define SCOPY_M2K_CONFIG_H_CMAKEIN

#define M2K_PLUGIN_DISPLAY_NAME "@PLUGIN_DISPLAY_NAME@"
#define M2K_PLUGIN_SCOPY_MODULE "@SCOPY_MODULE@"
#define M2K_PLUGIN_DESCRIPTION "@PLUGIN_DESCRIPTION@"

#cmakedefine ENABLE_SCOPYJS

#endif // SCOPY_M2K_CONFIG_H_CMAKEIN

17 changes: 12 additions & 5 deletions plugins/pqm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ message(STATUS "building plugin: " ${SCOPY_MODULE})

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

set(PLUGIN_NAME "PQM")
set(PLUGIN_DISPLAY_NAME "PQM")
set(PLUGIN_DESCRIPTION "Power Quality Monitor")

include(GenerateExportHeader)
Expand Down Expand Up @@ -53,6 +53,11 @@ generate_export_header(
${PROJECT_NAME} EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/${PROJECT_NAME}_export.h
)

configure_file(
include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h.cmakein
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h @ONLY
)

target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE})

Expand All @@ -69,9 +74,11 @@ target_link_libraries(
scopy-gr-util
)

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 ${PLUGIN_DESCRIPTION} PARENT_SCOPE)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(INSTALLER_DESCRIPTION ${PLUGIN_DISPLAY_NAME}" "${PLUGIN_DESCRIPTION})
configureinstallersettings(${PLUGIN_SHORT_NAME} ${INSTALLER_DESCRIPTION} "fixed")
endif()

set(PQM_TARGET_NAME ${PROJECT_NAME} PARENT_SCOPE)

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${SCOPY_PLUGIN_INSTALL_DIR})
11 changes: 11 additions & 0 deletions plugins/pqm/include/pqmplugin/scopy-pqmplugin_config.h.cmakein
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SCOPY_PQM_CONFIG_H_CMAKEIN
#define SCOPY_PQM_CONFIG_H_CMAKEIN

#define PQM_PLUGIN_DISPLAY_NAME "@PLUGIN_DISPLAY_NAME@"
#define PQM_PLUGIN_SCOPY_MODULE "@SCOPY_MODULE@"
#define PQM_PLUGIN_DESCRIPTION "@PLUGIN_DESCRIPTION@"

#cmakedefine ENABLE_SCOPYJS

#endif // SCOPY_PQM_CONFIG_H_CMAKEIN

10 changes: 5 additions & 5 deletions plugins/regmap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ message(STATUS "building plugin: " ${SCOPY_MODULE})

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

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

include(GenerateExportHeader)
Expand Down Expand Up @@ -112,8 +112,8 @@ target_link_libraries(
Qt5::Test
)

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 ${PLUGIN_DESCRIPTION} PARENT_SCOPE)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
configureinstallersettings(${PLUGIN_SHORT_NAME} ${PLUGIN_DESCRIPTION} "fixed")
endif()

set(REGNMAP_TARGET_NAME ${PROJECT_NAME} PARENT_SCOPE)
1 change: 1 addition & 0 deletions plugins/regmap/include/regmapplugin/regmapplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SCOPY_REGMAPPLUGIN_EXPORT RegmapPlugin : public QObject, public PluginBase

void initMetadata() override;
QString description() override;
QString displayName() override;

QWidget *getTool();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
#define REGMAP_XML_SYSTEM_PATH "@REGMAP_XML_SYSTEM_PATH@"
#define REGMAP_XML_BUILD_PATH "@REGMAP_XML_BUILD_PATH@"


#define REGMAP_PROJECT_NAME "@PROJECT_NAME@"
#define REGMAP_PLUGIN_NAME "@PLUGIN_NAME@"
#define REGMAP_PLUGIN_SHORT_NAME "@PLUGIN_SHORT_NAME@"
#define REGMAP_PLUGIN_DISPLAY_NAME "@PLUGIN_DISPLAY_NAME@"
#define REGMAP_PLUGIN_SCOPY_MODULE"@SCOPY_MODULE@"
#define REGMAP_PLUGIN_DESCRIPTION "@PLUGIN_DESCRIPTION@"

#cmakedefine ENABLE_SCOPYJS
Expand Down
Loading

0 comments on commit 254a9f6

Please sign in to comment.