Compare commits
	
		
			59 commits
		
	
	
		
			6aa03cc05b
			...
			ccf503f44b
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ccf503f44b | |||
| 3a7b42445e | |||
| 742dcd044d | |||
| 5fc73f60ab | |||
| 2fd02ce929 | |||
| 4475375e28 | |||
| fcbf6a277c | |||
| d7c1567d3e | |||
| 326f7bf833 | |||
| 514a27a789 | |||
| 46cdcb6874 | |||
| 9762138730 | |||
| 25bdfac834 | |||
| fa87648986 | |||
| 4eecb0bef2 | |||
| a599e65bae | |||
| 6065ab1636 | |||
| baff796eb8 | |||
| ba6a4a0342 | |||
| b6acc19ac8 | |||
| 197e10c0cf | |||
| 1ab514be71 | |||
| 26727a63e0 | |||
| 2ffecd9aae | |||
| 79e22cec0e | |||
| cf6eea6638 | |||
| 93eb4eb61a | |||
| 7cc8bbd3e5 | |||
| c80419e2ba | |||
| 5020941711 | |||
| 775211e9f3 | |||
| ddc44735d8 | |||
| 897acfe149 | |||
| 9597e33f3c | |||
| 6be011f75f | |||
| 05c4757338 | |||
| 39b68e7654 | |||
| 2fdaabdb07 | |||
| e4dd1711b2 | |||
| 6171c7ddb4 | |||
| ef10b77b1a | |||
| ec032439e1 | |||
| 4cf28095db | |||
| b1b9d6ce85 | |||
| f312f68b9e | |||
| 4fea22239c | |||
| f7c7e75185 | |||
| 073c3bb60f | |||
| 136b26e918 | |||
| b0a31d9633 | |||
| 6675e4c3cb | |||
| b17e165fd6 | |||
| b2609e4808 | |||
| 513acf0d30 | |||
| 24d772c2d8 | |||
| f7f6aa20ab | |||
| 4ef760baa0 | |||
| 48cb615051 | |||
| 3fed6aa4f2 | 
					 35 changed files with 584 additions and 671 deletions
				
			
		
							
								
								
									
										271
									
								
								.drone.yml
									
										
									
									
									
								
							
							
						
						
									
										271
									
								
								.drone.yml
									
										
									
									
									
								
							|  | @ -1,42 +1,42 @@ | ||||||
| --- | # --- | ||||||
| kind: pipeline | # kind: pipeline | ||||||
| type: exec | # type: exec | ||||||
| name: amd64 — msvc | # name: amd64 — msvc | ||||||
| trigger: | # trigger: | ||||||
|   branch: | #   branch: | ||||||
|   - main | #   - main | ||||||
| platform: | # platform: | ||||||
|   os: windows | #   os: windows | ||||||
|   arch: amd64 | #   arch: amd64 | ||||||
| 
 | # | ||||||
| steps: | # steps: | ||||||
| - name: unit tests | # - name: unit tests | ||||||
|   shell: powershell | #   shell: powershell | ||||||
|   commands:  | #   commands:  | ||||||
|     - ./tools/ci/amd64/msvc/unit_tests.ps1 | #     - ./tools/ci/amd64/msvc/unit_tests.ps1 | ||||||
| 
 | # | ||||||
| --- | # --- | ||||||
| kind: pipeline | # kind: pipeline | ||||||
| type: docker | # type: docker | ||||||
| name: amd64 — gcc | # name: amd64 — gcc | ||||||
| trigger: | # trigger: | ||||||
|   branch: | #   branch: | ||||||
|   - main | #   - main | ||||||
| 
 | # | ||||||
| steps: | # steps: | ||||||
| - name: unit tests | # - name: unit tests | ||||||
|   image: ci:latest | #   image: ci:latest | ||||||
|   pull: if-not-exists | #   pull: if-not-exists | ||||||
|   commands: | #   commands: | ||||||
|     - ./tools/ci/amd64/gcc/unit_tests.sh | #     - ./tools/ci/amd64/gcc/unit_tests.sh | ||||||
| 
 | # | ||||||
| - name: valgrind | # - name: valgrind | ||||||
|   image: ci:latest | #   image: ci:latest  | ||||||
|   pull: if-not-exists | #   pull: if-not-exists | ||||||
|   commands: | #   commands: | ||||||
|     - ./tools/ci/amd64/gcc/valgrind.sh | #     - ./tools/ci/amd64/gcc/valgrind.sh | ||||||
| 
 | # | ||||||
| --- | # --- | ||||||
| kind: pipeline | kind: pipeline | ||||||
| type: docker | type: docker | ||||||
| name: amd64 — clang | name: amd64 — clang | ||||||
|  | @ -45,114 +45,95 @@ trigger: | ||||||
|   - main |   - main | ||||||
| 
 | 
 | ||||||
| steps: | steps: | ||||||
| - name: code coverage | # - name: code coverage | ||||||
|   image: ci:latest | #   image: ci:latest | ||||||
|   pull: if-not-exists | #   pull: if-not-exists | ||||||
|   environment: | #   environment: | ||||||
|     CODECOV_TOKEN: | #     CODECOV_TOKEN: | ||||||
|       from_secret: CODECOV_TOKEN  | #       from_secret: CODECOV_TOKEN  | ||||||
|   commands: | #   commands: | ||||||
|     - ./tools/ci/amd64/clang/coverage.sh | #     - ./tools/ci/amd64/clang/coverage.sh | ||||||
| 
 | # | ||||||
| - name: leak sanitizer | # - name: leak sanitizer | ||||||
|   image: ci:latest | #   image: ci:latest  | ||||||
|   pull: if-not-exists | #   pull: if-not-exists | ||||||
|   commands: | #   commands: | ||||||
|     - ./tools/ci/amd64/clang/lsan.sh | #     - ./tools/ci/amd64/clang/lsan.sh | ||||||
| 
 | # | ||||||
| - name: memory sanitizer | - name: memory sanitizer | ||||||
|   image: ci:latest |   image: ci:latest | ||||||
|   pull: if-not-exists |   pull: if-not-exists | ||||||
|   commands: |   commands: | ||||||
|     - ./tools/ci/amd64/clang/msan.sh |     - ./tools/ci/amd64/clang/msan.sh | ||||||
| 
 | # | ||||||
| --- | # --- | ||||||
| kind: pipeline | # kind: pipeline | ||||||
| type: docker | # type: docker | ||||||
| name: static analysis | # name: static analysis | ||||||
| trigger: | # trigger: | ||||||
|   branch: | #   branch: | ||||||
|   - main | #   - main | ||||||
| 
 | # | ||||||
| steps: | # steps: | ||||||
| - name: clang tidy | # - name: clang tidy | ||||||
|   image: ci:latest | #   image: ci:latest  | ||||||
|   pull: if-not-exists | #   pull: if-not-exists | ||||||
|   privileged: true | #   privileged: true | ||||||
|   commands: | #   commands: | ||||||
|     - ./tools/ci/static_analysis/clang_tidy.sh | #     - ./tools/ci/static_analysis/clang_tidy.sh | ||||||
| 
 | # | ||||||
| - name: shell check | # - name: clang format | ||||||
|   image: ci:latest | #   image: ci:latest  | ||||||
|   pull: if-not-exists | #   pull: if-not-exists | ||||||
|   commands: | #   commands: | ||||||
|     - ./tools/ci/static_analysis/shell_check.sh | #     - ./tools/ci/static_analysis/clang_format.sh | ||||||
| 
 | # | ||||||
| - name: clang format | # --- | ||||||
|   image: ci:latest | # kind: pipeline | ||||||
|   pull: if-not-exists | # type: docker  | ||||||
|   commands: | # name: documentation — development | ||||||
|     - ./tools/ci/static_analysis/clang_format.sh | # node: | ||||||
| 
 | #   environment: ryali | ||||||
| - name: cmake format | # trigger: | ||||||
|   image: ci:latest | #   branch: | ||||||
|   pull: if-not-exists | #   - main | ||||||
|   commands: | # | ||||||
|     - ./tools/ci/static_analysis/cmake_format.sh | # steps: | ||||||
| 
 | # - name: build and deploy | ||||||
| - name: shell format | #   image: documentation:latest | ||||||
|   image: ci:latest | #   pull: if-not-exists | ||||||
|   pull: if-not-exists | #   commands: | ||||||
|   commands: | #     - pwd | ||||||
|     - ./tools/ci/static_analysis/shell_format.sh | #     - cd docs | ||||||
| 
 | #     - mkdir generated | ||||||
| --- | #     - touch generated/changelogs.rst | ||||||
| kind: pipeline | #     - touch generated/api.rst | ||||||
| type: docker  | #     - sphinx-build -M html . . | ||||||
| name: documentation — development | # | ||||||
| node: | #     - rm -rf /light_docs_dev/* | ||||||
|   environment: ryali | #     - mv ./html/* /light_docs_dev/ | ||||||
| trigger: | # | ||||||
|   branch: | # --- | ||||||
|   - main | # | ||||||
| 
 | # kind: pipeline | ||||||
| steps: | # type: docker | ||||||
| - name: build and deploy | # name: documentation — production | ||||||
|   image: documentation:latest | # node: | ||||||
|   pull: if-not-exists | #   environment: ryali | ||||||
|   commands: | # trigger: | ||||||
|     - pwd | #   event: | ||||||
|     - cd docs | #   - tag | ||||||
|     - mkdir generated | # | ||||||
|     - touch generated/changelogs.rst | # steps: | ||||||
|     - touch generated/api.rst | # - name: build and deploy | ||||||
|     - sphinx-build -M html . . | #   image: documentation:latest | ||||||
| 
 | #   pull: if-not-exists | ||||||
