Skip to content

Conversation

@azukizuki
Copy link
Contributor

@azukizuki azukizuki commented Oct 1, 2025

🔗 関連リンク

✅ レビュー前確認項目

  • 自動ビルド・テストが通っていること

✅ マージ前確認項目

  • (libcitygmlの変更がある場合)libcitygmlがmasterの最新版になっていること

🚀 実装内容

3rdpartyライブラリのバージョン上げる対応を実施しました

  • zlib はmacOSSDK 11以降でビルドが通らなくなるため(fopenメソッドが無いエラー)
  • libpngは現状SDKがサポートしているUE5.5で利用しているバージョンが上がったため、1.6.37に更新。しかし、これにより最新のMacOS環境ではfp.hがなくなり、math.hに統合されているためヘッダーが参照できずビルドが通らなくなります。そのためワークアラウンドとして fp.hという名前のmath.hをインクルードするだけのヘッダーをCMakeで仕込むようにしました。これはUE SDKの対応バージョンを上げる際に解消します(最新のUEでは1.6.44のlibpngを利用しており、上記対応は不要となる)

🌐 影響範囲

🛠️ 動作確認

⚠️ 懸念点

Summary by CodeRabbit

  • バグ修正
    • macOS で発生していたビルドエラーを解消。欠落ヘッダ互換対応とインクルード順の調整により Apple 環境でのコンパイル安定性を向上。
  • チョア
    • サードパーティ依存(PNG、zlib)の参照リビジョンを更新。
    • PNG ライブラリのリンク設定を整理して静的結合の扱いを統一。
    • iOS/macOS ビルドでの PNG 最適化フラグを無効化する設定を追加。

@coderabbitai
Copy link

coderabbitai bot commented Oct 1, 2025

Walkthrough

サブモジュール3rdparty/libpng3rdparty/zlibのコミット参照を更新。macOS向けにfp.h互換ヘッダ生成とインクルード順制御をCMakeに追加。ビルド時のPNG静的ターゲット参照をpng15_staticからpng_staticへ置換。CIのiOS/macOSビルドで-DPNG_ARM_NEON_OPT=0を追加。

Changes

Cohort / File(s) Summary of changes
Third-party submodules
3rdparty/libpng, 3rdparty/zlib
サブモジュールのコミットハッシュを更新(チェックアウト参照変更のみ)。
Root build config (Apple fixes)
CMakeLists.txt
macOS向けに簡易fp.h互換ヘッダをinclude_compatへ生成し、-isystemで優先インクルード。libpngサブディレクトリ前後でC/C++フラグを一時変更・復元する処理を追加。
Src build linkage
src/CMakeLists.txt
参照をpng15_staticpng_staticへ置換(target_link_librariesadd_dependencies$<TARGET_FILE:...>COMBINE_LIB_DEPENDS等)。
CI action flags
.github/actions/upload-mobile-dlls/action.yml
macOS/iOS用ビルドでCコンパイラ定義に-DPNG_ARM_NEON_OPT=0を追加(PNG ARM NEON最適化無効化フラグ)。

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as 開発者
    participant CM as CMake (configure)
    participant LP as libpng サブディレクトリ
    participant PL as plateau ターゲット
    participant CI as CI (upload-mobile-dlls)

    Dev->>CM: プロジェクトをconfigure
    alt Apple (macOS / iOS)
        CM->>CM: `include_compat/fp.h` を生成
        CM->>CM: C/C++FLAGS に `-isystem include_compat` を一時追加
    end
    CM->>LP: libpng をビルド(ターゲット: png_static)
    CM->>CM: 一時フラグを復元
    CM->>PL: plateau をリンク(依存: png_static)
    CI->>CI: iOS/macOS ビルドで `-DPNG_ARM_NEON_OPT=0` をC_FLAGSに追加
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

ぴょん、とんで更新の道
ハッシュを替えて静かに渡るやどり木
林檎の丘で fp.h を編んでおくよ
pngは新しい名で手を振るよ、ぴょん 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning プルリクエストは実装内容とチェックリストを含んでいるものの、関連リンク、影響範囲、動作確認、懸念点の各セクションが未記入でレビューに必要な情報が不足しているため不完全です。 「## 🔗 関連リンク」に該当するチケットやPRを記載し、「## 🌐 影響範囲」「## 🛠️ 動作確認」「## ⚠️ 懸念点」各セクションに変更の影響箇所、確認手順、注意点を追記してください。
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed タイトルは主たる変更である3rdpartyライブラリのバージョン更新を簡潔に示しており、変更内容と一致しているため適切です。
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/update_3rdparty_modules

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
CMakeLists.txt (2)

298-317: fp.h 互換ヘッダは「存在しない環境でのみ」適用に限定を

