-
I'd like to make a qt library that uses qcoro but can't seem to make it work. Here's my xmake.lua (I cloned the qcoro repo to $PROJECT_ROOT/vendor/):add_rules("mode.debug", "mode.release")
set_languages("cxx20")
package("qcoro")
add_deps("cmake")
set_sourcedir(path.join(os.scriptdir(), "vendor", "qcoro"))
on_install(function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local qt_sdkver = import("core.project.config").get("qt_sdkver")
if qt_sdkver and qt_sdkver:startswith("6") then
table.insert(configs, "-DUSE_QT_VERSION=6")
else
table.insert(configs, "-DUSE_QT_VERSION=5")
end
table.insert(configs, "-DQCORO_WITH_QTDBUS=OFF")
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cxxtypes("QCoro::Task", {includes = "qcoro/task.h"}))
end)
package_end()
option("feature1")
set_showmenu(true)
set_default(true)
set_description("Enable feature 1")
add_defines("MYPROJECT_FEATURE1_ENABLED")
option_end()
option("feature2")
set_showmenu(true)
set_default(true)
set_description("Enable feature 2")
add_defines("MYPROJECT_FEATURE2_ENABLED")
add_deps("feature1")
option_end()
option("feature3")
set_showmenu(true)
set_default(false)
set_description("Enable feature 3")
add_defines("MYPROJECT_FEATURE3_ENABLED")
option_end()
add_requires("qcoro", {optional = true, configs = {cxxflags = "-fcoroutines"}})
target("myproject")
add_rules("qt.shared")
add_headerfiles("src/*.h")
add_files("src/*.cpp")
add_defines("MYPROJECT_LIBRARY")
add_frameworks("QtCore")
add_options("feature1", "feature2", "feature3")
if has_config("feature1", "feature2") then
add_cxxflags("-fcoroutines")
add_frameworks("QtNetwork")
add_packages("qcoro")
end
if has_config("feature3") then
add_frameworks("QtWebSockets")
end
target_end() I thought I was adding
Which then results in another error when xmake tries to link it to my library:
And here's the full output of `xmake --verbose -y` (after running `xmake clean -a`):
Also: I've read in the docs that compiler flags set using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
try on_test(function (package)
local qt = assert(import("detect.sdks.find_qt")(), "qt not found!")
local qtcore_includedir = path.join(qt.includedir, "QtCore")
assert(package:has_cxxtypes("QCoro::Task<QString>", {includes = "qcoro/task.h",
configs = {includedirs = {qt.includedir, qtcore_includedir},
links = "Qt5Core",
languages = "c++2a",
cxxflags = {"-fPIC", "-fcoroutines", "-fconcepts"}}}))
end) |
Beta Was this translation helpful? Give feedback.
try