From 90a33771a400e7cea8c58e167312bfec1e86566b Mon Sep 17 00:00:00 2001 From: Pengfei Xuan Date: Sat, 23 Mar 2024 10:15:37 -0400 Subject: [PATCH] Add pthread for unix platform --- .github/workflows/ubuntu-cpu.yml | 11 ++++++++++- CMakeLists.txt | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-cpu.yml b/.github/workflows/ubuntu-cpu.yml index 9c69ce7..fac2f11 100644 --- a/.github/workflows/ubuntu-cpu.yml +++ b/.github/workflows/ubuntu-cpu.yml @@ -87,9 +87,18 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \ -DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \ -DCMAKE_PREFIX_PATH=${{ github.workspace }}/libtorch \ - -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \ + -DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON ninja + - name: Save Artifacts + uses: actions/upload-artifact@v4 + with: + path: | + build/libgsplat.a + build/opensplat + build/simple_trainer + - name: Clean Compiler Cache run: | set -x diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e5f4b8..606a7d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,9 @@ add_executable(opensplat opensplat.cpp point_io.cpp nerfstudio.cpp model.cpp kdt set_property(TARGET opensplat PROPERTY CXX_STANDARD 17) target_include_directories(opensplat PRIVATE ${PROJECT_SOURCE_DIR}/vendor/glm ${GPU_INCLUDE_DIRS}) target_link_libraries(opensplat PUBLIC ${STDPPFS_LIBRARY} ${GPU_LIBRARIES} ${GSPLAT_LIBS} ${TORCH_LIBRARIES} ${OpenCV_LIBS}) +if (NOT WIN32) + target_link_libraries(opensplat PUBLIC pthread) +endif() if(GPU_RUNTIME STREQUAL "HIP") target_compile_definitions(opensplat PRIVATE USE_HIP __HIP_PLATFORM_AMD__) elseif(GPU_RUNTIME STREQUAL "CUDA") @@ -96,6 +99,9 @@ if(OPENSPLAT_BUILD_SIMPLE_TRAINER) add_executable(simple_trainer simple_trainer.cpp project_gaussians.cpp rasterize_gaussians.cpp cv_utils.cpp) target_include_directories(simple_trainer PRIVATE ${PROJECT_SOURCE_DIR}/vendor/glm ${GPU_INCLUDE_DIRS}) target_link_libraries(simple_trainer PUBLIC ${GPU_LIBRARIES} ${GSPLAT_LIBS} ${TORCH_LIBRARIES} ${OpenCV_LIBS}) + if (NOT WIN32) + target_link_libraries(simple_trainer PUBLIC pthread) + endif() set_property(TARGET simple_trainer PROPERTY CXX_STANDARD 17) if(GPU_RUNTIME STREQUAL "HIP") target_compile_definitions(simple_trainer PRIVATE USE_HIP __HIP_PLATFORM_AMD__)