From 2606d8edc7884bdf12c1934e21479beef61dcd3e Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Mon, 6 Dec 2021 05:19:46 -0600 Subject: [PATCH] Python compatibility changes * Add OpenGLWidgest as a req * Use res directory for qrc replacement --- cpp.cmake | 1 + python_module_plugin.cmake | 17 +---------------- python_plugin.cmake | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/cpp.cmake b/cpp.cmake index 81b40c1..c6ac8c3 100644 --- a/cpp.cmake +++ b/cpp.cmake @@ -16,6 +16,7 @@ macro(do_cpp_project) find_package(Qt6 COMPONENTS Qml REQUIRED) find_package(Qt6 COMPONENTS Core5Compat REQUIRED) find_package(Qt6 COMPONENTS LinguistTools REQUIRED) + find_package(Qt6 COMPONENTS OpenGLWidgets REQUIRED) find_package(ZLIB REQUIRED) find_package(Boost REQUIRED COMPONENTS thread) find_package(fmt REQUIRED) diff --git a/python_module_plugin.cmake b/python_module_plugin.cmake index 4d3bda4..959fe8c 100644 --- a/python_module_plugin.cmake +++ b/python_module_plugin.cmake @@ -40,7 +40,7 @@ macro(do_src) endif() # resources in the src directory - file(GLOB_RECURSE resources ${src_dir}/*.ui ${src_dir}/*.qrc) + file(GLOB_RECURSE resources ${src_dir}/*.ui) foreach(object ${resources}) get_filename_component(ext "${object}" LAST_EXT) @@ -59,21 +59,6 @@ macro(do_src) "${object}" WORKING_DIRECTORY ${PYTHON_ROOT}) - list(APPEND src_files "${output}") -# elseif("${ext}" STREQUAL ".qrc") -# # process .qrc files and copy the resulting .py in data -# get_filename_component(name "${object}" NAME_WLE) -# get_filename_component(folder "${object}" DIRECTORY) -# set(output "${folder}/${name}.py") - -# execute_process( -# COMMAND ${PYTHON_ROOT}/PCbuild/amd64/python.exe -# -I -# -m PyQt6.pyrcc_main -# -o "${output}" -# "${object}" -# WORKING_DIRECTORY ${PYTHON_ROOT}) - list(APPEND src_files "${output}") endif() endforeach() diff --git a/python_plugin.cmake b/python_plugin.cmake index e163dc7..cac260f 100644 --- a/python_plugin.cmake +++ b/python_plugin.cmake @@ -21,6 +21,18 @@ function(is_interesting_python_dir var dir) else() set(${var} TRUE PARENT_SCOPE) endif() + +endfunction() + + +# sets `var` to TRUE if resource directory +# +function(is_res_directory var dir) + if(${dir} STREQUAL "res") + set(${var} TRUE PARENT_SCOPE) + else() + set(${var} TRUE PARENT_SCOPE) + endif() endfunction() @@ -42,6 +54,10 @@ macro(do_src) if (${is_interesting}) list(APPEND data_dirs "${object}") endif() + is_res_directory(is_res "${object}") + if (${is_res}) + list(APPEND res_dirs "${object}") + endif() else() get_filename_component(ext "${object}" LAST_EXT) @@ -98,4 +114,9 @@ macro(do_src) DIRECTORY ${data_dirs} DESTINATION ${install_dir}/data FILES_MATCHING PATTERN "*.py") + + # directories that go in bin/plugins/data/res + install( + DIRECTORY ${res_dirs} + DESTINATION ${install_dir}/data) endmacro()