Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5c8b01a
Update to temp version of updated commons
Idhrendur Jan 13, 2025
14b2d8b
Update requiredFile with fs::path
Idhrendur Jan 17, 2025
c7bffff
Update to modified commons.
Idhrendur Jan 17, 2025
7d15b15
Update RequiredFolder
Idhrendur Jan 17, 2025
3f2cacf
Update FronterMod
Idhrendur Jan 17, 2025
0087dec
Update configuration
Idhrendur Jan 17, 2025
5eeae07
Update PathsTab
Idhrendur Jan 17, 2025
1fe9715
Update Localization
Idhrendur Jan 17, 2025
0d38f10
Update modcopier
Idhrendur Jan 17, 2025
051b8d3
Merge remote-tracking branch 'origin/master' into fronter_path
Idhrendur Jan 17, 2025
35c9a6f
Capitalization
Idhrendur Jan 17, 2025
8873a31
Formatting
Idhrendur Jan 17, 2025
addcb42
Format
Idhrendur Jan 18, 2025
ef49558
Move cmake outward
Idhrendur Jan 18, 2025
ea15798
Update build script
Idhrendur Jan 18, 2025
3036f61
Fix more deprecations.
Idhrendur Jan 18, 2025
077025f
Formatting
Idhrendur Jan 18, 2025
8ba10bc
Update commons
Idhrendur Jan 18, 2025
badc6db
Update workflow.
Idhrendur Jan 18, 2025
778191a
More workflow updates
Idhrendur Jan 18, 2025
fe92b46
Fix workflow?
Idhrendur Jan 18, 2025
b7bda65
Add sqlite3 project
Idhrendur Jan 18, 2025
3f07535
Even more workflow fixes
Idhrendur Jan 18, 2025
dde3ce6
Try bumping to C++23
Idhrendur Jan 18, 2025
a6c8f77
Fix a path
Idhrendur Jan 18, 2025
81847ed
./, *sigh*
Idhrendur Jan 18, 2025
48d0045
Fix script
Idhrendur Jan 18, 2025
3b3c03f
using statements
Idhrendur Jan 18, 2025
2030002
Formatting
Idhrendur Jan 18, 2025
41d5d08
Testing fixes
Idhrendur Jan 18, 2025
e2f89aa
Update to merged common
Idhrendur Jan 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions Fronter/CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
cmake_minimum_required(VERSION 3.5)

project(Fronter)
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/Source)
set(PROJECT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/Fronter/Source)
set(PROJECT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/Fronter/Source)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++23")

add_compile_options(-lstdc++fs)
add_compile_options(-D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Wall -O2 -Wno-unused-variable)
add_link_options(-no-pie)

set(CURL_LIBRARY "-lcurl")
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR})

