-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
31 lines (28 loc) · 1.36 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(smplx)
include_directories(./include)
set(Torch_DIR G:/development/libtorch/share/cmake/Torch)
find_package(Torch REQUIRED)
find_package(ZLIB REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
set(PROJECT_SOURCES body_models.cpp joint_names.cpp lbs.cpp npyio.cpp vertex_ids.cpp vertex_joint_selector.cpp)
add_library(smplx SHARED ${PROJECT_SOURCES})
add_library(smplx_static STATIC ${PROJECT_SOURCES})
add_executable(example example.cpp ${PROJECT_SOURCES})
target_link_libraries(smplx "${TORCH_LIBRARIES}" ZLIB::ZLIB)
target_link_libraries(smplx_static "${TORCH_LIBRARIES}" ZLIB::ZLIB)
target_link_libraries(example "${TORCH_LIBRARIES}" ZLIB::ZLIB)
set_property(TARGET smplx PROPERTY CXX_STANDARD 17)
set_property(TARGET smplx_static PROPERTY CXX_STANDARD 17)
set_property(TARGET example PROPERTY CXX_STANDARD 17)
# The following code block is suggested to be used on Windows.
# According to https://github.com/pytorch/pytorch/issues/25457,
# the DLLs need to be copied to avoid memory errors.
#if (MSVC)
# file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")
# add_custom_command(TARGET example-app
# POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy_if_different
# ${TORCH_DLLS}
# $<TARGET_FILE_DIR:example-app>)
#endif (MSVC)