using nanobind within a qt in c++ #752
Unanswered
SimonDev666
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am using QT + C++ on kali linux (latest version).
I created a virt env as required nowadays - and is activative - i have a number of python modules install + pybind11. i can see all these when i cmake my projects. but i can not for nanobind in this project. it returns that it can not find nanobind??
no nanobindConfig.cmake or nanobind-config.cmake - i can see these files in the venv under nanobind
i have followed your instructions in your doc and check against others solutions - not no luck
if you could tell me what i am doing wrong - would very much appreciate it - i want to experiment with this lib within a normal c++ and use threading (later on)
here is my cmakelist
cmake_minimum_required(VERSION 3.16)
project(Test_Threadnanobind_001 LANGUAGES CXX)
if (CMAKE_VERSION VERSION_LESS 3.18)
set(DEV_MODULE Development)
else()
set(DEV_MODULE Development.Module)
endif()
find_package(Python 3.12 COMPONENTS Interpreter ${DEV_MODULE} REQUIRED)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
execute_process(
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT)
find_package(nanobind CONFIG REQUIRED)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
add_executable(Test_Threadnanobind_001
main.cpp
)
target_link_libraries(Test_Threadnanobind_001 Qt${QT_VERSION_MAJOR}::Core)
include(GNUInstallDirs)
install(TARGETS Test_Threadnanobind_001
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
Beta Was this translation helpful? Give feedback.
All reactions