Skip to content

Commit

Permalink
🔧 严格区分本地源码和以 FetchContent 下载的 3rdparty,以设置不同的安装方式
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoxi-scut committed Dec 5, 2024
1 parent e5d610e commit d2f2089
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
6 changes: 0 additions & 6 deletions 3rdparty/apriltag/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,3 @@ install(
ARCHIVE DESTINATION ${RMVL_3P_LIB_INSTALL_PATH}
OPTIONAL
)

if(UNIX)
set(apriltag_LIB "libapriltag.a" CACHE INTERNAL "name of the apriltag library")
elseif(WIN32)
set(apriltag_LIB "apriltag.lib" CACHE INTERNAL "name of the apriltag library")
endif()
13 changes: 1 addition & 12 deletions 3rdparty/open62541/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,4 @@ option(UA_ENABLE_PUBSUB "Enable the PubSub protocol" ON)
rmvl_download(open62541 GIT "https://github.com/open62541/open62541.git : v1.3.8")
set(open62541_VERSION "1.3.8" CACHE INTERNAL "open62541 version")

install(
TARGETS open62541
EXPORT RMVLModules
ARCHIVE DESTINATION ${RMVL_3P_LIB_INSTALL_PATH}
OPTIONAL
)

if(UNIX)
set(open62541_LIB "libopen62541.a" CACHE INTERNAL "name of the open62541 library")
elseif(WIN32)
set(open62541_LIB "open62541.lib" CACHE INTERNAL "name of the open62541 library")
endif()
_rmvl_set_target_in_3rd(open62541)
3 changes: 3 additions & 0 deletions cmake/RMVLCompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ endif()
# ----------------------------------------------------------------------------
# 3rdparty options
# ----------------------------------------------------------------------------
macro(_rmvl_set_target_in_3rd _name)
set(${_name}_IN_3RD ON CACHE INTERNAL "")
endmacro()

# opencv
find_package(OpenCV QUIET)
Expand Down
10 changes: 7 additions & 3 deletions cmake/RMVLGenConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ __find_imported_modules(optcamsdk OPTCameraSDK)
__find_imported_modules(galaxysdk GalaxySDK)
__find_imported_modules(optlc OPTLightCtrl)

# 3rdparty libraries
__find_imported_modules(apriltag apriltag)
__find_imported_modules(open62541::open62541 open62541)
# 3rdparty (local source code)
# all targets have been configured in the corresponding CMakeLists.txt, no need to configure again

# 3rdparty (download)
if(open62541_IN_3RD)
list(APPEND RMVL_MODULES_3RD_DOWNLOAD_CONFIGCMAKE "include(\$\{RMVL_INSTALL_PATH\}/lib/cmake/open62541/open62541Config.cmake)\n")
endif()

# --------------------------------------------------------------------------------------------
# Part 2/3: Generate RMVLConfig.cmake
Expand Down
2 changes: 2 additions & 0 deletions cmake/templates/RMVLConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ unset(__d)
# =============================================================
# Get imported targets found in Module mode
@RMVL_MODULES_IMPORTED_CONFIGCMAKE@
# 3rdparty (download)
if(WIN32)
if(NOT TARGET opencv_world)
add_library(opencv_world SHARED IMPORTED)
Expand All @@ -86,6 +87,7 @@ else()
endif()
endif()

@RMVL_MODULES_3RD_DOWNLOAD_CONFIGCMAKE@
# Export configuration
if(NOT TARGET rmvl_core)
include(${CMAKE_CURRENT_LIST_DIR}/RMVLModules.cmake)
Expand Down

0 comments on commit d2f2089

Please sign in to comment.