-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugingenerator: Added option to generate scopy sdk project.
You can now generate an out of tree (oot) plugin support project within plugin generator. To work, the scopy sdk project requires importing the libraries and dependencies that were generated with cpack. Signed-off-by: andreidanila1 <[email protected]>
- Loading branch information
1 parent
7250c7b
commit c7d7a69
Showing
8 changed files
with
854 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tools/plugingenerator/templates/sdk/sdk_cmake_func_template.mako
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Define a function to include all directories recursively | ||
function(inlcude_dirs root_dir) | ||
# Find all files and directories recursively | ||
file(GLOB_RECURSE all_items LIST_DIRECTORIES true ""${"${root_dir}"}/"") | ||
# Loop through each item found | ||
foreach(item ${"${all_items}"}) | ||
# Check if the item is a directory | ||
if(IS_DIRECTORY ${"${item}"}) | ||
message(${"${item}"}) | ||
target_include_directories(${"${PROJECT_NAME}"} PRIVATE ${"${item}"}) | ||
endif() | ||
endforeach() | ||
endfunction() | ||
|
||
# Define a function to link all .so files from a root directory | ||
function(link_libs root_dir) | ||
# Find all .so files from root_dir | ||
file(GLOB all_libs "${"${root_dir}"}/*.so") | ||
# Loop through each library found | ||
foreach(lib ${"${all_libs}"}) | ||
# Link libraries | ||
message(${"${lib}"}) | ||
target_link_libraries(${"${PROJECT_NAME}"} PRIVATE ${"${lib}"}) | ||
endforeach() | ||
endfunction() |
65 changes: 65 additions & 0 deletions
65
tools/plugingenerator/templates/sdk/sdk_cmake_template.mako
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
cmake_minimum_required(VERSION 3.9) | ||
|
||
# Project name | ||
set(TARGET_NAME "ScopySDK") | ||
|
||
project(${"${TARGET_NAME}"} VERSION 0.0.1 DESCRIPTION "Project Description") | ||
|
||
# Make sure CMake will take care of moc for us | ||
set(CMAKE_AUTOMOC ON) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(SDK_DEPS_PATH ${deps_path}) | ||
if(NOT DEFINED SDK_DEPS_PATH) | ||
message(FATAL_ERROR "SDK_DEPS_PATH is required!") | ||
else() | ||
if(NOT EXISTS ${"${SDK_DEPS_PATH}"}) | ||
message(FATAL_ERROR "The path=" \"${"${SDK_DEPS_PATH}"}\" " to the dependencies doesn't exist!") | ||
endif() | ||
endif() | ||
set(SDK_DEPS_INCLUDE ${"${SDK_DEPS_PATH}"}/usr/local/include) | ||
if(NOT EXISTS ${"${SDK_DEPS_INCLUDE}"}) | ||
message(FATAL_ERROR "The path=" \"${"${SDK_DEPS_INCLUDE}"}\" " to the headers doesn't exist!") | ||
endif() | ||
|
||
set(SDK_DEPS_LIB ${"${SDK_DEPS_PATH}"}/usr/local/lib) | ||
if(NOT EXISTS ${"${SDK_DEPS_LIB}"}) | ||
message(FATAL_ERROR "The path=" \"${"${SDK_DEPS_LIB}"}\" " to the libraries doesn't exist!") | ||
endif() | ||
|
||
set(PLUGIN_INSTALL_PATH ${"${CMAKE_CURRENT_BINARY_DIR}"}/plugin/${plugin_dir}/libscopy-${plugin_name}.so) | ||
|
||
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets) | ||
find_package(Qt${"${QT_VERSION_MAJOR}"} REQUIRED COMPONENTS Widgets Core) | ||
|
||
file(GLOB SRC_LIST src/*.cpp) | ||
file(GLOB HEADER_LIST include/*.h include/*.hpp) | ||
|
||
configure_file(include/sdk-util_config.h.cmakein ${"${CMAKE_CURRENT_SOURCE_DIR}"}/include/sdk-util_config.h @ONLY) | ||
|
||
set(PROJECT_SOURCES ${"${SRC_LIST}"} ${"${HEADER_LIST}"} ${"${CMAKE_CURRENT_SOURCE_DIR}"}/include/sdk-util_config.h) | ||
find_path(IIO_INCLUDE_DIRS iio.h REQUIRED) | ||
find_library(IIO_LIBRARIES NAMES iio libiio REQUIRED) | ||
|
||
add_subdirectory(plugin/${plugin_dir}) | ||
|
||
qt_add_resources(PROJ_RES res/resources.qrc) | ||
|
||
add_executable(${"${TARGET_NAME}"} ${"${PROJECT_SOURCES}"} ${"${PROJ_RES}"}) | ||
|
||
include(${"${CMAKE_CURRENT_SOURCE_DIR}"}/SdkSupport.cmake) | ||
|
||
target_include_directories(${"${TARGET_NAME}"} PRIVATE ${"${Qt${QT_VERSION_MAJOR}_INCLUDE_DIRS}"}) | ||
target_include_directories(${"${TARGET_NAME}"} PRIVATE ${"${CMAKE_SOURCE_DIR}"}/include) | ||
target_include_directories(${"${TARGET_NAME}"} INTERFACE ${"${IIO_INCLUDE_DIRS}"}) | ||
|
||
target_include_directories(${"${TARGET_NAME}"} PUBLIC ${"${SDK_DEPS_INCLUDE}"} ${"${IIO_INCLUDE_DIRS}"}) | ||
|
||
inlcude_dirs(${"${SDK_DEPS_INCLUDE}"}) | ||
# Add any extra libs to link also. | ||
link_libs(${"${SDK_DEPS_LIB}"}) | ||
target_link_libraries( | ||
${"${TARGET_NAME}"} PRIVATE Qt${"${QT_VERSION_MAJOR}"}::Widgets Qt${"${QT_VERSION_MAJOR}"}::Core ${"${IIO_LIBRARIES}"} | ||
) |
6 changes: 6 additions & 0 deletions
6
tools/plugingenerator/templates/sdk/sdk_cmakein_template.mako
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef SDK_UTIL_H_CMAKEIN | ||
#define SDK_UTIL_H_CMAKEIN | ||
|
||
#define PLUGIN_INSTALL_PATH "@PLUGIN_INSTALL_PATH@" | ||
|
||
#endif // SDK_UTIL_H_CMAKEIN |
Oops, something went wrong.