Skip to content

Commit 0675b2e

Browse files
Merge pull request #189 from cjee21/precomp
CMake: Enable using precompiled header
2 parents 073f297 + bd585a2 commit 0675b2e

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/ZenLib_Checks.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
CXXFLAGS: -Werror
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v5
16+
uses: actions/checkout@v6
1717
- name: Dependencies
1818
run: |
1919
if [ "$RUNNER_OS" == "macOS" ]; then
@@ -47,7 +47,7 @@ jobs:
4747
fail-fast: false
4848
steps:
4949
- name: Checkout ZenLib
50-
uses: actions/checkout@v5
50+
uses: actions/checkout@v6
5151
with:
5252
path: ZenLib
5353
- name: Add msbuild to PATH
@@ -57,6 +57,29 @@ jobs:
5757
- name: Build
5858
run: msbuild -p:Configuration=Release -p:Platform=${{ matrix.architecture }} ${{ github.workspace }}\ZenLib\Project\MSVC2022\ZenLib_MSVC.sln -verbosity:quiet -warnaserror
5959

60+
CMake:
61+
strategy:
62+
matrix:
63+
include:
64+
- runner: windows-latest
65+
CXXFLAGS: "/std:c++20 /WX /MP"
66+
- runner: ubuntu-latest
67+
CXXFLAGS: "-Werror"
68+
- runner: macos-latest
69+
CXXFLAGS: "-Werror"
70+
fail-fast: false
71+
name: CMake (${{ matrix.runner }})
72+
runs-on: ${{ matrix.runner }}
73+
env:
74+
CXXFLAGS: ${{ matrix.CXXFLAGS }}
75+
steps:
76+
- name: Checkout ZenLib
77+
uses: actions/checkout@v6
78+
- name: Configure CMake project
79+
run: cmake -S Project/CMake -B build -DCMAKE_BUILD_TYPE=Release
80+
- name: Build CMake project
81+
run: cmake --build build ${{ runner.os == 'Windows' && '--config Release' || '-j4' }}
82+
6083
MinGW:
6184
runs-on: windows-latest
6285
strategy:
@@ -73,7 +96,7 @@ jobs:
7396
CXXFLAGS: -Werror
7497
steps:
7598
- name: Checkout ZenLib
76-
uses: actions/checkout@v5
99+
uses: actions/checkout@v6
77100
- name: Setup MSYS2 environment
78101
uses: msys2/setup-msys2@v2
79102
with:

Project/CMake/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ else()
125125
set(ZenLib_Unicode "no")
126126
endif()
127127

128+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16")
129+
target_precompile_headers(zen PRIVATE "${ZenLib_SOURCES_PATH}/ZenLib/PreComp.h")
130+
endif()
131+
128132
FIND_PACKAGE(Threads)
129133
if(CMAKE_THREAD_LIBS_INIT)
130134
target_link_libraries(zen PUBLIC ${CMAKE_THREAD_LIBS_INIT})

0 commit comments

Comments
 (0)