diff options
| author | ruki <[email protected]> | 2018-04-15 21:34:39 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-04-15 21:34:39 +0800 |
| commit | 4dab3917696d31139166ada278a9b4e4f4e9e4e6 (patch) | |
| tree | f7c1cff0271e21b7e4e311f212743363a6376db9 | |
| parent | dfb2e572d6ce2675c0a4925f4dee7dd483365ce8 (diff) | |
impl qt console rule with qt sdk
| -rw-r--r-- | xmake/modules/detect/sdks/find_qt.lua | 15 | ||||
| -rw-r--r-- | xmake/platforms/macosx/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/qt/console/load.lua | 12 |
3 files changed, 19 insertions, 11 deletions
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua index 51aefbf63..6fb7d4b14 100644 --- a/xmake/modules/detect/sdks/find_qt.lua +++ b/xmake/modules/detect/sdks/find_qt.lua @@ -26,13 +26,14 @@ import("lib.detect.cache") import("lib.detect.find_file") import("core.base.option") +import("core.base.global") import("core.project.config") -- find qt sdk directory -function _find_sdkdir() +function _find_sdkdir(sdkdir) -- init the search directories - local pathes = {} + local pathes = {path.join(sdkdir, "**", "bin")} if os.host() == "macosx" then table.insert(pathes, "~/Qt/**/bin") elseif os.host() == "windows" then @@ -51,11 +52,7 @@ end function _find_qt(sdkdir) -- find qt directory - if not sdkdir or not os.isdir(sdkdir) then - sdkdir = _find_sdkdir() - end - - -- not found? + sdkdir = _find_sdkdir(sdkdir) if not sdkdir or not os.isdir(sdkdir) then return nil end @@ -102,11 +99,11 @@ function main(sdkdir, opt) end -- find qt - local qt = _find_qt(sdkdir or config.get("qt_dir")) + local qt = _find_qt(sdkdir or config.get("qt_dir") or global.get("qt_dir")) if qt then -- save sdk directory to config - config.set("qt_dir", qt.sdkdir) + config.set("qt_dir", qt.sdkdir, {force = true, readonly = true}) -- trace if opt.verbose or option.get("verbose") then diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua index b32419750..7cce0c77d 100644 --- a/xmake/platforms/macosx/xmake.lua +++ b/xmake/platforms/macosx/xmake.lua @@ -56,6 +56,8 @@ platform("macosx") , {nil, "target_minver", "kv", "auto", "The Target Minimal Version" } , {category = "Cuda SDK Configuration" } , {nil, "cuda_dir", "kv", "auto", "The Cuda SDK Directory" } + , {category = "Qt SDK Configuration" } + , {nil, "qt_dir", "kv", "auto", "The Qt SDK Directory" } } , global = @@ -63,6 +65,7 @@ platform("macosx") {} , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" } , {nil, "cuda_dir", "kv", "auto", "The Cuda SDK Directory" } + , {nil, "qt_dir", "kv", "auto", "The Qt SDK Directory" } } } diff --git a/xmake/rules/qt/console/load.lua b/xmake/rules/qt/console/load.lua index 8d752b9cd..0976d2ed4 100644 --- a/xmake/rules/qt/console/load.lua +++ b/xmake/rules/qt/console/load.lua @@ -38,6 +38,9 @@ function main(target) -- add defines for using core lib target:add("defines", "QT_CORE_LIB") + -- need c++11 + target:set("languages", "cxx11") + -- add defines for the compile mode if is_mode("debug") then target:add("defines", "QT_QML_DEBUG") @@ -53,6 +56,11 @@ function main(target) -- deprecated API in order to know how to port your code away from it. target:add("defines", "QT_DEPRECATED_WARNINGS") - -- add framework directories - target:add("frameworkdirs", qt.libdir) + -- add frameworks + if is_plat("macosx") then + target:add("frameworkdirs", qt.linkdirs) + target:add("frameworks", "QtCore", "DiskArbitration", "IOKit") + target:add("includedirs", path.join(qt.sdkdir, "lib/QtCore.framework/Headers")) + target:add("rpathdirs", "@executable_path/Frameworks", qt.linkdirs) + end end |
