rename:项目更名。
This commit is contained in:
parent
489f4fff58
commit
74031eb1e0
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"files.autoSave": "onFocusChange",
|
||||
"editor.fontSize": 13,
|
||||
"editor.fontSize": 14,
|
||||
"editor.fontFamily": "'Source Code Pro', 'Source Code Pro', 'Source Code Pro'",
|
||||
"cmake.configureOnOpen": true,
|
||||
"terminal.integrated.fontFamily": "Source Code Pro",
|
||||
@ -25,7 +25,7 @@
|
||||
"cmake.options.statusBarVisibility": "visible",
|
||||
"cmake.generator": "Ninja",
|
||||
"C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json",
|
||||
"C_Cpp.default.cppStandard": "c++14",
|
||||
"C_Cpp.default.cppStandard": "c++17",
|
||||
"editor.inlayHints.enabled": "off",
|
||||
"editor.unicodeHighlight.allowedLocales": {
|
||||
"ja": true,
|
||||
|
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(packqt VERSION 0.1 LANGUAGES CXX)
|
||||
project(binpack VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
# 获取环境变量 HOME
|
||||
if (UNIX)
|
||||
@ -49,41 +49,41 @@ set(PROJECT_SOURCES
|
||||
adddesktop.ui
|
||||
adddesktop.h
|
||||
adddesktop.cpp
|
||||
packqt.qrc
|
||||
binpack.qrc
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
qt_add_executable(packqt
|
||||
qt_add_executable(binpack
|
||||
MANUAL_FINALIZATION
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
# Define target properties for Android with Qt 6 as:
|
||||
# set_property(TARGET packqt APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||
# set_property(TARGET binpack APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
||||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
||||
else()
|
||||
if(ANDROID)
|
||||
add_library(packqt SHARED
|
||||
add_library(binpack SHARED
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||
else()
|
||||
add_executable(packqt
|
||||
add_executable(binpack
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(packqt PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ofen)
|
||||
target_link_libraries(binpack PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ofen)
|
||||
|
||||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
||||
# If you are developing for iOS or macOS you should consider setting an
|
||||
# explicit, fixed bundle identifier manually though.
|
||||
if(${QT_VERSION} VERSION_LESS 6.1.0)
|
||||
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.packqt)
|
||||
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.binpack)
|
||||
endif()
|
||||
set_target_properties(packqt PROPERTIES
|
||||
set_target_properties(binpack PROPERTIES
|
||||
${BUNDLE_ID_OPTION}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
@ -92,12 +92,12 @@ set_target_properties(packqt PROPERTIES
|
||||
)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS packqt
|
||||
install(TARGETS binpack
|
||||
BUNDLE DESTINATION .
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
if(QT_VERSION_MAJOR EQUAL 6)
|
||||
qt_finalize_executable(packqt)
|
||||
qt_finalize_executable(binpack)
|
||||
endif()
|
||||
|
@ -10,7 +10,7 @@ using namespace ofen;
|
||||
MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle("packqt v1.0.4");
|
||||
setWindowTitle("binpack v1.0.5");
|
||||
connect_operator();
|
||||
control_init();
|
||||
}
|
||||
@ -23,9 +23,8 @@ MainWidget::~MainWidget()
|
||||
void MainWidget::connect_operator()
|
||||
{
|
||||
connect(ui->btnSelcetBinary, &QPushButton::clicked, this,
|
||||
[=]() { SelectFile(this, ui->edBinary, "请选择Qt二进制文件", "所有文件 (*)"); });
|
||||
[=]() { SelectFile(this, ui->edBinary, "请选择二进制文件", "所有文件 (*)"); });
|
||||
connect(ui->btnSelectOut, &QPushButton::clicked, this, [=]() { SelectDirectory(this, ui->edOutDir); });
|
||||
connect(ui->btnSelectQt, &QPushButton::clicked, this, [=]() { SelectDirectory(this, ui->edQtDir); });
|
||||
connect(ui->btnAddEnv, &QPushButton::clicked, this, [=]() { add_env_btn(); });
|
||||
connect(ui->btnDelEnv, &QPushButton::clicked, this, [=]() { del_env_btn(); });
|
||||
connect(ui->btnGenerate, &QPushButton::clicked, this, [=]() { generate(); });
|
||||
@ -36,7 +35,6 @@ void MainWidget::connect_operator()
|
||||
void MainWidget::control_init()
|
||||
{
|
||||
ui->plainTextEdit->setReadOnly(true);
|
||||
ui->edQtDir->setText(QDir::homePath() + "/Qt5.14.2/5.14.2/gcc_64");
|
||||
ui->edOutDir->setText(QDir::homePath() + "/program");
|
||||
#if !defined(NDEBUG)
|
||||
#endif
|
||||
@ -249,14 +247,6 @@ void MainWidget::generate()
|
||||
std::vector<std::string> dynamic_so{};
|
||||
std::copy(result.begin(), result.end(), std::back_inserter(dynamic_so));
|
||||
|
||||
// 处理 platform文件夹
|
||||
std::list<fs::path> platform{};
|
||||
fs::path qt_platform(ui->edQtDir->text().trimmed().toStdString());
|
||||
qt_platform.append("plugins/platforms");
|
||||
for (const auto& entry : fs::directory_iterator(qt_platform)) {
|
||||
result.push_back(entry.path().string());
|
||||
}
|
||||
|
||||
while (!result.empty()) {
|
||||
std::string bin = result.front();
|
||||
result.pop_front();
|
||||
@ -283,9 +273,6 @@ void MainWidget::generate()
|
||||
fs::copy_file(data, purpose, fs::copy_options::overwrite_existing);
|
||||
}
|
||||
|
||||
// 复制platform文件夹
|
||||
copy_dir(qt_platform.string(), out_dir.string());
|
||||
|
||||
// 复制主体文件
|
||||
fs::path out_binary = fs::path(out_dir).append(fs::path(binary_.toStdString()).filename().string());
|
||||
fs::copy_file(binary_.toStdString(), out_binary, fs::copy_options::overwrite_existing);
|
||||
|
@ -45,10 +45,10 @@ private:
|
||||
public:
|
||||
static QString SelectDirectory(QWidget* parent, QLineEdit* pEdit, const QString& pre_path = "");
|
||||
static QString SelectFile(QWidget* parent, QLineEdit* pEdit, const QString& info, const QString& filter);
|
||||
static bool isOk(QWidget* parent, const QString& title, const QString& content);
|
||||
static void message(QWidget* parent, const QString& content);
|
||||
static void cmd_exec(const std::string& cmd);
|
||||
static bool add_run_sh(const std::string& out_dir, const std::string& exe_name);
|
||||
static bool isOk(QWidget* parent, const QString& title, const QString& content);
|
||||
static void message(QWidget* parent, const QString& content);
|
||||
static void cmd_exec(const std::string& cmd);
|
||||
static bool add_run_sh(const std::string& out_dir, const std::string& exe_name);
|
||||
|
||||
private:
|
||||
Ui::MainWidget* ui;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1057</width>
|
||||
<height>778</height>
|
||||
<width>965</width>
|
||||
<height>591</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -60,44 +60,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Qt路径(选到bin的父目录):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="edQtDir"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSelectQt">
|
||||
<property name="text">
|
||||
<string>选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
@ -142,7 +104,7 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gboxEnv">
|
||||
<property name="title">
|
||||
<string>2.LD_LIBRARY_PATH配置</string>
|
||||
<string>2.要搜寻的LD_LIBRARY_PATH位置</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
|
@ -44,6 +44,8 @@ AddDesktop::AddDesktop(QWidget* parent) : QDialog(parent), ui(new Ui::AddDesktop
|
||||
"png图标(*.png);;ico图标(*.ico);;svg图标(*.svg);;所有文件 (*)");
|
||||
});
|
||||
connect(ui->btnInstall, &QPushButton::clicked, this, &AddDesktop::install_to_desktop);
|
||||
connect(ui->envAdd, &QPushButton::clicked, this, &AddDesktop::add_env_btn);
|
||||
connect(ui->envDel, &QPushButton::clicked, this, &AddDesktop::del_env_btn);
|
||||
}
|
||||
|
||||
void AddDesktop::checkchange()
|
||||
@ -132,3 +134,21 @@ AddDesktop::~AddDesktop()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddDesktop::add_env_btn()
|
||||
{
|
||||
QString env = MainWidget::SelectDirectory(this, nullptr);
|
||||
if (env.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ui->listWidget->addItem(env);
|
||||
}
|
||||
|
||||
void AddDesktop::del_env_btn()
|
||||
{
|
||||
QListWidgetItem* item = ui->listWidget->currentItem();
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
delete ui->listWidget->takeItem(ui->listWidget->currentRow());
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ public:
|
||||
explicit AddDesktop(QWidget *parent = nullptr);
|
||||
~AddDesktop();
|
||||
|
||||
private:
|
||||
void add_env_btn();
|
||||
void del_env_btn();
|
||||
|
||||
private:
|
||||
void checkchange();
|
||||
void install_to_desktop();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>429</width>
|
||||
<height>259</height>
|
||||
<width>485</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -124,6 +124,47 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>附加环境目录:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="envAdd">
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="envDel">
|
||||
<property name="text">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
|
@ -10,7 +10,7 @@ cd "$SCRIPT_DIR" || exit
|
||||
echo "当前目录是:$SCRIPT_DIR"
|
||||
|
||||
# 将脚本所在目录添加到 LD_LIBRARY_PATH 环境变量
|
||||
export LD_LIBRARY_PATH="$SCRIPT_DIR"
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$SCRIPT_DIR":REPLACE
|
||||
|
||||
# 定义 replace_string 脚本的绝对路径
|
||||
REPLACE_STRING_SCRIPT="$SCRIPT_DIR/replace_string"
|
||||
|
Loading…
x
Reference in New Issue
Block a user