108 lines
3.5 KiB
CMake
108 lines
3.5 KiB
CMake
cmake_minimum_required (VERSION 3.13)
|
|
|
|
cmake_policy(SET CMP0077 NEW)
|
|
|
|
project (rbdlsim
|
|
VERSION 0.0.1
|
|
LANGUAGES CXX C)
|
|
|
|
find_package(Threads)
|
|
|
|
# RBDL
|
|
set(RBDL_USE_SIMPLE_MATH TRUE)
|
|
add_subdirectory (3rdparty/rbdl)
|
|
|
|
# libccd
|
|
set(ENABLE_DOUBLE_PRECISION On)
|
|
add_subdirectory (3rdparty/libccd)
|
|
|
|
# glfw
|
|
set(GLFW_BUILD_DOCS Off)
|
|
set(GLFW_BUILD_EXAMPLES Off)
|
|
set(GLFW_BUILD_TESTS Off)
|
|
set(GLFW_BUILD_INSTALL Off)
|
|
add_subdirectory (3rdparty/glfw)
|
|
|
|
# Tracy
|
|
add_library(TracyClient)
|
|
target_compile_definitions(TracyClient
|
|
PRIVATE TRACY_ENABLE=1)
|
|
target_include_directories(
|
|
TracyClient
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tracy>)
|
|
target_sources(TracyClient PRIVATE 3rdparty/tracy/TracyClient.cpp)
|
|
target_link_libraries(TracyClient PUBLIC ${CMAKE_THREAD_LIBS_INIT} "-ldl")
|
|
|
|
# Library
|
|
add_library(${PROJECT_NAME})
|
|
target_include_directories(
|
|
${PROJECT_NAME}
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/rbdl/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/3rdparty/rbdl/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tracy>
|
|
)
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE TRACY_ENABLE=1)
|
|
target_link_libraries(${PROJECT_NAME} rbdl ccd TracyClient)
|
|
target_sources(${PROJECT_NAME} PRIVATE src/rbdlsim.cc src/utils.cc)
|
|
|
|
# Simulator Executable
|
|
add_executable(runsim)
|
|
target_include_directories(
|
|
runsim
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/rbdl/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/3rdparty/rbdl/include>)
|
|
|
|
target_link_libraries(runsim ${PROJECT_NAME})
|
|
|
|
target_sources(runsim PRIVATE src/main.cc src/utils.cc)
|
|
|
|
# Visualization
|
|
add_executable(vissim)
|
|
target_include_directories(
|
|
vissim
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/rbdl/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/3rdparty/rbdl/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glfw/deps>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/imgui>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ImGuizmo>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/vectorial/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tracy>
|
|
)
|
|
target_compile_definitions(vissim PUBLIC TRACY_ENABLE=1)
|
|
target_link_libraries(vissim ${PROJECT_NAME} glfw)
|
|
|
|
target_sources(vissim PRIVATE
|
|
src/srender.c
|
|
3rdparty/glfw/deps/glad_gl.c
|
|
3rdparty/imgui/imgui.cpp
|
|
3rdparty/imgui/imgui_draw.cpp
|
|
3rdparty/imgui/imgui_widgets.cpp
|
|
3rdparty/imgui/imgui_demo.cpp
|
|
3rdparty/imgui/backends/imgui_impl_glfw.cpp
|
|
3rdparty/imgui/backends/imgui_impl_opengl3.cpp
|
|
3rdparty/ImGuizmo/ImGuizmo.cpp
|
|
src/vissim.cc
|
|
src/sthstry.c
|
|
src/simulator.cc
|
|
src/render_utils.c
|
|
)
|
|
|
|
# Tests
|
|
add_executable(runtests)
|
|
|
|
target_sources(runtests PRIVATE tests/runtests.cc tests/CollisionTests.cc
|
|
src/utils.cc src/sconvcol.c tests/sconvcolTests.cc)
|
|
target_include_directories(
|
|
runtests
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/rbdl/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/3rdparty/rbdl/include>
|
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/vectorial/include>
|
|
)
|
|
|
|
target_link_libraries(runtests ${PROJECT_NAME})
|