Skip to content

Commit

Permalink
Merge pull request #85 from oblivioncth/fp13_compat
Browse files Browse the repository at this point in the history
Move to FP13 compatibility
  • Loading branch information
oblivioncth authored Jul 14, 2024
2 parents 1bae49d + ed26160 commit fd61336
Show file tree
Hide file tree
Showing 22 changed files with 323 additions and 171 deletions.
68 changes: 25 additions & 43 deletions .github/workflows/build-clifp-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,15 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
compiler: [clang]
lib_linkage: [shared, static]
include:
- os: ubuntu-20.04
compiler: clang
c_comp: clang-12
cxx_comp: clang++-12
qt_comp: clang12
- os: ubuntu-22.04
compiler: gcc
c_comp: gcc-12
cxx_comp: g++-12
qt_comp: clang14
lib_linkage: shared
- os: ubuntu-22.04
compiler: gcc
c_comp: gcc-12
cxx_comp: g++-12
qt_comp: clang14
lib_linkage: static
- os: ubuntu-22.04
compiler: clang
c_comp: clang-14
cxx_comp: clang++-14
qt_comp: clang14
- lib_linkage: shared
cmake_bsl: ON
- lib_linkage: static
cmake_bsl: OFF
compiler: [{c: gcc-12, cxx: g++-12, qt: clang14}, {c: clang-12, cxx: clang++-12, qt: clang12}, {c: clang-14, cxx: clang++-14, qt: clang14}]
linkage: [{type: shared, cmake_bsl: ON}, {type: static, cmake_bsl: OFF}]
exclude:
- os: ubuntu-20.04
compiler: {c: gcc-12, cxx: g++-12, qt: clang14}
- os: ubuntu-20.04
compiler: {c: clang-14, cxx: clang++-14, qt: clang14}
- os: ubuntu-22.04
compiler: {c: clang-12, cxx: clang++-12, qt: clang12}
runs-on: ${{ matrix.os }}
env:
cmake_gen: Ninja Multi-Config
Expand All @@ -60,21 +40,14 @@ jobs:
- name: Install Qt (custom build)
uses: oblivioncth/actions/general/install-and-cache-qt-from-ffynnon@dev
with:
version: 6.6.0
version: 6.7.2
os: linux
compiler: ${{ matrix.qt_comp }}
linkage: ${{ matrix.lib_linkage }}
compiler: ${{ matrix.compiler.qt }}
linkage: ${{ matrix.linkage.type }}
path: ${{ env.qt_install_dir }}
credentials: ${{ secrets.qt_ffynnon_cred }}
- name: Update package index
run: sudo apt-get update
- name: WORKAROUND FOR https://github.com/actions/runner-images/issues/8659
if: matrix.os == 'ubuntu-22.04'
run: |
echo "TEMPORARY WORKAROUND FOR GITHUB RUNNER BUG #8659\n\nRemoving GCC 13 as it breaks Clang14"
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list
sudo apt-get update
sudo apt-get install -y --allow-downgrades libc6=2.35-0ubuntu3.4 libc6-dev=2.35-0ubuntu3.4 libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04
- name: Install OpenGL lib
run: sudo apt-get install libglu1-mesa-dev
- name: Install XCB Related libs
Expand All @@ -90,16 +63,25 @@ jobs:
run: sudo apt-get install libegl1-mesa-dev
- name: Install Wayland
run: sudo apt-get install libwayland-dev
- name: Install DBus [22.04]
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get install libdbus-1-dev
- name: Install libzstd-dev
run: sudo apt-get install libzstd-dev
- name: Install libdbus-1-dev
run: sudo apt-get install libdbus-1-dev
- name: Install libbrotli-dev
run: sudo apt-get install libbrotli-dev
- name: Checkout CLIFp
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ${{ env.clifp_src_suffix }}
fetch-depth: 0 # Required for verbose versioning to work correctly
- name: Build/Install CLIFp
working-directory: ${{ env.clifp_src_dir }}
run: |
echo Configuring CMake...
"$qt_cmake" -G "$cmake_gen" -S "$clifp_src_dir" -B "$clifp_build_dir" -D BUILD_SHARED_LIBS="${{ matrix.cmake_bsl }}" -D CMAKE_CXX_COMPILER="${{ matrix.cxx_comp }}" -D CMAKE_C_COMPILER="${{ matrix.c_comp }}"
"$qt_cmake" -G "$cmake_gen" -S "$clifp_src_dir" -B "$clifp_build_dir" -D BUILD_SHARED_LIBS="${{ matrix.linkage.cmake_bsl }}" -D CMAKE_CXX_COMPILER="${{ matrix.compiler.cxx }}" -D CMAKE_C_COMPILER="${{ matrix.compiler.c }}"
echo Changing to build directory...
cd "$clifp_build_dir"
echo Building CLIFp Release...
Expand All @@ -112,10 +94,10 @@ jobs:
- name: Get CLIFp artifact name
run: |
cpack_name=$(find "${{ env.clifp_package_path }}" -type f -name "*.zip")
artifact_name="$(basename "$cpack_name" .zip) [${{ matrix.cxx_comp }}]"
artifact_name="$(basename "$cpack_name" .zip) [${{ matrix.compiler.cxx }}]"
echo "current_artifact_name=$artifact_name" >> $GITHUB_ENV
- name: Upload CLIFp build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.current_artifact_name }}
path: ${{ env.clifp_install_path }}
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/build-clifp-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
lib_linkage: [shared, static]
include:
- lib_linkage: shared
cmake_bsl: ON
- lib_linkage: static
cmake_bsl: OFF
linkage: [{type: shared, cmake_bsl: ON}, {type: static, cmake_bsl: OFF}]
runs-on: windows-latest
env:
vs_dir: C:/Program Files/Microsoft Visual Studio/2022/Enterprise
Expand All @@ -37,14 +32,14 @@ jobs:
- name: Install Qt (custom build)
uses: oblivioncth/actions/general/install-and-cache-qt-from-ffynnon@dev
with:
version: 6.6.0
version: 6.7.2
os: windows
compiler: msvc2022
linkage: ${{ matrix.lib_linkage }}
linkage: ${{ matrix.linkage.type }}
path: ${{ env.qt_install_dir }}
credentials: ${{ secrets.qt_ffynnon_cred }}
- name: Checkout CLIFp
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ${{ env.clifp_src_suffix }}
fetch-depth: 0 # Required for verbose versioning to work correctly
Expand All @@ -55,7 +50,7 @@ jobs:
echo "Setup C++ Build Environment..."
CALL "${{ env.vs_dir }}\Common7\Tools\VsDevCmd.bat" -arch=amd64
echo "Configure CMake using Qt wrapper..."
CALL "${{ env.qt_cmake }}" -G "${{ env.cmake_gen }}" -S "${{ env.clifp_src_dir}}" -B "${{ env.clifp_build_dir }}" -D BUILD_SHARED_LIBS=${{ matrix.cmake_bsl }}
CALL "${{ env.qt_cmake }}" -G "${{ env.cmake_gen }}" -S "${{ env.clifp_src_dir}}" -B "${{ env.clifp_build_dir }}" -D BUILD_SHARED_LIBS=${{ matrix.linkage.cmake_bsl }}
echo "Changing to build directory..."
cd "%clifp_build_dir%"
echo "Building CLIFp release..."
Expand All @@ -70,7 +65,7 @@ jobs:
$artifact_name=$((Get-ChildItem -Path "${{ env.clifp_package_path }}" -Filter *.zip)[0].BaseName) + ' [msvc]'
echo "current_artifact_name=$artifact_name" >> $Env:GITHUB_ENV
- name: Upload CLIFp build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.current_artifact_name }}
path: ${{ env.clifp_install_path }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/master-pull-request-merge-reaction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v1
with:
Expand All @@ -100,7 +100,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download built CLIFp artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ${{ env.artifacts_path }}
- name: Zip up release artifacts
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ Thumbs.db
# Python byte code
*.pyc

# Build within source
/build

# Binaries
# --------
*.dll
Expand Down
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ project(CLIFp

# Get helper scripts
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FetchOBCMake.cmake)
fetch_ob_cmake("v0.3.4")
fetch_ob_cmake("2356fb3e6f2d5710045cd9dbe66187856418d8ca")

# Initialize project according to standard rules
include(OB/Project)
ob_standard_project_setup()

# Additional Project Variables
set(PROJECT_FORMAL_NAME "CLI Flashpoint")
set(TARGET_FP_VERSION_PREFIX 12.1)
set(TARGET_FP_VERSION_PREFIX 13.0)

# Configuration options
# Handled by fetched libs, but set this here formally since they aren't part of the main project
Expand All @@ -44,12 +44,17 @@ endif()
# Import Qt
set(CLIFP_QT_COMPONENTS
Core
Core5Compat
Gui
Widgets
Sql
Network
)

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
list(APPEND CLIFP_QT_COMPONENTS WaylandClient) # To enable wayland support
endif()

# Find Qt package
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x060000)
find_package(Qt6 REQUIRED COMPONENTS ${CLIFP_QT_COMPONENTS})
Expand All @@ -72,14 +77,14 @@ endif()

