Skip to content

Commit

Permalink
Various refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Aug 9, 2024
1 parent 1fd003e commit 2248b21
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 245 deletions.
157 changes: 35 additions & 122 deletions .github/workflows/gdext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ env:
vcpkg_tag: 1de2026f28ead93ff1773e6e680387643e914ea1 # 2024.07.12

jobs:
# TODO: refactor to matrix
windows:
name: 🪟Windows
runs-on: windows-latest
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
include:
- os: ubuntu-latest
name: 🐧Linux
- os: macos-14
name: 🍎macOS
- os: windows-latest
name: 🪟Windows

name: ${{ matrix.name }} Build
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
Expand All @@ -26,17 +37,31 @@ jobs:
python-version: 3.12

- name: Install tools
shell: bash
run: |
python -m pip install "scons<4.8"
scons --version
pip install ply
- name: Linux tools
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt install clang-format
- name: macOS tools
if: runner.os == 'macOS'
shell: bash
run: |
brew install clang-format ninja
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{ env.vcpkg_tag }}

- shell: bash
- name: Make cache key
shell: bash
run: |
echo "cache_key=godot-cpp-$(git -C gdext/godot-cpp rev-parse --short HEAD)-${{ runner.os }}-$ImageVersion" >> $GITHUB_ENV
Expand All @@ -49,7 +74,7 @@ jobs:
key: ${{ env.cache_key }}

- name: Build
if: github.ref_type != 'tag'
if: github.ref_type != 'tag' || runner.os != 'Windows'
run: |
cd gdext
scons godot-cpp
Expand All @@ -58,7 +83,7 @@ jobs:
scons target=template_release
- name: Build (with debug symbols)
if: github.ref_type == 'tag'
if: github.ref_type == 'tag' && runner.os == 'Windows'
run: |
cd gdext
scons debug_symbols=yes godot-cpp
Expand All @@ -69,125 +94,13 @@ jobs:
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: gdext-windows
path: addons/imgui-godot/bin

linux:
name: 🐧Linux
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Setup Python 3.x
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install tools
run: |
python -m pip install "scons<4.8"
scons --version
pip install ply
sudo apt install clang-format
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{ env.vcpkg_tag }}

- shell: bash
run: |
echo "cache_key=godot-cpp-$(git -C gdext/godot-cpp rev-parse --short HEAD)-${{ runner.os }}-$ImageVersion" >> $GITHUB_ENV
- uses: actions/cache@v4
id: cache-godot-cpp
with:
path: |
gdext/scons_cache
key: ${{ env.cache_key }}

- name: Build debug
run: |
cd gdext
scons godot-cpp
scons
- name: Build release
run: |
cd gdext
scons target=template_release godot-cpp
scons target=template_release
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: gdext-linux
path: addons/imgui-godot/bin

macos:
name: 🍎macOS
runs-on: macos-14

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Setup Python 3.x
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install tools
run: |
python -m pip install "scons<4.8"
scons --version
pip install ply
brew install clang-format ninja
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{ env.vcpkg_tag }}

- shell: bash
run: |
echo "cache_key=godot-cpp-$(git -C gdext/godot-cpp rev-parse --short HEAD)-${{ runner.os }}-$ImageVersion" >> $GITHUB_ENV
- uses: actions/cache@v4
id: cache-godot-cpp
with:
path: |
gdext/scons_cache
key: ${{ env.cache_key }}

- name: Build debug
run: |
export PATH="$(brew --prefix llvm@15)/bin:$PATH"
cd gdext
scons godot-cpp
scons
- name: Build release
run: |
export PATH="$(brew --prefix llvm@15)/bin:$PATH"
cd gdext
scons target=template_release godot-cpp
scons target=template_release
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: gdext-macos
name: gdext-${{ runner.os }}
path: addons/imgui-godot/bin

package:
name: 📦Package
runs-on: ubuntu-latest
needs: [windows, linux, macos]
needs: [build]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -267,7 +180,7 @@ jobs:
package_cs:
name: 📦Package (C# only)
runs-on: ubuntu-latest
needs: [windows, linux, macos]
needs: [build]

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions doc/test/gdscript/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ func _ready() -> void:
assert_equal(ImGuiGD.Scale, 2)
assert_equal(ImGui.GetFontSize(), 26)

# StringName conversion
assert_equal(ImGui.GetID("test_id"), 2044763162)

# rescale
call_deferred("change_scale")

Expand Down
5 changes: 5 additions & 0 deletions gdext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ target_compile_definitions(imgui-godot-native PUBLIC
IMGUI_ENABLE_FREETYPE
# IMGUI_ENABLE_FREETYPE_LUNASVG
IGN_EXPORT
# REAL_T_IS_DOUBLE
)

# target_compile_definitions(godot-cpp PUBLIC
# REAL_T_IS_DOUBLE
# )

if (MSVC)
target_compile_options(godot-cpp PRIVATE "/MP")
target_compile_options(imgui-godot-native PRIVATE "/MP")
Expand Down
2 changes: 1 addition & 1 deletion gdext/include/imgui-godot.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ inline void ResetFonts()
detail::ImGuiGD->call(sn);
}

inline void SetJoyAxisDeadZone(float deadZone)
inline void SetJoyAxisDeadZone(real_t deadZone)
{
ERR_FAIL_COND(!detail::GET_IMGUIGD());
static const StringName sn("JoyAxisDeadZone");
Expand Down
Loading

0 comments on commit 2248b21

Please sign in to comment.