fix: update CMakeLists to use existing source paths for backward version support
This commit is contained in:
parent
ded13c428f
commit
81417b57d6
|
|
@ -65,8 +65,13 @@ set(WEBOTS_CONTROLLER_C_PLUGIN_SOURCES dynamic_library.c html_robot_window.c
|
||||||
|
|
||||||
set(WEBOTS_CONTROLLER_C_SOURCES ${WEBOTS_CONTROLLER_C_CORE_SOURCES})
|
set(WEBOTS_CONTROLLER_C_SOURCES ${WEBOTS_CONTROLLER_C_CORE_SOURCES})
|
||||||
list(APPEND WEBOTS_CONTROLLER_C_SOURCES ${WEBOTS_CONTROLLER_C_PLUGIN_SOURCES})
|
list(APPEND WEBOTS_CONTROLLER_C_SOURCES ${WEBOTS_CONTROLLER_C_PLUGIN_SOURCES})
|
||||||
|
set(WEBOTS_CONTROLLER_C_SOURCE_PATHS)
|
||||||
list(TRANSFORM WEBOTS_CONTROLLER_C_SOURCES PREPEND "${WEBOTS_CONTROLLER_C_SOURCE_DIR}/")
|
foreach(_src IN LISTS WEBOTS_CONTROLLER_C_SOURCES)
|
||||||
|
set(_candidate "${WEBOTS_CONTROLLER_C_SOURCE_DIR}/${_src}")
|
||||||
|
if(EXISTS "${_candidate}")
|
||||||
|
list(APPEND WEBOTS_CONTROLLER_C_SOURCE_PATHS "${_candidate}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
find_package(Git REQUIRED)
|
find_package(Git REQUIRED)
|
||||||
|
|
@ -88,11 +93,17 @@ if(MSVC)
|
||||||
message(FATAL_ERROR "Failed to apply MSVC controller C source patch")
|
message(FATAL_ERROR "Failed to apply MSVC controller C source patch")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(TRANSFORM WEBOTS_CONTROLLER_C_SOURCES
|
set(_msvc_source_paths)
|
||||||
REPLACE "^${WEBOTS_CONTROLLER_C_SOURCE_DIR}" "${WEBOTS_CONTROLLER_MSVC_SOURCE_DIR}")
|
foreach(_src IN LISTS WEBOTS_CONTROLLER_C_SOURCES)
|
||||||
|
set(_candidate "${WEBOTS_CONTROLLER_MSVC_SOURCE_DIR}/${_src}")
|
||||||
|
if(EXISTS "${_candidate}")
|
||||||
|
list(APPEND _msvc_source_paths "${_candidate}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(WEBOTS_CONTROLLER_C_SOURCE_PATHS ${_msvc_source_paths})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(webots_controller ${WEBOTS_CONTROLLER_C_SOURCES})
|
add_library(webots_controller ${WEBOTS_CONTROLLER_C_SOURCE_PATHS})
|
||||||
add_library(webots-controller::webots_controller ALIAS webots_controller)
|
add_library(webots-controller::webots_controller ALIAS webots_controller)
|
||||||
add_library(webots-controller::Controller ALIAS webots_controller)
|
add_library(webots-controller::Controller ALIAS webots_controller)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,18 @@ set(WEBOTS_CONTROLLER_CPP_SOURCES
|
||||||
TouchSensor.cpp
|
TouchSensor.cpp
|
||||||
VacuumGripper.cpp)
|
VacuumGripper.cpp)
|
||||||
|
|
||||||
list(TRANSFORM WEBOTS_CONTROLLER_CPP_SOURCES PREPEND "${WEBOTS_CONTROLLER_CPP_SOURCE_DIR}/")
|
set(WEBOTS_CONTROLLER_CPP_SOURCE_PATHS)
|
||||||
|
foreach(_src IN LISTS WEBOTS_CONTROLLER_CPP_SOURCES)
|
||||||
|
set(_candidate "${WEBOTS_CONTROLLER_CPP_SOURCE_DIR}/${_src}")
|
||||||
|
if(EXISTS "${_candidate}")
|
||||||
|
list(APPEND WEBOTS_CONTROLLER_CPP_SOURCE_PATHS "${_candidate}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
file(GLOB_RECURSE WEBOTS_CONTROLLER_CPP_PUBLIC_HEADERS CONFIGURE_DEPENDS
|
file(GLOB_RECURSE WEBOTS_CONTROLLER_CPP_PUBLIC_HEADERS CONFIGURE_DEPENDS
|
||||||
"${WEBOTS_REPO_SOURCE_DIR}/include/controller/cpp/webots/*.hpp")
|
"${WEBOTS_REPO_SOURCE_DIR}/include/controller/cpp/webots/*.hpp")
|
||||||
|
|
||||||
add_library(webots_cpp_controller ${WEBOTS_CONTROLLER_CPP_SOURCES})
|
add_library(webots_cpp_controller ${WEBOTS_CONTROLLER_CPP_SOURCE_PATHS})
|
||||||
add_library(webots-controller::webots_cpp_controller ALIAS
|
add_library(webots-controller::webots_cpp_controller ALIAS
|
||||||
webots_cpp_controller)
|
webots_cpp_controller)
|
||||||
add_library(webots-controller::CppController ALIAS webots_cpp_controller)
|
add_library(webots-controller::CppController ALIAS webots_cpp_controller)
|
||||||
|
|
@ -77,4 +83,4 @@ install(
|
||||||
LIBRARY DESTINATION "lib"
|
LIBRARY DESTINATION "lib"
|
||||||
ARCHIVE DESTINATION "lib"
|
ARCHIVE DESTINATION "lib"
|
||||||
FILE_SET webots_cpp_headers
|
FILE_SET webots_cpp_headers
|
||||||
DESTINATION "include/controller/cpp")
|
DESTINATION "include/controller/cpp")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue