build system updates and other fixes

add preset config
import qt
separate core and frontend
This commit is contained in:
zhupengfei
2019-08-28 11:43:44 +08:00
parent d612b9cf37
commit fd5106759a
15 changed files with 723 additions and 46 deletions
+53 -2
View File
@@ -1,3 +1,54 @@
target_sources(threeSD PRIVATE
frontend/main.cpp
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if (POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
add_executable(threeSD
main.cpp
main.h
main.ui
)
target_link_libraries(threeSD PRIVATE common core)
target_link_libraries(threeSD PRIVATE Qt5::Widgets)
target_link_libraries(threeSD PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if (APPLE)
# TODO: support macOS
# set(MACOSX_ICON "../../dist/citra.icns")
# set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# target_sources(threeSD PRIVATE ${MACOSX_ICON})
# set_target_properties(threeSD PROPERTIES MACOSX_BUNDLE TRUE)
# set_target_properties(threeSD PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
elseif(WIN32)
# compile as a win32 gui application instead of a console application
target_link_libraries(threeSD PRIVATE Qt5::WinMain)
if(MSVC)
set_target_properties(threeSD PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
elseif(MINGW)
set_target_properties(threeSD PROPERTIES LINK_FLAGS_RELEASE "-mwindows")
endif()
endif()
target_compile_definitions(threeSD PRIVATE
# Use QStringBuilder for string concatenation to reduce
# the overall number of temporary strings created.
-DQT_USE_QSTRINGBUILDER
# Disable implicit type narrowing in signal/slot connect() calls.
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
# Disable unsafe overloads of QProcess' start() function.
-DQT_NO_PROCESS_COMBINED_ARGUMENT_START
# Disable implicit QString->QUrl conversions to enforce use of proper resolving functions.
-DQT_NO_URL_CAST_FROM_STRING
)
if (MSVC)
include(CopyQt5Deps)
copy_Qt5_deps(threeSD)
endif()
+34 -10
View File
@@ -1,14 +1,38 @@
// Dummy
// Copyright 2014 Citra Emulator Project / 2019 threeSD Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <iostream>
#include "common/logging/log.h"
#include <QApplication>
#include "frontend/main.h"
#include "ui_main.h"
int main() {
#ifdef __APPLE__
#include <string>
#include <unistd.h>
#include "common/common_paths.h"
#include "common/file_util.h"
#endif
LOG_ERROR(Frontend, "test");
_sleep(1000);
LOG_WARNING(Frontend, "test2");
system("pause");
MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<Ui::MainDialog>()) {
ui->setupUi(this);
}
return 0;
}
MainDialog::~MainDialog() = default;
int main(int argc, char* argv[]) {
// Init settings params
QCoreApplication::setOrganizationName("zhaowenlan1779");
QCoreApplication::setApplicationName("threeSD");
#ifdef __APPLE__
std::string bin_path = FileUtil::GetBundleDirectory() + DIR_SEP + "..";
chdir(bin_path.c_str());
#endif
QApplication app(argc, argv);
MainDialog main_dialog;
main_dialog.show();
return app.exec();
}
+23
View File
@@ -0,0 +1,23 @@
// Copyright 2019 threeSD Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <QDialog>
namespace Ui {
class MainDialog;
}
class MainDialog : public QDialog {
Q_OBJECT;
public:
explicit MainDialog(QWidget* parent = nullptr);
~MainDialog() override;
private:
std::unique_ptr<Ui::MainDialog> ui;
};
+239
View File
@@ -0,0 +1,239 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainDialog</class>
<widget class="QDialog" name="MainDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>450</height>
</rect>
</property>
<property name="windowTitle">
<string>threeSD</string>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel">
<property name="text">
<string>Auto-detected Configuration:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="configSelect">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QPushButton" name="advancedButton">
<property name="text">
<string>Advanced...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox">
<property name="title">
<string>Custom</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel">
<property name="text">
<string>SDMC:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="sdmcPath"/>
</item>
<item>
<widget class="QPushButton" name="sdmcPathExplore">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel">
<property name="text">
<string>User Directory:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="userPath"/>
</item>
<item>
<widget class="QPushButton" name="userPathExplore">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel">
<property name="text">
<string>movable.sed:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="movableSedPath"/>
</item>
<item>
<widget class="QPushButton" name="movableSedExplore">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel">
<property name="text">
<string>boot9.bin:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="bootrom9Path"/>
</item>
<item>
<widget class="QPushButton" name="bootrom9Explore">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel">
<property name="text">
<string>Safe mode firm Path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="safeModeFirmPath"/>
</item>
<item>
<widget class="QPushButton" name="safeModeFirmExplore">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel">
<property name="text">
<string>seeddb.bin:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="seeddbPath"/>
</item>
<item>
<widget class="QPushButton" name="seeddbExplore">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel">
<property name="text">
<string>sector0x96.bin:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="secretSectorPath"/>
</item>
<item>
<widget class="QPushButton" name="secretSectorExplore">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>