include_directories("../external/commonItems")
include_directories("../external/commonItems/external/json/single_include")
include_directories("../external/SQLiteCpp/include")
include_directories("../external/SQLiteCpp/sqlite3")
include_directories("external/commonItems")
include_directories("external/commonItems/external/json/single_include")
include_directories("external/SQLiteCpp/include")
include_directories("external/SQLiteCpp/sqlite3")
include_directories("/usr/include/wx-3.2-unofficial")
include_directories("/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2-unofficial")
include_directories("${PROJECT_SOURCE_DIR}")
Expand All @@ -35,14 +34,9 @@ file(GLOB LOGWATCHER_SOURCES "${PROJECT_SOURCE_DIR}/WorkerThreads/LogWatcher/*.c
file(GLOB MODCOPIER_SOURCES "${PROJECT_SOURCE_DIR}/WorkerThreads/ModCopier/*.cpp")
file(GLOB UPDATECHECKER_SOURCES "${PROJECT_SOURCE_DIR}/UpdateChecker/*.cpp")
file(GLOB SQLITE_SOURCES "${PROJECT_SOURCE_DIR}/../../external/SQLiteCpp/src/*.cpp")
set(COMMON_SOURCES "../external/commonItems/CommonFunctions.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../external/SQLiteCpp/sqlite3/sqlite3.c")
set(COMMON_SOURCES ${COMMON_SOURCES} "../external/commonItems/LinuxUtils.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../external/commonItems/Log.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../external/commonItems/OSCommonLayer.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../external/commonItems/Parser.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../external/commonItems/ParserHelpers.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../external/commonItems/StringUtils.cpp")

add_subdirectory(external/commonItems EXCLUDE_FROM_ALL)
add_subdirectory(external/SQLiteCpp/sqlite3 EXCLUDE_FROM_ALL)

add_executable(ConverterFrontend
${MAIN_SOURCES}
Expand All @@ -57,12 +51,11 @@ add_executable(ConverterFrontend
${MODCOPIER_SOURCES}
${UPDATECHECKER_SOURCES}
${SQLITE_SOURCES}
${COMMON_SOURCES}
)

find_package(wxWidgets REQUIRED COMPONENTS net core base)
include(${wxWidgets_USE_FILE})
target_link_libraries(ConverterFrontend ${wxWidgets_LIBRARIES} ${CURL_LIBRARIES})
target_link_libraries(ConverterFrontend commonLib sqlite3 ${wxWidgets_LIBRARIES} ${CURL_LIBRARIES})

add_custom_command(TARGET ConverterFrontend POST_BUILD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND chmod u+x ../Copy_Files.sh)
add_custom_command(TARGET ConverterFrontend POST_BUILD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ../Copy_Files.sh)
add_custom_command(TARGET ConverterFrontend POST_BUILD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND chmod u+x ./Copy_Files.sh)
add_custom_command(TARGET ConverterFrontend POST_BUILD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ./Copy_Files.sh)
147 changes: 147 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"description": "Target Windows with the Visual Studio development environment.",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "linux-base",
"description": "Target Linux with the gcc/g++ build environment.",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "x64-release-windows",
"displayName": "x64 Release Windows",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Release)",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release", "PLATFORM": "Windows" }
},
{
"name": "x64-debug-windows",
"displayName": "x64 Debug Windows",
"description": "Target Windows (64-bit) with the Visual Studio development environment. (Debug)",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "PLATFORM": "Windows" }
},
{
"name": "x64-debug-linux",
"displayName": "x64 Debug Linux",
"description": "Target Linux with the gcc/g++ build environment. (Debug)",
"inherits": "linux-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "PLATFORM": "Linux" }
},
{
"name": "x64-release-linux",
"displayName": "x64 Release Linux",
"description": "Target Linux with the gcc/g++ build environment. (Release)",
"inherits": "linux-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release", "PLATFORM": "Linux" }
}
,
{
"name": "x64-coverage-linux",
"displayName": "x64 Release Linux",
"description": "Target Linux with the gcc/g++ build environment. (Code Coverage)",
"inherits": "linux-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": { "CMAKE_BUILD_TYPE": "Coverage", "PLATFORM": "Linux", "COVERAGE": "true" }
}
],
"buildPresets": [
{
"name": "build-x64-release-windows",
"displayName": "x64 release",
"configurePreset": "x64-release-windows",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "build-x64-debug-windows",
"displayName": "x64 debug",
"configurePreset": "x64-debug-windows",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "build-x64-debug-linux",
"displayName": "x64 debug",
"configurePreset": "x64-debug-linux",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "build-x64-release-linux",
"displayName": "x64 release",
"configurePreset": "x64-release-linux",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "build-x64-coverage-linux",
"displayName": "x64 code coverage",
"configurePreset": "x64-coverage-linux",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
}
]
}
10 changes: 5 additions & 5 deletions Copy_Files.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
# Copy required resources
cp Resources/converter.ico ../Release/
cp Resources/GeneralFAQ-READ.ME.FIRST.txt ../Release/
cp Fronter/Resources/converter.ico Release/
cp Fronter/Resources/GeneralFAQ-READ.ME.FIRST.txt Release/

rm -rf ../Release/Configuration
mkdir ../Release/Configuration
cp Resources/*.yml ../Release/Configuration/
rm -rf Release/Configuration
mkdir Release/Configuration
cp Fronter/Resources/*.yml Release/Configuration/
55 changes: 28 additions & 27 deletions Fronter/Source/Configuration/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,30 @@
#include <fstream>
#include <ranges>

namespace fs = std::filesystem;


using std::filesystem::exists;
using std::filesystem::path;



Configuration::Configuration()
{
std::ofstream clearLog("log.txt");
clearLog.close();
registerKeys();
if (fs::exists("Configuration/fronter-configuration.txt"))
if (exists("Configuration/fronter-configuration.txt"))
{
parseFile("Configuration/fronter-configuration.txt");
parseFile(path("Configuration/fronter-configuration.txt"));
Log(LogLevel::Info) << "Frontend configuration loaded.";
}
else
{
Log(LogLevel::Warning) << "Configuration/fronter-configuration.txt not found!";
}
if (fs::exists("Configuration/fronter-options.txt"))
if (exists("Configuration/fronter-options.txt"))
{
parseFile("Configuration/fronter-options.txt");
parseFile(path("Configuration/fronter-options.txt"));
Log(LogLevel::Info) << "Frontend options loaded.";
}
else
Expand All @@ -34,10 +39,10 @@ Configuration::Configuration()
}
clearRegisteredKeywords();
registerPreloadKeys();
if (!converterFolder.empty() && fs::exists(fs::u8path(converterFolder + "/configuration.txt")))
if (!converterFolder.empty() && exists(converterFolder / "configuration.txt"))
{
Log(LogLevel::Info) << "Previous configuration located, preloading selections.";
parseFile(converterFolder + "/configuration.txt");
parseFile(converterFolder / "configuration.txt");
}
clearRegisteredKeywords();
}
Expand Down Expand Up @@ -172,12 +177,12 @@ bool Configuration::exportConfiguration() const
Log(LogLevel::Error) << "Converter folder is not set!";
return false;
}
if (!fs::exists(fs::u8path(converterFolder)))
if (!exists(converterFolder))
{
Log(LogLevel::Error) << "Could not find converter folder!";
return false;
}
std::ofstream confFile(fs::u8path(converterFolder + "/configuration.txt"));
std::ofstream confFile(converterFolder / "configuration.txt");
if (!confFile.is_open())
{
Log(LogLevel::Error) << "Could not open configuration.txt!";
Expand All @@ -186,13 +191,13 @@ bool Configuration::exportConfiguration() const

for (const auto& [requiredFolderName, folderPtr]: requiredFolders)
{
confFile << requiredFolderName << " = \"" << folderPtr->getValue() << "\"\n";
confFile << requiredFolderName << " = \"" << folderPtr->getValue().string() << "\"\n";
}
for (const auto& [requiredFileName, filePtr]: requiredFiles)
{
if (!filePtr->isOutputtable())
continue;
confFile << requiredFileName << " = \"" << filePtr->getValue() << "\"\n";
confFile << requiredFileName << " = \"" << filePtr->getValue().string() << "\"\n";
}

if (!autoGenerateModsFrom.empty())
Expand Down Expand Up @@ -226,22 +231,22 @@ bool Configuration::exportConfiguration() const
return true;
}

std::string Configuration::getSecondTailSource() const
path Configuration::getSecondTailSource() const
{
return converterFolder + "/log.txt";
return converterFolder / "log.txt";
}

void Configuration::clearSecondLog() const
{
std::ofstream clearSecondLog(converterFolder + "/log.txt");
std::ofstream clearSecondLog(converterFolder / "log.txt");
clearSecondLog.close();
}

void Configuration::autoLocateMods()
{
autolocatedMods.clear();
// Do we have a mod path?
std::string modPath;
path modPath;
for (const auto& filePtr: requiredFolders | std::views::values)
{
if (filePtr->getName() == autoGenerateModsFrom)
Expand All @@ -255,23 +260,19 @@ void Configuration::autoLocateMods()
// Does it exist?
if (!commonItems::DoesFolderExist(modPath))
{
Log(LogLevel::Warning) << "Mod path: " << modPath << " does not exist or can not be accessed!";
Log(LogLevel::Warning) << "Mod path: " << modPath.string() << " does not exist or can not be accessed!";
return;
}

// Are we looking at documents directory?
if (commonItems::DoesFolderExist(modPath + "/mod"))
modPath += "/mod";
if (commonItems::DoesFolderExist(modPath / "mod"))
modPath /= "mod";

// Are there mods inside?
std::vector<std::string> validModFiles;
std::vector<path> validModFiles;
for (const auto& file: commonItems::GetAllFilesInFolder(modPath))
{
const auto lastDot = file.find_last_of('.');
if (lastDot == std::string::npos)
continue;
const auto extension = file.substr(lastDot + 1, file.length() - lastDot - 1);
if (extension != "mod")
if (file.extension() != ".mod")
continue;
validModFiles.emplace_back(file);
}
Expand All @@ -284,17 +285,17 @@ void Configuration::autoLocateMods()

for (const auto& modFile: validModFiles)
{
FronterMod theMod(modPath + "/" + modFile);
FronterMod theMod(modPath / modFile);
if (theMod.getName().empty())
{
Log(LogLevel::Warning) << "Mod at " << modPath + "/" + modFile << " has no defined name, skipping.";
Log(LogLevel::Warning) << "Mod at " << (modPath / modFile).string() << " has no defined name, skipping.";
continue;
}
autolocatedMods.emplace_back(theMod);
}

// filter broken filenames from preloaded list.
std::set<std::string> modNames;
std::set<path> modNames;
for (const auto& mod: autolocatedMods)
modNames.insert(mod.getFileName());

Expand Down
Loading
Loading