Skip to content

Commit

Permalink
Add library type in contribution guide
Browse files Browse the repository at this point in the history
Signed-off-by: Uilian Ries <[email protected]>
  • Loading branch information
uilianries committed Jun 28, 2024
1 parent 073e161 commit a7d82d8
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 22 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/linux-clang-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ jobs:
-DUSE_SYSTEM_DEPENDENCIES:BOOL=ON \
-DUSE_STD_FORMAT:BOOL=ON \
-DCMAKE_TOOLCHAIN_FILE=build/Debug/generators/conan_toolchain.cmake \
-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld
- name: Build
run: cmake --build --preset=unixlike-clang-debug-${{ matrix.type }}
Expand All @@ -89,7 +88,7 @@ jobs:
run: ctest --preset=unixlike-clang-debug-${{ matrix.type }}

- name: Install
run: cmake --build --preset=unixlike-gcc-debug-${{ matrix.type }} --target install
run: cmake --build --preset=unixlike-clang-debug-${{ matrix.type }} --target install

- name: Examples
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/linux-gxx-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ jobs:
-DUSE_STD_FORMAT:BOOL=ON \
-DUSE_SYSTEM_DEPENDENCIES:BOOL=ON \
-DCMAKE_TOOLCHAIN_FILE=build/Debug/generators/conan_toolchain.cmake \
-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold
- name: Build
run: cmake --build --preset=unixlike-gcc-debug-${{ matrix.type }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/macos-clang-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DUSE_STD_FORMAT:BOOL=ON \
-DUSE_SYSTEM_DEPENDENCIES:BOOL=ON \
-DCMAKE_TOOLCHAIN_FILE=build/Debug/generators/conan_toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
-DCMAKE_TOOLCHAIN_FILE=build/Debug/generators/conan_toolchain.cmake
- name: Build
run: cmake --build --preset=unixlike-clang-debug-static
Expand All @@ -94,4 +93,4 @@ jobs:
run: ctest --preset=unixlike-clang-debug-static

- name: Install
run: cmake --build --preset=unixlike-gcc-debug-static --target install
run: cmake --build --preset=unixlike-clang-debug-static --target install
2 changes: 1 addition & 1 deletion .github/workflows/windows-msvc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Configure CMake
run: |
cmake -S . --preset=windows-msvc-debug-${{ matrix.type }} -G Ninja -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\build\Debug\generators\conan_toolchain.cmake -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=cl.exe -DBUILD_TESTING:BOOL=ON -DUSE_STD_FORMAT:BOOL=ON -DUSE_SYSTEM_DEPENDENCIES:BOOL=ON
cmake -S . --preset=windows-msvc-debug-${{ matrix.type }} -G Ninja -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\build\Debug\generators\conan_toolchain.cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=cl.exe -DBUILD_TESTING:BOOL=ON -DUSE_STD_FORMAT:BOOL=ON -DUSE_SYSTEM_DEPENDENCIES:BOOL=ON
- name: Build
run: cmake --build --preset=windows-msvc-debug-${{ matrix.type }}
Expand Down
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install/${presetName}",
"generator": "Ninja",
"cacheVariables": {
"USE_SYSTEM_DEPENDENCIES": "FALSE",
"USE_STD_FORMAT": "TRUE",
Expand Down
52 changes: 39 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,31 +107,37 @@ Follow the steps below to build the project:

```sh
cmake --list-presets
"unixlike-gcc-debug" - gcc Debug
"unixlike-gcc-release" - gcc Release
"unixlike-clang-debug" - clang Debug
"unixlike-clang-release" - clang Release
"windows-msvc-release" - msvc Release
"windows-msvc-release" - msvc Debug
"unixlike-gcc-debug-static" - Unixlike GCC Debug Static library
"unixlike-gcc-debug-shared" - Unixlike GCC Debug Shared library
"unixlike-gcc-release-static" - Unixlike GCC Release Static library
"unixlike-gcc-release-shared" - Unixlike GCC Release Shared library
"unixlike-clang-debug-static" - Unixlike Clang Debug Static library
"unixlike-clang-debug-shared" - Unixlike Clang Debug Shared library
"unixlike-clang-release-static" - Unixlike Clang Release Static library
"unixlike-clang-release-shared" - Unixlike Clang Release Shared library
"windows-msvc-debug-static" - Windows MSVC Debug Static library
"windows-msvc-debug-shared" - Windows MSVC Debug Shared library
"windows-msvc-release-static" - Windows MSVC Release Static library
"windows-msvc-release-shared" - Windows MSVC Release Shared library
```

For instance, if you are in Ubuntu and want to build using GCC in Debug mode, you should use the
preset `unixlike-gcc-debug`. The `unixlike-clang-` preset should work for both Linux and macOS when using the CLang
For instance, if you are in Ubuntu and want to build using GCC in Debug mode and static library (faker-cxx.a), you should use the
preset `unixlike-gcc-debug=static`. The `unixlike-clang-` preset should work for both Linux and macOS when using the CLang
compiler.

The `-S .` option in the following command specifies the source directory:

```sh
cmake -S . --preset unixlike-gcc-debug
cmake -S . --preset unixlike-gcc-debug-static
```

3. **Build the project:**

The following command generates the build files and compiles the project using the settings specified in
the `unixlike-gcc-debug` preset:
the `unixlike-gcc-debug-static` preset:

```sh
cmake --build --preset unixlike-gcc-debug
cmake --build --preset unixlike-gcc-debug-static
```

### Testing the Project
Expand All @@ -142,9 +148,29 @@ tests. Follow the steps below to test the project:
**1. Run the tests using the same preset:**

```sh
ctest --preset unixlike-gcc-debug
ctest --preset unixlike-gcc-debug-static
```

### Installing the Project

When wanting to install those generated artifacts like headers files and library, you can use CMake to operate as installer as well:

```sh
cmake --build --preset unixlike-gcc-debug-static --target install
```

By default, CMake will install in the subfolder `install` in the source folder.

In order to change the installation folder, you can use [CMAKE_INSTALL_PREFIX](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html) to configure the destination folder:

```sh
cmake -S . --preset unixlike-gcc-debug-static -DCMAKE_INSTALL_PREFIX=/opt/faker-cxx
cmake --build --preset unixlike-gcc-debug-static --target install
```

This configuration will install all artifacts in `/opt/faker-cxx`. The permission to write in the folder should be granted before executing the installation command.


## Submitting Changes

Once you've made your changes and ensured they adhere to the project's coding style and pass all tests, you can submit
Expand Down Expand Up @@ -186,7 +212,7 @@ PR titles are written in following convention: `type: subject`

**type** is required and indicates the intent of the PR

> The types `feat` and `fix` will be shown in the changelog as `### Features` or `### Bug Fixes`
> The types `feat` and `fix` will be shown in the changelog as `### Features` or `### Bug Fixes`

Allowed types are:

Expand Down

0 comments on commit a7d82d8

Please sign in to comment.