Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • sw/simox/simox
  • uwkce_singer/simox
2 results
Show changes
Commits on Source (3135)
Showing
with 1445 additions and 234 deletions
build/
build*
!/build/.gitkeep
!.gitkeep
!.gitignore
.idea
.venv
*.bak
*#
.#*
*~
*.swp
.*.kate-swp
.*.swo
*.pyc
.DS_Store
CMakeFiles
CMakeCache.txt
CMakeLists.txt.user*
*.o
*.os
*.a
*.la
*.lo
*.so
*.dylib
moc_*
# eclipse stuff
.project
.pydevproject
.settings
.metadata
.cproject
.project
# qtcreator project stuff
*.pro
*.pro.user
.cmake/api/v1/query/cache-v2
.cmake/api/v1/query/codemodel-v2
.cmake/api/v1/query/cmakeFiles-v1
# vscode stuff
.vscode
# clangd
.cache
.clang-format
.clang-tidy
stages:
- build-and-test
- deploy
- post-deploy-test
- downstream
.build-and-test:
cache:
# https://docs.gitlab.com/ee/ci/caching/#share-caches-across-jobs-in-different-branches
key: one-key-to-rule-them-all
paths:
- .ccache
before_script:
# Ccache configuration and introspection.
- apt-get update
- apt-get install ccache --yes
- ccache --set-config=cache_dir="$CI_PROJECT_DIR/.ccache"
- ccache --max-size=5G
- ccache --show-stats
# Activate Axii.
- source /axii/scripts/install_axii.sh
script:
# Create workspace.
- axii workspace create ~/workspace workspace
- axii workspace activate workspace
- _axii_auto_env_refresh
# Use workspace configuration from project.
- cp "$CI_PROJECT_DIR/.gitlab/ci/armarx-workspace.json" "$ARMARX_WORKSPACE/armarx-workspace.json"
- cat "$ARMARX_WORKSPACE/armarx-workspace.json"
- axii workspace env
- _axii_auto_env_refresh
- echo "Workspace information:"
- axii workspace list-modules
- axii workspace list-modules --deps
- axii workspace info
- export PROJECT_PATH_IN_WORKSPACE="$simox__PATH"
# Symlink project directory into Axii workspace.
- mkdir -p "$(dirname $PROJECT_PATH_IN_WORKSPACE)"
- ln -s "$CI_PROJECT_DIR" "$PROJECT_PATH_IN_WORKSPACE"
# Upgrade.
- axii workspace system --accept-apt-install
- axii workspace update --prefer-https
- _axii_auto_env_refresh
# Upgrade.
- axii workspace upgrade -m simox
- _axii_auto_env_refresh
- ccache --show-stats
# Test.
# ToDo: Add and use `axii ws test -m simox`
- cd "$PROJECT_PATH_IN_WORKSPACE/build"
- ctest --output-on-failure --output-junit "$CI_PROJECT_DIR/report.xml" .
# Generate documentation.
- cd "$PROJECT_PATH_IN_WORKSPACE/build"
- make doc
- du -sh *
- du -sh doc/*
build-and-test-bionic:
stage: build-and-test
extends: .build-and-test
image: git.h2t.iar.kit.edu:5050/sw/armarx/meta/axii:latest-bionic
artifacts:
reports:
junit: report.xml
name: "Simox-Documentation-$CI_COMMIT_REF_NAME"
paths:
- build/doc/html/
build-and-test-jammy:
stage: build-and-test
extends: .build-and-test
image: git.h2t.iar.kit.edu:5050/sw/armarx/meta/axii:latest-jammy
docker-bionic:
stage: deploy
needs: ["build-and-test-bionic"]
image:
name: gcr.io/kaniko-project/executor:v1.9.0-debug
entrypoint: [""]
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/docker/bionic"
--destination "${CI_REGISTRY_IMAGE}:latest-bionic"
rules:
- if: $CI_COMMIT_BRANCH == "master"
docker-jammy:
stage: deploy
needs: ["build-and-test-jammy"]
image:
name: gcr.io/kaniko-project/executor:v1.9.0-debug
entrypoint: [""]
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/docker/jammy"
--destination "${CI_REGISTRY_IMAGE}:latest-jammy"
rules:
- if: $CI_COMMIT_BRANCH == "master"
.test-docker-image-common:
before_script:
- source /axii/scripts/install_axii.sh
- _axii_auto_env_refresh
script:
- echo "ArmarX Workspace = '$ARMARX_WORKSPACE'"
- printenv
- axii workspace list-modules
- axii workspace list-modules --deps
- axii workspace info
- echo "Simox directory = '$Simox_DIR'"
- which RobotViewer
test-docker-image-bionic:
stage: post-deploy-test
needs: ["docker-bionic"]
extends: .test-docker-image-common
image: git.h2t.iar.kit.edu:5050/sw/simox/simox:latest-bionic
rules:
- if: $CI_COMMIT_BRANCH == "master"
test-docker-image-jammy:
stage: post-deploy-test
needs: ["docker-jammy"]
extends: .test-docker-image-common
image: git.h2t.iar.kit.edu:5050/sw/simox/simox:latest-jammy
rules:
- if: $CI_COMMIT_BRANCH == "master"
armarx-core:
stage: downstream
variables:
TODO_ENV_VARIABLE: "This variable will be available to the CI pipeline of ArmarXCore."
trigger:
project: sw/armarx/armarx-core
# This is optional, but we could tell ArmarX which Simox branch to use.
branch: master
rules:
- if: $CI_COMMIT_BRANCH == "master"
/SimDynamics/ @rietsch @nefzer
/SimoxUtility @meixner @reister
/VirtualRobot @meixner @reister
/GraspPlanning @hyseni
/GeometricPlanning @reister
{
"modules": {
"tools/ccache/default": {},
"deps/doxygen": {},
"simox": {}
},
"global": {
"prepare": {
"cmake": {
"definitions": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_COMPILER_LAUNCHER": "$CCACHE",
"CMAKE_CXX_COMPILER_LAUNCHER": "$CCACHE"
}
}
}
}
}
This diff is collapsed.
macro(BulletCheckPrecision)
message(STATUS "Testing Bullet for use of double precision...")
try_compile(
_resultDouble
${PROJECT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/CMakeModules/BulletCheckPrecision.cpp
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:string=${BULLET_INCLUDE_DIRS}"
"-DLINK_LIBRARIES:string=${BULLET_LIBRARIES}"
"-DCMAKE_CXX_FLAGS:string=-std=c++17"
COMPILE_DEFINITIONS
"-DBT_USE_DOUBLE_PRECISION"
OUTPUT_VARIABLE _buildOutDouble
)
if( _resultDouble )
message(STATUS "Bullet double precision detected. Automatically defining BT_USE_DOUBLE_PRECISION")
set(BULLET_USE_SINGLE_PRECISION OFF CACHE BOOL "" FORCE)
add_definitions(-DBT_USE_DOUBLE_PRECISION)
else()
# Try it *without* -DBT_USE_DOUBLE_PRECISION to make sure it's single...
try_compile(
_resultSingle
${PROJECT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/CMakeModules/BulletCheckPrecision.cpp
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:string=${BULLET_INCLUDE_DIRS}"
"-DLINK_LIBRARIES:string=${BULLET_LIBRARIES}"
OUTPUT_VARIABLE _buildOutSingle
)
if( _resultSingle )
message(STATUS "Bullet single precision detected. Not defining BT_USE_DOUBLE_PRECISION")
set(BULLET_USE_SINGLE_PRECISION ON CACHE BOOL "" FORCE)
else()
message(ERROR "Unable to determine single or double precision.")
message(STATUS "----------------------------------")
message(STATUS "Build config for double precision:")
message(STATUS " CMAKE_FLAGS")
message(STATUS " -DINCLUDE_DIRECTORIES:string=${BULLET_INCLUDE_DIRS}")
message(STATUS " -DLINK_LIBRARIES:string=${BULLET_LIBRARIES}")
message(STATUS " -DCMAKE_CXX_FLAGS:string=-std=c++17")
message(STATUS " COMPILE_DEFINITIONS")
message(STATUS " -DBT_USE_DOUBLE_PRECISION")
message(STATUS "Build output for double precision:")
message(STATUS "${_buildOutDouble}")
message(STATUS "----------------------------------")
message(STATUS "Build config for single precision:")
message(STATUS " CMAKE_FLAGS")
message(STATUS " -DINCLUDE_DIRECTORIES:string=${BULLET_INCLUDE_DIRS}")
message(STATUS " -DLINK_LIBRARIES:string=${BULLET_LIBRARIES}")
message(STATUS "Build output for single precision:")
message(STATUS "${_buildOutSingle}")
message(FATAL_ERROR "Unable to determine single or double precision.")
endif()
endif()
endmacro()
#pragma GCC diagnostic ignored "-Wunused-variable"
#include <btBulletCollisionCommon.h>
int
main()
{
btVector3 vec(0.0, 1.0, 0.0);
btStaticPlaneShape(vec, 0.0);
return 0;
}
# Find SIMOX
#
# This find script searches for simox and includes all neccessary config files.
#
# Search order
## 1. ${Custom_Simox_DIR}
## 2. ${Simox_DIR}
## 3. $ENV{Simox_DIR}
## [ The paths should point to either the build or the install directory or Simox ]
#
# The following variables are set:
## Simox_FOUND - TRUE on success
## Simox_INCLUDE_DIR - The include directory
## Simox_LIBRARIES - The libraries
#
#
# A CMakeLists.txt file for setting up a simox related project could look like this:
#
## PROJECT ( myDemo )
## FIND_PACKAGE(Simox REQUIRED)
## IF(Simox_USE_COIN_VISUALIZATION)
## FILE(GLOB SRCS ${PROJECT_SOURCE_DIR}/myDemo.cpp ${PROJECT_SOURCE_DIR}/myWindow.cpp)
## FILE(GLOB INCS ${PROJECT_SOURCE_DIR}/myWindow.h)
## set(GUI_MOC_HDRS ${PROJECT_SOURCE_DIR}/myWindow.h)
## set(GUI_UIS ${PROJECT_SOURCE_DIR}/myWindow.ui)
## SimoxQtApplication(${PROJECT_NAME} "${SRCS}" "${INCS}" "${GUI_MOC_HDRS}" "${GUI_UIS}")
## ENDIF()
#### CMAKE CONFIG
find_path( Simox_DIR SimoxConfig.cmake
"${Custom_Simox_DIR}"
"${Simox_DIR}"
"$ENV{Simox_DIR}")
SET (Simox_CMAKE_CONFIG ${Simox_DIR}/SimoxConfig.cmake)
if (NOT (Simox_FIND_QUIETLY OR VirtualRobot_FIND_QUIETLY))
MESSAGE(STATUS " * Including ${Simox_CMAKE_CONFIG}")
endif()
include (${Simox_CMAKE_CONFIG})
if( Simox_LIBRARIES AND Simox_BASE_DIR)
set( Simox_FOUND TRUE )
set( VirtualRobot_FOUND TRUE )
set( Simox_INCLUDE_DIR ${Simox_BASE_DIR} )
set( Simox_LIBRARY ${Simox_LIBRARIES} )
endif()
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Simox DEFAULT_MSG Simox_LIBRARIES Simox_INCLUDE_DIR )
mark_as_advanced( Simox_INCLUDE_DIR Simox_LIBRARIES )
find_library(tinyxml_library tinyxml)
if (tinyxml_library)
message (STATUS " ** Looking for libtinyxml - found")
set(tinyxml_libraries ${tinyxml_library})
endif ()
find_path(tinyxml_include_dirs NAMES tinyxml.h PATH_SUFFIXES tinyxml)
if (NOT tinyxml_include_dirs)
message (STATUS " ** Looking for tinyxml/tinyxml.hpp or tinyxml/tinyxml.h - not found.")
endif ()
if (NOT tinyxml_include_dirs OR NOT tinyxml_libraries)
include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
# Find tinyxml
pkg_check_modules(tinyxml tinyxml)
else()
MESSAGE(STATUS " ** tinyxml not found")
endif()
endif ()
## Copyright (c) 2014, Nikolaus Vahrenkamp (Karlsruhe Institute of Technology)
# set the parameters which are different for an in-source build
set(Simox_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
set(Simox_DATA_PATH "@Simox_DATA_PATH@")
set(Simox_MACROS_INCLUDE_DIR "@Simox_MACROS_INCLUDE_DIR@")
## Copyright (c) 2011, Karlsruhe Institute of Technology (Manfred Kroehnert)
## Copyright (c) 2014, Nikolaus Vahrenkamp (Karlsruhe Institute of Technology)
# - Config file for the Simox package
# It defines the following variables
# Simox_INCLUDE_DIRS - include directories for Simox
# Simox_LIBRARY_DIRS - library directories for Simox (normally not used!)
# Simox_LIBRARIES - libraries to link against
# Simox_EXECUTABLES - the Simox executable
# Simox_COMPILE_FLAGS - compile flags
# Simox_CMAKE_INCLUDE - list of includes that may be neccessary for external libraries (e.g. QT_USE_FILE)
# Simox_DATA_PATH - the standard data path
# Simox_CMAKE_DIR - Path to Simox cmake files.
# Simox_BASE_DIR - Path to Simox
SET(Simox_INCLUDE_DIRS "@Simox_INCLUDE_DIRS@")
SET(Simox_LIBRARY_DIRS "@Simox_LIB_DIRS@")
SET(Simox_COMPILE_FLAGS "@Simox_LIB_FLAGS@")
SET(Simox_CMAKE_INCLUDE "@Simox_LIBRARY_CMAKE_INCLUDE@")
SET(Simox_DATA_PATH "@Simox_DATA_PATH@")
SET(Simox_CMAKE_DIR "@Simox_CMAKE_DIR@")
SET(VirtualRobot_CMAKE_DIR "@VirtualRobot_CMAKE_DIR@")
SET(Simox_BASE_DIR "@Simox_BASE_DIR@")
# These are IMPORTED targets created by SimoxLibraryDepends.cmake
SET(Simox_LIBRARIES "@Simox_LIBRARIES_ALL@")
SET(Simox_EXECUTABLES "@Simox_EXECUTABLES@")
# Simox_INCLUDE_DIRS - include directories for Simox
# Simox_LIBRARIES - libraries to link against
# Simox_EXECUTABLE - the executables
# Simox_VISUALIZATION - if visualization is enabled
# Simox_USE_COIN_VISUALIZATION - if Coin3D visualization was selected
# Simox_USE_OPENSCENEGRAPH_VISUALIZATION - if osg visualization was selected
# Simox_USE_NLOPT - if NLopt was selected
# SimDynamics_USE_BULLET - if SimDynamics is build and BULLET is selected as physics engine
# SimDynamics_USE_BULLET_DOUBLE_PRECISION - if Bullet is build with double precision support
if(Simox_FOUND)
return()
endif()
set(Simox_FOUND TRUE)
# Compute paths
get_filename_component(Simox_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Our library dependencies (contains definitions for IMPORTED targets)
if(NOT TARGET Simox AND NOT Simox_BINARY_DIR)
include("${Simox_CMAKE_DIR}/SimoxTargets.cmake")
include("${Simox_CMAKE_DIR}/SimoxTargetsLegacy.cmake")
endif()
# These are IMPORTED targets created by SimoxTargets.cmake
set(Simox_LIBRARIES "@Simox_LIBRARIES@")
set(Simox_EXECUTABLE "@Simox_EXECUTABLE@")
if(EXISTS "${Simox_CMAKE_DIR}/CMakeCache.txt")
# In build tree
message(STATUS "Using Simox Source-Build from: ${Simox_CMAKE_DIR}")
include("${Simox_CMAKE_DIR}/SimoxBuildTreeSettings.cmake")
# Provide access to CMake helper scripts, e.g., Find... scripts.
# They might be needed as they define specific targets.
list(APPEND CMAKE_MODULE_PATH "${Simox_MACROS_INCLUDE_DIR}")
list(APPEND CMAKE_MODULE_PATH "${Simox_MACROS_INCLUDE_DIR}/find_modules")
else()
# Installed project
message(STATUS "Using Simox Binary Package from: ${Simox_CMAKE_DIR}")
set(Simox_INCLUDE_DIRS "")
foreach (INCLUDE_DIR @CONF_INCLUDE_DIRS@)
LIST(APPEND Simox_INCLUDE_DIRS "${Simox_CMAKE_DIR}/@RELATIVE_INSTALL_DIR@/${INCLUDE_DIR}")
endforeach ()
set(Simox_DATA_PATH "${Simox_CMAKE_DIR}/@RELATIVE_INSTALL_DIR@/@Simox_DATA_PATH@")
set(Simox_MACROS_INCLUDE_DIR "${Simox_CMAKE_DIR}")
endif()
SET(Simox_VISUALIZATION "@Simox_VISUALIZATION@")
SET(Simox_USE_COIN_VISUALIZATION "@Simox_USE_COIN_VISUALIZATION@")
SET(Simox_USE_OPENSCENEGRAPH_VISUALIZATION "@Simox_USE_OPENSCENEGRAPH_VISUALIZATION@")
SET(Simox_VISUALIZATION_LIBS "@Simox_VISUALIZATION_LIBS@")
SET(Simox_VISUALIZATION_INCLUDE_PATHS "@Simox_VISUALIZATION_INCLUDE_PATHS@")
SET(Simox_VISUALIZATION_COMPILE_FLAGS "@Simox_VISUALIZATION_COMPILE_FLAGS@")
# Convenient setup: all simox-related dependencies are included here.
# If this causes troubles, disable it by steting Simox_DISABLE_DEPENDENCIES_INCLUDE.
# Then you will need to setup the dependencies on your own, similar to the setup in SimoxExternalLibrarySetup.cmake
IF(NOT Simox_DISABLE_DEPENDENCIES_INCLUDE)
# include all library dependencies
if (NOT (Simox_FIND_QUIETLY OR VirtualRobot_FIND_QUIETLY))
MESSAGE(STATUS " * Including ${Simox_CMAKE_DIR}/SimoxExternalLibrarySetup.cmake")
endif()
include(${Simox_CMAKE_DIR}/SimoxExternalLibrarySetup.cmake)
if (NOT (Simox_FIND_QUIETLY OR VirtualRobot_FIND_QUIETLY))
MESSAGE(STATUS " * Including ${Simox_CMAKE_DIR}/SimoxMacros.cmake")
endif()
include(${Simox_CMAKE_DIR}/SimoxMacros.cmake)
ENDIF()
SET(Simox_USE_COLLADA "@Simox_USE_COLLADA@")
SET(Simox_USE_RBDL_LIB "@Simox_USE_RBDL_LIB@")
SET(Simox_USE_QT5 "ON") # this variable legacy support (Qt5 is now required)
SET(Simox_USE_NLOPT "@Simox_USE_NLOPT@")
SET(SimDynamics_USE_BULLET "@SimDynamics_USE_BULLET@")
SET(SimDynamics_USE_BULLET_DOUBLE_PRECISION "@SimDynamics_USE_BULLET_DOUBLE_PRECISION@")
SET(Simox_BOOST_VERSION "@Simox_BOOST_VERSION@")
FIND_PACKAGE(Eigen3 QUIET)
FIND_PACKAGE(Qt5 5.5.0 COMPONENTS OpenGL Core Gui Widgets QUIET)
FIND_PACKAGE(Boost ${Simox_BOOST_VERSION} EXACT COMPONENTS
filesystem
system
program_options
thread
unit_test_framework
regex
QUIET)
find_package(difflib QUIET)
find_package(doctest QUIET)
find_package(nlohmann_json 3.11.3 REQUIRED)
find_package(RBDL QUIET)
find_package(pugixml QUIET)
FIND_PACKAGE(SoQt QUIET)
if (NOT (Simox_FIND_QUIETLY OR VirtualRobot_FIND_QUIETLY))
MESSAGE(STATUS " * Including ${Simox_MACROS_INCLUDE_DIR}/SimoxMacros.cmake")
endif()
include(${Simox_MACROS_INCLUDE_DIR}/SimoxMacros.cmake)
## Copyright (c) 2012, Karlsruhe Institute of Technology
## Copyright (c) 2014, Nikolaus Vahrenkamp (Karlsruhe Institute of Technology)
set(PACKAGE_VERSION "@Simox_VERSION@")
......@@ -10,4 +10,5 @@ set(PACKAGE_VERSION "@Simox_VERSION@")
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
\ No newline at end of file
endif()
# Setup paths, libs and external cmake files to be used for SIMOX
if (NOT (Simox_FIND_QUIETLY OR VirtualRobot_FIND_QUIETLY))
MESSAGE(STATUS "SETTING LIBRARY DEPENDENCIES FOR SIMOX")
endif()
# VR
INCLUDE (${Simox_DIR}/VirtualRobotConfig.cmake)
INCLUDE (${VirtualRobot_CMAKE_DIR}/VirtualRobotExternalLibrarySetup.cmake)
# SABA
# GRASP STUDIO
# Build and helper macros
function(VirtualRobotQtApplication name srcs incs mocFiles uiFiles)
function(VirtualRobotApplication name srcs incs)
################################## EXECUTABLE ##############################
ADD_EXECUTABLE(${name} ${srcs} ${incs})
target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
TARGET_LINK_LIBRARIES(${name} PUBLIC VirtualRobot)
endfunction()
MESSAGE (STATUS "Qt Moc'ing: ${mocFiles}")
qt4_wrap_cpp(generatedMocFiles ${mocFiles})
MESSAGE (STATUS "Qt ui files: ${uiFiles}")
qt4_wrap_ui(generatedUiFiles ${uiFiles})
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
function(VirtualRobotQtApplication name srcs incs mocFiles uiFiles)
set(CMAKE_AUTOMOC "YES")
set(CMAKE_AUTOUIC "YES")
set(generatedUiFiles ${uiFiles})
set(generatedMocFiles ${mocFiles})
################################## EXECUTABLE ##############################
ADD_EXECUTABLE(${name} ${srcs} ${incs} ${generatedUiFiles} ${generatedMocFiles})
TARGET_LINK_LIBRARIES(${name} ${VirtualRobot_LIBRARIES})
target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
FIND_PACKAGE(SoQt REQUIRED)
TARGET_LINK_LIBRARIES(${name} PUBLIC VirtualRobot SoQt::SoQt)
endfunction()
function(VirtualRobotQtLibrary name srcs incs mocFiles uiFiles)
set(generatedUiFiles ${uiFiles})
set(generatedMocFiles ${mocFiles})
set(CMAKE_AUTOMOC "YES")
set(CMAKE_AUTOUIC "YES")
################################## LIBRARY ##############################
ADD_LIBRARY(${name} SHARED ${srcs} ${incs} ${generatedUiFiles} ${generatedMocFiles})
target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
TARGET_LINK_LIBRARIES(${name} PUBLIC VirtualRobot)
endfunction()
function(SimoxQtApplication name srcs incs mocFiles uiFiles)
function(SimoxApplication name srcs incs)
VirtualRobotApplication("${name}" "${srcs}" "${incs}")
# add Saba and GraspStudio
TARGET_LINK_LIBRARIES(${name} PUBLIC GraspStudio Saba)
endfunction()
function(SimoxQtApplication name srcs incs mocFiles uiFiles)
VirtualRobotQtApplication("${name}" "${srcs}" "${incs}" "${mocFiles}" "${uiFiles}")
# add Saba and GraspStudio
TARGET_LINK_LIBRARIES(${name} GraspStudio Saba)
TARGET_LINK_LIBRARIES(${name} PUBLIC GraspStudio Saba)
endfunction()
function(SimoxQtLibrary name srcs incs mocFiles uiFiles)
VirtualRobotQtLibrary("${name}" "${srcs}" "${incs}" "${mocFiles}" "${uiFiles}")
# add Saba and GraspStudio
TARGET_LINK_LIBRARIES(${name} PUBLIC GraspStudio Saba)
endfunction()
function(simox_subdirs RESULT DIRECTORY)
file(GLOB CHILDREN ${DIRECTORY}/*)
# message("## children of ${DIRECTORY}: ${CHILDREN}")
set(DIR_CHILDREN "")
foreach(CHILD ${CHILDREN})
if (IS_DIRECTORY "${CHILD}")
list(APPEND DIR_CHILDREN ${CHILD})
endif()
endforeach()
set(${RESULT} "${DIR_CHILDREN}" PARENT_SCOPE)
endfunction()
function(simox_subdirs_recursive RESULT DIRECTORY)
simox_subdirs(TOP_CHILDREN "${DIRECTORY}")
set(ALL_CHILDREN ${TOP_CHILDREN})
foreach(TOP_CHILD ${TOP_CHILDREN})
simox_subdirs_recursive(REC_CHILDREN ${TOP_CHILD})
list(APPEND ALL_CHILDREN ${REC_CHILDREN})
endforeach()
set(${RESULT} "${ALL_CHILDREN}" PARENT_SCOPE)
endfunction()
macro(simox_update_file file content) #macro since we want to provide simox_file_up_to_date
set(simox_file_up_to_date 0)
if(EXISTS "${file}")
file(SHA512 "${file}" _simox_file_sha)
string(SHA512 _simox_cont_sha "${content}")
if("${_simox_cont_sha}" STREQUAL "${_simox_file_sha}")
set(simox_file_up_to_date 1)
endif()
endif()
#write file
if(${simox_file_up_to_date} EQUAL 0)
file(WRITE "${file}" "${content}")
endif()
endmacro()
macro(simox_generate_subdir_headers dir prefix_to_remove out_headers)
string(REPLACE "//" "/" prefix_to_remove_fixed "${prefix_to_remove}/")
string(REPLACE "${prefix_to_remove_fixed}" "" dir_rel "${dir}")
_simox_generate_subdir_headers_impl("${dir}" "${prefix_to_remove_fixed}" ${out_headers})
endmacro()
macro(_simox_generate_subdir_headers_impl dir prefix_to_remove out_headers)
simox_subdirs(subdirs ${dir})
foreach(subdir ${subdirs})
#recurse
_simox_generate_subdir_headers_impl("${subdir}" "${prefix_to_remove}" ${out_headers})
file(GLOB headers ${subdir}/*.h)
list(LENGTH headers n)
string(REGEX REPLACE ".*/" "" subdir_name "${subdir}")
if(
NOT ${n} EQUAL 0 AND
NOT "${subdir_name}" STREQUAL "detail" AND
NOT "${subdir_name}" STREQUAL "_detail" AND
NOT "${subdir_name}" STREQUAL "internal" AND
NOT "${subdir_name}" STREQUAL "_internal"
)
set(subdir_header_abs "${subdir}.h")
string(REPLACE "${prefix_to_remove}" "" subdir_header "${subdir_header_abs}")
list(APPEND ${out_headers} ${subdir_header})
#create file content
set(content "#pragma once\n\n// This file is generated!\n\n")
foreach(header ${headers})
string(REPLACE "${subdir}/" "${subdir_name}/" h "${header}")
set(content "${content}#include \"${h}\" // IWYU pragma: export\n")
endforeach()
#check for file change
simox_update_file("${subdir_header_abs}" "${content}")
endif()
endforeach()
endmacro()
// This file is generated using cmake configure_file!
#pragma once
#include <type_traits> // IWYU pragma: keep
//implementation namespace
namespace simox::meta::member::method::@NAME@::impl
{
template<class Class, class RType, class...Ps>
RType type_fn(RType(Class::*)(Ps...));
template<class T>
using ret_t = decltype(type_fn(&T::@NAME@));
template<class T, class = void>
struct member_rtype {};
template<class T>
struct member_rtype<T, std::void_t<ret_t<T>>>
{
using type = ret_t<T>;
};
template<class T, class = void>
struct member_exists : std::false_type {};
template<class T>
struct member_exists<T, std::void_t<ret_t<T>>> : std::true_type {};
}
//meta fncs namespaced by class
namespace simox::meta::member::method::@NAME@
{
template<class T> using exists = impl::member_exists<T>;
template<class T> static constexpr bool exists_v = exists<T>::value;
template<class T> using return_type = impl::member_rtype<T>;
template<class T> using return_type_t = typename return_type<T>::type;
}
//exists_v
namespace simox::meta::member::method::exists_v
{
template<class T>
static constexpr bool @NAME@ = ::simox::meta::member::method::@NAME@::exists_v<T>;
}
//concept
namespace simox::meta::member::method::ccept
{
template<class T>
concept @NAME@ = ::simox::meta::member::method::@NAME@::exists_v<T>;
}
//return_type_t
namespace simox::meta::member::method::return_type_t
{
template<class T>
using @NAME@ = simox::meta::member::method::@NAME@::return_type_t<T>;
}
// This file is generated using cmake configure_file!
#pragma once
#include <type_traits> // IWYU pragma: keep
//implementation namespace
namespace simox::meta::member::static_method::@NAME@::impl
{
template<class RType, class...Ps>
RType type_fn(RType(*)(Ps...));
template<class T>
using ret_t = decltype(type_fn(&T::@NAME@));
template<class T, class = void>
struct member_rtype {};
template<class T>
struct member_rtype<T, std::void_t<ret_t<T>>>
{
using type = ret_t<T>;
};
template<class T, class = void>
struct member_exists : std::false_type {};
template<class T>
struct member_exists<T, std::void_t<ret_t<T>>> : std::true_type {};
}
//meta fncs namespaced by class
namespace simox::meta::member::static_method::@NAME@
{
template<class T> using exists = impl::member_exists<T>;
template<class T> static constexpr bool exists_v = exists<T>::value;
template<class T> using return_type = impl::member_rtype<T>;
template<class T> using return_type_t = typename return_type<T>::type;
}
//exists_v
namespace simox::meta::member::static_method::exists_v
{
template<class T>
static constexpr bool @NAME@ = ::simox::meta::member::static_method::@NAME@::exists_v<T>;
}
//concept
namespace simox::meta::member::static_method::ccept
{
template<class T>
concept @NAME@ = ::simox::meta::member::static_method::@NAME@::exists_v<T>;
}
//return_type_t
namespace simox::meta::member::static_method::return_type_t
{
template<class T>
using @NAME@ = simox::meta::member::static_method::@NAME@::return_type_t<T>;
}
// This file is generated using cmake configure_file!
#pragma once
#include <type_traits> // IWYU pragma: keep
//implementation namespace
namespace simox::meta::member::static_variable::@NAME@::impl
{
template<class Type>
Type type_fn(const Type*);
template<class T>
using var_t = decltype(type_fn(&T::@NAME@));
template<class T, class = void>
struct member_value_type {};
template<class T>
struct member_value_type<T, std::void_t<var_t<T>>>
{
using type = var_t<T>;
};
template<class T, class = void>
struct member_value_exists : std::false_type {};
template<class T>
struct member_value_exists<T, std::void_t<var_t<T>>> : std::true_type {};
}
//meta fncs namespaced by class
namespace simox::meta::member::static_variable::@NAME@
{
template<class T> using exists = impl::member_value_exists<T>;
template<class T> static constexpr bool exists_v = exists<T>::value;
template<class T> using type = impl::member_value_type<T>;
template<class T> using type_t = typename type<T>::type;
}
//exists_v
namespace simox::meta::member::static_variable::exists_v
{
template<class T>
static constexpr bool @NAME@ = ::simox::meta::member::static_variable::@NAME@::exists_v<T>;
}
//concept
namespace simox::meta::member::static_variable::ccept
{
template<class T>
concept @NAME@ = ::simox::meta::member::static_variable::@NAME@::exists_v<T>;
}
//type_t
namespace simox::meta::member::static_variable::type_t
{
template<class T>
using @NAME@ = ::simox::meta::member::static_variable::@NAME@::type_t<T>;
}
// This file is generated using cmake configure_file!
#define BOOST_TEST_MODULE SimoxUtility / meta / check_for_members_ @CATEGORY @_ @NAME @
#include <boost/test/included/unit_test.hpp> // IWYU pragma: keep
#include <SimoxUtility/meta/type_traits/member/method/@NAME@.h>
#include <SimoxUtility/meta/type_traits/member/static_method/@NAME@.h>
#include <SimoxUtility/meta/type_traits/member/static_variable/@NAME@.h>
#include <SimoxUtility/meta/type_traits/member/type/@NAME@.h>
#include <SimoxUtility/meta/type_traits/member/variable/@NAME@.h>
// ////////////////////////////////////////////////////////////////////////// //
//test stub
// *INDENT-OFF*
template <class T, class Texp, bool Exists>
struct test_method
{
static void test();
};
template <class T, class Texp, bool Exists>
struct test_static_method
{
static void test();
};
template <class T, class Texp, bool Exists>
struct test_variable
{
static void test();
};
template <class T, class Texp, bool Exists>
struct test_static_variable
{
static void test();
};
template <class T, class Texp, bool Exists>
struct test_type
{
static void test();
};
// *INDENT-ON*
// ////////////////////////////////////////////////////////////////////////// //
//core test function
template <class T, class Texp, bool Exists>
void
test_method<T, Texp, Exists>::test()
{
namespace ns = simox::meta::member::method;
static_assert(Exists == ns::exists_v::@NAME @<T>);
static_assert(Exists == ns::ccept ::@NAME @<T>);
if constexpr (Exists)
{
static_assert(std::is_same_v<Texp, ns::return_type_t::@NAME @<T>>);
}
}
template <class T, class Texp, bool Exists>
void
test_static_method<T, Texp, Exists>::test()
{
namespace ns = simox::meta::member::static_method;
static_assert(Exists == ns::exists_v::@NAME @<T>);
static_assert(Exists == ns::ccept ::@NAME @<T>);
if constexpr (Exists)
{
static_assert(std::is_same_v<Texp, ns::return_type_t::@NAME @<T>>);
}
}
template <class T, class Texp, bool Exists>
void
test_variable<T, Texp, Exists>::test()
{
namespace ns = simox::meta::member::variable;
static_assert(Exists == ns::exists_v::@NAME @<T>);
static_assert(Exists == ns::ccept ::@NAME @<T>);
if constexpr (Exists)
{
static_assert(std::is_same_v<Texp, ns::type_t::@NAME @<T>>);
}
}
template <class T, class Texp, bool Exists>
void
test_static_variable<T, Texp, Exists>::test()
{
namespace ns = simox::meta::member::static_variable;
static_assert(Exists == ns::exists_v::@NAME @<T>);
static_assert(Exists == ns::ccept ::@NAME @<T>);
if constexpr (Exists)
{
static_assert(std::is_same_v<Texp, ns::type_t::@NAME @<T>>);
}
}
template <class T, class Texp, bool Exists>
void
test_type<T, Texp, Exists>::test()
{
namespace ns = simox::meta::member::type;
static_assert(Exists == ns::exists_v::@NAME @<T>);
static_assert(Exists == ns::ccept ::@NAME @<T>);
if constexpr (Exists)
{
static_assert(std::is_same_v<Texp, ns::type_t::@NAME @<T>>);
}
}
// ////////////////////////////////////////////////////////////////////////// //
// default impl
class nonprimitive
{
};
// *INDENT-OFF*
template <class T>
struct with_variable
{
T @NAME @ = {};
};
template <class T>
struct with_variable_2
{
T @NAME @_2 = {};
};
template <class T>
struct with_static_variable
{
static constexpr T @NAME @ = {};
};
template <class T>
struct with_static_variable_2
{
static constexpr T @NAME @_2 = {};
};
template <class T>
struct with_type
{
using @NAME @ = T;
};
template <class T>
struct with_type_2
{
using @NAME @_2 = T;
};
template <class T>
struct with_method
{
T @NAME @();
};
template <class T>
struct with_method_2
{
T @NAME @_2();
};
template <class T>
struct with_static_method
{
static T @NAME @();
};
template <class T>
struct with_static_method_2
{
static T @NAME @_2();
};
// *INDENT-ON*
enum member_type
{
variable,
static_variable,
method,
static_method,
type,
};
template <template <class, class, bool> class Tmp, class T, member_type MT>
void
test_all_for_type()
{
Tmp<with_static_variable<T>, T, MT == member_type::static_variable>::test();
Tmp<with_static_variable_2<T>, T, false>::test();
Tmp<with_variable<T>, T, MT == member_type::variable>::test();
Tmp<with_variable_2<T>, T, false>::test();
Tmp<with_type<T>, T, MT == member_type::type>::test();
Tmp<with_type_2<T>, T, false>::test();
Tmp<with_method<T>, T, MT == member_type::method>::test();
Tmp<with_method_2<T>, T, false>::test();
Tmp<with_static_method<T>, T, MT == member_type::static_method>::test();
Tmp<with_static_method_2<T>, T, false>::test();
}
template <class T>
void
test_all()
{
test_all_for_type<test_method, T, member_type::method>();
test_all_for_type<test_static_method, T, member_type::static_method>();
test_all_for_type<test_variable, T, member_type::variable>();
test_all_for_type<test_static_variable, T, member_type::static_variable>();
test_all_for_type<test_type, T, member_type::type>();
}
BOOST_AUTO_TEST_CASE(test_check_for_members_ @NAME @)
{
test_all<int>();
test_all<nonprimitive>();
}
// This file is generated using cmake configure_file!
#pragma once
#include <type_traits> // IWYU pragma: keep
//implementation namespace
namespace simox::meta::member::type::@NAME@::impl
{
template<class T, class = void>
struct member_type_exists : std::false_type
{};
template<class T>
struct member_type_exists < T, std::void_t < typename T::@NAME@ > > : std::true_type
{};
template<class T, class = void>
struct member_type_type
{};
template<class T>
struct member_type_type < T, std::void_t < typename T::@NAME@ > >
{
using type = typename T::@NAME@;
};
}
//meta fncs namespaced by class
namespace simox::meta::member::type::@NAME@
{
template<class T> using exists = impl::member_type_exists<T>;
template<class T> static constexpr bool exists_v = exists<T>::value;
template<class T> using type = impl::member_type_type<T>;
template<class T> using type_t = typename type<T>::type;
}
//exists_v
namespace simox::meta::member::type::exists_v
{
template<class T>
static constexpr bool @NAME@ = ::simox::meta::member::type::@NAME@::exists_v<T>;
}
//concept
namespace simox::meta::member::type::ccept
{
template<class T>
concept @NAME@ = ::simox::meta::member::type::@NAME@::exists_v<T>;
}
//type_t
namespace simox::meta::member::type::type_t
{
template<class T>
using @NAME@ = ::simox::meta::member::type::@NAME@::type_t<T>;
}