Skip to content

Commit

Permalink
[v7] Initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Mar 15, 2024
1 parent 97cc050 commit 1ef7676
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 7 deletions.
1 change: 1 addition & 0 deletions .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ cmake .. \
-DDART_VERBOSE=ON \
-DDART_TREAT_WARNINGS_AS_ERRORS=ON \
-DDART_CODECOV=$CODECOV \
-DDART_BUILD_V7=ON \
${install_prefix_option}

# Check format
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
-DDART_MSVC_DEFAULT_OPTIONS=ON ^
-DDART_VERBOSE=ON ^
-DBUILD_SHARED_LIBS=${{ matrix.build_shared_libs }} ^
-DDART_BUILD_V7=ON ^
|| exit /b
cmake ^
--build build ^
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ option(DART_FAST_DEBUG "Add -O1 option for DEBUG mode build" OFF)
# See: https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949
option(DART_FORCE_COLORED_OUTPUT
"Always produce ANSI-colored output (GNU/Clang only)." OFF)
option(DART_BUILD_V7 "Build DART with V7 engine" OFF)

#===============================================================================
# Print intro
Expand Down
3 changes: 3 additions & 0 deletions cmake/DARTConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ endfunction()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})

# TODO: Improve the include mechanism
include(dart_v7Targets)

# Default component: dart
list(APPEND @PROJECT_NAME_UPPERCASE@_FIND_COMPONENTS dart)

Expand Down
96 changes: 96 additions & 0 deletions cmake/dart_v7_defs.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Copyright (c) The DART development contributors
# All rights reserved.
#
# The list of contributors can be found at:
# https://github.com/dartsim/dart/blob/master/LICENSE
#
# This file is provided under the following "BSD-style" License:
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

function(dart_library)
set(prefix _ARG)
set(options
)
set(oneValueArgs
NAME
)
set(multiValueArgs
HEADERS
SOURCES
PUBLIC_LINK_LIBRARIES
PRIVATE_LINK_LIBRARIES
)
cmake_parse_arguments(
"${prefix}" "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}
)

# Get the current directory relative to the root of the project
# assuming that dart/* is the root of the source tree
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" relative_path ${CMAKE_CURRENT_SOURCE_DIR})

add_library(${_ARG_NAME}
${_ARG_HEADERS}
${_ARG_SOURCES}
)

