Skip to content

Commit

Permalink
Support buildings bindings as standalone project with external hde
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Sep 25, 2024
1 parent 5b6d09f commit 002b75d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ find_package(YCM REQUIRED)
# Import cmake utilities
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(AddWarningsConfigurationToTarget)
include(AddHDEPythonModule)

# To build shared libraries in Windows, we set CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS to TRUE
# See https://cmake.org/cmake/help/v3.4/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.html
Expand Down Expand Up @@ -74,11 +73,6 @@ if(NOT MSVC)
USE_LINK_PATH)
endif()


#Function to automatize the process of creating python bindings
include(AddWearablesPythonModule)


# Tweak linker flags in Linux
if(UNIX AND NOT APPLE)
get_filename_component(LINKER_BIN ${CMAKE_LINKER} NAME)
Expand Down
24 changes: 24 additions & 0 deletions bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
# SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause

# Detect if we are doing a standalone build of the bindings, using an external icub-main
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(HDE_BINDINGS_BUILD_STANDALONE TRUE)
else()
set(HDE_BINDINGS_BUILD_STANDALONE FALSE)
endif()

if(HDE_BINDINGS_BUILD_STANDALONE)
cmake_minimum_required(VERSION 3.16)
# Extract project version from top project
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt cmake_content)
string(REGEX MATCH "VERSION[ ]+([0-9]+\\.[0-9]+\\.[0-9]+)" cmake_version_match ${cmake_content})
set(top_project_version ${CMAKE_MATCH_1})
project(HumanDynamicsEstimationBindings
VERSION ${top_project_version})
set(HDE_COMPILE_PYTHON_BINDINGS ON)
find_package(YARP REQUIRED)
find_package(WearableData REQUIRED)
find_package(HumanDynamicsEstimation REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
endif()

if(HDE_COMPILE_PYTHON_BINDINGS)
include(AddWearablesPythonModule)
include(AddHDEPythonModule)

find_package(Python3 3.6 COMPONENTS Interpreter Development REQUIRED)

Expand Down

0 comments on commit 002b75d

Please sign in to comment.