Skip to content

Commit dc68db8

Browse files
committed
Enable unity builds
1 parent b1f3d86 commit dc68db8

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Build with CMake
4444
run: |
45-
cmake dynadjust -DBUILD_TESTING=OFF
45+
cmake dynadjust -DBUILD_TESTING=OFF -DUSE_UNITY_BUILD=ON
4646
make -j2
4747
ls -la bin/
4848
@@ -92,7 +92,7 @@ jobs:
9292
- name: Build with CMake
9393
run: |
9494
source /opt/intel/oneapi/setvars.sh
95-
cmake dynadjust -DUSE_MKL=ON -DBUILD_TESTING=OFF
95+
cmake dynadjust -DUSE_MKL=ON -DBUILD_TESTING=OFF -DUSE_UNITY_BUILD=ON
9696
make -j2
9797
ls -la bin/
9898
@@ -143,7 +143,7 @@ jobs:
143143
144144
- name: Build with CMake
145145
run: |
146-
cmake -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF dynadjust
146+
cmake -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DUSE_UNITY_BUILD=ON dynadjust
147147
make -j2
148148
ls -la bin/
149149
@@ -179,7 +179,7 @@ jobs:
179179

180180
- name: Build with CMake
181181
run: |
182-
cmake dynadjust -DBUILD_TESTING=OFF
182+
cmake dynadjust -DBUILD_TESTING=OFF -DUSE_UNITY_BUILD=ON
183183
make -j2 VERBOSE=1
184184
ls -la bin/
185185
@@ -204,7 +204,7 @@ jobs:
204204

205205
- name: Build with CMake
206206
run: |
207-
cmake -DBUILD_STATIC=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release dynadjust
207+
cmake -DBUILD_STATIC=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DUSE_UNITY_BUILD=ON dynadjust
208208
make -j2 VERBOSE=1
209209
ls -la bin/
210210

dynadjust/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ option(ILP64 "Use ILP64 interface (64-bit matrix indexing) for BLAS and LAPACK"
99

1010
# Build optimization options
1111
option(USE_PRECOMPILED_HEADERS "Use precompiled headers to speed up compilation" ON)
12+
option(USE_UNITY_BUILD "Use unity builds to speed up compilation" OFF)
1213

1314
# Enable precompiled headers
1415
set(CMAKE_DISABLE_PRECOMPILE_HEADERS OFF)
1516

17+
# Enable unity builds if requested
18+
if(USE_UNITY_BUILD)
19+
set(CMAKE_UNITY_BUILD ON)
20+
set(CMAKE_UNITY_BUILD_BATCH_SIZE 16)
21+
message(STATUS "Unity builds enabled (batch size: ${CMAKE_UNITY_BUILD_BATCH_SIZE})")
22+
endif()
23+
1624
# Fix Boost 1.70+ issue with CMake 3.14+
1725
if(POLICY CMP0167)
1826
cmake_policy(SET CMP0167 NEW)

0 commit comments

Comments
 (0)