mirror of
				https://github.com/TheLartians/ModernCppStarter.git
				synced 2025-10-31 02:01:33 +01:00 
			
		
		
		
	No run-clang-tidy yet on CI!
pimp my GNUmakefile to do it right
This commit is contained in:
		
							parent
							
								
									a6dcfe52db
								
							
						
					
					
						commit
						c122dc042f
					
				
					 2 changed files with 18 additions and 16 deletions
				
			
		
							
								
								
									
										12
									
								
								.github/workflows/macos.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/workflows/macos.yml
									
										
									
									
										vendored
									
									
								
							|  | @ -38,9 +38,9 @@ jobs: | ||||||
|           cd build |           cd build | ||||||
|           ctest --build-config Debug |           ctest --build-config Debug | ||||||
| 
 | 
 | ||||||
|       - name: build standalone with clang-tidy | #       - name: run clang-tidy | ||||||
|         run: | | #         run: | | ||||||
|           cmake -S standalone -B build/standalone -DCMAKE_EXPORT_COMPILE_COMMANDS=1 | #           cmake -S . -B build/QS -DCMAKE_EXPORT_COMPILE_COMMANDS=1 | ||||||
|           export PATH=/usr/local/opt/llvm/bin/:${PATH} | #           export PATH=/usr/local/opt/llvm/bin/:${PATH} | ||||||
|           /usr/local/opt/llvm/share/clang/run-clang-tidy.py -p build/standalone standalone || | #           /usr/local/opt/llvm/share/clang/run-clang-tidy.py -p build/QS source || | ||||||
|           echo IGNORED | #           echo IGNORED | ||||||
|  |  | ||||||
							
								
								
									
										22
									
								
								GNUmakefile
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								GNUmakefile
									
										
									
									
									
								
							|  | @ -1,10 +1,12 @@ | ||||||
| # | # | ||||||
| # Note: make var CURDIR:=$(/bin/pwd) |  | ||||||
| ROOT?=$(CURDIR)/stagedir |  | ||||||
| 
 | 
 | ||||||
| #XXX GENERATOR?="Unix Makefiles" | #XXX GENERATOR?="Unix Makefiles" | ||||||
| GENERATOR?=Ninja | GENERATOR?=Ninja | ||||||
| 
 | 
 | ||||||
|  | STAGEDIR?="${CURDIR}/stage" | ||||||
|  | CMAKE_PRESET:=-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=${STAGEDIR} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| #XXX export CXX=clang++ | #XXX export CXX=clang++ | ||||||
| export CPM_USE_LOCAL_PACKAGES=0 | export CPM_USE_LOCAL_PACKAGES=0 | ||||||
| export CPM_SOURCE_CACHE=${HOME}/.cache/CPM | export CPM_SOURCE_CACHE=${HOME}/.cache/CPM | ||||||
|  | @ -33,26 +35,27 @@ lock: all standalone doc | ||||||
| 
 | 
 | ||||||
| # install the library to stagedir | # install the library to stagedir | ||||||
| install: | install: | ||||||
| 	cmake -S . -B build/$@ -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${ROOT} -DCMAKE_INSTALL_PREFIX=${ROOT} # --trace-expand | 	cmake -S . -B build/$@ ${CMAKE_PRESET} -DCMAKE_INSTALL_PREFIX=${STAGEDIR} -DCMAKE_CXX_STANDARD=20 # --trace-expand | ||||||
| 	cmake --build build/$@ --target $@ | 	cmake --build build/$@ --target $@ | ||||||
|  | 	perl -i.bak -pe 's#$$CPM_SOURCE_CACHE-I#-isystem $$1#g' build/install/compile_commands.json | ||||||
|  | 	run-clang-tidy.py -p build/$@ source | ||||||
| 
 | 
 | ||||||
| # test the library | # test the library | ||||||
| test: install | test: install | ||||||
| 	cmake -S $@ -B build/$@ -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${ROOT} -DTEST_INSTALLED_VERSION=1 | 	cmake -S $@ -B build/$@ ${CMAKE_PRESET} -DTEST_INSTALLED_VERSION=1 | ||||||
| 	cmake --build build/$@ | 	cmake --build build/$@ | ||||||
| 	cmake --build build/$@ --target $@ | 	cmake --build build/$@ --target $@ | ||||||
| 
 | 
 | ||||||
| # all together | # all together | ||||||
| all: test | all: test | ||||||
| 	cmake -S $@ -B build/$@ -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${ROOT} -DTEST_INSTALLED_VERSION=1 -DENABLE_TEST_COVERAGE=1  -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DUSE_STATIC_ANALYZER=clang-tidy | 	cmake -S $@ -B build/$@ ${CMAKE_PRESET} -DENABLE_TEST_COVERAGE=1 -DUSE_STATIC_ANALYZER=clang-tidy | ||||||
| 	cmake --build build/$@ | 	cmake --build build/$@ | ||||||
| 	cmake --build build/$@ --target test | 	cmake --build build/$@ --target test | ||||||
| 	# cmake --build build/$@ --target check-format | 	# cmake --build build/$@ --target check-format | ||||||
| 	# TODO builddriver run-clang-tidy.py -p build/$@ -checks='-*,modernize-*,misc-*,hicpp-*,cert-*,readability-*,portability-*,performance-*,google-*' |  | ||||||
| 
 | 
 | ||||||
| # GenerateDocs | # GenerateDocs | ||||||
| doc: | doc: | ||||||
| 	cmake -S documentation -B build/documentation -G "${GENERATOR}" | 	cmake -S documentation -B build/documentation "${CMAKE_PRESET}" | ||||||
| 	cmake --build build/documentation --target GenerateDocs | 	cmake --build build/documentation --target GenerateDocs | ||||||
| 
 | 
 | ||||||
| format: distclean | format: distclean | ||||||
|  | @ -62,10 +65,9 @@ format: distclean | ||||||
| 	find . -name '*.h' | xargs clang-format -i | 	find . -name '*.h' | xargs clang-format -i | ||||||
| 
 | 
 | ||||||
| standalone: | standalone: | ||||||
| 	cmake -S $@ -B build/$@ -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${ROOT} -DCMAKE_EXPORT_COMPILE_COMMANDS=1 | 	cmake -S $@ -B build/$@ ${CMAKE_PRESET} | ||||||
| 	cmake --build build/$@ | 	cmake --build build/$@ | ||||||
| 
 | 
 | ||||||
| # check the library | # check the library | ||||||
| check: standalone | check: standalone | ||||||
| 	run-clang-tidy.py -p build/standalone standalone | 	builddriver run-clang-tidy.py -p build/standalone -checks='-*,modernize-*,misc-*,hicpp-*,cert-*,readability-*,portability-*,performance-*,google-*' standalone | ||||||
| 	# TODO builddriver run-clang-tidy.py -p build/standalone -checks='-*,modernize-*,misc-*,hicpp-*,cert-*,readability-*,portability-*,performance-*,google-*' standalone |  | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue