From b5ae3805b0b1c4299dd52670694da0339438e245 Mon Sep 17 00:00:00 2001 From: thomz12 Date: Sat, 19 Sep 2026 11:51:24 +0200 Subject: [PATCH] Quick readme, only include gtest when testing is enabled. --- CMakeLists.txt | 7 +++++-- CMakePresets.json | 11 ++++++++++- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a8ba54..4361b08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,10 @@ project(juiceboy ) include(CTest) -find_package(GTest CONFIG REQUIRED) -include(GoogleTest) + +if (BUILD_TESTING) + find_package(GTest CONFIG REQUIRED) + include(GoogleTest) +endif () add_subdirectory(juiceboy) \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index eb36757..0d8bf60 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -18,7 +18,16 @@ "name": "debug", "displayName": "Debug", "inherits": "base", - "generator": "Ninja" + "generator": "Ninja", + "cacheVariables": { + "BUILD_TESTING": "ON" + } + } + ], + "buildPresets": [ + { + "name": "debug", + "configurePreset": "debug" } ] } \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6a6432a --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Juice Boy + +This is my first attempt at writing an emulator of any kind. It's mostly for me to learn about emulation. + +This project is written in `C++23` and uses `CMake` and `vcpkg`. + +## Building + +These steps describe the intended way of building. It should, however, be possible to not use presets or vcpkg to build. + +### Prerequisites + +- A build system that [can be generated](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#id9) + with [CMake](https://cmake.org/). +- A `C++23` compatible compiler. +- [vcpkg](https://vcpkg.io/en/) installed and + `VCPKG_ROOT` [environment variable set](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-bash). + +### Configure & Compile + +Most IDEs should pick up on the CMakePresets.json file and be able to do everything for you. + +If you want to manually generate and build without an IDE, you can still use the presets: + +``` +cmake --preset debug +cmake --build --preset debug +``` + +There will be more presets for most platforms in the future. + +## Testing + +Eventually testing against test ROMs would be ideal, but until then you can run the unit tests. + +``` +ctest --build-dir +``` + +Disable building tests by setting `ENABLE_TESTING` to `OFF`.