diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 53eadcd..752518a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -15,9 +15,6 @@ jobs: build: env: buildDir: "${{ github.workspace }}/build/" - vcpkg-tag: "2022.09.27" - VCPKG_ROOT: "${{ github.workspace }}/vcpkg/" - VCPKG_DEFAULT_BINARY_CACHE: "${{ github.workspace }}/vcpkg/.cache" CCACHE_DIR: "${{ github.workspace }}/ccache/" CCACHE_BASEDIR: "${{ github.workspace }}/ccache/" SCCACHE_DIR: "${{ github.workspace }}/ccache/" @@ -64,42 +61,22 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v3 with: - version: 6.3.2 + version: 6.7.0 cache: true - - name: download vcpkg - run: | - git clone https://github.com/microsoft/vcpkg ${{ github.workspace }}/vcpkg || true - pushd vcpkg - git checkout --force ${{ env.vcpkg-tag }} - ./bootstrap-vcpkg.sh - popd - - - name: cache vcpkg - id: cache-vcpkg + - name: cache ccache uses: actions/cache@v3 with: path: | - ${{ github.workspace }}/vcpkg/.cache ${{ github.workspace }}/ccache - key: ${{ runner.os }}-build-${{ env.vcpkg-tag }}-${{ env.DATE }}-${{ hashFiles('vcpkg.json') }} + key: ${{ runner.os }}-build-${{ env.DATE }} }} restore-keys: | ${{ runner.os }}-build- - - name: Make cache dir - if: steps.cache-vcpkg.outputs.cache-hit != 'true' - run: mkdir -p "${{ github.workspace }}/vcpkg/.cache" - - name: Configure & Build run: | ./scripts/dist_linux.sh - - uses: actions/upload-artifact@v2 - if: failure() - with: - name: vcpkg-logs - path: ${{env.VCPKG_ROOT}}/buildtrees/**/*.log - - uses: actions/upload-artifact@v2 with: name: arclight-linux-x64 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index c88e2fe..c173f64 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,9 +15,6 @@ jobs: build: env: buildDir: "${{ github.workspace }}/build/" - vcpkg-tag: "2022.09.27" - VCPKG_ROOT: "${{ github.workspace }}/vcpkg/" - VCPKG_DEFAULT_BINARY_CACHE: "${{ github.workspace }}/vcpkg/.cache" MACOSX_DEPLOYMENT_TARGET: "10.15" CCACHE_DIR: "${{ github.workspace }}/ccache/" CCACHE_BASEDIR: "${{ github.workspace }}/ccache/" @@ -57,42 +54,22 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v3 with: - version: 6.3.2 + version: 6.7.0 cache: true - - name: download vcpkg - run: | - git clone https://github.com/microsoft/vcpkg ${{ github.workspace }}/vcpkg || true - pushd vcpkg - git checkout --force ${{ env.vcpkg-tag }} - ./bootstrap-vcpkg.sh - popd - - - name: cache vcpkg - id: cache-vcpkg + - name: cache ccache uses: actions/cache@v3 with: path: | - ${{ github.workspace }}/vcpkg/.cache ${{ github.workspace }}/ccache - key: ${{ runner.os }}-build-${{ env.vcpkg-tag }}-${{ env.DATE }}-${{ hashFiles('vcpkg.json') }} + key: ${{ runner.os }}-build-${{ env.DATE }} restore-keys: | ${{ runner.os }}-build- - - name: Make cache dir - if: steps.cache-vcpkg.outputs.cache-hit != 'true' - run: mkdir -p "${{ github.workspace }}/vcpkg/.cache" - - name: Configure & Build run: | ./scripts/dist_mac.sh - - uses: actions/upload-artifact@v2 - if: failure() - with: - name: vcpkg-logs - path: ${{env.VCPKG_ROOT}}/buildtrees/**/*.log - - uses: actions/upload-artifact@v2 with: name: arclight-macOS-x64 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 0497c75..f36794f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,9 +15,6 @@ jobs: build: env: buildDir: "${{ github.workspace }}/build/" - vcpkg-tag: "2022.09.27" - VCPKG_ROOT: "c:/vcpkg_root/" - VCPKG_DEFAULT_BINARY_CACHE: "c:/vcpkg_root/.cache" CCACHE_DIR: "${{ github.workspace }}/ccache/" CCACHE_BASEDIR: "${{ github.workspace }}/ccache/" SCCACHE_DIR: "${{ github.workspace }}/ccache/" @@ -50,25 +47,15 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v3 with: - version: 6.3.2 + version: 6.7.0 cache: true - - name: download vcpkg - run: | - git clone https://github.com/microsoft/vcpkg c:/vcpkg_root - pushd c:/vcpkg_root - git checkout --force ${{ env.vcpkg-tag }} - ./bootstrap-vcpkg.bat - popd - - - name: cache vcpkg - id: cache-vcpkg + - name: cache ccache uses: actions/cache@v3 with: path: | - ${{ github.workspace }}/vcpkg/.cache ${{ github.workspace }}/ccache - key: ${{ runner.os }}-build-${{ env.vcpkg-tag }}-${{ env.DATE }}-${{ hashFiles('vcpkg.json') }} + key: ${{ runner.os }}-build-${{ env.DATE }} restore-keys: | ${{ runner.os }}-build- @@ -78,12 +65,6 @@ jobs: - name: Configure & Build run: .\scripts\dist_win.bat - - uses: actions/upload-artifact@v2 - if: failure() - with: - name: vcpkg-logs - path: ${{env.VCPKG_ROOT}}/buildtrees/**/*.log - - uses: actions/upload-artifact@v2 with: name: arclight-windows-x64 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cebb09..8f2cb2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.21) project(arclight VERSION 1.0.0 LANGUAGES CXX C) set (CMAKE_CXX_STANDARD 20) +if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) +endif() + include(cmake/PreventInSourceBuilds.cmake) include(cmake/ProjectSettings.cmake) @@ -16,8 +20,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GN endif() if(MSVC) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /MTd") elseif(UNIX AND NOT APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sized-deallocation") endif() diff --git a/CMakePresets.json b/CMakePresets.json index 400711a..1a0716c 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -13,17 +13,21 @@ "binaryDir": "${sourceDir}/build", "generator": "Ninja", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": { - "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "type": "FILEPATH" + "CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/bin", + "ROLLNW_BUILD_BENCHMARKS": { + "type": "BOOL", + "value": "OFF" }, - "CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/bin" + "BUILD_TESTING": { + "type": "BOOL", + "value": "OFF" + } } }, { - "name": "windows-default", + "name": "windows", "inherits": "default", - "generator": "NMake Makefiles", + "generator": "Ninja", "displayName": "Windows-only configuration", "description": "This build is only available on Windows", "binaryDir": "${sourceDir}/build", @@ -37,16 +41,7 @@ "strategy": "external" }, "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/bin", - "CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG": "${sourceDir}/bin", - "CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE": "${sourceDir}/bin", - "CMAKE_LIBRARY_OUTPUT_DIRECTORY": "${sourceDir}/bin", - "CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG": "${sourceDir}/bin", - "CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE": "${sourceDir}/bin", - "VCPKG_TARGET_TRIPLET": "x64-windows-static", - "VCPKG_HOST_TRIPLET": "x64-windows-static", - "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>" + "CMAKE_BUILD_TYPE": "Release" } }, { diff --git a/scripts/dist_linux.sh b/scripts/dist_linux.sh index e74e36e..730e64b 100755 --- a/scripts/dist_linux.sh +++ b/scripts/dist_linux.sh @@ -1,10 +1,5 @@ #!/bin/bash -if [[ -z "${VCPKG_ROOT}" ]]; then - echo "Environment variable VCPKG_ROOT not set, do you have vcpkg installed?" - exit 1 -fi - if [[ -z "${Qt6_DIR}" ]]; then echo "Environment variable Qt6_DIR not set, do you have Qt installed?" exit 1 diff --git a/scripts/dist_mac.sh b/scripts/dist_mac.sh index 69bdfd0..fa93528 100755 --- a/scripts/dist_mac.sh +++ b/scripts/dist_mac.sh @@ -1,10 +1,5 @@ #!/bin/sh -if [[ -z "${VCPKG_ROOT}" ]]; then - echo "Environment variable VCPKG_ROOT not set, do you have vcpkg installed?" - exit 1 -fi - if [[ -z "${Qt6_DIR}" ]]; then echo "Environment variable Qt6_DIR not set, do you have Qt installed?" exit 1 diff --git a/scripts/dist_win.bat b/scripts/dist_win.bat index 2c24121..3808068 100644 --- a/scripts/dist_win.bat +++ b/scripts/dist_win.bat @@ -1,11 +1,9 @@ @echo off -IF "%VCPKG_ROOT%"=="" ECHO Environment variable VCPKG_ROOT not set, do you have vcpkg installed? - IF "%Qt6_DIR%"=="" ECHO Environment variable Qt6_DIR not set, do you have Qt installed? echo "Configuring..." -cmake --preset windows-default +cmake --preset windows echo "Building..." cmake --build --preset default diff --git a/src/erfherder/CMakeLists.txt b/src/erfherder/CMakeLists.txt index 77d7bbd..6387c62 100644 --- a/src/erfherder/CMakeLists.txt +++ b/src/erfherder/CMakeLists.txt @@ -1,5 +1,4 @@ -find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets) -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) +find_package(Qt6 REQUIRED COMPONENTS Widgets) set(SRC_FILES main.cpp diff --git a/src/erfherder/main.cpp b/src/erfherder/main.cpp index 7eba7aa..cbae66f 100644 --- a/src/erfherder/main.cpp +++ b/src/erfherder/main.cpp @@ -39,7 +39,6 @@ int main(int argc, char* argv[]) // FA6 Free ZFontIcon::addFont(":/fa6/" + Fa6::FA6_TTF_FILE_FREE_SOLID); - ZFontIcon::addFont(":/fa6/" + Fa6::FA6_TTF_FILE_FREE_REGULAR); MainWindow main; diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 37469ed..2c7b320 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -6,104 +6,6 @@ endif() find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) -# # Use provided python interpreter if given. -# if(NOT python_interpreter) -# find_program(python_interpreter NAMES python3 python) -# endif() -# message(STATUS "Using python interpreter: ${python_interpreter}") - - -# # Macro to get various pyside / python include / link flags. -# macro(pyside_config option output_var) -# if(${ARGC} GREATER 2) -# set(is_list ${ARGV2}) -# else() -# set(is_list "") -# endif() - -# execute_process( -# COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/src/widgets/pyside_config.py" -# ${option} -# OUTPUT_VARIABLE ${output_var} -# OUTPUT_STRIP_TRAILING_WHITESPACE) - -# if ("${${output_var}}" STREQUAL "") -# message(FATAL_ERROR "Error: Calling pyside_config.py ${option} returned no output.") -# endif() -# if(is_list) -# string (REPLACE " " ";" ${output_var} "${${output_var}}") -# endif() -# endmacro() - -# # Query for the shiboken6-generator path, PySide6 path, Python path, include paths and linker flags. -# pyside_config(--shiboken-module-path SHIBOKEN_MODULE_PATH) -# pyside_config(--shiboken-generator-path SHIBOKEN_GENERATOR_PATH) -# pyside_config(--pyside-path PYSIDE_PATH) - -# pyside_config(--python-include-path PYTHON_INCLUDE_DIR) -# pyside_config(--shiboken-generator-include-path SHIBOKEN_GENERATOR_INCLUDE_DIR 1) -# pyside_config(--pyside-include-path PYSIDE_INCLUDE_DIR 1) - -# pyside_config(--python-link-flags-cmake PYTHON_LINKING_DATA 0) -# pyside_config(--shiboken-module-shared-libraries-cmake SHIBOKEN_MODULE_SHARED_LIBRARIES 0) -# pyside_config(--pyside-shared-libraries-cmake PYSIDE_SHARED_LIBRARIES 0) - -# set(SHIBOKEN_PATH "${SHIBOKEN_GENERATOR_PATH}/shiboken6${CMAKE_EXECUTABLE_SUFFIX}") - -# if(NOT EXISTS ${SHIBOKEN_PATH}) -# message(FATAL_ERROR "Shiboken executable not found at path: ${SHIBOKEN_PATH}") -# endif() - - -# # Get all relevant Qt include dirs, to pass them on to shiboken. -# get_property(QT_WIDGETS_INCLUDE_DIRS TARGET Qt6::Widgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES) -# set(INCLUDES "") -# foreach(INCLUDE_DIR ${QT_WIDGETS_INCLUDE_DIRS}) -# list(APPEND INCLUDES "-I${INCLUDE_DIR}") -# endforeach() - -# # On macOS, check if Qt is a framework build. This affects how include paths should be handled. -# get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK) -# if (QtCore_is_framework) -# get_target_property(qt_core_library_location Qt6::Core LOCATION) -# # PYSIDE-623: We move up until the directory contains all the frameworks. -# # This is "lib" in ".../lib/QtCore.framework/Versions/A/QtCore". -# get_filename_component(lib_dir "${qt_core_library_location}/../../../.." ABSOLUTE) -# list(APPEND INCLUDES "--framework-include-paths=${lib_dir}") -# endif() - -# # Set up the options to pass to shiboken. -# set(WRAPPED_HEADER ${CMAKE_SOURCE_DIR}/global.h) -# set(TYPESYSTEM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/arclight_typesystem.xml) - -# set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic -# --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero -# --avoid-protected-hack -# ${INCLUDES} -# -I${CMAKE_SOURCE_DIR} -# -T${CMAKE_SOURCE_DIR} -# -T${PYSIDE_PATH}/typesystems -# --output-directory=${CMAKE_CURRENT_BINARY_DIR} -# ) - -# # Specify which sources will be generated by shiboken, and their dependencies. -# set(GENERATED_SOURCES -# ${CMAKE_CURRENT_BINARY_DIR}/AppLib/applib_module_wrapper.cpp -# ${CMAKE_CURRENT_BINARY_DIR}/AppLib/mainwindow_wrapper.cpp) - -# set(GENERATED_SOURCES_DEPENDENCIES -# ${WRAPPED_HEADER} -# ${TYPESYSTEM_FILE} -# ) - -# # Add custom target to run shiboken. -# add_custom_command(OUTPUT ${GENERATED_SOURCES} -# COMMAND ${SHIBOKEN_PATH} -# ${SHIBOKEN_OPTIONS} ${WRAPPED_HEADER} ${TYPESYSTEM_FILE} -# DEPENDS ${GENERATED_SOURCES_DEPENDENCIES} -# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -# COMMENT "Running generator for ${TYPESYSTEM_FILE}.") - add_library(arclight-widgets STATIC ContainerModel.cpp ContainerModel.hpp diff --git a/src/widgets/ContainerModel.cpp b/src/widgets/ContainerModel.cpp index 8ea3c6e..005cf32 100755 --- a/src/widgets/ContainerModel.cpp +++ b/src/widgets/ContainerModel.cpp @@ -45,7 +45,9 @@ void ContainerSortFilterProxyModel::onFilterUpdated(const QString& filter) bool ContainerSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const { - if (filter_empty_) { return true; } + if (filter_empty_) { + return true; + } QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); auto data = index.data(Qt::DisplayRole); @@ -85,11 +87,11 @@ void ContainerModel::addFile(const nw::Resource& res, const fs::path& file) } } -void ContainerModel::addFile(const nw::Resource& res, const nw::ByteArray& bytes) +void ContainerModel::addFile(const nw::Resource& res, const nw::ResourceData& data) { if (auto e = dynamic_cast(container_)) { if (e->erase(res)) { - e->add(res, bytes); + e->add(res, data.bytes); auto it = std::find_if(std::begin(resources_), std::end(resources_), [&res](const auto& rd) { return rd.name == res; }); @@ -98,7 +100,7 @@ void ContainerModel::addFile(const nw::Resource& res, const nw::ByteArray& bytes emit dataChanged(index(row, 0), index(row, columnCount())); } else { beginInsertRows(QModelIndex(), rowCount(), rowCount()); - e->add(res, bytes); + e->add(res, data.bytes); resources_.push_back(e->stat(res)); endInsertRows(); } @@ -199,14 +201,18 @@ bool ContainerModel::canDropMimeData(const QMimeData* mime, Qt::DropAction actio Q_UNUSED(column); Q_UNUSED(parent); - if (!mime->hasUrls()) { return false; } + if (!mime->hasUrls()) { + return false; + } for (const auto& url : mime->urls()) { QFileInfo fn{url.fileName()}; QFileInfo path{url.toLocalFile()}; if (path.absolutePath().toStdString() == container_->working_directory()) { return false; } - if (path.isDir()) { return false; } + if (path.isDir()) { + return false; + } if (nw::ResourceType::from_extension(fn.completeSuffix().toStdString()) == nw::ResourceType::invalid) { return false; } @@ -272,7 +278,9 @@ Qt::ItemFlags ContainerModel::flags(const QModelIndex& index) const QVariant ContainerModel::headerData(int section, Qt::Orientation orientation, int role) const { - if (!container_) { return {}; } + if (!container_) { + return {}; + } if (role != Qt::DisplayRole || orientation != Qt::Horizontal) return {}; diff --git a/src/widgets/ContainerModel.hpp b/src/widgets/ContainerModel.hpp index 28a5073..e554140 100755 --- a/src/widgets/ContainerModel.hpp +++ b/src/widgets/ContainerModel.hpp @@ -33,7 +33,7 @@ class ContainerModel : public QAbstractTableModel { explicit ContainerModel(nw::Container* container, QObject* parent = nullptr); void addFile(const nw::Resource& res, const std::filesystem::path& file); - void addFile(const nw::Resource& res, const nw::ByteArray& bytes); + void addFile(const nw::Resource& res, const nw::ResourceData& bytes); void addFiles(const QStringList& files); void mergeFiles(const QStringList& files); void setColumnCount(int cols); diff --git a/src/widgets/TlkModel.hpp b/src/widgets/TlkModel.hpp index ce7e7ed..9e176a1 100644 --- a/src/widgets/TlkModel.hpp +++ b/src/widgets/TlkModel.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include diff --git a/src/widgets/TlkView.hpp b/src/widgets/TlkView.hpp index c7ede50..4ab5f37 100644 --- a/src/widgets/TlkView.hpp +++ b/src/widgets/TlkView.hpp @@ -2,7 +2,7 @@ #include "TlkModel.hpp" -#include +#include #include diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index e951a93..0000000 --- a/vcpkg.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "arclight", - "version": "0.1.0", - "dependencies": [ - "catch2", - "fmt", - "abseil", - "zstd", - "zlib", - "sqlite3", - "minizip", - "nlohmann-json", - "nowide", - { - "name": "libiconv", - "platform": "windows" - }, - "glm", - "stduuid" - ] -}