Skip to content

Commit abb8e72

Browse files
authored
Merge pull request GeoscienceAustralia#301 from GeoscienceAustralia/dr-headers
Cleaning up headers to speed up compiling
2 parents ab330c1 + 371b926 commit abb8e72

File tree

106 files changed

+7125
-6401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+7125
-6401
lines changed

.github/workflows/build.yml

Lines changed: 194 additions & 165 deletions
Large diffs are not rendered by default.

.github/workflows/test.yml

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -71,33 +71,33 @@ jobs:
7171
if [ -f ctest_output.log ]; then
7272
# Find the line with "tests passed" and get everything from there to the end
7373
SUMMARY_LINE=$(grep -n "tests passed" ctest_output.log | head -1 | cut -d: -f1)
74-
74+
7575
if [ -n "$SUMMARY_LINE" ]; then
7676
# Get the first line (the summary line)
7777
FIRST_LINE=$(tail -n +$SUMMARY_LINE ctest_output.log | head -1)
7878
# Get the multiline summary from the tests passed line onwards
79-
SUMMARY_CONTENT=$(tail -n +$SUMMARY_LINE ctest_output.log | grep -v "Errors while" | tr '\n' '\a')
79+
SUMMARY_CONTENT=$(tail -n +$SUMMARY_LINE ctest_output.log | grep -v "Errors while running" | tr '\n' '\a')
8080
# Replace newlines with %0A for GitHub Actions annotation
8181
SUMMARY_CONTENT=$(echo "$SUMMARY_CONTENT" | tr '\a' '\n' | sed ':a;N;$!ba;s/\n/%0A/g')
82-
82+
8383
# Check if there are failed tests
8484
if grep -q "tests failed" ctest_output.log; then
8585
echo "::error title=Test results (openblas): $FIRST_LINE::$SUMMARY_CONTENT"
8686
else
8787
echo "::notice title=Test results (openblas): $FIRST_LINE::$SUMMARY_CONTENT"
8888
fi
8989
else
90-
echo "::error title=Test Error::Could not find test summary in ctest output"
90+
echo "::warning title=Test Warning::Could not find test summary in ctest output"
9191
fi
9292
else
93-
echo "::error title=Test Error::Could not find ctest output file"
93+
echo "::warning title=Test Warning::Could not find ctest output file"
9494
fi
9595
9696
ctest_linux_dyn_mkl:
9797
name: Build and run ctests on Linux (mkl)
9898
runs-on: ubuntu-latest
9999
env:
100-
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
100+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
101101
PKGS: >
102102
libxerces-c-dev xsdcxx libboost-program-options-dev gmt ghostscript lldb-18
103103
@@ -128,6 +128,8 @@ jobs:
128128
with:
129129
path: /opt/intel
130130
key: intel-oneapi-linux-${{ env.ONEAPI_HASH }}
131+
restore-keys: |
132+
intel-oneapi-linux-
131133
132134
- name: Install Intel OneAPI
133135
if: steps.cache-oneapi.outputs.cache-hit != 'true'
@@ -233,26 +235,26 @@ jobs:
233235
if [ -f ctest_output.log ]; then
234236
# Find the line with "tests passed" and get everything from there to the end
235237
SUMMARY_LINE=$(grep -n "tests passed" ctest_output.log | head -1 | cut -d: -f1)
236-
238+
237239
if [ -n "$SUMMARY_LINE" ]; then
238240
# Get the first line (the summary line)
239241
FIRST_LINE=$(tail -n +$SUMMARY_LINE ctest_output.log | head -1)
240242
# Get the multiline summary from the tests passed line onwards
241243
SUMMARY_CONTENT=$(tail -n +$SUMMARY_LINE ctest_output.log | grep -v "Errors while running" | tr '\n' '\a')
242244
# Replace newlines with %0A for GitHub Actions annotation
243245
SUMMARY_CONTENT=$(echo "$SUMMARY_CONTENT" | tr '\a' '\n' | sed ':a;N;$!ba;s/\n/%0A/g')
244-
246+
245247
# Check if there are failed tests
246248
if grep -q "tests failed" ctest_output.log; then
247249
echo "::error title=Test results (mkl): $FIRST_LINE::$SUMMARY_CONTENT"
248250
else
249251
echo "::notice title=Test results (mkl): $FIRST_LINE::$SUMMARY_CONTENT"
250252
fi
251253
else
252-
echo "::error title=Test Error::Could not find test summary in ctest output"
254+
echo "::warning title=Test Warning::Could not find test summary in ctest output"
253255
fi
254256
else
255-
echo "::error title=Test Error::Could not find ctest output file"
257+
echo "::warning title=Test Warning::Could not find ctest output file"
256258
fi
257259
258260
test_linux_mkl_binaries:
@@ -261,9 +263,9 @@ jobs:
261263
needs: [] # Don't depend on other test jobs
262264
env:
263265
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
264-
PKGS: >
265-
libxerces-c-dev xsdcxx libboost-program-options-dev
266-
266+
# PKGS: >
267+
# libxerces-c-dev xsdcxx libboost-program-options-dev
268+
267269
steps:
268270
- name: Show CPU information
269271
shell: bash
@@ -278,25 +280,26 @@ jobs:
278280
run: |
279281
echo ONEAPI_HASH=$(echo "${LINUX_BASEKIT_URL}" | md5sum | cut -f 1 -d" ") >> $GITHUB_ENV
280282
281-
- name: Install dependencies
282-
shell: bash
283-
run: |
284-
sudo apt-get update
285-
sudo apt-get install -y ${{ env.PKGS }}
283+
# - name: Install dependencies
284+
# shell: bash
285+
# run: |
286+
# sudo apt-get update
287+
# sudo apt-get install -y ${{ env.PKGS }}
286288

