对于 QBS,我应该在我的 DynamicLibrary{} 中设置什么参数来安装 headers 和构建时的库?
For QBS, What parameters would I set in my DynamicLibrary{} to install headers and libraries upon build?
我正在将我的 Qt 库从 qmake 迁移到 qbs,我正在尝试找到一个合适的模板来帮助我了解简化上述库的构建和安装所需的参数。
目前我的一个图书馆的 qbs 文件如下所示:
import qbs
DynamicLibrary {
name: "qparsingtoolkit";
Depends {name: "cpp"}
Depends {name: "Qt.core"}
files: [
"Headers/qparsingparameters.h",
"Headers/qparsingtoolkit.h",
"Headers/qparsingtoolkit_global.h",
"Sources/qparsingparameters.cpp",
"Sources/qparsingtoolkit.cpp",
]
}
安装比较简单。
我只想要一个 headers 放在 /usr/include/qconsoledesigner
和 .so
库安装在
/usr/share/qconsoledesigner
DynamicLibrary {
name: "qparsingtoolkit";
Depends {name: "cpp"}
Depends {name: "Qt.core"}
qbs.installPrefix: "usr"
files: [
"Sources/qparsingparameters.cpp",
"Sources/qparsingtoolkit.cpp",
]
Group {
name: "api_headers"
files: [
"Headers/qparsingparameters.h",
"Headers/qparsingtoolkit.h",
"Headers/qparsingtoolkit_global.h",
]
qbs.install: true
qbs.installDir: "include/qconsoledesigner"
}
Group {
fileTagsFilter: ["dynamiclibrary", "dynamiclibrary_symlink"]
qbs.install: true
qbs.installDir: "share/qconsoledesigner"
}
}
请注意,目标二进制文件的安装将来会变得更加简单;参见例如http://doc-snapshots.qt.io/qbs/qml-qbsconvenienceitems-dynamiclibrary.html#installDir-prop.
正常的 "qbs build" 安装到构建目录内的安装根目录中。要安装 "globally",请按照 "qbs build" 和 "sudo qbs install --no-build --install-root /"。
我正在将我的 Qt 库从 qmake 迁移到 qbs,我正在尝试找到一个合适的模板来帮助我了解简化上述库的构建和安装所需的参数。
目前我的一个图书馆的 qbs 文件如下所示:
import qbs
DynamicLibrary {
name: "qparsingtoolkit";
Depends {name: "cpp"}
Depends {name: "Qt.core"}
files: [
"Headers/qparsingparameters.h",
"Headers/qparsingtoolkit.h",
"Headers/qparsingtoolkit_global.h",
"Sources/qparsingparameters.cpp",
"Sources/qparsingtoolkit.cpp",
]
}
安装比较简单。
我只想要一个 headers 放在 /usr/include/qconsoledesigner
和 .so
库安装在
/usr/share/qconsoledesigner
DynamicLibrary {
name: "qparsingtoolkit";
Depends {name: "cpp"}
Depends {name: "Qt.core"}
qbs.installPrefix: "usr"
files: [
"Sources/qparsingparameters.cpp",
"Sources/qparsingtoolkit.cpp",
]
Group {
name: "api_headers"
files: [
"Headers/qparsingparameters.h",
"Headers/qparsingtoolkit.h",
"Headers/qparsingtoolkit_global.h",
]
qbs.install: true
qbs.installDir: "include/qconsoledesigner"
}
Group {
fileTagsFilter: ["dynamiclibrary", "dynamiclibrary_symlink"]
qbs.install: true
qbs.installDir: "share/qconsoledesigner"
}
}
请注意,目标二进制文件的安装将来会变得更加简单;参见例如http://doc-snapshots.qt.io/qbs/qml-qbsconvenienceitems-dynamiclibrary.html#installDir-prop.
正常的 "qbs build" 安装到构建目录内的安装根目录中。要安装 "globally",请按照 "qbs build" 和 "sudo qbs install --no-build --install-root /"。