現状は APPLE 全域で適用。macOS < 15 環境では本来の fp.h を不要に隠蔽しうるため、存在検出で条件分岐してください。C++言語はすでに有効なので CheckIncludeFileCXX が使えます。

include(CheckIncludeFileCXX)
check_include_file_cxx("fp.h" HAVE_FP_H)
if(APPLE AND NOT HAVE_FP_H)
  # ここに互換ヘッダ生成ロジック
endif()

ビルドログで HAVE_FP_H の判定結果をご確認ください。


310-317: include パスのリークと -isystem の二重指定を解消

  • include_directories(BEFORE SYSTEM ...) はディレクトリプロパティに残留し、他サブプロジェクトにも影響します。
  • さらに C/CXX フラグへ -isystem を直接付与しており二重管理です。png のビルドターゲットにだけスコープするのが安全です。

適用方針:

  • ここでの include_directories(...) と C/CXX フラグ書き換えを削除。
  • add_subdirectory(3rdparty/libpng) の後で、png ターゲットにのみシステムインクルードを付与。
-  include_directories(BEFORE SYSTEM "${FP_H_COMPAT_DIR}")
-
-  # libpngのビルド時のみCFLAGSを一時的に変更するため、現在の値を保存
-  set(CMAKE_C_FLAGS_SAVE "${CMAKE_C_FLAGS}")
-  set(CMAKE_CXX_FLAGS_SAVE "${CMAKE_CXX_FLAGS}")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -isystem ${FP_H_COMPAT_DIR}")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${FP_H_COMPAT_DIR}")
+  # インクルードは png ターゲットにだけ付与(add_subdirectory 後に設定)

add_subdirectory の直後(行 319 の後)に以下を追加してください:

if(APPLE AND (NOT HAVE_FP_H))
  # 互換ヘッダを png ターゲットに限定してシステムインクルード付与
  target_include_directories(png_static SYSTEM BEFORE PRIVATE "${FP_H_COMPAT_DIR}")
endif()

C/CXX フラグの退避/復元(321-325行)も不要になります。

Also applies to: 321-325

src/CMakeLists.txt (1)

43-53: iOS/Android ブロックの "png_static" はターゲットとして参照を(クォート解除)

文字列としてリンクすると使用要件(インクルード等)が伝播しません。実体ターゲットが存在するため、クォートを外してターゲットリンクにしてください。

-    "png_static"
+    png_static

他の内部ターゲットも可能なら非クォート化をご検討ください(citygml, GLTFSDK など)。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4efbd1 and 0a5869b.