|     - rm -rf /light_docs_dev/* | #   commands: | ||||||
|     - mv ./html/* /light_docs_dev/ | #     - cd docs | ||||||
| 
 | #     - mkdir generated | ||||||
| --- | #     - touch generated/changelogs.rst | ||||||
| 
 | #     - touch generated/api.rst | ||||||
| kind: pipeline | #     - sphinx-build -M html . . | ||||||
| type: docker | # | ||||||
| name: documentation — production | #     - rm -rf /light_docs/* | ||||||
| node: | #     - mv ./html/* /light_docs/ | ||||||
|   environment: ryali |  | ||||||
| trigger: |  | ||||||
|   event: |  | ||||||
|   - tag |  | ||||||
| 
 |  | ||||||
| steps: |  | ||||||
| - name: build and deploy |  | ||||||
|   image: documentation:latest |  | ||||||
|   pull: if-not-exists |  | ||||||
|   commands: |  | ||||||
|     - cd docs |  | ||||||
|     - mkdir generated |  | ||||||
|     - touch generated/changelogs.rst |  | ||||||
|     - touch generated/api.rst |  | ||||||
|     - sphinx-build -M html . . |  | ||||||
| 
 |  | ||||||
|     - rm -rf /light_docs/* |  | ||||||
|     - mv ./html/* /light_docs/ |  | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -7,20 +7,20 @@ add_subdirectory(./time) | ||||||
| add_subdirectory(./logger) | add_subdirectory(./logger) | ||||||
| add_subdirectory(./debug) | add_subdirectory(./debug) | ||||||
| add_subdirectory(./math) | add_subdirectory(./math) | ||||||
| # | #  | ||||||
| add_subdirectory(./asset_baker) | add_subdirectory(./asset_baker) | ||||||
| add_subdirectory(./assets) | add_subdirectory(./assets) | ||||||
| # | #  | ||||||
| add_subdirectory(./camera) | add_subdirectory(./camera) | ||||||
| add_subdirectory(./input) | add_subdirectory(./input) | ||||||
| # add_subdirectory(./ui) | # add_subdirectory(./ui) | ||||||
| # | #  | ||||||
| add_subdirectory(./surface) | add_subdirectory(./surface) | ||||||
| add_subdirectory(./renderer) | add_subdirectory(./renderer) | ||||||
| add_subdirectory(./ecs) | add_subdirectory(./ecs) | ||||||
| # | #  | ||||||
| add_subdirectory(./app) | add_subdirectory(./app) | ||||||
| 
 | 
 | ||||||
| # apps | # apps  | ||||||
| add_subdirectory(./mirror) | add_subdirectory(./mirror) | ||||||
| add_subdirectory(test) | add_subdirectory(test) | ||||||
|  |  | ||||||
|  | @ -1,5 +1,2 @@ | ||||||
| add_library_module(app application.cpp) | add_library_module(app application.cpp) | ||||||
| target_link_libraries( | target_link_libraries(app PUBLIC memory PRIVATE lt_debug) | ||||||
|     app |  | ||||||
|     PUBLIC memory |  | ||||||
|     PRIVATE lt_debug) |  | ||||||
|  |  | ||||||
|  | @ -1,6 +1,18 @@ | ||||||
| add_library_module(libasset_baker bakers.cpp) | add_library_module(libasset_baker | ||||||
| target_link_libraries(libasset_baker PUBLIC assets logger lt_debug tbb) |     bakers.cpp | ||||||
| add_test_module(libasset_baker bakers.test.cpp) | ) | ||||||
|  | target_link_libraries(libasset_baker | ||||||
|  | PUBLIC | ||||||
|  |     assets | ||||||
|  |     logger | ||||||
|  |     lt_debug | ||||||
|  |     tbb | ||||||
|  | ) | ||||||
|  | add_test_module(libasset_baker  | ||||||
|  |     bakers.test.cpp | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| add_executable_module(asset_baker entrypoint/baker.cpp) | add_executable_module(asset_baker | ||||||
|  |     entrypoint/baker.cpp | ||||||
|  | ) | ||||||
| target_link_libraries(asset_baker PRIVATE libasset_baker) | target_link_libraries(asset_baker PRIVATE libasset_baker) | ||||||
|  |  | ||||||
|  | @ -1,2 +1,7 @@ | ||||||
| #include <asset_baker/bakers.hpp> | #include <asset_baker/bakers.hpp> | ||||||
| #include <test/test.hpp> | #include <test/test.hpp> | ||||||
|  | 
 | ||||||
|  | using ::lt::test::Case; | ||||||
|  | using ::lt::test::Suite; | ||||||
|  | 
 | ||||||
|  | // TODO(Light): add asset baking tests!
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,14 @@ | ||||||
| add_library_module(assets shader.cpp) | add_library_module(assets  | ||||||
|  |     shader.cpp | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| target_link_libraries(assets PUBLIC logger lt_debug) | target_link_libraries( | ||||||
|  | assets  | ||||||
|  | PUBLIC | ||||||
|  | logger  | ||||||
|  | lt_debug | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| add_test_module(assets shader.test.cpp) | add_test_module(assets | ||||||
|  |     shader.test.cpp | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| add_library_module(lt_debug instrumentor.cpp) | add_library_module(lt_debug instrumentor.cpp) | ||||||
| target_link_libraries(lt_debug PUBLIC logger) | target_link_libraries(lt_debug PUBLIC logger) | ||||||
| target_precompile_headers(lt_debug PUBLIC | target_precompile_headers(lt_debug PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/private/pch.hpp) | ||||||
|                           ${CMAKE_CURRENT_SOURCE_DIR}/private/pch.hpp) |  | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ using lt::test::expect_unreachable; | ||||||
| using lt::test::Suite; | using lt::test::Suite; | ||||||
| 
 | 
 | ||||||
| using lt::test::expect_eq; | using lt::test::expect_eq; | ||||||
|  | using lt::test::expect_ne; | ||||||
| 
 | 
 | ||||||
| using lt::test::expect_false; | using lt::test::expect_false; | ||||||
| using lt::test::expect_true; | using lt::test::expect_true; | ||||||
|  |  | ||||||
|  | @ -1,9 +1,21 @@ | ||||||
| add_library_module(libmirror) | add_library_module(libmirror  | ||||||
| target_link_libraries(libmirror INTERFACE app time input surface renderer) | ) | ||||||
|  | target_link_libraries( | ||||||
|  |   libmirror | ||||||
|  |   INTERFACE | ||||||
|  |   app | ||||||
|  |   time | ||||||
|  |   input  | ||||||
|  |   surface | ||||||
|  |   renderer | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| add_test_module( | add_test_module(libmirror  | ||||||
|     libmirror layers/editor_layer.test.cpp panels/asset_browser.test.cpp |     layers/editor_layer.test.cpp | ||||||
|     panels/properties.test.cpp panels/scene_hierarchy.test.cpp) |     panels/asset_browser.test.cpp | ||||||
|  |     panels/properties.test.cpp | ||||||
|  |     panels/scene_hierarchy.test.cpp | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| add_executable_module(mirror entrypoint/mirror.cpp) | add_executable_module(mirror entrypoint/mirror.cpp) | ||||||
| target_link_libraries(mirror PRIVATE libmirror input) | target_link_libraries(mirror PRIVATE libmirror input) | ||||||
|  |  | ||||||
|  | @ -24,10 +24,6 @@ void renderer_callback( | ||||||
|     std::any &user_data |     std::any &user_data | ||||||
| ) | ) | ||||||
| { | { | ||||||
| 	std::ignore = message_severity; |  | ||||||
| 	std::ignore = message_type; |  | ||||||
| 	std::ignore = user_data; |  | ||||||
| 
 |  | ||||||
| 	log_dbg("RENDERER CALLBACK: {}", data.message); | 	log_dbg("RENDERER CALLBACK: {}", data.message); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -208,6 +204,7 @@ public: | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		auto entity = ecs::Entity { m_editor_registry, m_window }; | 		auto entity = ecs::Entity { m_editor_registry, m_window }; | ||||||
|  | 		memory::Ref<app::SystemStats> system_stats = nullptr; | ||||||
| 
 | 
 | ||||||
| 		m_renderer_system = std::make_shared<renderer::System>(renderer::System::CreateInfo { | 		m_renderer_system = std::make_shared<renderer::System>(renderer::System::CreateInfo { | ||||||
| 		    .config = { .target_api = renderer::Api::vulkan, .max_frames_in_flight = 3u }, | 		    .config = { .target_api = renderer::Api::vulkan, .max_frames_in_flight = 3u }, | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| add_library_module( | add_library_module(renderer | ||||||
|     renderer |  | ||||||
|     system.cpp |     system.cpp | ||||||
|  | 
 | ||||||
|     # Vulkan - backend |     # Vulkan - backend | ||||||
|     backend/vk/messenger.cpp |     backend/vk/messenger.cpp | ||||||
|     backend/vk/context/device.cpp |     backend/vk/context/device.cpp | ||||||
|  | @ -18,17 +18,27 @@ add_library_module( | ||||||
|     frontend/context/surface.cpp |     frontend/context/surface.cpp | ||||||
|     frontend/context/swapchain.cpp |     frontend/context/swapchain.cpp | ||||||
|     frontend/renderer/renderer.cpp |     frontend/renderer/renderer.cpp | ||||||
|     frontend/renderer/pass.cpp) |     frontend/renderer/pass.cpp | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| target_link_libraries( | target_link_libraries(renderer | ||||||
|     renderer | PUBLIC  | ||||||
|     PUBLIC app ecs memory assets time bitwise |     app  | ||||||
|     PRIVATE surface pthread) |     ecs | ||||||
|  |     memory | ||||||
|  |     assets | ||||||
|  |     time | ||||||
|  |     bitwise | ||||||
|  | PRIVATE | ||||||
|  |     surface | ||||||
|  |     pthread | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| add_test_module( | add_test_module(renderer  | ||||||
|     renderer |  | ||||||
|     test/utils.cpp |     test/utils.cpp | ||||||
|  | 
 | ||||||
|     system.test.cpp |     system.test.cpp | ||||||
|  | 
 | ||||||
|     # general backend tests through the frontend |     # general backend tests through the frontend | ||||||
|     frontend/messenger.test.cpp |     frontend/messenger.test.cpp | ||||||
|     frontend/context/surface.test.cpp |     frontend/context/surface.test.cpp | ||||||
|  | @ -36,9 +46,17 @@ add_test_module( | ||||||
|     frontend/context/swapchain.test.cpp |     frontend/context/swapchain.test.cpp | ||||||
|     frontend/renderer/pass.test.cpp |     frontend/renderer/pass.test.cpp | ||||||
|     frontend/renderer/renderer.test.cpp |     frontend/renderer/renderer.test.cpp | ||||||
|  | 
 | ||||||
|     # backend specific tests -- vk |     # backend specific tests -- vk | ||||||
|     backend/vk/context/instance.test.cpp |     backend/vk/context/instance.test.cpp | ||||||
|     # backend specific tests -- dx backend specific tests -- mt |  | ||||||
| ) |  | ||||||
| 
 | 
 | ||||||
| target_link_libraries(renderer_tests PRIVATE surface pthread) |     # backend specific tests -- dx | ||||||
|  | 
 | ||||||
|  |     # backend specific tests -- mt | ||||||
|  | )  | ||||||
|  | 
 | ||||||
|  | target_link_libraries(renderer_tests | ||||||
|  | PRIVATE | ||||||
|  |     surface | ||||||
|  |     pthread | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | @ -1,3 +1,2 @@ | ||||||
| add_library(std INTERFACE) | add_library(std INTERFACE) | ||||||
| target_precompile_headers(std INTERFACE | target_precompile_headers(std INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/public/pch.hpp) | ||||||
|                           ${CMAKE_CURRENT_SOURCE_DIR}/public/pch.hpp) |  | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ | ||||||
| #include <cfenv> | #include <cfenv> | ||||||
| #include <cfloat> | #include <cfloat> | ||||||
| #include <cinttypes> | #include <cinttypes> | ||||||
|  | #include <ciso646> | ||||||
| #include <climits> | #include <climits> | ||||||
| #include <clocale> | #include <clocale> | ||||||
| #include <cmath> | #include <cmath> | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| if(NOT WIN32) | if (NOT WIN32) | ||||||
|     add_library_module(surface linux/system.cpp) |     add_library_module(surface linux/system.cpp) | ||||||
|     target_link_libraries(surface PRIVATE X11) |     target_link_libraries(surface PRIVATE X11) | ||||||
| 
 | 
 | ||||||
|  | @ -7,10 +7,17 @@ else(WIN32) | ||||||
| 
 | 
 | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| target_link_libraries( | target_link_libraries(surface PUBLIC  | ||||||
|     surface |     ecs | ||||||
|     PUBLIC ecs app math memory tbb |     app | ||||||
|     PRIVATE logger lt_debug time) |     math | ||||||
|  |     memory | ||||||
|  |     tbb | ||||||
|  |     PRIVATE | ||||||
|  |     logger  | ||||||
|  |     lt_debug | ||||||
|  |     time | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| add_test_module(surface system.test.cpp) | add_test_module(surface system.test.cpp) | ||||||
| add_fuzz_module(surface system.fuzz.cpp) | add_fuzz_module(surface system.fuzz.cpp) | ||||||
|  |  | ||||||
							
								
								
									
										38
									
								
								modules/test.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										38
									
								
								modules/test.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,38 @@ | ||||||
|  | #!/bin/bash | ||||||
|  | 
 | ||||||
|  | find . -type f \( -name "*.cpp" -o -name "*.hpp" \) -print0 | while IFS= read -r -d '' file; do | ||||||
|  |   scope=false | ||||||
|  |   ref=false | ||||||
|  |   if grep -Eq "Scope\s*<" "$file"; then | ||||||
|  |     scope=true | ||||||
|  |     sed -i -E 's/(Scope)(\s*<)/memory::\1\2/g' "$file" | ||||||
|  |   fi | ||||||
|  |   if grep -Eq "Ref\s*<" "$file"; then | ||||||
|  |     ref=true | ||||||
|  |     sed -i -E 's/(Ref)(\s*<)/memory::\1\2/g' "$file" | ||||||
|  |   fi | ||||||
|  |   if grep -Eq "\bcreate_scope\b" "$file"; then | ||||||
|  |     scope=true | ||||||
|  |     sed -i -E 's/\b(create_scope)\b/memory::\1/g' "$file" | ||||||
|  |   fi | ||||||
|  |   if grep -Eq "\bcreate_ref\b" "$file"; then | ||||||
|  |     ref=true | ||||||
|  |     sed -i -E 's/\b(create_ref)\b/memory::\1/g' "$file" | ||||||
|  |   fi | ||||||
|  |   if $scope || $ref; then | ||||||
|  |     includes="" | ||||||
|  |     $scope && includes+="#include <memory/scope.hpp>\n" | ||||||
|  |     $ref && includes+="#include <memory/reference.hpp>\n" | ||||||
|  |     tmp=$(mktemp) | ||||||
|  |     if [[ "$file" =~ \.hpp$ ]] && pragma_line=$(grep -En -m1 '^#pragma once' "$file" | cut -d: -f1); then | ||||||
|  |       insert_line=$((pragma_line + 2)) | ||||||
|  |     else | ||||||
|  |       insert_line=1 | ||||||
|  |     fi | ||||||
|  |     head -n $((insert_line - 1)) "$file" > "$tmp" | ||||||
|  |     echo -e "$includes" >> "$tmp" | ||||||
|  |     tail -n +$insert_line "$file" >> "$tmp" | ||||||
|  |     mv "$tmp" "$file" | ||||||
|  |     clang-format -i "$file" | ||||||
|  |   fi | ||||||
|  | done | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| add_library_module(test test.cpp entrypoint.cpp) | add_library_module(test test.cpp entrypoint.cpp) | ||||||
| add_library_module(fuzz_test test.cpp fuzz.cpp) | add_library_module(fuzz_test test.cpp fuzz.cpp) | ||||||
| 
 | 
 | ||||||
| target_link_libraries(test PUBLIC tbb logger) | target_link_libraries(test PUBLIC tbb) | ||||||
| target_link_libraries(fuzz_test PUBLIC tbb logger) | target_link_libraries(fuzz_test PUBLIC tbb) | ||||||
| 
 | 
 | ||||||
| add_test_module(test test.test.cpp) | add_test_module(test test.test.cpp) | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| #include <logger/logger.hpp> |  | ||||||
| #include <test/test.hpp> | #include <test/test.hpp> | ||||||
| 
 | 
 | ||||||
| using namespace ::lt::test; | using namespace ::lt::test; | ||||||
|  | @ -85,14 +84,14 @@ try | ||||||
| } | } | ||||||
| catch (const std::exception &exp) | catch (const std::exception &exp) | ||||||
| { | { | ||||||
| 	log_crt("Terminated due to uncaught exception:"); | 	std::println("Terminated due to uncaught exception:"); | ||||||
| 	log_crt("\twhat: {}", exp.what()); | 	std::println("\twhat: {}", exp.what()); | ||||||
| 
 | 
 | ||||||
| 	return EXIT_FAILURE; | 	return EXIT_FAILURE; | ||||||
| } | } | ||||||
| catch (...) | catch (...) | ||||||
| { | { | ||||||
| 	log_crt("Terminated due to uncaught non-std exception!"); | 	std::println("Terminated due to uncaught non-std exception!"); | ||||||
| 
 | 
 | ||||||
| 	return EXIT_FAILURE; | 	return EXIT_FAILURE; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
| add_library_module(time timer.cpp) | add_library_module(time timer.cpp) | ||||||
| target_link_libraries(time PUBLIC tbb) | target_link_libraries(time PUBLIC tbb) | ||||||
| add_test_module(time timer.test.cpp) | add_test_module(time timer.test.cpp) | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ | ||||||
| #include <ui/ui.hpp> | #include <ui/ui.hpp> | ||||||
| 
 | 
 | ||||||
| #ifdef LIGHT_PLATFORM_WINDOWS | #ifdef LIGHT_PLATFORM_WINDOWS | ||||||
|  | 	#include <renderer/dx/shared_context.hpp> | ||||||
| 	#include <renderer/dx/user_interface.hpp> | 	#include <renderer/dx/user_interface.hpp> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -13,6 +14,7 @@ | ||||||
| #include <input/events/keyboard.hpp> | #include <input/events/keyboard.hpp> | ||||||
| #include <input/events/mouse.hpp> | #include <input/events/mouse.hpp> | ||||||
| #include <input/key_codes.hpp> | #include <input/key_codes.hpp> | ||||||
|  | #include <renderer/graphics_context.hpp> | ||||||
| #include <utility> | #include <utility> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -25,7 +27,8 @@ namespace lt { | ||||||
| 
 | 
 | ||||||
| UserInterface *UserInterface::s_context = nullptr; | UserInterface *UserInterface::s_context = nullptr; | ||||||
| 
 | 
 | ||||||
| auto UserInterface::create(memory::Ref<SharedContext> sharedContext) -> memory::Scope<UserInterface> | auto UserInterface::create(memory::Ref<SharedContext> sharedContext) | ||||||
|  |     -> memory::Scope<UserInterface> | ||||||
| { | { | ||||||
| 	auto scopeUserInterface = memory::Scope<UserInterface> { nullptr }; | 	auto scopeUserInterface = memory::Scope<UserInterface> { nullptr }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -11,7 +11,8 @@ class SharedContext; | ||||||
| class UserInterface | class UserInterface | ||||||
| { | { | ||||||
| public: | public: | ||||||
| 	static auto create(memory::Ref<SharedContext> sharedContext) -> memory::Scope<UserInterface>; | 	static auto create(memory::Ref<SharedContext> sharedContext) | ||||||
|  | 	    -> memory::Scope<UserInterface>; | ||||||
| 
 | 
 | ||||||
| 	static void dockspace_begin(); | 	static void dockspace_begin(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,59 +1,50 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| set -euo pipefail | set -e | ||||||
| cd "$(git rev-parse --show-toplevel)/" | cd $(git rev-parse --show-toplevel)/ | ||||||
| 
 | rm -rf ./build && mkdir build/ | ||||||
| CC=$(which clang) |  | ||||||
| export CC |  | ||||||
| 
 |  | ||||||
| CXX=$(which clang++) |  | ||||||
| export CXX |  | ||||||
| 
 |  | ||||||
| DISPLAY=:99 |  | ||||||
| export DISPLAY |  | ||||||
| 
 | 
 | ||||||
| Xvfb :99 -screen 0 1024x768x16 & | Xvfb :99 -screen 0 1024x768x16 & | ||||||
|  | export CXX=$(which clang++) | ||||||
|  | export CC=$(which clang) | ||||||
|  | export DISPLAY=:99 | ||||||
| 
 | 
 | ||||||
| cmake \ | cmake . \ | ||||||
|     -S . \ | -Bbuild \ | ||||||
|     -B build \ | -GNinja \ | ||||||
|     -G Ninja \ | -DCMAKE_LINKER_TYPE=MOLD \ | ||||||
|     -D CMAKE_LINKER_TYPE=MOLD \ | -DENABLE_UNIT_TESTS=ON \ | ||||||
|     -D ENABLE_UNIT_TESTS=ON \ | -DENABLE_LLVM_COVERAGE=ON \ | ||||||
|     -D ENABLE_LLVM_COVERAGE=ON \ | -DCMAKE_BUILD_TYPE=Release \ | ||||||
|     -D CMAKE_BUILD_TYPE=Release \ | -DCMAKE_CXX_FLAGS="-std=c++23 -stdlib=libc++ -g -fno-omit-frame-pointer" \ | ||||||
|     -D CMAKE_CXX_FLAGS="-std=c++23 -stdlib=libc++ -g -fno-omit-frame-pointer" | && cmake --build ./build -j `nproc` | ||||||
| 
 | 
 | ||||||
| cmake --build ./build -j"$(nproc)" | mkdir -p ./build/coverage/  | ||||||
|  | for test in $(find ./build -type f -name '*_tests' -executable); do | ||||||
|  |     export LLVM_PROFILE_FILE="./build/coverage/$(basename "$(dirname "$test")").profraw"; | ||||||
|  |     echo ${LLVM_PROFILE_FILE} >> ./build/coverage/list; | ||||||
| 
 | 
 | ||||||
| mkdir -p ./build/coverage/ |  | ||||||
| while IFS= read -r -d '' test; do |  | ||||||
|     LLVM_PROFILE_FILE="./build/coverage/$(basename "$(dirname "$test")").profraw" |  | ||||||
|     export LLVM_PROFILE_FILE |  | ||||||
| 
 |  | ||||||
|     echo "${LLVM_PROFILE_FILE}" >>./build/coverage/list |  | ||||||
|     gdb \ |     gdb \ | ||||||
|         --return-child-result \ |     --return-child-result \ | ||||||
|         -ex='set confirm off' \ |     -ex='set confirm off' \ | ||||||
|         -ex='set pagination off' \ |     -ex='set pagination off' \ | ||||||
|         -ex='run' \ |     -ex='run' \ | ||||||
|         -ex='bt full' \ |     -ex='bt full' \ | ||||||
|         -ex='quit' \ |     -ex='quit' \ | ||||||
|         -q \ |     -q \ | ||||||
|         "$test" |     "$test" | ||||||
| done < <(find ./build -type f -name '*_tests' -executable -print0) | done | ||||||
| 
 | 
 | ||||||
| llvm-profdata merge --input-files './build/coverage/list' -o "./build/coverage/merged.profdata" | llvm-profdata merge --input-files './build/coverage/list' -o "./build/coverage/merged.profdata"  | ||||||
| find ./build/modules -type f -name "*.profraw" -exec rm -fv {} + | find ./build/modules -type f -name "*.profraw" -exec rm -fv {} + | ||||||
| 
 | 
 | ||||||
| LLVM_COV_SHOW=$( | LLVM_COV_SHOW=$(llvm-cov show \ | ||||||
|     llvm-cov show \ |  | ||||||
|         -instr-profile='./build/coverage/merged.profdata' \ |         -instr-profile='./build/coverage/merged.profdata' \ | ||||||
|         "$(find ./build -type f -name '*_tests' -executable -exec printf -- '-object %s ' {} \;)" \ |         $(find ./build -type f -name '*_tests' -executable -exec printf -- '-object %s ' {} \;) \ | ||||||
|         "$(find ./build -type f -name '*\.a' -exec printf -- '-object %s ' {} \;)" \ |         $(find ./build -type f -name '*\.a' -exec printf -- '-object %s ' {} \;) \ | ||||||
|         -ignore-filename-regex='\.test\.cpp$' \ |         -ignore-filename-regex='\.test\.cpp$' \ | ||||||
|         -ignore-filename-regex='\.fuzz\.cpp$' |         -ignore-filename-regex='\.fuzz\.cpp$' | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| echo "${LLVM_COV_SHOW}" >'./build/coverage/coverage.txt' | echo "${LLVM_COV_SHOW}" > './build/coverage/coverage.txt' | ||||||
| cd ./build/coverage/ && wget -qO- "https://codecov.io/bash" | bash | cd ./build/coverage/ && wget -qO- "https://codecov.io/bash" | bash | ||||||
|  |  | ||||||
|  | @ -1,50 +1,39 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| set -euo pipefail | set -e | ||||||
| cd "$(git rev-parse --show-toplevel)/" | cd $(git rev-parse --show-toplevel)/ | ||||||
| 
 | rm -rf ./build && mkdir build/ | ||||||
| CC=$(which clang) |  | ||||||
| export CC |  | ||||||
| 
 |  | ||||||
| CXX=$(which clang++) |  | ||||||
| export CXX |  | ||||||
| 
 |  | ||||||
| DISPLAY=:99 |  | ||||||
| export DISPLAY |  | ||||||
| 
 |  | ||||||
| LSAN_OPTIONS="suppressions=$(git rev-parse --show-toplevel)/tools/ci/amd64/clang/lsan.supp:fast_unwind_on_malloc=0:verbosity=1:report_objects=1" |  | ||||||
| export LSAN_OPTIONS |  | ||||||
| 
 |  | ||||||
| LSAN_SYMBOLIZER_PATH="$(which llvm-symbolizer)" |  | ||||||
| export LSAN_SYMBOLIZER_PATH |  | ||||||
| 
 | 
 | ||||||
| Xvfb :99 -screen 0 1024x768x16 & | Xvfb :99 -screen 0 1024x768x16 & | ||||||
|  | export CXX=$(which clang++) | ||||||
|  | export CC=$(which clang) | ||||||
|  | export DISPLAY=:99 | ||||||
| 
 | 
 | ||||||
| cmake \ | cmake . \ | ||||||
|     -S . \ | -Bbuild \ | ||||||
|     -B build \ | -GNinja \ | ||||||
|     -G Ninja \ | -DCMAKE_LINKER_TYPE=MOLD \ | ||||||
|     -D CMAKE_LINKER_TYPE=MOLD \ | -DENABLE_UNIT_TESTS=ON \ | ||||||
|     -D ENABLE_UNIT_TESTS=ON \ | -DCMAKE_BUILD_TYPE=Debug \ | ||||||
|     -D CMAKE_BUILD_TYPE=Release \ | -DCMAKE_CXX_FLAGS=" \ | ||||||
|     -D CMAKE_CXX_FLAGS=" \ |  | ||||||
| -fsanitize=leak \ | -fsanitize=leak \ | ||||||
|  | -fno-omit-frame-pointer \ | ||||||
| -fno-common \ | -fno-common \ | ||||||
| -g \ | -g \ | ||||||
| -fno-omit-frame-pointer \ |  | ||||||
| -std=c++23 \ | -std=c++23 \ | ||||||
| -nostdinc++ \ | -nostdinc++ \ | ||||||
| -isystem /libcxx_lsan/include/c++/v1/" \ | -isystem /libcxx_lsan/include/c++/v1/" \ | ||||||
|     -D CMAKE_EXE_LINKER_FLAGS=" \ | -DCMAKE_EXE_LINKER_FLAGS=" \ | ||||||
| -fsanitize=leak \ | -fsanitize=leak \ | ||||||
| -L/libcxx_lsan/lib \ | -L/libcxx_lsan/lib \ | ||||||
| -lc++ \ | -lc++ \ | ||||||
| -lc++abi \ | -lc++abi \ | ||||||
| -Wl,-rpath,/libcxx_lsan/lib" | -Wl,-rpath,/libcxx_lsan/lib" \ | ||||||
|  | && cmake --build ./build -j`nproc` | ||||||
| 
 | 
 | ||||||
| cmake --build ./build --target='renderer_tests' -j"$(nproc)" | export LSAN_OPTIONS="suppressions=$(git rev-parse --show-toplevel)/tools/ci/amd64/clang/lsan.supp:fast_unwind_on_malloc=0:verbosity=1:report_objects=1" | ||||||
| 
 | export LSAN_SYMBOLIZER_PATH="$(which llvm-symbolizer)" | ||||||
| while IFS= read -r -d '' test; do | for test in $(find ./build -type f -name '*_tests' -executable); do | ||||||
|     echo "Running $test" |     echo "Running $test" | ||||||
|     "$test" |     "$test" | ||||||
| done < <(find ./build -type f -name '*_tests' -executable -print0) | done | ||||||
|  |  | ||||||
|  | @ -1,45 +1,61 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| set -euo pipefail | set -e | ||||||
| cd "$(git rev-parse --show-toplevel)/" | cd $(git rev-parse --show-toplevel)/ | ||||||
| 
 | rm -rf ./build && mkdir build/ | ||||||
| CC=$(which clang) |  | ||||||
| export CC |  | ||||||
| 
 |  | ||||||
| CXX=$(which clang++) |  | ||||||
| export CXX |  | ||||||
| 
 |  | ||||||
| DISPLAY=:99 |  | ||||||
| export DISPLAY |  | ||||||
| 
 | 
 | ||||||
| Xvfb :99 -screen 0 1024x768x16 & | Xvfb :99 -screen 0 1024x768x16 & | ||||||
|  | export CXX=$(which clang++) | ||||||
|  | export CC=$(which clang) | ||||||
|  | export DISPLAY=:99 | ||||||
| 
 | 
 | ||||||
| cmake \ | export PKG_CONFIG_PATH=/msan/lib/pkgconfig:${PKG_CONFIG_PATH} | ||||||
|     -S . \ | 
 | ||||||
|     -B build \ | source '/1.4.328.1/setup-env.sh' | ||||||
|     -G Ninja \ | 
 | ||||||
|     -D CMAKE_LINKER_TYPE=MOLD \ | echo "REVPARSE: $(git rev-parse --show-toplevel)" | ||||||
|     -D ENABLE_UNIT_TESTS=ON \ | 
 | ||||||
|     -D CMAKE_BUILD_TYPE=Release \ | cat "$(git rev-parse --show-toplevel)/tools/ci/amd64/clang/msan.supp" | ||||||
|     -D CMAKE_CXX_FLAGS=" \ | 
 | ||||||
|  | cmake . \ | ||||||
|  | -Bbuild \ | ||||||
|  | -GNinja \ | ||||||
|  | -DCMAKE_INCLUDE_PATH=/msan/include \ | ||||||
|  | -DCMAKE_LIBRARY_PATH=/msan/lib \ | ||||||
|  | -DCMAKE_PREFIX_PATH=/msan \ | ||||||
|  | -DCMAKE_LINKER_TYPE=MOLD \ | ||||||
|  | -DENABLE_UNIT_TESTS=ON \ | ||||||
|  | -DCMAKE_BUILD_TYPE=Release \ | ||||||
|  | -DCMAKE_C_FLAGS=" \ | ||||||
| -fsanitize=memory \ | -fsanitize=memory \ | ||||||
| -fsanitize-memory-track-origins \ | -fsanitize-memory-track-origins \ | ||||||
| -g \ | -fsanitize-ignorelist=$(git rev-parse --show-toplevel)/tools/ci/amd64/clang/msan.supp \ | ||||||
| -fno-omit-frame-pointer \ | -fno-omit-frame-pointer \ | ||||||
|  | -g" \ | ||||||
|  | -DCMAKE_CXX_FLAGS=" \ | ||||||
|  | -fsanitize=memory \ | ||||||
|  | -fsanitize-memory-track-origins \ | ||||||
|  | -fsanitize-ignorelist=$(git rev-parse --show-toplevel)/tools/ci/amd64/clang/msan.supp \ | ||||||
|  | -fno-omit-frame-pointer \ | ||||||
|  | -g \ | ||||||
| -std=c++23 \ | -std=c++23 \ | ||||||
| -nostdinc++ \ | -nostdinc++ \ | ||||||
| -isystem /libcxx_msan/include/c++/v1/" \ | -isystem /libcxx_msan/include/c++/v1/" \ | ||||||
|     -D CMAKE_EXE_LINKER_FLAGS=" \ | -DCMAKE_EXE_LINKER_FLAGS=" \ | ||||||
| -fsanitize=memory \ | -fsanitize=memory \ | ||||||
| -fsanitize-memory-track-origins \ | -fsanitize-memory-track-origins \ | ||||||
| -L/libcxx_msan/lib \ | -fsanitize-ignorelist=$(git rev-parse --show-toplevel)/tools/ci/amd64/clang/msan.supp \ | ||||||
|  | -g \ | ||||||
|  | -std=c++23 \ | ||||||
|  | -L/msan/lib -Wl,-rpath,/msan/lib \ | ||||||
|  | -L/libcxx_msan/lib -Wl,-rpath,/libcxx_msan/lib \ | ||||||
| -lc++ \ | -lc++ \ | ||||||
| -lc++abi \ | -lc++abi" \ | ||||||
| -Wl,-rpath,/libcxx_msan/lib" | && cmake --build ./build --target='renderer_tests' -j`nproc` | ||||||
| 
 | 
 | ||||||
| cmake --build ./build -j"$(nproc)" | export MSAN_SYMBOLIZER_PATH="$(which llvm-symbolizer)" | ||||||
| 
 | export MSAN_OPTIONS="suppressions=$(git rev-parse --show-toplevel)/tools/ci/amd64/clang/msan.supp:fast_unwind_on_malloc=0:verbosity=1:report_umrs=1" | ||||||
| while IFS= read -r -d '' test; do | for test in $(find ./build -type f -name '*_tests' -executable); do | ||||||
|     echo "Running $test" |   echo "Running $test" | ||||||
|     "$test" |   "$test" | ||||||
| done < <(find ./build -type f -name '*_tests' -executable -print0) | done | ||||||
|  |  | ||||||
|  | @ -1,41 +1,33 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| set -euo pipefail | set -e | ||||||
| cd "$(git rev-parse --show-toplevel)/" | cd $(git rev-parse --show-toplevel)/ | ||||||
| 
 | rm -rf ./build && mkdir build/ | ||||||
| CC=$(which gcc) |  | ||||||
| export CC |  | ||||||
| 
 |  | ||||||
| CXX=$(which g++) |  | ||||||
| export CXX |  | ||||||
| 
 |  | ||||||
| DISPLAY=:99 |  | ||||||
| export DISPLAY |  | ||||||
| 
 | 
 | ||||||
| Xvfb :99 -screen 0 1024x768x16 & | Xvfb :99 -screen 0 1024x768x16 & | ||||||
|  | export CXX=$(which g++) | ||||||
|  | export CC=$(which gcc) | ||||||
|  | export DISPLAY=:99 | ||||||
| 
 | 
 | ||||||
| # gcc uses libstdc++ by default | # gcc uses libstdc++ by default | ||||||
| cmake \ | cmake . \ | ||||||
|     -S . \ | -Bbuild \ | ||||||
|     -B build \ | -GNinja \ | ||||||
|     -G Ninja \ | -DCMAKE_LINKER_TYPE=MOLD \ | ||||||
|     -D CMAKE_LINKER_TYPE=MOLD \ | -DENABLE_UNIT_TESTS=ON \ | ||||||
|     -D ENABLE_UNIT_TESTS=ON \ | -DCMAKE_BUILD_TYPE=Release \ | ||||||
|     -D CMAKE_BUILD_TYPE=Release \ | -DCMAKE_CXX_FLAGS="-std=c++23 -g -fno-omit-frame-pointer" \ | ||||||
|     -D CMAKE_CXX_FLAGS="-std=c++23 -g -fno-omit-frame-pointer" | && cmake --build ./build -j `nproc` | ||||||
| 
 | 
 | ||||||
| cmake --build ./build -j"$(nproc)" | for test in $(find ./build -type f -name '*_tests' -executable); do | ||||||
| 
 |  | ||||||
| while IFS= read -r -d '' test; do |  | ||||||
|     echo "Running $test" |     echo "Running $test" | ||||||
|     gdb \ |     gdb \ | ||||||
|         --return-child-result \ |     --return-child-result \ | ||||||
|         -ex='set confirm off' \ |     -ex='set confirm off' \ | ||||||
|         -ex='set pagination off' \ |     -ex='set pagination off' \ | ||||||
|         -ex='run' \ |     -ex='run' \ | ||||||
|         -ex='bt full' \ |     -ex='bt full' \ | ||||||
|         -ex='quit' \ |     -ex='quit' \ | ||||||
|         -q \ |     -q \ | ||||||
|         "$test" |     "$test" | ||||||
| 
 | done | ||||||
| done < <(find ./build -type f -name '*_tests' -executable -print0) |  | ||||||
|  |  | ||||||
|  | @ -1,45 +1,35 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| set -euo pipefail | export DEBUGINFOD_URLS="https://debuginfod.archlinux.org/" | ||||||
| cd "$(git rev-parse --show-toplevel)/" |  | ||||||
| 
 | 
 | ||||||
| CC=$(which gcc) | set -e | ||||||
| export CC | cd $(git rev-parse --show-toplevel)/ | ||||||
| 
 | rm -rf ./build && mkdir build/ | ||||||
| CXX=$(which g++) |  | ||||||
| export CXX |  | ||||||
| 
 |  | ||||||
| DISPLAY=:99 |  | ||||||
| export DISPLAY |  | ||||||
| 
 |  | ||||||
| DEBUGINFOD_URLS="https://debuginfod.archlinux.org/" |  | ||||||
| export DEBUGINFOD_URLS |  | ||||||
| 
 | 
 | ||||||
| Xvfb :99 -screen 0 1024x768x16 & | Xvfb :99 -screen 0 1024x768x16 & | ||||||
|  | export CXX=$(which g++) | ||||||
|  | export CC=$(which gcc) | ||||||
|  | export DISPLAY=:99 | ||||||
| 
 | 
 | ||||||
| # gcc uses libstdc++ by default | # gcc uses libstdc++ by default | ||||||
| cmake \ | cmake . \ | ||||||
|     -S . \ | -Bbuild \ | ||||||
|     -B build \ | -GNinja \ | ||||||
|     -G Ninja \ | -DCMAKE_LINKER_TYPE=MOLD \ | ||||||
|     -D CMAKE_LINKER_TYPE=MOLD \ | -DENABLE_UNIT_TESTS=ON \ | ||||||
|     -D ENABLE_UNIT_TESTS=ON \ | -DCMAKE_BUILD_TYPE=Release \ | ||||||
|     -D CMAKE_BUILD_TYPE=Release \ | -DCMAKE_CXX_FLAGS="-std=c++23 -g -fno-omit-frame-pointer" \ | ||||||
|     -D CMAKE_CXX_FLAGS="-std=c++23 -fno-omit-frame-pointer -fno-common -g" | && cmake --build ./build -j `nproc` | ||||||
| 
 | 
 | ||||||
| cmake --build ./build -j"$(nproc)" | for test in $(find ./build -type f -name '*_tests' -executable); do | ||||||
| 
 |  | ||||||
| while IFS= read -r -d '' test; do |  | ||||||
|     echo "Running $test" |     echo "Running $test" | ||||||
| 
 |  | ||||||
|     valgrind \ |     valgrind \ | ||||||
|         --leak-check=full \ |     --leak-check=full \ | ||||||
|         --show-leak-kinds=all \ |     --show-leak-kinds=all \ | ||||||
|         --track-origins=yes \ |     --track-origins=yes \ | ||||||
|         --verbose \ |     --verbose \ | ||||||
|         --num-callers=50 \ |     --num-callers=50 \ | ||||||
|         --gen-suppressions=all \ |     --gen-suppressions=all \ | ||||||
|         --suppressions='./tools/ci/amd64/gcc/valgrind.supp' \ |     --suppressions='./tools/ci/amd64/gcc/valgrind.supp' \ | ||||||
|         --error-exitcode=255 "${test}" || exit 1 |     --error-exitcode=255 ${test} || exit 1 | ||||||
| 
 | done | ||||||
| done < <(find ./build -type f -name '*_tests' -executable -print0) |  | ||||||
|  |  | ||||||
|  | @ -1,130 +1,3 @@ | ||||||
| { |  | ||||||
|    <insert_a_suppression_name_here> |  | ||||||
|    Memcheck:Leak |  | ||||||
|    match-leak-kinds: indirect |  | ||||||
|    fun:calloc |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    fun:_ZNK2lt8renderer2vk6Device17destroy_swapchainEP16VkSwapchainKHR_T |  | ||||||
| } |  | ||||||
| { |  | ||||||
|    <insert_a_suppression_name_here> |  | ||||||
|    Memcheck:Leak |  | ||||||
|    match-leak-kinds: definite |  | ||||||
|    fun:malloc |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    fun:_ZNK2lt8renderer2vk6Device17destroy_swapchainEP16VkSwapchainKHR_T |  | ||||||
| } |  | ||||||
| { |  | ||||||
|    <insert_a_suppression_name_here> |  | ||||||
|    Memcheck:Leak |  | ||||||
|    match-leak-kinds: reachable |  | ||||||
|    fun:malloc |  | ||||||
|    fun:_dbus_strdup |  | ||||||
|    fun:UnknownInlinedFun |  | ||||||
|    fun:UnknownInlinedFun |  | ||||||
|    fun:internal_bus_get |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    fun:UnknownInlinedFun |  | ||||||
|    fun:UnknownInlinedFun |  | ||||||
|    fun:loader_icd_scan |  | ||||||
|    fun:UnknownInlinedFun |  | ||||||
|    fun:UnknownInlinedFun |  | ||||||
|    fun:terminator_EnumerateInstanceExtensionProperties |  | ||||||
|    fun:vkEnumerateInstanceExtensionProperties |  | ||||||
| } |  | ||||||
| { |  | ||||||
|    <insert_a_suppression_name_here> |  | ||||||
|    Memcheck:Cond |  | ||||||
|    obj:/usr/lib/libnvidia-glvkspirv.so.580.95.05 |  | ||||||
|    obj:/usr/lib/libnvidia-glvkspirv.so.580.95.05 |  | ||||||
|    obj:/usr/lib/libnvidia-glvkspirv.so.580.95.05 |  | ||||||
|    fun:_nv002nvvm |  | ||||||
| } |  | ||||||
| { |  | ||||||
|    <insert_a_suppression_name_here> |  | ||||||
|    Memcheck:Leak |  | ||||||
|    match-leak-kinds: reachable |  | ||||||
|    fun:malloc |  | ||||||
|    fun:malloc |  | ||||||
|    fun:_dl_close_worker |  | ||||||
|    fun:_dl_close |  | ||||||
|    fun:_dl_catch_exception |  | ||||||
|    fun:_dl_catch_error |  | ||||||
|    fun:_dlerror_run |  | ||||||
| } |  | ||||||
| { |  | ||||||
|    <insert_a_suppression_name_here> |  | ||||||
|    Memcheck:Leak |  | ||||||
|    match-leak-kinds: definite |  | ||||||
|    fun:malloc |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    fun:~Swapchain |  | ||||||
| } |  | ||||||
| { |  | ||||||
|    <insert_a_suppression_name_here> |  | ||||||
|    Memcheck:Leak |  | ||||||
|    match-leak-kinds: indirect |  | ||||||
|    fun:calloc |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    obj:* |  | ||||||
|    fun:~Swapchain |  | ||||||
| } |  | ||||||
| { | { | ||||||
|     <insert_a_suppression_name_here> |     <insert_a_suppression_name_here> | ||||||
|     Memcheck:Param |     Memcheck:Param | ||||||
|  |  | ||||||
|  | @ -1,19 +1,19 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| set -euo pipefail | set -e | ||||||
| cd "$(git rev-parse --show-toplevel)/" | cd $(git rev-parse --show-toplevel)/ | ||||||
| 
 | 
 | ||||||
| has_fomatting_issues=0 | has_fomatting_issues=0 | ||||||
| while IFS= read -r -d '' file; do | for file in $(find ./modules -name '*.?pp'); do | ||||||
|     echo "Checking format for $file" |   echo "Checking format for $file" | ||||||
| 
 |   if ! clang-format --dry-run --Werror "$file"; then | ||||||
|     if ! clang-format --dry-run --Werror "$file"; then |     echo "❌ Formatting issue detected in $file" | ||||||
|         echo "❌ Formatting issue detected in $file" |     has_fomatting_issues=1 | ||||||
|         has_fomatting_issues=1 |   fi | ||||||
|     fi | done | ||||||
| done < <(find ./modules -name '*.?pp' -print0) |  | ||||||
| 
 | 
 | ||||||
| if [ "$has_fomatting_issues" -eq 0 ]; then | if [ "$has_fomatting_issues" -eq 0 ]; then | ||||||
|     echo "✅ All files are properly formatted! Well done! ^~^" |   echo "✅ All files are properly formatted! Well done! ^~^" | ||||||
| fi | fi | ||||||
|  | 
 | ||||||
| exit ${has_fomatting_issues} | exit ${has_fomatting_issues} | ||||||
|  |  | ||||||
|  | @ -1,22 +1,17 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| set -euo pipefail | set -e | ||||||
| cd "$(git rev-parse --show-toplevel)/" | cd $(git rev-parse --show-toplevel)/ | ||||||
|  | rm -rf ./build && mkdir build/ && cd build | ||||||
| 
 | 
 | ||||||
| CC=$(which clang) | export CC=$(which clang) | ||||||
| export CC | export CXX=$(which clang++) | ||||||
| 
 | 
 | ||||||
| CXX=$(which clang++) | cmake .. \ | ||||||
| export CXX | -G Ninja \ | ||||||
| 
 | -DCMAKE_LINKER_TYPE=MOLD \ | ||||||
| cmake \ | -DENABLE_UNIT_TESTS=ON \ | ||||||
|     -S . \ | -DENABLE_STATIC_ANALYSIS=ON \ | ||||||
|     -B build \ | -DCMAKE_BUILD_TYPE=Release \ | ||||||
|     -G Ninja \ | -DCMAKE_CXX_FLAGS="-std=c++23 -stdlib=libc++" \ | ||||||
|     -D CMAKE_LINKER_TYPE=MOLD \ | && cmake --build . -j `nproc` | ||||||
|     -D ENABLE_UNIT_TESTS=ON \ |  | ||||||
|     -D ENABLE_STATIC_ANALYSIS=ON \ |  | ||||||
|     -D CMAKE_BUILD_TYPE=Release \ |  | ||||||
|     -D CMAKE_CXX_FLAGS="-std=c++23 -stdlib=libc++" |  | ||||||
| 
 |  | ||||||
| cmake --build . -j"$(nproc)" |  | ||||||
|  |  | ||||||
|  | @ -1,19 +0,0 @@ | ||||||
| #!/usr/bin/env bash |  | ||||||
| 
 |  | ||||||
| set -euo pipefail |  | ||||||
| cd "$(git rev-parse --show-toplevel)/" |  | ||||||
| 
 |  | ||||||
| has_formatting_issues=0 |  | ||||||
| while IFS= read -r -d '' file; do |  | ||||||
|     echo "Checking format for $file" |  | ||||||
| 
 |  | ||||||
|     if ! cmake-format --check "$file"; then |  | ||||||
|         echo "❌ Formatting issue detected in $file" |  | ||||||
|         has_formatting_issues=1 |  | ||||||
|     fi |  | ||||||
| done < <(find ./modules ./tools/cmake -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) -print0) |  | ||||||
| 
 |  | ||||||
| if [ "$has_formatting_issues" -ne 0 ]; then |  | ||||||
|     echo "✅ All files are properly formatted! Well done! ^~^" |  | ||||||
| fi |  | ||||||
| exit ${has_formatting_issues} |  | ||||||
|  | @ -1,19 +0,0 @@ | ||||||
| #!/bin/bash |  | ||||||
| 
 |  | ||||||
| set -euo pipefail |  | ||||||
| cd "$(git rev-parse --show-toplevel)/" |  | ||||||
| 
 |  | ||||||
| has_shellcheck_issues=0 |  | ||||||
| while IFS= read -r -d '' file; do |  | ||||||
|     echo "Checking shell script $file" |  | ||||||
| 
 |  | ||||||
|     if ! shellcheck "$file"; then |  | ||||||
|         echo "❌ Shellcheck issue detected in $file" |  | ||||||
|         has_shellcheck_issues=1 |  | ||||||
|     fi |  | ||||||
| done < <(find ./modules ./tools -name '*.sh' -print0) |  | ||||||
| 
 |  | ||||||
| if [ "$has_shellcheck_issues" -eq 0 ]; then |  | ||||||
|     echo "✅ All files are properly shellchecked! Well done! ^~^" |  | ||||||
| fi |  | ||||||
| exit ${has_shellcheck_issues} |  | ||||||
|  | @ -1,19 +0,0 @@ | ||||||
| #!/bin/bash |  | ||||||
| 
 |  | ||||||
| set -euo pipefail |  | ||||||
| cd "$(git rev-parse --show-toplevel)/" |  | ||||||
| 
 |  | ||||||
| has_fomatting_issues=0 |  | ||||||
| while IFS= read -r -d '' file; do |  | ||||||
|     echo "Checking format for $file" |  | ||||||
| 
 |  | ||||||
|     if ! shfmt -i 4 -ci -d "$file"; then |  | ||||||
|         echo "❌ Formatting issue detected in $file" |  | ||||||
|         has_fomatting_issues=1 |  | ||||||
|     fi |  | ||||||
| done < <(find ./modules ./tools -name '*.sh' -print0) |  | ||||||
| 
 |  | ||||||
| if [ "$has_fomatting_issues" -eq 0 ]; then |  | ||||||
|     echo "✅ All files are properly formatted! Well done! ^~^" |  | ||||||
| fi |  | ||||||
| exit ${has_fomatting_issues} |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| if(WIN32) | if(WIN32) | ||||||
|     add_compile_definitions(LIGHT_PLATFORM_WINDOWS) |   add_compile_definitions(LIGHT_PLATFORM_WINDOWS) | ||||||
| elseif(UNIX) | elseif(UNIX) | ||||||
|     add_compile_definitions(LIGHT_PLATFORM_LINUX) |   add_compile_definitions(LIGHT_PLATFORM_LINUX) | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
|  | @ -1,140 +1,157 @@ | ||||||
| function(add_library_module libname) | function (add_library_module libname) | ||||||
|     set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/public_includes") |     set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/public_includes") | ||||||
|     file(MAKE_DIRECTORY "${PUBLIC_INCLUDE_DIR}") |     file(MAKE_DIRECTORY "${PUBLIC_INCLUDE_DIR}") | ||||||
|     file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/public/" |     file(CREATE_LINK | ||||||
|          "${PUBLIC_INCLUDE_DIR}/${libname}" SYMBOLIC) |         "${CMAKE_CURRENT_SOURCE_DIR}/public/" | ||||||
|  |         "${PUBLIC_INCLUDE_DIR}/${libname}" | ||||||
|  |         SYMBOLIC | ||||||
|  |     ) | ||||||
| 
 | 
 | ||||||
|     if("${ARGN}" STREQUAL "") # Header only library |     if ("${ARGN}" STREQUAL "") # Header only library | ||||||
|         message("Adding INTERFACE library ${libname}") |         message("Adding INTERFACE library ${libname}") | ||||||
|         add_library(${libname} INTERFACE) |         add_library(${libname} INTERFACE) | ||||||
|         target_include_directories(${libname} INTERFACE ${PUBLIC_INCLUDE_DIR}) |         target_include_directories(${libname} INTERFACE ${PUBLIC_INCLUDE_DIR}) | ||||||
| 
 | 
 | ||||||
|         target_link_libraries(${libname} INTERFACE std) |         target_link_libraries(${libname} INTERFACE std) | ||||||
| 
 | 
 | ||||||
|     else() # Compiled library |     else () # Compiled library | ||||||
|         set(source_files) |         set(source_files) | ||||||
|         set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private") |         set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private") | ||||||
|         foreach(source_file ${ARGN}) |         foreach (source_file ${ARGN}) | ||||||
|             list(APPEND source_files "${source_directory}/${source_file}") |             list(APPEND source_files "${source_directory}/${source_file}") | ||||||
|         endforeach() |         endforeach () | ||||||
| 
 | 
 | ||||||
|         message("Adding library ${libname} with source files: ${source_files}") |         message("Adding library ${libname} with source files: ${source_files}") | ||||||
|         add_library(${libname} ${source_files}) |         add_library(${libname} ${source_files}) | ||||||
| 
 | 
 | ||||||
|         set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/private_includes") |         set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/private_includes") | ||||||
|         file(MAKE_DIRECTORY "${PRIVATE_INCLUDE_DIR}") |         file(MAKE_DIRECTORY "${PRIVATE_INCLUDE_DIR}") | ||||||
|         file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/private/" |         file(CREATE_LINK | ||||||
|              "${PRIVATE_INCLUDE_DIR}/${libname}" SYMBOLIC) |             "${CMAKE_CURRENT_SOURCE_DIR}/private/" | ||||||
|  |             "${PRIVATE_INCLUDE_DIR}/${libname}" | ||||||
|  |             SYMBOLIC | ||||||
|  |         ) | ||||||
| 
 | 
 | ||||||
|         target_include_directories( |         target_include_directories(${libname}  | ||||||
|             ${libname} |  | ||||||
|             PUBLIC ${PUBLIC_INCLUDE_DIR} |             PUBLIC ${PUBLIC_INCLUDE_DIR} | ||||||
|             PRIVATE ${PRIVATE_INCLUDE_DIR}) |             PRIVATE ${PRIVATE_INCLUDE_DIR} | ||||||
|  |         ) | ||||||
| 
 | 
 | ||||||
|         target_link_libraries(${libname} PUBLIC std) |         target_link_libraries(${libname} PUBLIC std) | ||||||
|     endif() |     endif () | ||||||
| 
 | 
 | ||||||
| endfunction() | endfunction () | ||||||
| 
 | 
 | ||||||
| function(add_executable_module exename) | function (add_executable_module exename) | ||||||
|     set(source_files) |     set(source_files) | ||||||
|     set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private") |     set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private") | ||||||
|     foreach(source_file ${ARGN}) |     foreach (source_file ${ARGN}) | ||||||
|         list(APPEND source_files "${source_directory}/${source_file}") |         list(APPEND source_files "${source_directory}/${source_file}") | ||||||
|     endforeach() |     endforeach () | ||||||
| 
 | 
 | ||||||
|     message("Adding executable ${exename} with source files: ${source_files}") |     message("Adding executable ${exename} with source files: ${source_files}") | ||||||
| 
 | 
 | ||||||
|     set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/public_includes") |     set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/public_includes") | ||||||
|     file(MAKE_DIRECTORY "${PUBLIC_INCLUDE_DIR}") |     file(MAKE_DIRECTORY "${PUBLIC_INCLUDE_DIR}") | ||||||
|     file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/public/" |     file(CREATE_LINK | ||||||
|          "${PUBLIC_INCLUDE_DIR}/${exename}" SYMBOLIC) |         "${CMAKE_CURRENT_SOURCE_DIR}/public/" | ||||||
|  |         "${PUBLIC_INCLUDE_DIR}/${exename}" | ||||||
|  |         SYMBOLIC | ||||||
|  |     ) | ||||||
|     set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/private_includes") |     set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/private_includes") | ||||||
|     file(MAKE_DIRECTORY "${PRIVATE_INCLUDE_DIR}") |     file(MAKE_DIRECTORY "${PRIVATE_INCLUDE_DIR}") | ||||||
|     file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/private/" |     file(CREATE_LINK | ||||||
|          "${PRIVATE_INCLUDE_DIR}${exename}" SYMBOLIC) |         "${CMAKE_CURRENT_SOURCE_DIR}/private/" | ||||||
|  |         "${PRIVATE_INCLUDE_DIR}${exename}" | ||||||
|  |         SYMBOLIC | ||||||
|  |     ) | ||||||
| 
 | 
 | ||||||
|     add_executable(${exename} ${source_files}) |     add_executable(${exename} ${source_files}) | ||||||
|     target_link_libraries(${exename} PRIVATE std) |     target_link_libraries(${exename} PRIVATE std) | ||||||
|     target_include_directories(${exename} PRIVATE ${PUBLIC_INCLUDE_DIR} |     target_include_directories(${exename} PRIVATE ${PUBLIC_INCLUDE_DIR} ${PRIVATE_INCLUDE_DIR}) | ||||||
|                                                   ${PRIVATE_INCLUDE_DIR}) | endfunction () | ||||||
| endfunction() |  | ||||||
| 
 | 
 | ||||||
| function(add_test_module target_lib_name) | function (add_test_module target_lib_name) | ||||||
|     if(NOT ${ENABLE_UNIT_TESTS}) |     if (NOT ${ENABLE_UNIT_TESTS}) | ||||||
|         return() |         return() | ||||||
|     endif() |     endif () | ||||||
| 
 | 
 | ||||||
|     set(source_files) |     set(source_files) | ||||||
|     set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private") |     set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private") | ||||||
|     foreach(source_file ${ARGN}) |     foreach (source_file ${ARGN}) | ||||||
|         list(APPEND source_files "${source_directory}/${source_file}") |         list(APPEND source_files "${source_directory}/${source_file}") | ||||||
|     endforeach() |     endforeach () | ||||||
| 
 | 
 | ||||||
|     message( |     message("Adding test executable ${target_lib_name}_tests with source files: ${source_files}") | ||||||
|         "Adding test executable ${target_lib_name}_tests with source files: ${source_files}" |  | ||||||
|     ) |  | ||||||
| 
 | 
 | ||||||
|     set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/public_includes") |     set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/public_includes") | ||||||
|     file(MAKE_DIRECTORY "${PUBLIC_INCLUDE_DIR}") |     file(MAKE_DIRECTORY "${PUBLIC_INCLUDE_DIR}") | ||||||
|     file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/public/" |     file(CREATE_LINK | ||||||
|          "${PUBLIC_INCLUDE_DIR}/${target_lib_name}" SYMBOLIC) |         "${CMAKE_CURRENT_SOURCE_DIR}/public/" | ||||||
|  |         "${PUBLIC_INCLUDE_DIR}/${target_lib_name}" | ||||||
|  |         SYMBOLIC | ||||||
|  |     ) | ||||||
|     set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/private_includes") |     set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/private_includes") | ||||||
|     file(MAKE_DIRECTORY "${PRIVATE_INCLUDE_DIR}") |     file(MAKE_DIRECTORY "${PRIVATE_INCLUDE_DIR}") | ||||||
|     file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/private/" |     file(CREATE_LINK | ||||||
|          "${PRIVATE_INCLUDE_DIR}/${target_lib_name}" SYMBOLIC) |         "${CMAKE_CURRENT_SOURCE_DIR}/private/" | ||||||
|  |         "${PRIVATE_INCLUDE_DIR}/${target_lib_name}" | ||||||
|  |         SYMBOLIC | ||||||
|  |     ) | ||||||
| 
 | 
 | ||||||
|     add_executable(${target_lib_name}_tests ${source_files}) |     add_executable(${target_lib_name}_tests ${source_files}) | ||||||
|     target_link_libraries(${target_lib_name}_tests PRIVATE ${target_lib_name} |     target_link_libraries(${target_lib_name}_tests PRIVATE ${target_lib_name} std test) | ||||||
|                                                            std test) |     target_include_directories(${target_lib_name}_tests | ||||||
|     target_include_directories( |  | ||||||
|         ${target_lib_name}_tests |  | ||||||
|         PRIVATE ${PUBLIC_INCLUDE_DIR} |         PRIVATE ${PUBLIC_INCLUDE_DIR} | ||||||
|         PRIVATE ${PRIVATE_INCLUDE_DIR}) |         PRIVATE ${PRIVATE_INCLUDE_DIR} | ||||||
| endfunction() |     ) | ||||||
|  | endfunction () | ||||||
| 
 | 
 | ||||||
| function(add_fuzz_module target_lib_name) | function (add_fuzz_module target_lib_name) | ||||||
|     if(NOT ${ENABLE_FUZZ_TESTS}) |     if (NOT ${ENABLE_FUZZ_TESTS}) | ||||||
|         return() |         return() | ||||||
|     endif() |     endif () | ||||||
| 
 | 
 | ||||||
|     set(source_files) |     set(source_files) | ||||||
|     set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private") |     set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private") | ||||||
|     foreach(source_file ${ARGN}) |     foreach (source_file ${ARGN}) | ||||||
|         list(APPEND source_files "${source_directory}/${source_file}") |         list(APPEND source_files "${source_directory}/${source_file}") | ||||||
|     endforeach() |     endforeach () | ||||||
| 
 | 
 | ||||||
|     message( |     message("Adding fuzz executable ${target_lib_name}_fuzz with source files: ${source_files}") | ||||||
|         "Adding fuzz executable ${target_lib_name}_fuzz with source files: ${source_files}" |  | ||||||
|     ) |  | ||||||
| 
 | 
 | ||||||
|     set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/public_includes") |     set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/public_includes") | ||||||
|     file(MAKE_DIRECTORY "${PUBLIC_INCLUDE_DIR}") |     file(MAKE_DIRECTORY "${PUBLIC_INCLUDE_DIR}") | ||||||
|     file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/public/" |     file(CREATE_LINK | ||||||
|          "${PUBLIC_INCLUDE_DIR}/${target_lib_name}" SYMBOLIC) |         "${CMAKE_CURRENT_SOURCE_DIR}/public/" | ||||||
|  |         "${PUBLIC_INCLUDE_DIR}/${target_lib_name}" | ||||||
|  |         SYMBOLIC | ||||||
|  |     ) | ||||||
|     set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/private_includes") |     set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/private_includes") | ||||||
|     file(MAKE_DIRECTORY "${PRIVATE_INCLUDE_DIR}") |     file(MAKE_DIRECTORY "${PRIVATE_INCLUDE_DIR}") | ||||||
|     file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/private/" |     file(CREATE_LINK | ||||||
|          "${PRIVATE_INCLUDE_DIR}/${target_lib_name}" SYMBOLIC) |         "${CMAKE_CURRENT_SOURCE_DIR}/private/" | ||||||
|  |         "${PRIVATE_INCLUDE_DIR}/${target_lib_name}" | ||||||
|  |         SYMBOLIC | ||||||
|  |     ) | ||||||
| 
 | 
 | ||||||
|     add_executable(${target_lib_name}_fuzz ${source_files}) |     add_executable(${target_lib_name}_fuzz ${source_files}) | ||||||
|     target_link_libraries(${target_lib_name}_fuzz PRIVATE ${target_lib_name} |     target_link_libraries(${target_lib_name}_fuzz PRIVATE ${target_lib_name} std fuzz_test) | ||||||
|                                                           std fuzz_test) |  | ||||||
|     target_link_options(${target_lib_name}_fuzz PRIVATE -fsanitize=fuzzer) |     target_link_options(${target_lib_name}_fuzz PRIVATE -fsanitize=fuzzer) | ||||||
|     target_compile_options(${target_lib_name}_fuzz PRIVATE -fsanitize=fuzzer) |     target_compile_options(${target_lib_name}_fuzz PRIVATE -fsanitize=fuzzer) | ||||||
|     target_include_directories( |     target_include_directories(${target_lib_name}_fuzz | ||||||
|         ${target_lib_name}_fuzz |  | ||||||
|         PRIVATE ${PUBLIC_INCLUDE_DIR} |         PRIVATE ${PUBLIC_INCLUDE_DIR} | ||||||
|         PRIVATE ${PRIVATE_INCLUDE_DIR}) |         PRIVATE ${PRIVATE_INCLUDE_DIR} | ||||||
| endfunction() |     ) | ||||||
|  | endfunction () | ||||||
| 
 | 
 | ||||||
| function(add_option option help) | function (add_option option help) | ||||||
|     option(${option} ${help}) |     option(${option} ${help}) | ||||||
| 
 | 
 | ||||||
|     if(${option}) |     if (${option}) | ||||||
|         message(STATUS "${option}: ON") |         message(STATUS "${option}: ON") | ||||||
|         add_compile_definitions(${option}=1) |         add_compile_definitions(${option}=1) | ||||||
|     else() |     else () | ||||||
|         message(STATUS "${option}: OFF") |         message(STATUS "${option}: OFF") | ||||||
|     endif() |     endif () | ||||||
| endfunction() | endfunction () | ||||||
|  |  | ||||||
|  | @ -1,41 +1,32 @@ | ||||||
| add_option(ENABLE_UNIT_TESTS "Enables the building of the unit test modules") | add_option(ENABLE_UNIT_TESTS "Enables the building of the unit test modules") | ||||||
| add_option(ENABLE_FUZZ_TESTS "Enables the building of the fuzz test modules") | add_option(ENABLE_FUZZ_TESTS "Enables the building of the fuzz test modules") | ||||||
| add_option(ENABLE_STATIC_ANALYSIS | add_option(ENABLE_STATIC_ANALYSIS "Makes the clang-tidy checks mandatory for compilation") | ||||||
|            "Makes the clang-tidy checks mandatory for compilation") | add_option(ENABLE_LLVM_COVERAGE "Enables the code coverage instrumentation for clang") | ||||||
| add_option(ENABLE_LLVM_COVERAGE |  | ||||||
|            "Enables the code coverage instrumentation for clang") |  | ||||||
| 
 | 
 | ||||||
| if(ENABLE_STATIC_ANALYSIS) | if (ENABLE_STATIC_ANALYSIS) | ||||||
|     set(CMAKE_CXX_CLANG_TIDY |     set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--warnings-as-errors=*;--allow-no-checks") | ||||||
|         "clang-tidy;--warnings-as-errors=*;--allow-no-checks") | endif () | ||||||
| endif() |  | ||||||
| 
 | 
 | ||||||
| if(ENABLE_LLVM_COVERAGE) | if(ENABLE_LLVM_COVERAGE) | ||||||
|     include(CheckCXXSourceCompiles) |     include(CheckCXXSourceCompiles) | ||||||
| 
 | 
 | ||||||
|     if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |     if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | ||||||
|         message( |         message(FATAL_ERROR "ENABLE_LLVM_COVERAGE only supports the clang compiler") | ||||||
|             FATAL_ERROR "ENABLE_LLVM_COVERAGE only supports the clang compiler") |     endif () | ||||||
|     endif() |  | ||||||
| 
 | 
 | ||||||
|     # Check for libc++ |     # Check for libc++ | ||||||
|     check_cxx_source_compiles( |     check_cxx_source_compiles(" | ||||||
|         " |  | ||||||
|         #include <string> |         #include <string> | ||||||
|         #ifdef _LIBCPP_VERSION |         #ifdef _LIBCPP_VERSION | ||||||
|         int main() { return 0; } |         int main() { return 0; } | ||||||
|         #else |         #else | ||||||
|         #error Not using libc++ |         #error Not using libc++ | ||||||
|         #endif |         #endif | ||||||
|     " |     " USING_LIBCXX) | ||||||
|         USING_LIBCXX) |  | ||||||
|     if(NOT USING_LIBCXX) |     if(NOT USING_LIBCXX) | ||||||
|         message( |         message(FATAL_ERROR "ENABLE_LLVM_COVERAGE requires libc++, please compile with -stdlib=libc++") | ||||||
|             FATAL_ERROR |  | ||||||
|                 "ENABLE_LLVM_COVERAGE requires libc++, please compile with -stdlib=libc++" |  | ||||||
|         ) |  | ||||||
|     endif() |     endif() | ||||||
| 
 | 
 | ||||||
|     add_compile_options(-fprofile-instr-generate -fcoverage-mapping) |     add_compile_options(-fprofile-instr-generate -fcoverage-mapping) | ||||||
|     add_link_options(-fprofile-instr-generate -fcoverage-mapping) |     add_link_options(-fprofile-instr-generate -fcoverage-mapping) | ||||||
| endif() | endif () | ||||||
|  |  | ||||||
							
								
								
									
										36
									
								
								tools/scripts/build_ci_images.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								tools/scripts/build_ci_images.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,36 @@ | ||||||
|  | #!/bin/bash | ||||||
|  | 
 | ||||||
|  | set -e | ||||||
|  | CI_DIR="$(git rev-parse --show-toplevel)/tools/ci/" | ||||||
|  | 
 | ||||||
|  | echo "===========[ amd64_clang ]==========="] | ||||||
|  | echo "==> Building amd64_clang_coverage..." | ||||||
|  | docker build -t amd64_clang_coverage -f $CI_DIR/amd64/clang/coverage.dockerfile . | ||||||
|  | echo "...DONE <==" | ||||||
|  | 
 | ||||||
|  | echo "==> Building amd64_clang_lsan..." | ||||||
|  | docker build -t amd64_clang_lsan -f $CI_DIR/amd64/clang/lsan.dockerfile . | ||||||
|  | echo "...DONE <==" | ||||||
|  | 
 | ||||||
|  | echo "==> Building image: amd64_clang_msan" | ||||||
|  | docker build -t amd64_clang_msan -f $CI_DIR/amd64/clang/msan.dockerfile . | ||||||
|  | echo "...DONE <==" | ||||||
|  | 
 | ||||||
|  | echo "==> Building image: clang_format" | ||||||
|  | docker build -t clang_format -f $CI_DIR/static_analysis/clang_format.dockerfile . | ||||||
|  | echo "...DONE <==" | ||||||
|  | 
 | ||||||
|  | echo "==> Building image: static_analysis" | ||||||
|  | docker build -t clang_tidy -f $CI_DIR/static_analysis/clang_tidy.dockerfile . | ||||||
|  | echo "...DONE <==" | ||||||
|  | 
 | ||||||
|  | echo "===========[ amd64_gcc ]==========="] | ||||||
|  | echo "==> Building image: amd64_gcc_unit_tests" | ||||||
|  | docker build -t amd64_gcc_unit_tests -f $CI_DIR/amd64/gcc/unit_tests.dockerfile . | ||||||
|  | echo "...DONE <==" | ||||||
|  | 
 | ||||||
|  | echo "==> Building image: amd64_gcc_valgrind" | ||||||
|  | docker build -t amd64_gcc_valgrind -f $CI_DIR/amd64/gcc/valgrind.dockerfile . | ||||||
|  | echo "...DONE <==" | ||||||
|  | 
 | ||||||
|  | echo "WOOOOOOOOOOOOOOOOH!!! DONE :D" | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue