Skip to content

Commit 0be95cc

Browse files
committed
Added linux build pipeline, fixing cmake platform detection issue
1 parent c632ab4 commit 0be95cc

33 files changed

Lines changed: 233 additions & 478 deletions

CMakeCache.txt

Lines changed: 0 additions & 414 deletions
This file was deleted.

build/linux_build_dependencise.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
cd ..
3+
cp -f "src\ffmpeg\bin\avcodec-60.dll" $projectpath
4+
cp -f "src\ffmpeg\bin\avdevice-60.dll" $projectpath
5+
cp -f "src\ffmpeg\bin\avfilter-9.dll" $projectpath
6+
cp -f "src\ffmpeg\bin\avformat-60.dll" $projectpath
7+
cp -f "src\ffmpeg\bin\avutil-58.dll" $projectpath
8+
cp -f "src\ffmpeg\bin\postproc-57.dll" $projectpath
9+
cp -f "src\ffmpeg\bin\swresample-4.dll" $projectpath
10+
cp -f "src\ffmpeg\bin\swscale-7.dll" $projectpath

build/linux_build_post.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
cd ..
3+
cp -f "GDExtensionTemplate-build\GDExtensionTemplate\lib\Linux-AMD64\Debug\gd_videoplayer-d.dll" $projectpath

build/linux_codegen.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
cd ..
3+
cd src
4+
echo Linux>platform.txt
5+
cd ..
6+
cmake -B GDExtensionTemplate-build -G"Visual Studio 17 2022" -DPlatfrom=Linux -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=GDExtensionTemplate-install gd_videoplayer

build/linux_example_build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
projectpath=example\addons\videoplayer\lib\Linux-AMD64
3+
./linux_build_post.bat
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
releasepath=example\addons\videoplayer\lib\Linux-AMD64
3+
./linux_build_dependencise.bat

build/linux_pull_submodule.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
cd ..
3+
git clone -b 4.1 https://github.com/godotengine/godot-cpp.git
4+
cd src
5+
curl --output ffmpeg.zip -L -O https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip
6+
tar -xf ffmpeg.zip
7+
rename ffmpeg-master-latest-win64-gpl-shared ffmpeg
8+
rm ./ffmpeg.zip

build/msys_install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
pacman -Ss
3+
pacman -y -S mingw-w64-x86_64-cmake git

build/windows_codegen.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
@echo off
22
cd ..
3+
cd src
4+
echo Windows>platform.txt
5+
cd ..
36
cmake -B GDExtensionTemplate-build -G"Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=GDExtensionTemplate-install gd_videoplayer
47
pause

example/Script/DemoMediaPlayer.gd

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var aspect: float
2727
var rootInterface:Control
2828
var phase = 0.0
2929

30+
var current_size: Vector2i = Vector2i(1, 1)
3031

3132
func _ready():
3233
if(geo != null):
@@ -38,24 +39,34 @@ func _ready():
3839
if (play_on_start):
3940
player.load_path(uri);
4041
player.play();
41-
player.audio_init();
42+
43+
func _process(delta):
44+
_update_size();
45+
46+
func _update_size():
47+
aspect = float(current_size.x) / float(current_size.y);
48+
var root_size = rootInterface.get_rect().size
49+
var root_aspect = root_size.x / root_size.y
50+
if current_size == Vector2i(1, 1):
51+
texture_rect.size = Vector2(root_size.x, root_size.y)
52+
texture_rect.position = Vector2(0,0)
53+
return
54+
if root_aspect > aspect:
55+
# Fit height
56+
texture_rect.size = Vector2(root_size.y * aspect, root_size.y)
57+
texture_rect.position = Vector2((root_size.x - (root_size.y * aspect)) / 2.0, 0.0)
58+
else:
59+
# Fit width
60+
texture_rect.size = Vector2(root_size.x, root_size.x / aspect)
61+
texture_rect.position = Vector2(0.0, (root_size.y - (root_size.x / aspect)) / 2.0)
4262

4363
func texture_update(tex:ImageTexture, size:Vector2i):
44-
aspect = float(size.x) / float(size.y);
64+
current_size = size;
4565
if (mat != null):
4666
mat.set_deferred("shader_parameter/tex", tex);
4767
if (texture_rect != null):
4868
texture_rect.set_deferred("texture", tex);
49-
var root_size = rootInterface.get_rect().size
50-
var root_aspect = root_size.x / root_size.y
51-
if root_aspect > aspect:
52-
# Fit height
53-
texture_rect.size = Vector2(root_size.y * aspect, root_size.y)
54-
texture_rect.position = Vector2((root_size.x - (root_size.y * aspect)) / 2.0, 0.0)
55-
else:
56-
# Fit width
57-
texture_rect.size = Vector2(root_size.x, root_size.x / aspect)
58-
texture_rect.position = Vector2(0.0, (root_size.y - (root_size.x / aspect)) / 2.0)
69+
5970

6071
func audio_update(data:PackedFloat32Array, size:int, channel:int):
6172
pass
@@ -83,7 +94,6 @@ func load_trigger(p:String):
8394
print("Loading: ", p)
8495
player.load_path(p);
8596
player.play();
86-
player.audio_init();
8797

8898
func async_load_finish(result):
8999
print("Loading result: ", result)

0 commit comments

Comments
 (0)