📒 Files selected for processing (4)
  • 3rdparty/libpng (1 hunks)
  • 3rdparty/zlib (1 hunks)
  • CMakeLists.txt (1 hunks)
  • src/CMakeLists.txt (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-and-test (ubuntu-24.04, x86_64)
  • GitHub Check: build-and-test (windows-2022, x86_64)
  • GitHub Check: build-and-test (macos-14, arm64)
🔇 Additional comments (3)
3rdparty/zlib (1)

1-1: サブモジュール更新を確認しました

差分はコミット参照の更新のみで問題は見当たりませんでした。

src/CMakeLists.txt (2)

98-101: COMBINE_LIB_FILES の更新(png_static)OK

静的結合対象の置換は妥当です。


117-118: COMBINE_LIB_DEPENDS の更新(png_static)OK

依存関係の差し替えは妥当です。

Comment on lines 290 to +291
set(PNG_STATIC "defined" CACHE STRING "" FORCE)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

PNG_STATIC の再代入(型不整合)を削除してください

PNG_STATIC ON の直後に set(PNG_STATIC "defined" ...) を文字列で再代入しており、オプションの意味を壊します。重複かつ誤用の可能性が高いです。後者の行を削除してください。Windows の消費側に PNG_STATIC マクロが必要なら、ターゲット側へ target_compile_definitions(... PUBLIC PNG_STATIC) を付けるのが正攻法です(別コメントで提案)。

-set(PNG_STATIC "defined" CACHE STRING "" FORCE)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
set(PNG_STATIC "defined" CACHE STRING "" FORCE)
🤖 Prompt for AI Agents
In CMakeLists.txt around lines 290-291, remove the erroneous re-assignment
set(PNG_STATIC "defined" CACHE STRING "" FORCE) because it overwrites the
PNG_STATIC option with a string (type mismatch) and breaks the option; simply
delete that line and, if consumers on Windows actually need a PNG_STATIC
preprocessor macro, add target_compile_definitions(<target> PUBLIC PNG_STATIC)
on the appropriate targets instead of re-setting the cached variable.

Comment on lines +34 to 36
add_dependencies(plateau libjpeg-turbo png_static tiff hmm)
target_link_libraries(plateau PRIVATE ${JPEG_TURBO_LIBRARIES} png_static tiff hmm)
target_include_directories(plateau PRIVATE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

❓ Verification inconclusive

png15_static → png_static 置換は妥当。Windows 向けに PNG_STATIC を公開定義してください

差し替えは正しいです。Windows で静的 libpng を使う場合、消費側が PNG_STATIC を定義していないと __declspec(dllimport) との不整合でリンク警告/失敗の恐れがあります。plateau に公開定義を追加してください。

 add_dependencies(plateau libjpeg-turbo png_static tiff hmm)
 target_link_libraries(plateau PRIVATE ${JPEG_TURBO_LIBRARIES} png_static tiff hmm)
+if(WIN32)
+  target_compile_definitions(plateau PUBLIC PNG_STATIC)
+endif()

🏁 Script executed:

#!/bin/bash
# リポジトリ内に png15_static の残存参照がないか確認
rg -nP 'png15_static'

Length of output: 0


Windowsビルド向けにPNG_STATIC定義を追加
静的リンクした libpng と __declspec(dllimport) の不整合によるリンク警告/失敗を防ぐため、CMakeLists.txt に以下を追加してください。

 add_dependencies(plateau libjpeg-turbo png_static tiff hmm)
 target_link_libraries(plateau PRIVATE ${JPEG_TURBO_LIBRARIES} png_static tiff hmm)
+if(WIN32)
+  target_compile_definitions(plateau PUBLIC PNG_STATIC)
+endif()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
add_dependencies(plateau libjpeg-turbo png_static tiff hmm)
target_link_libraries(plateau PRIVATE ${JPEG_TURBO_LIBRARIES} png_static tiff hmm)
target_include_directories(plateau PRIVATE
add_dependencies(plateau libjpeg-turbo png_static tiff hmm)
target_link_libraries(plateau PRIVATE ${JPEG_TURBO_LIBRARIES} png_static tiff hmm)
if(WIN32)
target_compile_definitions(plateau PUBLIC PNG_STATIC)
endif()
target_include_directories(plateau PRIVATE
🤖 Prompt for AI Agents
In src/CMakeLists.txt around lines 34 to 36, the build can get link
warnings/failures on Windows due to using a statically linked libpng while
symbols expect __declspec(dllimport); add the PNG_STATIC preprocessor definition
for the plateau target when building on Windows. Modify the CMake file to set
the definition only for Windows (e.g., check WIN32 or MSVC) and apply it to the
plateau target via target_compile_definitions(... PRIVATE PNG_STATIC) so the
static libpng export/import mismatch is avoided.

@azukizuki azukizuki marked this pull request as draft October 1, 2025 14:18
@azukizuki
Copy link
Contributor Author

libpngのmobileビルド時のエラー修正対応Done
ビルドも通ったのでDraft外します。
https://github.com/Synesthesias/libplateau/actions/runs/18181055614

@azukizuki azukizuki self-assigned this Oct 2, 2025
@azukizuki azukizuki marked this pull request as ready for review October 2, 2025 03:41
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a5869b and 6d99e27.

📒 Files selected for processing (1)
  • .github/actions/upload-mobile-dlls/action.yml (1 hunks)

-D CMAKE_OSX_ARCHITECTURES="arm64"
-D CMAKE_OSX_DEPLOYMENT_TARGET=13.0
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_C_FLAGS="-DPNG_ARM_NEON_OPT=0"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

CMAKE_C_FLAGSを直接上書きしないでください
cmake -D CMAKE_C_FLAGS="..." でキャッシュ値を丸ごと置き換えると、Apple向けツールチェーンが自動で設定していた必須フラグ(-fembed-bitcode-isysroot など)が消失し、最悪ビルド失敗や提出要件を満たせなくなる恐れがあります。PNGのNEON最適化だけを抑止したいのであれば、target_compile_definitions() 等で該当ターゲットに PNG_ARM_NEON_OPT=0 を付与するか、CMake側に専用オプションを生やして切り替えるようにしてください。

🤖 Prompt for AI Agents
.github/actions/upload-mobile-dlls/action.yml around line 91: this change
overwrites the entire cached CMAKE_C_FLAGS via -D CMAKE_C_FLAGS="...", which
removes Apple toolchain required flags (e.g. -fembed-bitcode, -isysroot) and can
break builds; instead, stop setting CMAKE_C_FLAGS directly and apply
PNG_ARM_NEON_OPT=0 to the specific build target(s) (use
target_compile_definitions() in the CMakeLists for the iOS-related targets) or
add a dedicated CMake option (e.g. -DPNG_ARM_NEON_OPT=0 used within CMake to set
a definition) so only the PNG_NEON macro is disabled without replacing global
compiler flags.

@azukizuki azukizuki merged commit 8e7950e into dev/v4 Oct 2, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants