add building commands

This commit is contained in:
fxia22 2020-02-10 11:48:22 -08:00
parent 523a2b9c88
commit 0531d9b0f3
3 changed files with 8 additions and 3 deletions

View File

@ -16,19 +16,23 @@ find_package(CUDA REQUIRED)
set(CUDA_LIBRARIES PUBLIC ${CUDA_LIBRARIES})
cuda_add_library(MeshRendererContext MODULE glad/egl.cpp glad/gl.cpp cpp/Mesh_renderer.cpp)
add_library(CGLUtils MODULE glad/egl.cpp glad/gl.cpp cpp/cgl_utils.cpp)
add_library(tinyobjloader MODULE cpp/tinyobjloader/tiny_obj_loader.cc cpp/tinyobjloader/bindings.cc)
if (USE_GLAD)
target_link_libraries(MeshRendererContext PRIVATE pybind11::module dl pthread)
target_link_libraries(CGLUtils PRIVATE pybind11::module dl pthread)
else ()
target_link_libraries(MeshRendererContext PRIVATE pybind11::module dl pthread EGL ${OPENGL_LIBRARIES})
target_link_libraries(CGLUtils PRIVATE pybind11::module dl pthread EGL ${OPENGL_LIBRARIES})
endif()
target_link_libraries(tinyobjloader PRIVATE pybind11::module)
set_target_properties(MeshRendererContext PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")
set_target_properties(CGLUtils PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")
set_target_properties(tinyobjloader PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")

View File

@ -614,7 +614,7 @@ class MeshRenderer:
results.append(seg)
if '3d' in modes:
pc = CGLUtils.readbuffer_meshrenderer('pc', self.width, self.height)
pc = CGLUtils.readbuffer_meshrenderer('3d', self.width, self.height)
pc = pc.reshape(self.height, self.width, 4)[::-1, :]
results.append(pc)

View File

@ -126,7 +126,8 @@ setup(
'pyassimp==4.1.3',
'gputil'
],
ext_modules=[CMakeExtension('MeshRendererContext', sourcedir='gibson2/core/render')],
ext_modules=[CMakeExtension('MeshRendererContext', sourcedir='gibson2/core/render'),
CMakeExtension('CGLUtils', sourcedir='gibson2/core/render')],
cmdclass=dict(build_ext=CMakeBuild),
tests_require=[],
) #yapf: disable