From 6e2211360672f7c7fa0f2a9d4f4598279e063d60 Mon Sep 17 00:00:00 2001 From: Eddy Jansson Date: Sat, 9 Nov 2024 13:20:40 +0100 Subject: [PATCH 1/3] cmake: Build all executables. --- CMakeLists.txt | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fcc2ee..0ab5dd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,50 @@ - cmake_minimum_required(VERSION 3.20) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -project(tiny_bvh_test LANGUAGES CXX) +project(tiny_bvh LANGUAGES CXX) + +if (APPLE) + find_library(COCOA_LIBRARY Cocoa) +elseif (UNIX) + find_package(X11) +endif() enable_testing() -## Build test app ## +add_executable(tiny_bvh_test tiny_bvh_test.cpp) +add_executable(tiny_bvh_renderer tiny_bvh_renderer.cpp) +add_executable(tiny_bvh_speedtest tiny_bvh_speedtest.cpp) +add_executable(tiny_bvh_fenster tiny_bvh_fenster.cpp) -add_executable(${PROJECT_NAME} tiny_bvh_test.cpp) if (NOT MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE -march=native) + set(common_cxx_flags + -g -march=native + ) + target_compile_options(tiny_bvh_test PRIVATE ${common_cxx_flags}) + target_compile_options(tiny_bvh_renderer PRIVATE ${common_cxx_flags}) + if (NOT APPLE) + target_compile_options(tiny_bvh_speedtest PRIVATE ${common_cxx_flags} -fopenmp) + target_link_options(tiny_bvh_speedtest PRIVATE -fopenmp) + else() + # No openmp support in default compiler + target_compile_options(tiny_bvh_speedtest PRIVATE ${common_cxx_flags}) + target_link_options(tiny_bvh_speedtest PRIVATE) + endif() + target_compile_options(tiny_bvh_fenster PRIVATE ${common_cxx_flags}) + if (WIN32) + target_link_libraries(tiny_bvh_fenster -mwindows) + elseif (APPLE) + target_link_libraries(tiny_bvh_fenster ${COCOA_LIBRARY}) + elseif (X11_FOUND) + target_link_libraries(tiny_bvh_fenster ${X11_LIBRARIES}) + endif() +else() + if (WIN32) + set_target_properties(tiny_bvh_fenster PROPERTIES WIN32_EXECUTABLE TRUE) + endif() endif() -add_test(NAME "${PROJECT_NAME}" COMMAND ${PROJECT_NAME}) +add_test(NAME "tiny_bvh_test" COMMAND tiny_bvh_test) From 6632a54bb454ddcc7c1d8c9885086be7f4f9bfa2 Mon Sep 17 00:00:00 2001 From: Eddy Jansson Date: Sat, 9 Nov 2024 13:44:52 +0100 Subject: [PATCH 2/3] fenster: Only use AVX builder if available. --- tiny_bvh_fenster.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tiny_bvh_fenster.cpp b/tiny_bvh_fenster.cpp index 9a976f2..57a050d 100644 --- a/tiny_bvh_fenster.cpp +++ b/tiny_bvh_fenster.cpp @@ -103,7 +103,11 @@ void Init() #else // build a BVH over the scene +#if defined(BVH_USEAVX) bvh.BuildAVX( triangles, verts / 3 ); +#else + bvh.Build( triangles, verts / 3 ); +#endif bvh.Convert( BVH::WALD_32BYTE, BVH::ALT_SOA ); #endif @@ -200,4 +204,4 @@ void Tick( uint32_t* buf ) } } ALIGNED_FREE( rays ); -} \ No newline at end of file +} From 8e698847d8f1603d63e52a7790e6b07d35fa6975 Mon Sep 17 00:00:00 2001 From: Eddy Jansson Date: Sat, 9 Nov 2024 13:52:33 +0100 Subject: [PATCH 3/3] ci: Upgrade to checkout@v4 There's a deprecation warning on v3. --- .github/workflows/tinybvh_sdk_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tinybvh_sdk_ci.yml b/.github/workflows/tinybvh_sdk_ci.yml index 47f6125..017fc97 100644 --- a/.github/workflows/tinybvh_sdk_ci.yml +++ b/.github/workflows/tinybvh_sdk_ci.yml @@ -15,7 +15,7 @@ jobs: config: [Release, Debug] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Packages if: ${{ matrix.os == 'ubuntu-latest' }}