Skip to content

Commit 32600a9

Browse files
rockepandazzhe
andauthored
Feature/texture packing (Synesthesias#182)
* テクスチャパッキング実装, submodule追加 * libjpeg-turboのcmake修正 (Synesthesias#179) * texture_packingの実装、samplesの実行により、テクスチャ結合済みのOBJ,MTLファイルを出力 * texture_packingの実装、jpeg形式の画像に加えて、png形式、tiff形式の画像に対応しました。 * C#実装、不要ファイル削除 * バグ修正 * リファクタリング * 最小地物単位で結合されない問題修正 * Mac, Ubuntu向け対応 * ThirdPartyNotice追加 * licensed追記 * Mac向け修正 * submeshが一部適用されないバグ修正 * test修正 * Mac, Ubuntu向け修正(fPIC) * test修正 * マルチアーキテクチャ対応 * Update libcitygml --------- Co-authored-by: 和正 崎山 <kazsakinotwen@gmail.com>
1 parent be55952 commit 32600a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1677
-60
lines changed

.github/actions/build/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
visual_studio_version:
99
description: "ビルドで利用する Visual Studio のバージョンです。Windowsでのみ利用します。"
1010
required: true
11+
arch:
12+
description: "ビルド対象のCPUアーキテクチャです。MacOSでのみ利用します。"
13+
required: false
14+
default: "x86_64"
1115

1216
runs:
1317
using: Composite
@@ -58,6 +62,7 @@ runs:
5862
-D CMAKE_CXX_FLAGS="-w"
5963
-D BUILD_LIB_TYPE=dynamic
6064
-D RUNTIME_LIB_TYPE=MT
65+
-D CMAKE_OSX_ARCHITECTURES:STRING="${{ inputs.arch }}"
6166
${{ env.ADDITIONAL_CMAKE_OPTIONS }}
6267
shell: ${{ inputs.shell_type }}
6368
# 10万行超えの警告が出るので一時的な処置として警告を抑制しています。
@@ -78,6 +83,7 @@ runs:
7883
-D CMAKE_CXX_FLAGS="-w"
7984
-D BUILD_LIB_TYPE=static
8085
-D RUNTIME_LIB_TYPE=MD
86+
-D CMAKE_OSX_ARCHITECTURES:STRING="${{ inputs.arch }}"
8187
${{ env.ADDITIONAL_CMAKE_OPTIONS }}
8288
shell: ${{ inputs.shell_type }}
8389

.github/actions/upload-dll/action.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ inputs:
77
visual_studio_version:
88
description: "ビルドで利用する Visual Studio のバージョンです。Windowsでのみ利用します。"
99
required: true
10+
arch:
11+
description: "ビルド対象のCPUアーキテクチャです。MacOSでのみ利用します。"
12+
required: false
13+
default: "x86_64"
1014

1115
runs:
1216
using: Composite
@@ -53,18 +57,34 @@ runs:
5357
echo "HOME=$(echo $HOME)" >> $GITHUB_ENV
5458
shell: ${{ inputs.shell_type }}
5559

56-
- name: Copy Libraries for MacOS
57-
if: runner.os == 'MacOS'
60+
- name: Copy Libraries for MacOS(x86_64)
61+
if: runner.os == 'MacOS' && inputs.arch == 'x86_64'
62+
run: |
63+
mkdir $HOME/output/
64+
find ${{github.workspace}}/out/build/x64-Release-Unity -name *.dylib | xargs -I {} cp -v {} $HOME/output
65+
find ${{github.workspace}}/out/build/x64-Release-Unreal -name libplateau_combined.a | xargs -I {} cp -v {} $HOME/output
66+
echo "HOME=$(echo $HOME)" >> $GITHUB_ENV
67+
shell: ${{ inputs.shell_type }}
68+
69+
- name: Copy Libraries for MacOS(arm64)
70+
if: runner.os == 'MacOS' && inputs.arch == 'arm64'
5871
run: |
5972
mkdir $HOME/output/
6073
find ${{github.workspace}}/out/build/x64-Release-Unity -name *.dylib | xargs -I {} cp -v {} $HOME/output
6174
find ${{github.workspace}}/out/build/x64-Release-Unreal -name libplateau_combined.a | xargs -I {} cp -v {} $HOME/output
6275
echo "HOME=$(echo $HOME)" >> $GITHUB_ENV
6376
shell: ${{ inputs.shell_type }}
6477

65-
- name: Upload DLL(so, dylib) for Ubuntu and MacOS
66-
if: runner.os != 'Windows'
78+
- name: Upload DLL(so) for Ubuntu
79+
if: runner.os == 'Linux'
6780
uses: actions/upload-artifact@v2
6881
with:
6982
name: libplateau-${{matrix.os}}
7083
path: ${{env.HOME}}/output/
84+
85+
- name: Upload DLL(dylib) for MacOS
86+
if: runner.os == 'MacOS'
87+
uses: actions/upload-artifact@v2
88+
with:
89+
name: libplateau-${{matrix.os}}-${{matrix.arch}}
90+
path: ${{env.HOME}}/output/

.github/workflows/upload-dlls-older-visual-studio.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [windows-2019, macos-latest, ubuntu-20.04]
23+
arch: [x86_64]
24+
include:
25+
- os: macos-latest
26+
arch: arm64
2327

2428
steps:
2529

@@ -81,13 +85,15 @@ jobs:
8185
mkdir -p ~/a/plateau-plugins/dynamic-libs/Windows/x86_64
8286
mkdir -p ~/a/plateau-plugins/dynamic-libs/Linux/x86_64
8387
mkdir -p ~/a/plateau-plugins/dynamic-libs/MacOS/x86_64
88+
mkdir -p ~/a/plateau-plugins/dynamic-libs/MacOS/arm64
8489
mkdir -p ~/a/plateau-plugins/dynamic-libs/ManagedDLL
8590
mkdir -p ~/a/plateau-plugins/dynamic-libs/Android
8691
mkdir -p ~/a/plateau-plugins/dynamic-libs/iOS/plateau.framework
8792
cp ~/a/libplateau-windows/plateau.dll ~/a/plateau-plugins/dynamic-libs/Windows/x86_64
8893
cp ~/a/libplateau-windows/CSharpPLATEAU.dll ~/a/plateau-plugins/dynamic-libs/ManagedDLL
8994
cp ~/a/libplateau-ubuntu-20.04/*.so ~/a/plateau-plugins/dynamic-libs/Linux/x86_64
90-
cp ~/a/libplateau-macos-latest/*.dylib ~/a/plateau-plugins/dynamic-libs/MacOS/x86_64
95+
cp ~/a/libplateau-macos-latest-x86_64/*.dylib ~/a/plateau-plugins/dynamic-libs/MacOS/x86_64
96+
cp ~/a/libplateau-macos-latest-arm64/*.dylib ~/a/plateau-plugins/dynamic-libs/MacOS/arm64
9197
cp ~/a/libplateau-android-dll/libplateau.so ~/a/plateau-plugins/dynamic-libs/Android
9298
cp ~/a/libplateau-ios-dll/* ~/a/plateau-plugins/dynamic-libs/iOS/plateau.framework
9399
@@ -98,7 +104,8 @@ jobs:
98104
mkdir -p ~/a/plateau-plugins/static-libs/macos
99105
cp ~/a/libplateau-windows/*.lib ~/a/plateau-plugins/static-libs/windows
100106
cp ~/a/libplateau-ubuntu-20.04/*.a ~/a/plateau-plugins/static-libs/linux
101-
cp ~/a/libplateau-macos-latest/*.a ~/a/plateau-plugins/static-libs/macos
107+
cp ~/a/libplateau-macos-latest-x86_64/*.a ~/a/plateau-plugins/static-libs/macos/x86_64
108+
cp ~/a/libplateau-macos-latest-arm64/*.a ~/a/plateau-plugins/static-libs/macos/arm64
102109
103110
- name: upload artifact
104111
uses: actions/upload-artifact@v3

.github/workflows/upload-dlls.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
os: [windows-2022, macos-latest, ubuntu-20.04]
26-
26+
arch: [x86_64]
27+
include:
28+
- os: macos-latest
29+
arch: arm64
2730
steps:
2831

2932
- uses: actions/checkout@v3
@@ -39,6 +42,7 @@ jobs:
3942
with:
4043
shell_type: ${{ (runner.os == 'Windows' && 'powershell') || 'bash' }}
4144
visual_studio_version: "17 2022"
45+
arch: ${{ matrix.arch }}
4246

4347
# 2つ目のジョブ。
4448
# AndroidとiOS用にライブラリをビルド。
@@ -84,24 +88,28 @@ jobs:
8488
mkdir -p ~/a/plateau-plugins/dynamic-libs/Windows/x86_64
8589
mkdir -p ~/a/plateau-plugins/dynamic-libs/Linux/x86_64
8690
mkdir -p ~/a/plateau-plugins/dynamic-libs/MacOS/x86_64
91+
mkdir -p ~/a/plateau-plugins/dynamic-libs/MacOS/arm64
8792
mkdir -p ~/a/plateau-plugins/dynamic-libs/ManagedDLL
8893
mkdir -p ~/a/plateau-plugins/dynamic-libs/Android
8994
mkdir -p ~/a/plateau-plugins/dynamic-libs/iOS/plateau.framework
9095
cp ~/a/libplateau-windows/plateau.dll ~/a/plateau-plugins/dynamic-libs/Windows/x86_64
9196
cp ~/a/libplateau-windows/CSharpPLATEAU.dll ~/a/plateau-plugins/dynamic-libs/ManagedDLL
9297
cp ~/a/libplateau-ubuntu-20.04/*.so ~/a/plateau-plugins/dynamic-libs/Linux/x86_64
93-
cp ~/a/libplateau-macos-latest/*.dylib ~/a/plateau-plugins/dynamic-libs/MacOS/x86_64
98+
cp ~/a/libplateau-macos-latest-x86_64/*.dylib ~/a/plateau-plugins/dynamic-libs/MacOS/x86_64
99+
cp ~/a/libplateau-macos-latest-arm64/*.dylib ~/a/plateau-plugins/dynamic-libs/MacOS/arm64
94100
cp ~/a/libplateau-android-dll/libplateau.so ~/a/plateau-plugins/dynamic-libs/Android
95101
cp ~/a/libplateau-ios-dll/* ~/a/plateau-plugins/dynamic-libs/iOS/plateau.framework
96102
97103
- name: sum-up-static-libs
98104
run: |
99105
mkdir -p ~/a/plateau-plugins/static-libs/windows
100106
mkdir -p ~/a/plateau-plugins/static-libs/linux
101-
mkdir -p ~/a/plateau-plugins/static-libs/macos
107+
mkdir -p ~/a/plateau-plugins/static-libs/macos/x86_64
108+
mkdir -p ~/a/plateau-plugins/static-libs/macos/arm64
102109
cp ~/a/libplateau-windows/*.lib ~/a/plateau-plugins/static-libs/windows
103110
cp ~/a/libplateau-ubuntu-20.04/*.a ~/a/plateau-plugins/static-libs/linux
104-
cp ~/a/libplateau-macos-latest/*.a ~/a/plateau-plugins/static-libs/macos
111+
cp ~/a/libplateau-macos-latest-x86_64/*.a ~/a/plateau-plugins/static-libs/macos/x86_64
112+
cp ~/a/libplateau-macos-latest-arm64/*.a ~/a/plateau-plugins/static-libs/macos/arm64
105113
106114
- name: upload artifact
107115
uses: actions/upload-artifact@v3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ bin
2929
*.DotSettings.user
3030

3131
# Test data
32+
33+
# Intermidiate build data
34+
3rdparty/*/*.tar.gz

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@
2828
[submodule "3rdparty/libxml2"]
2929
path = 3rdparty/libxml2
3030
url = https://github.com/GNOME/libxml2
31+
[submodule "3rdparty/libpng"]
32+
path = 3rdparty/libpng
33+
url = https://github.com/glennrp/libpng
34+
[submodule "3rdparty/libtiff"]
35+
path = 3rdparty/libtiff
36+
url = https://github.com/libsdl-org/libtiff

.licensed.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ reviewed:
1414
- pybind11 # BSD-3ライセンスなのでOK
1515
- zlib # 再配布可能、要ライセンス表示
1616
- libcitygml # LGPLライセンス、改変部分をpublicリポジトリで公開しているのでOK
17+
- libjpeg-turbo # 再配布可能、要ライセンス表示
18+
- libpng # 再配布可能、要ライセンス表示
19+
- libtiff # 再配布可能、要ライセンス表示
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
include(ExternalProject)
2+
3+
# Set compiler flags
4+
if (MSVC)
5+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_CRT_SECURE_NO_WARNINGS")
6+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_WARNINGS")
7+
endif()
8+
9+
# Set WITH_SIMD
10+
include(CheckLanguage)
11+
check_language(ASM_NASM)
12+
if (CMAKE_ASM_NASM_COMPILER)
13+
if (APPLE)
14+
# macOS might have /usr/bin/nasm but it cannot be used
15+
# https://stackoverflow.com/q/53974320
16+
# To fix this, run `brew install nasm`
17+
execute_process(COMMAND nasm --version RESULT_VARIABLE return_code)
18+
if("${return_code}" STREQUAL "0")
19+
enable_language(ASM_NASM)
20+
option(WITH_SIMD "" ON)
21+
else()
22+
message(STATUS "nasm found but can't be used, run `brew install nasm`")
23+
option(WITH_SIMD "" OFF)
24+
endif()
25+
else()
26+
enable_language(ASM_NASM)
27+
option(WITH_SIMD "" ON)
28+
endif()
29+
else()
30+
option(WITH_SIMD "" OFF)
31+
endif()
32+
if (WITH_SIMD)
33+
message(STATUS "NASM assembler enabled")
34+
else()
35+
message(STATUS "NASM assembler not found - libjpeg-turbo performance may suffer")
36+
endif()
37+
38+
if (STATIC_WINDOWS_RUNTIME)
39+
set(WITH_CRT_DLL OFF)
40+
else()
41+
set(WITH_CRT_DLL ON)
42+
endif()
43+
message(STATUS "libturbojpeg: WITH_CRT_DLL=${WITH_CRT_DLL}")
44+
45+
# If MSVC, the OUTPUT_NAME was set to turbojpeg-static
46+
if(MSVC)
47+
set(lib_name "turbojpeg-static")
48+
else()
49+
set(lib_name "turbojpeg")
50+
endif()
51+
52+
ExternalProject_Add(
53+
libjpeg-turbo
54+
URL https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/3.0.0.tar.gz
55+
URL_HASH SHA256=171dae5d73560bc94006a7c0c3281bd9bfde6a34f7e41e66f930a1a9162bd7df
56+
DOWNLOAD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libjpeg-turbo"
57+
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/libjpeg-turbo"
58+
UPDATE_COMMAND ""
59+
LIST_SEPARATOR |
60+
CMAKE_ARGS
61+
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
62+
-DWITH_CRT_DLL=${WITH_CRT_DLL}
63+
-DENABLE_STATIC=ON
64+
-DENABLE_SHARED=OFF
65+
-DWITH_SIMD=${WITH_SIMD}
66+
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/3rdparty/libjpeg-turbo
67+
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
68+
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
69+
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
70+
${ExternalProject_CMAKE_ARGS_hidden}
71+
BUILD_BYPRODUCTS
72+
<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}
73+
)
74+
75+
ExternalProject_Get_Property(libjpeg-turbo INSTALL_DIR)
76+
set(JPEG_TURBO_INCLUDE_DIRS "${INSTALL_DIR}/include/") # "/" is critical.
77+
set(JPEG_TURBO_LIB_DIR "${INSTALL_DIR}/lib")
78+
set(JPEG_TURBO_LIBRARIES "${JPEG_TURBO_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}")

3rdparty/libpng

Submodule libpng added at f8e5fa9

3rdparty/libtiff

Submodule libtiff added at cb88a5b

0 commit comments

Comments
 (0)