diff --git a/BUILD.md b/BUILD.md index 2d7dc6790..cd13e38ae 100644 --- a/BUILD.md +++ b/BUILD.md @@ -14,6 +14,12 @@ up builds. The minimum set of dependencies is: All other dependencies are optional and can be disabled while configuring the build (in `meson setup` step). +## General notes + +You can maintain several Meson build configurations using subdirectories, for +example, the **debug** and **release** configurations can reside in +`build/debug` and `build/release`, respectively. + ## OS-specific instructions Instructions in this article assume you're using Linux or BSD but will work @@ -67,7 +73,7 @@ is disabled by default. To enable it for Meson builds, set the `tracy` option to `true`: ``` shell -meson setup -Dtracy=true build/release-tracy build +meson setup -Dtracy=true build/release-tracy meson compile -C build/release-tracy ``` @@ -182,8 +188,8 @@ automatically. Build and run tests: ``` shell -meson setup -Dbuildtype=debug build -meson test -C build +meson setup -Dbuildtype=debug build/debug +meson test -C build/debug ``` ### Run unit tests (with user-supplied gtest sources) @@ -195,56 +201,54 @@ Place files described in `subprojects/gtest.wrap` file in `subprojects/packagecache/` directory, and then: ``` shell -meson setup -Dbuildtype=debug --wrap-mode=nodownload build -meson test -C build +meson setup -Dbuildtype=debug --wrap-mode=nodownload build/debug +meson test -C build/debug ``` Re-running a single GTest test over and over can be done with the below command; this can be very useful during development. ``` shell -meson compile -C build && ./build/tests/ +meson compile -C build/debug && ./build/debug/tests/ ``` To list the names of all GTest tests: ``` shell -meson test -C build --list | grep gtest +meson test -C build/debug --list | grep gtest ``` To run a single GTest test case: ``` shell -./build/tests/ --gtest_filter= +./build/debug/tests/ --gtest_filter= ``` Concrete example: ``` shell -./build/tests/bitops --gtest_filter=bitops.nominal_byte +./build/debug/tests/bitops --gtest_filter=bitops.nominal_byte ``` ### Build test coverage report -Prerequisites: +Prerequisite: Install Clang's `lcov` package and/or the GCC-equivalent `gcovr` package. + +Build and run the tests: ``` shell -# Fedora -sudo dnf install gcovr lcov +meson setup -Dbuildtype=debug -Db_coverage=true build/cov +meson compile -C build/cov +meson test -C build/cov ``` -Run tests and generate report: +Generate and view the coverage report: ``` shell -meson setup -Dbuildtype=debug -Db_coverage=true build -meson test -C build -meson compile -C build coverage-html -``` - -Open the report with your browser: - -``` shell -firefox build/meson-logs/coveragereport/index.html" +cd build/cov +ninja coverage-html +cd meson-logs/coveragereport +firefox index.html ``` ### Static analysis report @@ -263,8 +267,8 @@ sudo apt install clang-tools Build and generate report: ``` shell -meson setup -Dbuildtype=debug build -meson compile -C build scan-build +meson setup -Dbuildtype=debug build/debug +meson compile -C build/debug scan-build ``` ### Make a sanitizer build @@ -300,3 +304,4 @@ will leave your normal `build/` files untouched. Run the sanitizer binary as you normally would, then exit and look for sanitizer mesasge in the log output. If none exist, then your program is running clean. + diff --git a/README.md b/README.md index 1cda264e9..231ffdd9d 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,8 @@ sudo xbps-install -S SDL2-devel SDL2_image-devel SDL2_net-devel alsa-lib-devel \ ``` shell # macOS xcode-select --install -brew install ccache meson libpng sdl2 sdl2_image sdl2_net opusfile fluid-synth libslirp speexdsp +brew install cmake ccache meson libpng sdl2 sdl2_image sdl2_net opusfile \ + fluid-synth libslirp pkg-config python3 speexdsp ``` ### Build and stay up-to-date with the latest sources diff --git a/docs/build-macos.md b/docs/build-macos.md index 418faeabc..a86f099fa 100644 --- a/docs/build-macos.md +++ b/docs/build-macos.md @@ -5,21 +5,25 @@ or MacPorts package managers. We recommend using Homebrew and Clang, because Apple's Core SDKs can be used only with Apple's fork of Clang compiler. + ## Install Dependencies under macOS Before installing either Homebrew or MacPorts, the Apple's Xcode tools need to be installed and the license agreed to: + ## Xcode Installation 1. Install the command line tools: `xcode-select --install` and accept the license agreement + 2. Install software updates: **Apple menu** > **System Preferences** > **Software Update** > *"Updates are available: command line tools for Xcode"* Click **Update Now** to proceed. + 3. Install build dependencies using either Homebrew or MacPorts. ### Install dependencies (Homebrew) @@ -28,8 +32,8 @@ to be installed and the license agreed to: 2. Install dependencies and related tools: ``` shell - brew install ccache cmake libpng meson libslirp \ - opusfile pkg-config python3 sdl2 sdl2_net speexdsp + brew install cmake ccache meson libpng sdl2 sdl2_image sdl2_net opusfile \ + fluid-synth libslirp pkg-config python3 speexdsp ``` 3. Add brew to your shell path: @@ -45,9 +49,9 @@ to be installed and the license agreed to: 2. Install dependencies and related tools: ``` shell - sudo port -q install ccache cmake fluidsynth libpng libsdl2 \ - libsdl2_net meson opusfile pkgconfig python310 \ - libslirp speexdsp + sudo port -q install cmake ccache meson libpng libsdl2 \ + libsdl2_image libsdl2_net opusfile fluidsynth libslirp \ + pkgconfig python310 speexdsp ``` ## Build @@ -62,11 +66,12 @@ cd src git clone https://github.com/dosbox-staging/dosbox-staging.git cd dosbox-staging meson setup build -ninja -C build +meson compile -C build ``` See more build options in [BUILD.md](/BUILD.md). + ## Permissions and Running 1. Allow the terminal to get keyboard events, which will let you @@ -80,4 +85,3 @@ See more build options in [BUILD.md](/BUILD.md). cd src/dosbox-staging/ ./build/dosbox ``` - diff --git a/docs/build-windows.md b/docs/build-windows.md index dd12ed159..3f289c327 100644 --- a/docs/build-windows.md +++ b/docs/build-windows.md @@ -5,6 +5,7 @@ Windows builds can be created using: - The Clang or GCC compilers using the Meson buildsystem running within the MSYS2 environment to provide dependencies. + ## Build using Visual Studio 1. Install Visual Studio Community 2019: . @@ -19,9 +20,10 @@ you build a binary optimized for gaming. 1. Edit `src\platform\visualc\config.h` and enable `C_DEBUG` and optionally `C_HEAVY_DEBUG` by setting them to `1` instead of `0`. - + 2. Select a **Release** build type in Visual Studio, and run the build. + ## Build using MSYS2 1. Install MSYS2: @@ -82,7 +84,6 @@ you build a binary optimized for gaming. meson compile -C build/release-clang ``` - 10. Create a package of the binary and DLLs to a destination directory: ``` shell