-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,230 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR) | ||
project(sapien-render-server LANGUAGES C CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall") | ||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g0 -Wall") | ||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "") | ||
|
||
add_compile_definitions("$<$<CONFIG:DEBUG>:_DEBUG>") | ||
add_compile_definitions("$<$<NOT:$<CONFIG:Debug>>:NDEBUG>") | ||
|
||
set(CMAKE_DEBUG_POSTFIX "") | ||
|
||
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
include(eigen) | ||
include(grpc) | ||
include(pybind11) | ||
|
||
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/proto proto/render_server.proto) | ||
grpc_generate_cpp(GRPC_SRCS GRPC_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/proto proto/render_server.proto) | ||
|
||
find_package(sapien REQUIRED) | ||
|
||
file(GLOB_RECURSE RENDER_SERVER_SRC "src/*.cpp") | ||
|
||
pybind11_add_module(pysapien_render_server ${RENDER_SERVER_SRC} ${PROTO_SRCS} ${GRPC_SRCS} NO_EXTRAS) | ||
# add_library(sapien_render_server ${RENDER_SERVER_SRC} ${PROTO_SRCS} ${GRPC_SRCS}) | ||
target_link_libraries(pysapien_render_server PRIVATE grpc++ sapien::sapien eigen) | ||
target_include_directories(pysapien_render_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
if(TARGET Eigen3::Eigen) | ||
return() | ||
endif() | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
eigen | ||
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git | ||
GIT_TAG 3.4.0 | ||
GIT_SHALLOW TRUE | ||
GIT_PROGRESS TRUE | ||
OVERRIDE_FIND_PACKAGE | ||
) | ||
|
||
set(EIGEN_BUILD_DOC OFF CACHE BOOL "" FORCE) | ||
set(BUILD_TESTING OFF) | ||
set(EIGEN_BUILD_PKGCONFIG OFF) | ||
|
||
FetchContent_MakeAvailable(eigen) | ||
|
||
set(Eigen3_DIR ${eigen_BINARY_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
if(TARGET grpc++) | ||
return() | ||
endif() | ||
|
||
set(gRPC_ZLIB_PROVIDER "package") | ||
set(gRPC_BUILD_TESTS OFF CACHE BOOL "" FORCE) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
grpc | ||
GIT_REPOSITORY https://github.com/grpc/grpc | ||
GIT_TAG v1.51.1 | ||
) | ||
|
||
set(FETCHCONTENT_QUIET OFF) | ||
FetchContent_MakeAvailable(grpc) | ||
set(FETCHCONTENT_QUIET ON) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
|
||
if (zlib_SOURCE_DIR) | ||
target_include_directories(grpc PRIVATE ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) | ||
target_include_directories(grpc++ PRIVATE ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) | ||
endif() | ||
|
||
|
||
# MIT License | ||
|
||
# Copyright (c) 2018 Ivan Safonov | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
function(PROTOBUF_GENERATE_CPP SRCS HDRS DEST) | ||
if(NOT ARGN) | ||
message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") | ||
return() | ||
endif() | ||
|
||
set(${SRCS}) | ||
set(${HDRS}) | ||
foreach(FIL ${ARGN}) | ||
get_filename_component(ABS_FIL ${FIL} ABSOLUTE) | ||
get_filename_component(FIL_WE ${FIL} NAME_WE) | ||
get_filename_component(_protobuf_include_path ${ABS_FIL} DIRECTORY) | ||
|
||
list(APPEND ${SRCS} "${DEST}/${FIL_WE}.pb.cc") | ||
list(APPEND ${HDRS} "${DEST}/${FIL_WE}.pb.h") | ||
|
||
add_custom_command( | ||
OUTPUT "${DEST}/${FIL_WE}.pb.cc" | ||
"${DEST}/${FIL_WE}.pb.h" | ||
COMMAND protobuf::protoc | ||
ARGS --cpp_out ${DEST} -I${_protobuf_include_path} ${ABS_FIL} | ||
DEPENDS ${ABS_FIL} protobuf::protoc | ||
COMMENT "Running C++ protocol buffer compiler on ${FIL}" | ||
VERBATIM ) | ||
endforeach() | ||
set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) | ||
set(${SRCS} ${${SRCS}} PARENT_SCOPE) | ||
set(${HDRS} ${${HDRS}} PARENT_SCOPE) | ||
endfunction() | ||
|
||
|
||
function(GRPC_GENERATE_CPP SRCS HDRS DEST) | ||
if(NOT ARGN) | ||
message(SEND_ERROR "Error: GRPC_GENERATE_CPP() called without any proto files") | ||
return() | ||
endif() | ||
|
||
set(${SRCS}) | ||
set(${HDRS}) | ||
foreach(FIL ${ARGN}) | ||
get_filename_component(ABS_FIL ${FIL} ABSOLUTE) | ||
get_filename_component(FIL_WE ${FIL} NAME_WE) | ||
get_filename_component(_protobuf_include_path ${ABS_FIL} DIRECTORY) | ||
|
||
list(APPEND ${SRCS} "${DEST}/${FIL_WE}.grpc.pb.cc") | ||
list(APPEND ${HDRS} "${DEST}/${FIL_WE}.grpc.pb.h") | ||
|
||
add_custom_command( | ||
OUTPUT "${DEST}/${FIL_WE}.grpc.pb.cc" | ||
"${DEST}/${FIL_WE}.grpc.pb.h" | ||
COMMAND protobuf::protoc | ||
ARGS --grpc_out ${DEST} -I${_protobuf_include_path} --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> ${ABS_FIL} | ||
DEPENDS ${ABS_FIL} protobuf::protoc grpc_cpp_plugin | ||
COMMENT "Running C++ gRPC compiler on ${FIL}" | ||
VERBATIM ) | ||
endforeach() | ||
|
||
set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) | ||
set(${SRCS} ${${SRCS}} PARENT_SCOPE) | ||
set(${HDRS} ${${HDRS}} PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
if(TARGET pybind11) | ||
return() | ||
endif() | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
pybind11 | ||
GIT_REPOSITORY https://github.com/pybind/pybind11.git | ||
GIT_TAG smart_holder | ||
GIT_SHALLOW TRUE | ||
GIT_PROGRESS TRUE | ||
) | ||
|
||
FetchContent_MakeAvailable(pybind11) |
Oops, something went wrong.