From efb7c120c00c396cd7cc3b395c1c18ec62e12a97 Mon Sep 17 00:00:00 2001 From: shenlei Date: Mon, 12 Oct 2026 18:04:42 +0900 Subject: [PATCH] Build against sibling ../sdk by default Point the sdk submodule at https://git.slcydia.fun/4v5u09Z5a4Yuc/metin2-SDK.git and default AVA2_SDK_ROOT to an SDK checkout beside the repository (../sdk), falling back to the pinned submodule when it is absent. Co-Authored-By: Claude Opus 5.5 --- .gitmodules | 2 +- CMakeLists.txt | 12 ++++++++++-- README.md | 12 +++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.gitmodules b/.gitmodules index d5bbece3..4d1dfc65 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "sdk"] path = sdk - url = http://192.168.21.200:8418/4v5u09Z5a4Yuc/metin2-SDK.git + url = https://git.slcydia.fun/4v5u09Z5a4Yuc/metin2-SDK.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a49acfd..e95e6e13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,11 +4,19 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) include(CTest) -set(AVA2_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/sdk" CACHE PATH "Metin2 SDK source directory") +# Default: the SDK checkout beside this repository (../sdk); fall back to the pinned submodule. +get_filename_component(_ava2_sibling_sdk "${CMAKE_CURRENT_SOURCE_DIR}/../sdk" ABSOLUTE) +if(EXISTS "${_ava2_sibling_sdk}/gr2/CMakeLists.txt" AND EXISTS "${_ava2_sibling_sdk}/speedtree/CMakeLists.txt") + set(_ava2_default_sdk "${_ava2_sibling_sdk}") +else() + set(_ava2_default_sdk "${CMAKE_CURRENT_SOURCE_DIR}/sdk") +endif() +set(AVA2_SDK_ROOT "${_ava2_default_sdk}" CACHE PATH "Metin2 SDK source directory") if(NOT EXISTS "${AVA2_SDK_ROOT}/gr2/CMakeLists.txt" OR NOT EXISTS "${AVA2_SDK_ROOT}/speedtree/CMakeLists.txt") - message(FATAL_ERROR "SDK missing. Run git submodule update --init --recursive or set AVA2_SDK_ROOT.") + message(FATAL_ERROR "SDK missing. Clone it beside this repository as ../sdk, run git submodule update --init --recursive, or set AVA2_SDK_ROOT.") endif() +message(STATUS "AVA2 SDK: ${AVA2_SDK_ROOT}") add_subdirectory("${AVA2_SDK_ROOT}/speedtree" ${CMAKE_CURRENT_BINARY_DIR}/sdk_speedtree) add_subdirectory("${AVA2_SDK_ROOT}/gr2" ${CMAKE_CURRENT_BINARY_DIR}/sdk_gr2) add_subdirectory(shared/codepage) diff --git a/README.md b/README.md index 9baa612b..006f2dff 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Independent AVA2 port, Android arm64 first with macOS arm64 for development. The host, login/selection transport, supported loading/game socket bridge and Python 2 bootstrap are implemented. It is not yet a playable client. ```sh -git submodule update --init --recursive +git submodule update --init --recursive # only when ../sdk is not checked out cmake -S . -B build/dev -DCMAKE_BUILD_TYPE=Debug cmake --build build/dev -j 8 ctest --test-dir build/dev --output-on-failure @@ -21,10 +21,12 @@ See [port status](docs/PORT-PLAN.md), [login implementation and verification](do Windows equivalence is tracked in [the parity audit](docs/WINDOWS-PARITY.md). Preview characters require `--preview-data`; game previews do not prove server gameplay. The static [placeholder inventory](docs/WINDOWS-PARITY-INVENTORY.json) is regenerated with `python3 tools/audit_windows_parity.py`. -The SDK is maintained in its own Git repository and pinned by the `sdk` submodule. -Clone with `git clone --recurse-submodules`, or run the initialization command above -before configuring. To develop against an existing SDK checkout, configure with -`-DAVA2_SDK_ROOT=/absolute/path/to/sdk`; normal builds use the pinned submodule. +The SDK is maintained in its own Git repository +(https://git.slcydia.fun/4v5u09Z5a4Yuc/metin2-SDK.git). By default CMake uses an SDK +checkout beside this repository (`../sdk`, i.e. `chakan` and `sdk` in the same parent +directory). Without it, the build falls back to the pinned `sdk` submodule: clone with +`git clone --recurse-submodules` or run the initialization command above. Any other +checkout can be selected with `-DAVA2_SDK_ROOT=/absolute/path/to/sdk`. Keep build outputs in `build/dev`, `build/release`, or another named directory under `build/`, rather than configuring directly into `build/`. Put diagnostic