Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMakePreset and README instructions for using a full MSYS2 and MinGW Build #83

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(CMAKE_AUTOUIC ON)

find_package(SDL2 REQUIRED)
find_package(spdlog REQUIRED)
find_package(Qt6 6.7 REQUIRED COMPONENTS Quick Gui OpenGL QuickControls2 Quick3D Sql Charts QuickTest Multimedia REQUIRED)
find_package(Qt6 6.7 REQUIRED COMPONENTS Quick Gui OpenGL QuickControls2 Quick3D Sql Charts QuickTest Multimedia Svg REQUIRED)
find_package(cpr REQUIRED)
find_package(GTest REQUIRED)
find_package(nlohmann_json REQUIRED)
Expand Down Expand Up @@ -169,6 +169,7 @@ target_link_libraries(firelight_lib PUBLIC
Qt6::QuickTest
Qt6::Multimedia
Qt6::GuiPrivate
Qt6::Svg
# PkgConfig::FFMPEG
${FFMPEG_LIBRARIES}
LibArchive::LibArchive
Expand Down Expand Up @@ -247,6 +248,10 @@ file(COPY ${CMAKE_SOURCE_DIR}/assets/nope.wav DESTINATION ${CMAKE_BINARY_DIR}/sy
file(COPY ${CMAKE_SOURCE_DIR}/assets/openquick.wav DESTINATION ${CMAKE_BINARY_DIR}/system/sfx)
file(COPY ${CMAKE_SOURCE_DIR}/assets/closequick.wav DESTINATION ${CMAKE_BINARY_DIR}/system/sfx)
file(COPY ${CMAKE_SOURCE_DIR}/assets/menumove.wav DESTINATION ${CMAKE_BINARY_DIR}/system/sfx)
file(COPY ${CMAKE_SOURCE_DIR}/assets/startgame.wav DESTINATION ${CMAKE_BINARY_DIR}/system/sfx)
file(COPY ${CMAKE_SOURCE_DIR}/assets/defaultnotification.wav DESTINATION ${CMAKE_BINARY_DIR}/system/sfx)
file(COPY ${CMAKE_SOURCE_DIR}/assets/switchon.wav DESTINATION ${CMAKE_BINARY_DIR}/system/sfx)
file(COPY ${CMAKE_SOURCE_DIR}/assets/switchoff.wav DESTINATION ${CMAKE_BINARY_DIR}/system/sfx)

enable_testing()
include(GoogleTest)
Expand Down
20 changes: 20 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
{
"version": 6,
"configurePresets": [
{
"name": "debug-full-mingw",
"displayName": "Debug-Full-MinGW",
"binaryDir": "build/debug",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"VCPKG_LIBRARY_LINKAGE": "static",
"VCPKG_DISABLE_COMPILER_TRACKING": "ON",
"VCPKG_TARGET_TRIPLET": "x64-mingw-dynamic",
"VCPKG_HOST_TRIPLET": "x64-mingw-dynamic"
},
"environment": {
"VCPKG_DEFAULT_TRIPLET": "x64-mingw-dynamic",
"VCPKG_DEFAULT_HOST_TRIPLET": "x64-mingw-dynamic",
"VCPKG_DEFAULT_TARGET_TRIPLET": "x64-mingw-dynamic"
}
},
{
"name": "debug",
"displayName": "Debug",
Expand Down
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,34 @@ Here are the things you need to build the application:
- spdlog
- GTest (currently required even without running tests, but this will be fixed later)

#### Recommended Windows setup

I HIGHLY RECOMMEND YOU FOLLOW THIS GUIDE: https://github.com/HO-COOH/CPPDevOnWindows

I recommend using MSYS2 on Windows and using pacboy to install the libraries. I don't currently have any platforms
other than that, so unfortunately I can't help you yet :-(
#### Recommended Windows setup using MinGW

1) Follow this guide to download MSYS2 https://github.com/HO-COOH/CPPDevOnWindows
2) Open MSYS2 and install the following using pacman:
```
examples soon sry
pacman -S mingw-w64-x86_64-clang
pacman -S mingw-w64-x86_64-ninja
pacman -S mingw-w64-x86_64-gdb
pacman -S mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-qt6-base
pacman -S mingw-w64-x86_64-qt6-tools
pacman -S mingw-w64-x86_64-qt6-multimedia
pacman -S mingw-w64-x86_64-qt6-declarative
pacman -S mingw-w64-x86_64-qt6-quick3d
pacman -S mingw-w64-x86_64-qt6-charts
pacman -S mingw-w64-x86_64-qt6-svg
pacman -S mingw-w64-x86_64-spdlog
pacman -S mingw-w64-x86_64-cpr
pacman -S mingw-w64-x86_64-gtest
pacman -S mingw-w64-x86_64-nlohmann-json
```
3) In Windows, edit your PATH environment variable to add your MinGW MSYS2 Path (should be similar to C:\msys64\mingw64\bin)
4) In your preferred IDE (CLion is what we used), use the debug-full-mingw CMakePreset to run cmake.
5) Run the build and start firelight.exe
6) ***IMPORTANT*** - If you get a white screen:
- Go to Graphics Settings in Windows
- Add Firelight.exe
- Instruct it to use your graphics card

[//]: # (### Installing)

Expand Down
3 changes: 3 additions & 0 deletions src/app/db/sqlite_content_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ namespace firelight::db {
}

std::vector<Mod> SqliteContentDatabase::getAllMods() {
if (!tableExists("mods")) {
return {};
}
QSqlQuery query(getDatabase());
query.prepare("SELECT * FROM mods");

Expand Down
2 changes: 1 addition & 1 deletion src/app/rcheevos/ra_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ namespace firelight::achievements {
const auto size = rc_client_progress_size(m_client);
if (state.size() != size) {
// TODO: Handle this better. Do we need to reset?
printf("State size mismatch: %lu != %llu\n", state.size(), size);
printf("State size mismatch: %llu != %llu\n", state.size(), size);
return;
}

Expand Down