-
Notifications
You must be signed in to change notification settings - Fork 4
3rdpartyライブラリの更新 #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3rdpartyライブラリの更新 #283
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -288,7 +288,41 @@ set(PNG_ARM_NEON "off" | |||
| set(PNG_ARM_NEON_OPT "0" | ||||
| CACHE STRING "Enable ARM NEON optimizations") | ||||
| set(PNG_STATIC "defined" CACHE STRING "" FORCE) | ||||
|
|
||||
|
Comment on lines
290
to
+291
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PNG_STATIC の再代入(型不整合)を削除してください
-set(PNG_STATIC "defined" CACHE STRING "" FORCE)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||
| # macOS 15 (Sequoia) 以降でfp.hが無いことによるエラーの対応 | ||||
| # libpng 1.6.37ではfp.hをincludeしているが、 | ||||
| # macOS 15以降では fp.h がシステムから削除されているためビルドエラーになる。math.hに統合されている | ||||
| # libpngはUnrealEngineで利用している物とバージョンを揃える必要があるためアップデートが出来ないため、fp.hという名前のヘッダーを作成し、 | ||||
| # その中でmath.hをincludeするというアプローチでコンパイルを通す | ||||
|
|
||||
| if(APPLE) | ||||
| set(FP_H_COMPAT_DIR "${CMAKE_CURRENT_BINARY_DIR}/include_compat") | ||||
| file(MAKE_DIRECTORY "${FP_H_COMPAT_DIR}") | ||||
| file(WRITE "${FP_H_COMPAT_DIR}/fp.h" | ||||
| "/* macOS 15以降で削除された fp.h の互換ヘッダー | ||||
| * fp.h の機能は math.h に統合されているため、math.h をインクルードします。 | ||||
| */ | ||||
| #ifndef _FP_H_COMPAT_ | ||||
| #define _FP_H_COMPAT_ | ||||
| #include <math.h> | ||||
| #endif | ||||
| ") | ||||
| 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}") | ||||
| endif() | ||||
|
|
||||
| add_subdirectory("3rdparty/libpng") | ||||
|
|
||||
| # libpngのビルド後、CFLAGSを元に戻す(他のサブプロジェクトに影響を与えないため) | ||||
| if(APPLE) | ||||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_SAVE}") | ||||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}") | ||||
| endif() | ||||
| set(PNG_INCLUDE_DIRS | ||||
| "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libpng" | ||||
| "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/libpng") | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,24 +31,22 @@ if( NOT(IOS OR ANDROID) ) | |||||||||||||||||||
| # 注意点: | ||||||||||||||||||||
| # libpngのバージョンは、Unreal EngineのPngImageWrapper.hに記載のバージョンに合わせる必要があります。 | ||||||||||||||||||||
| # そうでないと、UEでパッケージ化したあとexeを起動したときにassertion failedのダイアログが出て強制終了になります。 | ||||||||||||||||||||
| # Unreal Engineの対応バージョンを上げるときには併せてPngImageWrapperで利用のlibpngバージョンを確認し、 | ||||||||||||||||||||
| # libpngのバージョンが上がる場合はlibplateau submoduleのlibpngを新しいバージョンにしたうえで下のpng15_staticの15を{major_ver}{minor_ver}に置き換える必要がありそうです。 | ||||||||||||||||||||
| add_dependencies(plateau libjpeg-turbo png15_static tiff hmm) | ||||||||||||||||||||
| target_link_libraries(plateau PRIVATE ${JPEG_TURBO_LIBRARIES} png15_static tiff hmm) | ||||||||||||||||||||
| 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 | ||||||||||||||||||||
|
Comment on lines
+34
to
36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major ❓ Verification inconclusivepng15_static → png_static 置換は妥当。Windows 向けに 差し替えは正しいです。Windows で静的 libpng を使う場合、消費側が 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定義を追加 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| "${JPEG_TURBO_INCLUDE_DIRS}" | ||||||||||||||||||||
| "${PNG_INCLUDE_DIRS}" | ||||||||||||||||||||
| "${TIFF_INCLUDE}" | ||||||||||||||||||||
| "${HMM_INCLUDE}" | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| else() | ||||||||||||||||||||
| target_link_libraries(plateau PUBLIC | ||||||||||||||||||||
| "citygml" | ||||||||||||||||||||
| "GLTFSDK" | ||||||||||||||||||||
| "crypto" | ||||||||||||||||||||
| "ssl" | ||||||||||||||||||||
| target_link_libraries(plateau PUBLIC | ||||||||||||||||||||
| "citygml" | ||||||||||||||||||||
| "GLTFSDK" | ||||||||||||||||||||
| "crypto" | ||||||||||||||||||||
| "ssl" | ||||||||||||||||||||
| "c_wrapper" | ||||||||||||||||||||
| "png15_static" | ||||||||||||||||||||
| "png_static" | ||||||||||||||||||||
| "${LibOpenMeshCore}" | ||||||||||||||||||||
| "${LibOpenMeshTools}" | ||||||||||||||||||||
| "hmm" | ||||||||||||||||||||
|
|
@@ -97,7 +95,7 @@ if(BUILD_LIB_TYPE STREQUAL "static") | |||||||||||||||||||
| $<TARGET_FILE:LibXml2> | ||||||||||||||||||||
| $<TARGET_FILE:httplib> | ||||||||||||||||||||
| $<TARGET_FILE:zlibstatic> | ||||||||||||||||||||
| $<TARGET_FILE:png15_static> | ||||||||||||||||||||
| $<TARGET_FILE:png_static> | ||||||||||||||||||||
| $<TARGET_FILE:tiff> | ||||||||||||||||||||
| $<TARGET_FILE:hmm> | ||||||||||||||||||||
| ${JPEG_TURBO_LIBRARIES} | ||||||||||||||||||||
|
|
@@ -116,7 +114,7 @@ if(BUILD_LIB_TYPE STREQUAL "static") | |||||||||||||||||||
| endif() | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if(BUILD_LIB_TYPE STREQUAL "static") | ||||||||||||||||||||
| set(COMBINE_LIB_DEPENDS plateau citygml xerces-c GLTFSDK crypto ssl LibXml2 httplib zlibstatic libjpeg-turbo png15_static tiff ${LibOpenMeshCore} ${LibOpenMeshTools} hmm) | ||||||||||||||||||||
| set(COMBINE_LIB_DEPENDS plateau citygml xerces-c GLTFSDK crypto ssl LibXml2 httplib zlibstatic libjpeg-turbo png_static tiff ${LibOpenMeshCore} ${LibOpenMeshTools} hmm) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # windows で libファイル結合します。 | ||||||||||||||||||||
| # 参考 : https://stackoverflow.com/questions/60190374/how-to-bundle-multiple-static-libraries-into-single-library-in-cmake-for-windows | ||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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