include(OB/FetchQx)
ob_fetch_qx(
REF "v0.5.6"
REF "5dc3b3440442408456a867eb901185e5a281d4af"
COMPONENTS
${CLIFP_QX_COMPONENTS}
)

# Fetch libfp (build and import from source)
include(OB/Fetchlibfp)
ob_fetch_libfp("v0.5.2")
ob_fetch_libfp("086051bca750adac3178a86fc47b61f1770d8b40")

# Fetch QI-QMP (build and import from source)
include(OB/FetchQI-QMP)
Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Other than a few pop-up dialogs used for alerts and errors, CLIFp runs completel

## Quickstart

Download the latest **static** [release](https://github.com/oblivioncth/CLIFp/releases) that's appropriate for your system and place it in the root of your Flashpoint directory.
Download the latest [release](https://github.com/oblivioncth/CLIFp/releases) that's appropriate for your system (see [Release Builds](#release-builds) for guidance on that) and place it in the root of your Flashpoint directory.

Play a game:

Expand Down Expand Up @@ -304,4 +304,31 @@ The functionality of the tray icon may be expanded upon in future releases.
- [OBCMake](https://github.com/oblivioncth/OBCmake)

### Details
The source for this project is managed by a sensible CMake configuration that allows for straightforward compilation and consumption of its target(s), either as a sub-project or as an imported package. All required dependencies except for Qt6 are automatically acquired via CMake's FetchContent mechanism.
The source for this project is managed by a sensible CMake configuration that allows for straightforward compilation and consumption of its target(s), either as a sub-project or as an imported package. All required dependencies except for Qt6 are automatically acquired via CMake's FetchContent mechanism.

## Release Builds
For guidance on which release build is likely best for your system, compare your system to the table below and try whichever is most comparable to yours in the order shown. The compiler used is somewhat arbitrary, so equivalent compilers are combined in the table. If one build type with a given compiler does not work for you it's unlikely the other listed as part of the same line will, but you can try it if you want.

| System | Builds |
| ----------------------------------------- | ------------------------------------------------------------------------ |
| Windows | 1) Windows Static <br> 2) Windows Shared |
| Ubuntu 24.04, Ubuntu 22.02, Arch, SteamOS | 1) Linux Static Clang++14/GCC++12 <br> 2) Linux Shared Clang++14/GCC++12 |
| Ubuntu 20.04 | 1) Linux Static Clang++12 <br> 2) Linux Shared Clang++12 |

Note that for shared builds, you must place the entire directory structure of the release in your Flashpoint folder and run CLIFp from within it's bin directory, like so:
```
Flashpoint/
├── CLIFp/
│ ├── bin/
│ │ └── clifp.exe
│ ├── cmake
│ ├── LICENSE
│ ├── README.md
│ └── ...
├── version.txt
├── preferences.json
└── ...
```
For static builds you can simply take the CLIFp executable out of the bin directory and place it directly in your Flashpoint folder.

Remember these are just guidelines. Ultimately use whichever build you like, or build CLIFp yourself.
4 changes: 2 additions & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ set(CLIFP_SOURCE
tools/blockingprocessmanager.cpp
tools/deferredprocessmanager.h
tools/deferredprocessmanager.cpp
tools/mounter_proxy.h
tools/mounter_proxy.cpp
tools/mounter_game_server.h
tools/mounter_game_server.cpp
tools/mounter_qmp.h
tools/mounter_qmp.cpp
tools/mounter_router.h
Expand Down
13 changes: 11 additions & 2 deletions app/src/command/c-download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ Qx::Error CDownload::perform()
const Fp::Toolkit* tk = mCore.fpInstall().toolkit();
for(const auto& pg : pItr->playlistGames())
{
/* TODO: This doesn't handle Game Redirects, i.e. if one ID on a playlist becomes a redirect entry in the future.
* Either need to add redirects here, or implement them in the DB module of libfp (full implementation).
*/

// Get data
Fp::GameData gameData;
if(Fp::DbError gdErr = db->getGameData(gameData, pg.gameId()); gdErr.isValid())
Expand All @@ -92,8 +96,13 @@ Qx::Error CDownload::perform()
if(tk->datapackIsPresent(gameData))
continue;

// Queue download
downloadTask->addFile({.target = tk->datapackUrl(gameData), .dest = tk->datapackPath(gameData), .checksum = gameData.sha256()});
// Queue download, if possible
TDownloadError packError = downloadTask->addDatapack(tk, &gameData);
if(packError.isValid())
{
postError(packError);
return packError;
}

// Note data id
dataIds.append(gameData.id());
Expand Down
4 changes: 2 additions & 2 deletions app/src/command/c-play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Qx::Error CPlay::enqueueAdditionalApp(const Fp::AddApp& addApp, const QString& p
TExec* addAppTask = new TExec(&mCore);
addAppTask->setIdentifier(addApp.name());
addAppTask->setStage(taskStage);
addAppTask->setExecutable(addAppPathInfo.canonicalFilePath());
addAppTask->setExecutable(QDir::cleanPath(addAppPathInfo.absoluteFilePath())); // Like canonical but doesn't care if path DNE
addAppTask->setDirectory(addAppPathInfo.absoluteDir());
addAppTask->setParameters(addApp.launchCommand());
addAppTask->setEnvironment(mCore.childTitleProcessEnvironment());
Expand Down Expand Up @@ -272,7 +272,7 @@ Qx::Error CPlay::enqueueGame(const Fp::Game& game, const Fp::GameData& gameData,
TExec* gameTask = new TExec(&mCore);
gameTask->setIdentifier(game.title());
gameTask->setStage(taskStage);
gameTask->setExecutable(gamePathInfo.canonicalFilePath());
gameTask->setExecutable(QDir::cleanPath(gamePathInfo.absoluteFilePath())); // Like canonical but doesn't care if path DNE
gameTask->setDirectory(gamePathInfo.absoluteDir());
gameTask->setParameters(!gameData.isNull() ? gameData.launchCommand() : game.launchCommand());
gameTask->setEnvironment(mCore.childTitleProcessEnvironment());
Expand Down
4 changes: 2 additions & 2 deletions app/src/command/c-run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Qx::Error CRun::perform()
TExec* runTask = new TExec(&mCore);
runTask->setIdentifier(NAME + u" program"_s);
runTask->setStage(Task::Stage::Primary);
runTask->setExecutable(inputInfo.canonicalFilePath());
runTask->setDirectory(inputInfo.canonicalPath());
runTask->setExecutable(QDir::cleanPath(inputInfo.absoluteFilePath())); // Like canonical but doesn't care if path DNE
runTask->setDirectory(inputInfo.absolutePath());
runTask->setParameters(mParser.value(CL_OPTION_PARAM));
runTask->setEnvironment(mCore.childTitleProcessEnvironment());
runTask->setProcessType(TExec::ProcessType::Blocking);
Expand Down
4 changes: 4 additions & 0 deletions app/src/command/title-command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ Qx::Error TitleCommand::getTitleId(QUuid& id)
postError(err);
return err;
}
QUuid origId = titleId;
titleId = mCore.fpInstall().database()->handleGameRedirects(titleId); // Redirect shortcut
if(titleId != origId)
logEvent(LOG_EVENT_GAME_REDIRECT.arg(origId.toString(QUuid::WithoutBraces), titleId.toString(QUuid::WithoutBraces)));
}
else if(mParser.isSet(CL_OPTION_TITLE) || mParser.isSet(CL_OPTION_TITLE_STRICT))
{
Expand Down
1 change: 1 addition & 0 deletions app/src/command/title-command.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class TitleCommand : public Command
static inline const QString LOG_EVENT_SEL_RAND = u"Selecting a playable title at random..."_s;
static inline const QString LOG_EVENT_INIT_RAND_ID = u"Randomly chose primary title is \"%1\""_s;
static inline const QString LOG_EVENT_INIT_RAND_PLAY_ADD_COUNT = u"Chosen title has %1 playable additional-apps"_s;
static inline const QString LOG_EVENT_GAME_REDIRECT = u"Game redirected: %1 -> %2"_s;
static inline const QString LOG_EVENT_RAND_DET_PRIM = u"Selected primary title"_s;
static inline const QString LOG_EVENT_RAND_DET_ADD_APP = u"Selected additional-app \"%1\""_s;
static inline const QString LOG_EVENT_RAND_GET_INFO = u"Querying random game info..."_s;
Expand Down
Loading

0 comments on commit fd61336

Please sign in to comment.