单个库的配置导出
This commit is contained in:
@@ -937,34 +937,38 @@ function(library_cache_operations self out)
|
||||
endforeach ()
|
||||
set(${out} "${_ops}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
# INTERNAL: __library_export_registry_dir(<self> <registry> <dir>)
|
||||
# 作用: 将已经构造完成的 library registry 及命名空间公共配置导出成 Bash 可读取的目录。
|
||||
# 参数: self 是提供公共配置的命名空间;registry 是待导出的 registry ID;dir 是输出目录。
|
||||
# 返回: 无。
|
||||
# 注意: registry/ 是当前 registry 的完整磁盘投影,导出前会整体替换;每个库的 map/init/clear 统一在 registry/nodes/<namespace>/<id>/。
|
||||
function(__library_export_registry_dir self registry dir)
|
||||
__library_globals_id("${self}" _globals)
|
||||
__library_operations_id("${self}" _operations)
|
||||
file(REMOVE_RECURSE "${dir}/registry")
|
||||
file(MAKE_DIRECTORY "${dir}")
|
||||
registry_serialize_dir("${registry}" "${dir}/registry")
|
||||
map_serialize_file("${_globals}" "${dir}/globals.txt")
|
||||
list_serialize_file("${_operations}" "${dir}/operations.txt")
|
||||
registry_assert_acyclic("${registry}")
|
||||
registry_build_order("${registry}" _order)
|
||||
string(REPLACE ";" "\n" _order_text "${_order}")
|
||||
codec_write_text_file("${dir}/build_order.txt" "${_order_text}\n")
|
||||
registry_items("${registry}" _items)
|
||||
foreach (_item IN LISTS _items)
|
||||
registry_collect_deps("${registry}" "${_item}" _deps)
|
||||
string(REPLACE ";" "\n" _deps_text "${_deps}")
|
||||
registry_node_dir("${registry}" "${_item}" "${dir}/registry" _node_dir)
|
||||
codec_write_text_file("${_node_dir}/dependencies.txt" "${_deps_text}\n")
|
||||
endforeach ()
|
||||
endfunction()
|
||||
# API: library_export_dir(<self> <dir>)
|
||||
# 作用: 将业务层数据导出成 Bash 可读取的目录。
|
||||
# 参数: self 是业务对象名称;dir 是输出目录。
|
||||
# 返回: 无。
|
||||
# 注意: 输出 registry/、globals.txt、build_order.txt、operations.txt、dependencies/;每个库的 map/init/clear 统一在 registry/nodes/<namespace>/<id>/。
|
||||
function(library_export_dir self dir)
|
||||
__library_globals_id("${self}" _globals)
|
||||
__library_operations_id("${self}" _operations)
|
||||
__library_build_registry("${self}" _registry)
|
||||
file(MAKE_DIRECTORY "${dir}")
|
||||
file(GLOB _legacy_node_dirs LIST_DIRECTORIES TRUE "${dir}/registry/nodes/__library_map_*")
|
||||
if (_legacy_node_dirs)
|
||||
file(REMOVE_RECURSE ${_legacy_node_dirs})
|
||||
endif ()
|
||||
registry_serialize_dir("${_registry}" "${dir}/registry")
|
||||
map_serialize_file("${_globals}" "${dir}/globals.txt")
|
||||
list_serialize_file("${_operations}" "${dir}/operations.txt")
|
||||
registry_assert_acyclic("${_registry}")
|
||||
registry_build_order("${_registry}" _order)
|
||||
string(REPLACE ";" "\n" _order_text "${_order}")
|
||||
codec_write_text_file("${dir}/build_order.txt" "${_order_text}\n")
|
||||
registry_items("${_registry}" _items)
|
||||
foreach (_item IN LISTS _items)
|
||||
registry_collect_deps("${_registry}" "${_item}" _deps)
|
||||
string(REPLACE ";" "\n" _deps_text "${_deps}")
|
||||
registry_node_dir("${_registry}" "${_item}" "${dir}/registry" _node_dir)
|
||||
codec_write_text_file("${_node_dir}/dependencies.txt" "${_deps_text}\n")
|
||||
endforeach ()
|
||||
__library_export_registry_dir("${self}" "${_registry}" "${dir}")
|
||||
endfunction()
|
||||
# INTERNAL: __library_data_export_dir(<self> <out>)
|
||||
# 作用: 返回 library 默认数据导出目录。
|
||||
@@ -1199,4 +1203,4 @@ function(library_get_missing_with_rely out)
|
||||
endif ()
|
||||
endwhile ()
|
||||
set(${out} "${_missing}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endfunction()
|
||||
|
||||
@@ -6,9 +6,9 @@ include("${CMAKE_CURRENT_LIST_DIR}/computer_graphics.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/libarchive.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/with_qt.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/osg_earth.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/proxy.cmake")
|
||||
if (DEFINED ENV{VULKAN_SDK} OR NOT "$ENV{VULKAN_SDK}" STREQUAL "")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/vsg_cesium.cmake")
|
||||
endif ()
|
||||
|
||||
rcl_export_configuration(global)
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
include_guard(GLOBAL)
|
||||
block()
|
||||
set(proxy_opts
|
||||
-DBUILD_TESTING=OFF
|
||||
-DBUILD_DOC_TESTING=OFF
|
||||
-DPROXY_BUILD_MODULES=OFF
|
||||
)
|
||||
_register_git_cmake_library(global::proxy
|
||||
"https://github.com/ngcpp/proxy.git"
|
||||
"4.1.0"
|
||||
)
|
||||
rcl_get_effective_install_dir(global::proxy PROXY_ROOT)
|
||||
set(msft_proxy4_DIR "${PROXY_ROOT}/share/msft_proxy4")
|
||||
rcl_cmake_library_set_cmake_options(global::proxy
|
||||
${proxy_opts}
|
||||
)
|
||||
rcl_cmake_library_set_other_use_opt(global::proxy
|
||||
"-Dmsft_proxy4_DIR=\"${msft_proxy4_DIR}\""
|
||||
)
|
||||
rcl_cmake_library_set_init_script(global::proxy
|
||||
"set(msft_proxy4_DIR \"${msft_proxy4_DIR}\")"
|
||||
"find_package(msft_proxy4 4.1 CONFIG REQUIRED)"
|
||||
)
|
||||
rcl_cmake_library_set_clear_script(global::proxy
|
||||
"unset(msft_proxy4_DIR)"
|
||||
)
|
||||
endblock()
|
||||
@@ -174,6 +174,44 @@ function(rcl_export_configuration namespace_name)
|
||||
library_cache_operations("${namespace_name}" _operations)
|
||||
library_export_dir("${namespace_name}" "${_namespace_data_dir}")
|
||||
endfunction()
|
||||
# INTERNAL: __rcl_export_namespace_libraries_configuration(<namespace_name> [library_names...])
|
||||
# 作用: 将一组库及其递归依赖整批刷新到指定命名空间的配置目录。
|
||||
# 参数: namespace_name 决定导出目录和公共配置;ARGN 是 namespace::id 格式的完整库名列表。
|
||||
function(__rcl_export_namespace_libraries_configuration namespace_name)
|
||||
rcl_get_data_export_dir("${namespace_name}" _namespace_data_dir)
|
||||
library_cache_operations("${namespace_name}" _operations)
|
||||
string(SHA256 _registry_hash "rcl-export-libraries:${namespace_name}:${ARGN}")
|
||||
set(_registry "__rcl_export_libraries_registry_${_registry_hash}")
|
||||
__library_populate_registry("${_registry}" ${ARGN})
|
||||
__library_export_registry_dir("${namespace_name}" "${_registry}" "${_namespace_data_dir}")
|
||||
endfunction()
|
||||
# API: rcl_export_libraries_configuration([library_names...])
|
||||
# 作用: 将 ARGN 指定库及其递归依赖按各自所属命名空间刷新到配置目录,不导出无关库。
|
||||
# 参数: ARGN 全部使用 namespace::id 格式的完整库名;不单独传 namespace_name。
|
||||
# 返回: 无;未传入库时终止配置。
|
||||
# 设计契约: 内存 registry 是本轮 configure 的唯一权威来源;先统一计算依赖闭包,再按命名空间整批导出,禁止逐库修补磁盘配置。
|
||||
function(rcl_export_libraries_configuration)
|
||||
if (NOT ARGN)
|
||||
message(FATAL_ERROR "rcl_export_libraries_configuration requires at least one library")
|
||||
endif ()
|
||||
library_dependency_order(_library_names ${ARGN})
|
||||
set(_namespace_names)
|
||||
foreach (_library_name IN LISTS _library_names)
|
||||
__rcl_split_library_name("${_library_name}" _namespace_name _library_id)
|
||||
list(APPEND _namespace_names "${_namespace_name}")
|
||||
endforeach ()
|
||||
list(REMOVE_DUPLICATES _namespace_names)
|
||||
foreach (_namespace_name IN LISTS _namespace_names)
|
||||
set(_namespace_libraries)
|
||||
foreach (_library_name IN LISTS _library_names)
|
||||
__rcl_split_library_name("${_library_name}" _library_namespace _library_id)
|
||||
if ("${_library_namespace}" STREQUAL "${_namespace_name}")
|
||||
list(APPEND _namespace_libraries "${_library_name}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
__rcl_export_namespace_libraries_configuration("${_namespace_name}" ${_namespace_libraries})
|
||||
endforeach ()
|
||||
endfunction()
|
||||
# API: rcl_set_script_root(<namespace_name> <script_root>)
|
||||
# 作用: 设置命名空间脚本根目录。
|
||||
# 参数: namespace_name 是命名空间;script_root 是脚本根目录。
|
||||
|
||||
Reference in New Issue
Block a user