From 1e1e77e41ac09458c48f6f5f2f6560b81656c4b3 Mon Sep 17 00:00:00 2001 From: wyc <1104749580@qq.com> Date: Sun, 9 Aug 2026 01:27:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cmake | 138 ++++++++++++++++++++++-------------------- third_party/init.bash | 44 +++++++++++--- 2 files changed, 107 insertions(+), 75 deletions(-) diff --git a/main.cmake b/main.cmake index 0bda63e..a1dfc38 100644 --- a/main.cmake +++ b/main.cmake @@ -1,75 +1,81 @@ get_filename_component(name ${CMAKE_CURRENT_LIST_DIR} NAME) set(rely global::drogon global::libarchive global::SQLiteCpp) rcl_load_dependency_environment(${rely}) - - find_package(Drogon) find_package(SQLiteCpp CONFIG REQUIRED) set(Core Psc_Core_Static) -if (1) - set(md "${CMAKE_CURRENT_LIST_DIR}/module") - if (WIN32) - set(cfg_dir ${CMAKE_CURRENT_LIST_DIR}/config) - else () - set(cfg_dir ${CMAKE_CURRENT_LIST_DIR}/config) - endif () - set(data_dir ${CMAKE_CURRENT_LIST_DIR}/data) - - - append_glob_source(dll_source_srcs "${md}/dll_source") - add_library(dll_source SHARED ${dll_source_srcs}) - add_executable(data_process "${dll_source_srcs}") - target_include_directories(dll_source PUBLIC "${md}") - target_link_libraries(dll_source PUBLIC ${Core}) - target_link_libraries(data_process PUBLIC ${Core}) - - _attach_post_build_file(dll_source - ${cfg_dir}/data_progress_config.json - ${data_dir}/BIN_Blank_Text/ADS-B_195_0205.txt - # "${CMAKE_CURRENT_LIST_DIR}/data/BIN_Blank_Text/ADS-B_195_0205.txt" - ) - - append_glob_source(mlat_source_srcs "${md}/mlat_source") - add_library(mlat_source SHARED ${mlat_source_srcs}) - target_include_directories(mlat_source PUBLIC "${md}") - target_link_libraries(mlat_source PUBLIC ${Core}) - - - append_glob_source(ecap_server_srcs "${md}/Local_Server") - add_executable(ecap_server "${md}/Local_Server_main.cpp" ${ecap_server_srcs}) - target_include_directories(ecap_server PUBLIC "${md}") - target_include_directories(ecap_server PRIVATE ${ZLIB_INCLUDE_DIR}) - - target_link_libraries(ecap_server PUBLIC SSR) - target_link_libraries(ecap_server PUBLIC ${Core}) - target_link_libraries(ecap_server PRIVATE Drogon::Drogon) - target_link_libraries(ecap_server PRIVATE SQLiteCpp) - target_link_libraries(ecap_server PRIVATE ${ZLIB_LIBRARY}) - - message("LibArchive_SUB_LIBRARIES {${LibArchive_SUB_LIBRARIES}}") - target_link_libraries(ecap_server PRIVATE - LibArchive::LibArchive - ${LibArchive_SUB_LIBRARIES} - - ) - target_compile_definitions(ecap_server PRIVATE LIBARCHIVE_STATIC) - target_compile_definitions(ecap_server PRIVATE NOMINMAX) - target_compile_definitions(ecap_server PRIVATE INCL_EXTRA_HTON_FUNCTIONS) # drogon用 - - - _attach_post_build_file(ecap_server ${cfg_dir}/config.json) - - - if (MSVC) - target_compile_definitions(ecap_server PRIVATE - _CRTDBG_MAP_ALLOC - ) - endif () - add_dependencies(ecap_server dll_source) - - +set(md "${CMAKE_CURRENT_LIST_DIR}/module") +if (WIN32) + set(cfg_dir ${CMAKE_CURRENT_LIST_DIR}/config) +else () + set(cfg_dir ${CMAKE_CURRENT_LIST_DIR}/config) endif () - -_add_directory_to_clion("C:/tiles") +set(data_dir ${CMAKE_CURRENT_LIST_DIR}/data) +append_glob_source(dll_source_srcs "${md}/dll_source") +add_library(dll_source SHARED ${dll_source_srcs}) +add_executable(data_process "${dll_source_srcs}") +target_include_directories(dll_source PUBLIC "${md}") +target_link_libraries(dll_source PUBLIC ${Core}) +target_link_libraries(data_process PUBLIC ${Core}) +_attach_post_build_file(dll_source + ${cfg_dir}/data_progress_config.json + ${data_dir}/BIN_Blank_Text/ADS-B_195_0205.txt + # "${CMAKE_CURRENT_LIST_DIR}/data/BIN_Blank_Text/ADS-B_195_0205.txt" +) +append_glob_source(mlat_source_srcs "${md}/mlat_source") +add_library(mlat_source SHARED ${mlat_source_srcs}) +target_include_directories(mlat_source PUBLIC "${md}") +target_link_libraries(mlat_source PUBLIC ${Core}) +append_glob_source(ecap_server_srcs "${md}/Local_Server") +add_executable(ecap_server "${md}/Local_Server_main.cpp" ${ecap_server_srcs}) +target_include_directories(ecap_server PUBLIC "${md}") +target_include_directories(ecap_server PRIVATE ${ZLIB_INCLUDE_DIR}) +target_link_libraries(ecap_server PUBLIC SSR) +target_link_libraries(ecap_server PUBLIC ${Core}) +target_link_libraries(ecap_server PRIVATE Drogon::Drogon) +target_link_libraries(ecap_server PRIVATE SQLiteCpp) +target_link_libraries(ecap_server PRIVATE ${ZLIB_LIBRARY}) +message("LibArchive_SUB_LIBRARIES {${LibArchive_SUB_LIBRARIES}}") +target_link_libraries(ecap_server PRIVATE + LibArchive::LibArchive + ${LibArchive_SUB_LIBRARIES} +) +target_compile_definitions(ecap_server PRIVATE LIBARCHIVE_STATIC) +target_compile_definitions(ecap_server PRIVATE NOMINMAX) +target_compile_definitions(ecap_server PRIVATE INCL_EXTRA_HTON_FUNCTIONS) # drogon用 +_attach_post_build_file(ecap_server ${cfg_dir}/config.json) +if (MSVC) + target_compile_definitions(ecap_server PRIVATE + _CRTDBG_MAP_ALLOC + ) +endif () +add_dependencies(ecap_server dll_source) +set(ecap_package_includes + "^.*$" +) +set(ecap_package_excludes + # "^[.]git/.*$" + # "^[.]idea/.*$" + "^data/.*$" + "^cmake-build-[^/]*/.*$" + "^(.*/)?node_modules/.*$" + "^(.*/)?.git/.*$" + "^(.*/)?wwwroot/.*$" + "^(.*/)?dist/.*$" + "^(.*/)?htdocs/.*$" + "^(.*/)?model/.*$" + "^(.*/)?.idea/.*$" + "^(.*/)?dll_source_lzy/.*$" + "^.*[.]tsbuildinfo$" + "^.*[.]zip$" +) +_add_project_zip_target( + ecap_package_zip + "${CMAKE_CURRENT_LIST_DIR}/ecap_package.zip" + "${CMAKE_SOURCE_DIR}" + ecap_package_includes + ecap_package_excludes +) +#_add_directory_to_clion("C:/tiles") rcl_unload_dependency_environment(${rely}) diff --git a/third_party/init.bash b/third_party/init.bash index 89b3577..6d4234e 100644 --- a/third_party/init.bash +++ b/third_party/init.bash @@ -5,23 +5,49 @@ cd "$root" origin="$(git remote get-url origin)" origin="${origin%/}" remote_root="$(printf '%s\n' "$origin" | sed -E 's#/[^/]+(\.git)?$##')" +remote_root="${remote_root%/*}" +echo "remote_root: $remote_root" +get_default_branch() { + local repo="$1" + local branch + branch="$(git ls-remote --symref "$repo" HEAD | awk '$1 == "ref:" { + sub("^refs/heads/", "", $2) + print $2 + exit + }')" + if [ -z "$branch" ]; then + printf '无法获取远程仓库默认分支: %s\n' "$repo" >&2 + return 1 + fi + printf '%s\n' "$branch" +} fetch_repo() { local repo="$1" - local branch="$2" - local dir="$3" + local dir="$2" + local branch="${3-}" + if [ -z "$branch" ]; then + branch="$(get_default_branch "$repo")" + fi if [ -d "$dir" ]; then - echo "文件夹【$dir】已存在 跳过初始化 " + git -C "$dir" rev-parse --is-inside-work-tree >/dev/null + git -C "$dir" remote set-url origin "$repo" + git -C "$dir" fetch origin "$branch" + git -C "$dir" checkout "$branch" + git -C "$dir" pull --ff-only origin "$branch" else git clone --branch "$branch" --single-branch "$repo" "$dir" fi } fetch_repo_ex() { local name="$1" + local branch="${2-}" local repo="${remote_root}/${name}" - local branch="master" - fetch_repo "$repo" "$branch" "third_party/${name}" + local dir="${name##*/}" + fetch_repo "$repo" "third_party/${dir}" "$branch" } -fetch_repo_ex "build_infra" -fetch_repo_ex "CPP_Core" -fetch_repo_ex "SSR" -fetch_repo_ex "eacp_webapp" +fetch_repo_ex "ae/build_infra" +fetch_repo_ex "ae/CPP_Core" +fetch_repo_ex "ae/SSR" +fetch_repo_ex "ae/eacp_webapp" +fetch_repo_ex "psc/Structive" +fetch_repo_ex "psc/Adminive"