287289
- name: Cache Intel OneAPI
288290
id: cache-oneapi
289291
uses: actions/cache@v4
290292
with:
291293
path: /opt/intel
292-
key: intel-oneapi-linux-all-${{ env.ONEAPI_HASH }}
294+
key: intel-oneapi-linux-${{ env.ONEAPI_HASH }}
295+
restore-keys: |
296+
intel-oneapi-linux-
293297
294298
- name: Install Intel OneAPI
295299
if: steps.cache-oneapi.outputs.cache-hit != 'true'
296300
run: |
297301
curl -L $LINUX_BASEKIT_URL -o install.sh
298-
#sudo sh install.sh -a --action install --components intel.oneapi.lin.mkl.devel --eula=accept -s
299-
sudo sh install.sh -a --action install --eula=accept -s
302+
sudo sh install.sh -a --action install --components intel.oneapi.lin.mkl.devel --eula=accept -s
300303
301304
- name: Check branch name
302305
shell: bash
@@ -599,15 +602,15 @@ jobs:
599602
600603
test_windows_mkl_binaries:
601604
name: Test Windows MKL binaries from build workflow
602-
runs-on: windows-latest
605+
runs-on: windows-2025
603606
needs: [] # Don't depend on other test jobs
604607
env:
605608
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
606-
VCPKG_PACKAGES: boost-geometry boost-process boost-iostreams boost-spirit boost-system boost-program-options boost-interprocess xerces-c
609+
VCPKG_PACKAGES: boost-geometry boost-process boost-iostreams boost-spirit boost-program-options boost-interprocess xerces-c vcpkg-tool-ninja
607610
VCPKG_INSTALLATION_ROOT: "C:/vcpkg"
608611
VCPKG_BINARY_SOURCES: "clear"
609612
ONEAPI_VERSION: "2025.2"
610-
613+
611614
steps:
612615
- name: Show CPU information
613616
shell: powershell
@@ -626,14 +629,19 @@ jobs:
626629
uses: actions/cache@v4
627630
with:
628631
path: ${{ env.VCPKG_INSTALLATION_ROOT }}/installed
629-
key: vcpkg-${{ runner.os }}-${{ env.VCPKG_HASH }}
632+
key: vcpkg-${{ runner.os }}-mkl-${{ env.VCPKG_HASH }}
633+
restore-keys: |
634+
vcpkg-${{ runner.os }}-mkl-
635+
vcpkg-${{ runner.os }}-
630636
631637
- name: Cache Intel OneAPI
632638
id: cache-oneapi
633639
uses: actions/cache@v4
634640
with:
635641
path: C:\Program Files (x86)\Intel\oneAPI
636-
key: intel-oneapi-${{ env.ONEAPI_HASH }}
642+
key: intel-oneapi-windows-${{ env.ONEAPI_HASH }}
643+
restore-keys: |
644+
intel-oneapi-windows-
637645
638646
- name: Install vcpkg prerequisites
639647
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
@@ -781,14 +789,14 @@ jobs:
781789
782790
test_windows_openblas_binaries:
783791
name: Test Windows OpenBLAS binaries from build workflow
784-
runs-on: windows-latest
792+
runs-on: windows-2025
785793
needs: [] # Don't depend on other test jobs
786794
env:
787795
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
788-
VCPKG_PACKAGES: boost-geometry boost-process boost-iostreams boost-spirit boost-program-options boost-interprocess xerces-c openblas lapack-reference
796+
VCPKG_PACKAGES: boost-geometry boost-process boost-iostreams boost-spirit boost-program-options boost-interprocess xerces-c vcpkg-tool-ninja openblas lapack-reference
789797
VCPKG_INSTALLATION_ROOT: "C:/vcpkg"
790798
VCPKG_BINARY_SOURCES: "clear"
791-
799+
792800
steps:
793801
- name: Show CPU information
794802
shell: powershell
@@ -807,6 +815,9 @@ jobs:
807815
with:
808816
path: ${{ env.VCPKG_INSTALLATION_ROOT }}/installed
809817
key: vcpkg-${{ runner.os }}-openblas-${{ env.VCPKG_HASH }}
818+
restore-keys: |
819+
vcpkg-${{ runner.os }}-openblas-
820+
vcpkg-${{ runner.os }}-
810821
811822
- name: Install vcpkg prerequisites
812823
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
@@ -916,12 +927,12 @@ jobs:
916927
name: Build and run ctests on Windows (mkl)
917928
runs-on: windows-2025
918929
env:
919-
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
920-
VCPKG_PACKAGES: boost-geometry boost-process boost-iostreams boost-spirit boost-program-options boost-interprocess xerces-c
930+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
931+
VCPKG_PACKAGES: boost-geometry boost-process boost-iostreams boost-spirit boost-program-options boost-interprocess xerces-c vcpkg-tool-ninja
921932
VCPKG_INSTALLATION_ROOT: "C:/vcpkg"
922933
VCPKG_BINARY_SOURCES: "clear"
923934
ONEAPI_VERSION: "2025.2"
924-
935+
925936
steps:
926937

927938
- name: Show CPU information
@@ -941,14 +952,19 @@ jobs:
941952
uses: actions/cache@v4
942953
with:
943954
path: ${{ env.VCPKG_INSTALLATION_ROOT }}/installed
944-
key: vcpkg-${{ runner.os }}-${{ env.VCPKG_HASH }}
955+
key: vcpkg-${{ runner.os }}-mkl-${{ env.VCPKG_HASH }}
956+
restore-keys: |
957+
vcpkg-${{ runner.os }}-mkl-
958+
vcpkg-${{ runner.os }}-
945959
946960
- name: Cache Intel OneAPI
947961
id: cache-oneapi
948962
uses: actions/cache@v4
949963
with:
950964
path: C:\Program Files (x86)\Intel\oneAPI
951-
key: intel-oneapi-${{ env.ONEAPI_HASH }}
965+
key: intel-oneapi-windows-${{ env.ONEAPI_HASH }}
966+
restore-keys: |
967+
intel-oneapi-windows-
952968
953969
- name: Install vcpkg prerequisites
954970
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
@@ -1069,29 +1085,29 @@ jobs:
10691085
elif command -v sed &> /dev/null; then
10701086
sed -i.bak 's/\r$//' ctest_output.log 2>/dev/null || true
10711087
fi
1072-
1088+
10731089
# Find the line with "tests passed" and get everything from there to the end
10741090
SUMMARY_LINE=$(grep -n "tests passed" ctest_output.log 2>/dev/null | head -1 | cut -d: -f1)
1075-
1091+
10761092
if [ -n "$SUMMARY_LINE" ]; then
10771093
# Get the first line (the summary line)
10781094
FIRST_LINE=$(tail -n +$SUMMARY_LINE ctest_output.log | head -1)
10791095
# Get the multiline summary from the tests passed line onwards
10801096
SUMMARY_CONTENT=$(tail -n +$SUMMARY_LINE ctest_output.log | grep -v "Errors while running" | head -20)
10811097
# Replace newlines with %0A for GitHub Actions annotation
10821098
SUMMARY_CONTENT=$(echo "$SUMMARY_CONTENT" | sed ':a;N;$!ba;s/\n/%0A/g')
1083-
1099+
10841100
# Check if there are failed tests
10851101
if grep -q "tests failed" ctest_output.log; then
1086-
echo "::error title=Test results (windows mkl)::$FIRST_LINE - $SUMMARY_CONTENT"
1102+
echo "::error title=Test results (windows mkl): $FIRST_LINE::$SUMMARY_CONTENT"
10871103
else
1088-
echo "::notice title=Test results (windows mkl)::$FIRST_LINE - $SUMMARY_CONTENT"
1104+
echo "::notice title=Test results (windows mkl): $FIRST_LINE::$SUMMARY_CONTENT"
10891105
fi
10901106
else
1091-
echo "::warning title=Test Warning::Could not find test summary in ctest output (tests may still be running or output format changed)"
1107+
echo "::warning title=Test Warning::Could not find test summary in ctest output"
10921108
fi
10931109
else
1094-
echo "::warning title=Test Warning::Could not find ctest output file (tests may not have run)"
1110+
echo "::warning title=Test Warning::Could not find ctest output file"
10951111
fi
10961112
exit 0
10971113

dynadjust/CMakeLists.txt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@ option(BUILD_STATIC "Build static binaries in the 'static' directory" OFF)
77
option(USE_OPENMP "Use OpenMP for parallel processing" OFF)
88
option(ILP64 "Use ILP64 interface (64-bit matrix indexing) for BLAS and LAPACK" OFF)
99

10+
# Build optimization options
11+
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)
13+
14+
# Enable precompiled headers
1015
set(CMAKE_DISABLE_PRECOMPILE_HEADERS OFF)
1116

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+
1224
# Fix Boost 1.70+ issue with CMake 3.14+
1325
if(POLICY CMP0167)
1426
cmake_policy(SET CMP0167 NEW)
@@ -509,14 +521,17 @@ if(BUILD_STATIC)
509521
XERCES_STATIC_LIBRARY
510522
)
511523

512-
# Set optimization flags based on compiler
513524
if(MSVC)
514-
# Use MSVC-specific optimization flags
515525
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>")
516-
add_compile_options(/O2)
526+
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
527+
add_compile_options(/O2)
528+
endif()
517529
else()
518-
# Use GCC/Clang optimization flags
519-
add_compile_options(-O3)
530+
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "")
531+
add_compile_options(-O3)
532+
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
533+
add_compile_options(-O2)
534+
endif()
520535
endif()
521536

522537
if(BLAS_LIBRARIES)
@@ -698,8 +713,6 @@ if (BUILD_TESTING)
698713
message(STATUS "Setting up tests...")
699714

700715

