Skip to content

Commit

Permalink
fixes for windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fbxiang committed Nov 4, 2023
1 parent e4c1bc3 commit 651a6a4
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion 3rd_party/sapien-vulkan-2
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(sapien LANGUAGES C CXX)

if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
endif()


set(CMAKE_CXX_STANDARD 20)

if(MSVC)
Expand Down Expand Up @@ -49,7 +54,10 @@ list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(physx5)
include(zlib)
include(grpc)

# TODO: re-enable render server
# include(grpc)

include(eigen)
include(vulkan)
include(cereal)
Expand Down Expand Up @@ -84,7 +92,8 @@ file(GLOB_RECURSE SAPIEN_SRC "src/*.h" "src/*.cpp" "src/*.cc")
add_library(sapien SHARED ${SAPIEN_SRC})

target_link_libraries(sapien PUBLIC eigen svulkan2 cereal)
target_link_libraries(sapien PRIVATE physx5 spdlog::spdlog easy_profiler grpc++ ${CMAKE_DL_LIBS} assimp::assimp)
target_link_libraries(sapien PRIVATE physx5 spdlog::spdlog easy_profiler # grpc++
${CMAKE_DL_LIBS} assimp::assimp)

if (UNIX)
target_link_libraries(sapien PRIVATE stdc++fs)
Expand Down
2 changes: 1 addition & 1 deletion cmake/physx5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endif()

if (WIN32)
target_include_directories(physx5 SYSTEM INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/physx/include>)
target_link_directories(physx5 INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/physx/bin/win.x86_64.vc143.md/release>)
target_link_directories(physx5 INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/physx/bin/win.x86_64.vc143.mt/release>)
target_link_libraries(physx5 INTERFACE
PhysXVehicle2_static_64.lib PhysXExtensions_static_64.lib
PhysXVehicle_static_64.lib PhysX_static_64.lib PhysXPvdSDK_static_64.lib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#include "sapien/serialize.h"
#include <svulkan2/resource/model.h>

#ifdef SAPIEN_CUDA
#include <cuda_runtime.h>
#endif

namespace sapien {
namespace component {
Expand Down Expand Up @@ -49,9 +51,11 @@ class CudaDeformableMeshComponent : public Component {

svulkan2::scene::Object *mObject{};

#ifdef SAPIEN_CUDA
vk::UniqueSemaphore mSem{};
cudaExternalSemaphore_t mCudaSem{};
uint64_t mSemValue{0};
#endif
};

} // namespace component
Expand Down
2 changes: 2 additions & 0 deletions include/sapien/component/system.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#include <memory>
#include <vector>
#include <string>
#include <stdexcept>

namespace sapien {
namespace component {
Expand Down
2 changes: 1 addition & 1 deletion python/py_package/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ __all__ = [

def set_log_level(level: str) -> None:
pass
__version__ = '3.0.0.dev20231103'
__version__ = '3.0.0.dev20231104'
SceneConfig = sapien.pysapien.physx.PhysxSceneConfig
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ def build_sapien(sapien_source_dir, sapien_build_dir):
else:
cmake_args += ["-DSAPIEN_CUDA=OFF"]

cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]
cmake_args += ["-DCMAKE_INSTALL_PREFIX=" + install_dir]
cmake_args += [
f"-DCMAKE_BUILD_TYPE={cfg}",
f"-DCMAKE_INSTALL_PREFIX={install_dir}",
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded",
]

env = os.environ.copy()
subprocess.check_call(
Expand Down Expand Up @@ -162,6 +165,7 @@ def build_pinocchio(self, ext):
cmake_args = [
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$<1:{extdir}>",
f"-DPYTHON_EXECUTABLE={sys.executable}",
f"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded",
]
if args.debug:
cfg = "Debug"
Expand Down Expand Up @@ -193,6 +197,7 @@ def build_pybind(self, ext):
cmake_args = [
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$<1:{extdir}>",
f"-DPYTHON_EXECUTABLE={sys.executable}",
f"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded",
]
if args.debug:
cfg = "Debug"
Expand Down
5 changes: 2 additions & 3 deletions src/component/sapien_renderer/deformable_mesh_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include "sapien/entity.h"
#include "sapien/scene.h"

#include <cuda_runtime.h>

namespace sapien {
namespace component {

Expand All @@ -14,6 +12,7 @@ CudaDeformableMeshComponent::CudaDeformableMeshComponent(uint32_t maxVertexCount
mEngine = SapienRenderEngine::Get();
mMesh = std::make_shared<svulkan2::resource::SVMeshDeformable>(maxVertexCount, maxTriangleCount);

#ifdef SAPIEN_CUDA
vk::SemaphoreTypeCreateInfo timelineCreateInfo(vk::SemaphoreType::eTimeline, 0);
vk::SemaphoreCreateInfo createInfo{};
vk::ExportSemaphoreCreateInfo exportCreateInfo(
Expand All @@ -34,8 +33,8 @@ CudaDeformableMeshComponent::CudaDeformableMeshComponent(uint32_t maxVertexCount
throw std::runtime_error("Failed to export semaphore to CUDA: " +
std::string(cudaGetErrorName(err)));
}
#endif

// TODO: set material
mMaterial = std::make_shared<SapienRenderMaterial>();
}

Expand Down
6 changes: 4 additions & 2 deletions src/component/sapien_renderer/sapien_renderer_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ void SapienRendererDefault::internalSetShaderSearchPath(std::string const &dir)
}

void SapienRendererDefault::setImguiIniFilename(std::string const &filename) {
svulkan2::renderer::GuiWindow::gImguiIniFileLocation = filename;
svulkan2::renderer::GuiWindow::setImguiIniFileLocation(filename);
// svulkan2::renderer::GuiWindow::gImguiIniFileLocation = filename;
}

std::string SapienRendererDefault::getImguiIniFilename() {
return svulkan2::renderer::GuiWindow::gImguiIniFileLocation;
return svulkan2::renderer::GuiWindow::getImguiIniFileLocation();
// return svulkan2::renderer::GuiWindow::gImguiIniFileLocation;
}

} // namespace component
Expand Down

0 comments on commit 651a6a4

Please sign in to comment.