target_include_directories(${_ARG_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_compile_features(${_ARG_NAME} PUBLIC cxx_std_17)

target_link_libraries(${_ARG_NAME}
PUBLIC
${_ARG_PUBLIC_LINK_LIBRARIES}
PRIVATE
${_ARG_PRIVATE_LINK_LIBRARIES}
)

set_target_properties(${_ARG_NAME} PROPERTIES
OUTPUT_NAME dart-${_ARG_NAME}
)

include(GNUInstallDirs)

install(
FILES ${_ARG_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${relative_path}/
)

install(
TARGETS ${_ARG_NAME}
EXPORT dart_${_ARG_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

install(
EXPORT dart_${_ARG_NAME}Targets
NAMESPACE DART::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake
)

endfunction()
5 changes: 5 additions & 0 deletions dart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ target_link_libraries(dart
PUBLIC
${CMAKE_DL_LIBS}
${PROJECT_NAME}-external-odelcpsolver
v7
Eigen3::Eigen
ccd
fcl
Expand Down Expand Up @@ -226,3 +227,7 @@ endif()
install(FILES dart.hpp DESTINATION include/dart/ COMPONENT headers)

dart_format_add(${dart_core_headers} ${dart_core_sources})

if(DART_BUILD_V7)
add_subdirectory(v7)
endif()
37 changes: 37 additions & 0 deletions dart/v7/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) The DART development contributors
# All rights reserved.
#
# The list of contributors can be found at:
# https://github.com/dartsim/dart/blob/master/LICENSE
#
# This file is provided under the following "BSD-style" License:
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

include(dart_v7_defs)

dart_library(
NAME v7
HEADERS empty.hpp
SOURCES empty.cpp
)
47 changes: 47 additions & 0 deletions dart/v7/empty.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) The DART development contributors
* All rights reserved.
*
* The list of contributors can be found at:
* https://github.com/dartsim/dart/blob/main/LICENSE
*
* This file is provided under the following "BSD-style" License:
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * This code incorporates portions of Open Dynamics Engine
* (Copyright (c) 2001-2004, Russell L. Smith. All rights
* reserved.) and portions of FCL (Copyright (c) 2011, Willow
* Garage, Inc. All rights reserved.), which were released under
* the same BSD license as below
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/v7/empty.hpp"

namespace dart::v7 {

void foo() {
// Empty
}

} // namespace dart::v7
45 changes: 45 additions & 0 deletions dart/v7/empty.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) The DART development contributors
* All rights reserved.
*
* The list of contributors can be found at:
* https://github.com/dartsim/dart/blob/main/LICENSE
*
* This file is provided under the following "BSD-style" License:
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * This code incorporates portions of Open Dynamics Engine
* (Copyright (c) 2001-2004, Russell L. Smith. All rights
* reserved.) and portions of FCL (Copyright (c) 2011, Willow
* Garage, Inc. All rights reserved.), which were released under
* the same BSD license as below
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#pragma once

namespace dart::v7 {

void foo();

} // namespace dart::v7
11 changes: 7 additions & 4 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]

[tasks]
clean = "rm -rf build"
build-v7 = { cmd= "cmake --build build --target v7 --parallel", depends_on = ["configure"] }
configure_local = { cmd= "cmake -G Ninja -S . -B build -DDART_VERBOSE=ON -DDART_BUILD_V7=ON -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX" }
install_local = { cmd= "cmake --install build --prefix $CONDA_PREFIX", depends_on = ["configure_local", "build"] }

[dependencies]
assimp = ">=5.3.1,<5.4"
Expand Down Expand Up @@ -44,7 +47,7 @@ pipx = ">=1.4.3,<1.5"
freeglut = ">=3.2.2,<3.3"

[target.linux-64.tasks]
configure = "cmake -G Ninja -S . -B build -DDART_VERBOSE=ON"
configure = "cmake -G Ninja -S . -B build -DDART_VERBOSE=ON -DDART_BUILD_V7=ON"
lint = { cmd= "cmake --build build --target format && black . && isort .", depends_on = ["configure"] }
check-lint = { cmd= "black . --check && isort . --check", depends_on = ["configure"] }
build = { cmd = "cmake --build build -j", depends_on = [
Expand All @@ -67,7 +70,7 @@ test_all = { cmd = "cmake --build build -j --target ALL", depends_on = [
clang-format-14 = ">=14.0.6,<14.1"

[target.osx-64.tasks]
configure = "cmake -G Ninja -S . -B build -DDART_VERBOSE=ON"
configure = "cmake -G Ninja -S . -B build -DDART_VERBOSE=ON -DDART_BUILD_V7=ON"
lint = { cmd= "cmake --build build --target format && black . && isort .", depends_on = ["configure"] }
check-lint = { cmd= "cmake --build build --target check-format && black . --check && isort . --check", depends_on = ["configure"] }
build = { cmd = "cmake --build build -j", depends_on = [
Expand All @@ -90,7 +93,7 @@ test_all = { cmd = "cmake --build build -j --target ALL", depends_on = [
clang-format-14 = ">=14.0.6,<14.1"

[target.osx-arm64.tasks]
configure = "cmake -G Ninja -S . -B build -DDART_VERBOSE=ON"
configure = "cmake -G Ninja -S . -B build -DDART_VERBOSE=ON -DDART_BUILD_V7=ON"
lint = { cmd= "cmake --build build --target format && black . && isort .", depends_on = ["configure"] }
check-lint = { cmd= "cmake --build build --target check-format && black . --check && isort . --check", depends_on = ["configure"] }
build = { cmd = "cmake --build build -j", depends_on = [
Expand All @@ -116,7 +119,7 @@ clang-format-14 = ">=14.0.6,<14.1"
freeglut = ">=3.2.2,<3.3"

[target.win-64.tasks]
configure = "cmake -S . -B build -G 'Visual Studio 17 2022' -DCMAKE_BUILD_TYPE=Release -DDART_MSVC_DEFAULT_OPTIONS=ON -DBUILD_SHARED_LIBS=OFF -DDART_VERBOSE=ON"
configure = "cmake -S . -B build -G 'Visual Studio 17 2022' -DCMAKE_BUILD_TYPE=Release -DDART_MSVC_DEFAULT_OPTIONS=ON -DBUILD_SHARED_LIBS=OFF -DDART_VERBOSE=ON -DDART_BUILD_V7=ON"
lint = { cmd= "black . && isort .", depends_on = ["configure"] }
check-lint = { cmd= "black . --check && isort . --check", depends_on = ["configure"] }
build = { cmd = "cmake --build build --config Release -j", depends_on = [
Expand Down
8 changes: 5 additions & 3 deletions python/dartpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ if(BUILD_SHARED_LIBS)
"Install the shared libraries to be able to import ${pybind_module}."
)
endif()

# TODO: Fix installing dartpy to site-packages directory
# Install the pybind module to site-packages directory
install(TARGETS ${pybind_module}
LIBRARY DESTINATION "${PYTHON_SITE_PACKAGES}"
)
# install(TARGETS ${pybind_module}
# LIBRARY DESTINATION "${PYTHON_SITE_PACKAGES}"
# )

list(REMOVE_ITEM dartpy_headers
${CMAKE_CURRENT_LIST_DIR}/eigen_geometry_pybind.h
Expand Down

0 comments on commit 1ef7676

Please sign in to comment.