701-
702-
703716
# test execution of dynadjust binaries
704717
# 1. gnss network (simultaneous, phased-block 1, phased, staged)
705718
add_test (NAME import-gnss-network COMMAND $<TARGET_FILE:${DNAIMPORT_TARGET}> -n gnss gnss-network.stn gnss-network.msr --export-dna --export-xml --export-asl --export-aml --export-map --output-msr-to-stn --test-integrity -r GDA2020 --flag-unused-stations)
@@ -1478,7 +1491,7 @@ if (BUILD_TESTING)
14781491
# no DynaML.xsd - remove file in platform-independent manner (using CMake command) by setting up a test dependency
14791492
add_test (NAME import-no-xsd-file-remove COMMAND ${CMAKE_COMMAND} -E remove DynaML.xsd)
14801493
add_test (NAME import-no-xsd-file COMMAND $<TARGET_FILE:${DNAIMPORT_TARGET}> -n gnss gnss-networkstn.xml gnss-networkmsr.xml)
1481-
set_tests_properties(import-no-xsd-file PROPERTIES DEPENDS import-no-xsd-file-remove)
1494+
set_tests_properties(import-no-xsd-file PROPERTIES DEPENDS import-no-xsd-file-remove TIMEOUT 5)
14821495
# Restore DynaML.xsd after testing its absence
14831496
add_test (NAME import-no-xsd-file-restore COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../sampleData/DynaML.xsd DynaML.xsd)
14841497
set_tests_properties(import-no-xsd-file-restore PROPERTIES DEPENDS import-no-xsd-file)
@@ -1640,8 +1653,8 @@ if (BUILD_TESTING)
16401653
add_test (NAME plot-no-plate COMMAND $<TARGET_FILE:${DNAPLOT_TARGET}> nosegapucor --plate ./noplate.file)
16411654

16421655
set_tests_properties(
1643-
plot-no-option plot-invalid-option plot-no-project plot-no-std-options plot-no-network plot-no-name plot-no-help
1644-
plot-box-ew plot-box-ns plot-no-seg plot-no-cor plot-no-apu plot-no-plate
1656+
plot-no-option plot-invalid-option plot-no-project plot-no-std-options plot-no-network plot-no-name plot-no-help
1657+
plot-box-ew plot-box-ns plot-no-seg plot-no-cor plot-no-apu plot-no-plate
16451658
PROPERTIES WILL_FAIL TRUE)
16461659

16471660
### DYNADJUST ###

dynadjust/CMakePresets.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"VCPKG_TARGET_TRIPLET": "x64-windows",
1515
"USE_MKL": "OFF",
1616
"USE_OPENMP": "ON",
17-
"BUILD_TESTING":"OFF"
17+
"BUILD_TESTING":"OFF",
18+
"USE_UNITY_BUILD":"ON"
1819
}
1920
},
2021
{
@@ -35,7 +36,8 @@
3536
"MKL_INTERFACE": "lp64",
3637
"ENABLE_SCALAPACK": "True",
3738
"BLA_VENDOR": "Intel10_64lp",
38-
"BUILD_TESTING":"OFF"
39+
"BUILD_TESTING":"OFF",
40+
"USE_UNITY_BUILD":"ON"
3941
}
4042
},
4143
{
@@ -49,7 +51,8 @@
4951
"VCPKG_TARGET_TRIPLET": "x64-windows",
5052
"USE_MKL": "OFF",
5153
"USE_OPENMP": "ON",
52-
"BUILD_TESTING":"ON"
54+
"BUILD_TESTING":"ON",
55+
"USE_UNITY_BUILD":"ON"
5356
}
5457
},
5558
{
@@ -70,7 +73,8 @@
7073
"MKL_INTERFACE": "lp64",
7174
"ENABLE_SCALAPACK": "True",
7275
"BLA_VENDOR": "Intel10_64lp",
73-
"BUILD_TESTING":"ON"
76+
"BUILD_TESTING":"ON",
77+
"USE_UNITY_BUILD":"ON"
7478
}
7579
}
7680
],

dynadjust/dynadjust/dnaadjust/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_definitions(-DBUILD_DNAADJUST_DLL -DBUILD_EXPORTDNATYPES)
66
include_directories (${PROJECT_SOURCE_DIR})
77

88
add_library (${PROJECT_NAME} SHARED
9+
${CMAKE_SOURCE_DIR}/include/functions/template_instantiations.cpp
910
${CMAKE_SOURCE_DIR}/include/io/adj_file.cpp
1011
${CMAKE_SOURCE_DIR}/include/io/aml_file.cpp
1112
${CMAKE_SOURCE_DIR}/include/io/asl_file.cpp

0 commit comments

Comments
 (0)