Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ueshita committed Sep 1, 2024
1 parent 6fb1fb1 commit f74df8d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 20 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,24 @@ jobs:
name: bin_windows
path: ./Dev/Godot/addons/effekseer/bin

windows-debug:
name: Build for Windows (Debug)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Update Submodules
run: git submodule update --init
- name: Build binaries
run: |
python -m pip install scons
python Dev/Cpp/build.py platform=windows debug=yes
shell: cmd
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: bin_windows_debug
path: ./Dev/Godot/addons/effekseer/bin

web:
name: Build for Web
runs-on: ubuntu-latest
Expand Down
54 changes: 34 additions & 20 deletions Dev/Cpp/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,55 +16,69 @@ def replace_word(file_name, target_str, replace_str):
with open(file_name, "w") as file:
file.write(text)

def import_generate_bindings():
def import_generate_bindings(arch: str):
bits = "32" if "32" in arch else "64"
binding_generator = __import__("godot-cpp.binding_generator").binding_generator
cwd = os.getcwd()
os.chdir(os.path.join(os.path.dirname(script_path), "godot-cpp"))
binding_generator.generate_bindings("gdextension/extension_api.json", False)
binding_generator.generate_bindings("gdextension/extension_api.json", False, bits=bits)
os.chdir(cwd)

import_generate_bindings()

os.chdir(os.path.dirname(script_path))

is_debug = False
options = []

if "debug=yes" in sys.argv:
options.append("target=template_debug")
options.append("dev_build=yes")
is_debug = True

if "platform=windows" in sys.argv:
os.makedirs("../Godot/addons/effekseer/bin/windows", exist_ok = True)

subprocess.run("scons platform=windows arch=x86_32 target=template_release", shell = True, check=True)
subprocess.run("scons platform=windows arch=x86_64 target=template_release", shell = True, check=True)
for arch in ["x86_32", "x86_64"]:
import_generate_bindings(arch)
subprocess.run(["scons", "platform=windows", f"arch={arch}"] + options, check=True)

if is_debug:
shutil.copy2("bin/windows/libeffekseer.x86_32.pdb", "../Godot/addons/effekseer/bin/windows/libeffekseer.x86_32.pdb")
shutil.copy2("bin/windows/libeffekseer.x86_64.pdb", "../Godot/addons/effekseer/bin/windows/libeffekseer.x86_64.pdb")

elif "platform=macos" in sys.argv:
os.makedirs("../Godot/addons/effekseer/bin/macos", exist_ok = True)

subprocess.run("scons platform=macos arch=x86_64 target=template_release", shell = True, check=True)

subprocess.run("lipo -create ../Godot/addons/effekseer/bin/macos/libeffekseer.x86_64.dylib -output ../Godot/addons/effekseer/bin/macos/libeffekseer.dylib", shell = True, check=True)
os.remove("../Godot/addons/effekseer/bin/macos/libeffekseer.x86_64.dylib")
import_generate_bindings("64")
subprocess.run(["scons", "platform=macos", "arch=universal"] + options, check=True)

os.rename("../Godot/addons/effekseer/bin/macos/libeffekseer.universal.dylib", "../Godot/addons/effekseer/bin/macos/libeffekseer.dylib")

elif "platform=android" in sys.argv:
os.makedirs("../Godot/addons/effekseer/bin/android", exist_ok = True)

subprocess.run("scons platform=android arch=arm32 target=template_release", shell = True, check=True)
subprocess.run("scons platform=android arch=arm64 target=template_release", shell = True, check=True)
subprocess.run("scons platform=android arch=x86_32 target=template_release", shell = True, check=True)
subprocess.run("scons platform=android arch=x86_64 target=template_release", shell = True, check=True)
for arch in ["arm32", "arm64", "x86_32", "x86_64"]:
import_generate_bindings(arch)
subprocess.run(["scons", "platform=android", f"arch={arch}", "use_static_cpp=yes"] + options, check=True)

elif "platform=ios" in sys.argv:
os.makedirs("../Godot/addons/effekseer/bin/ios", exist_ok = True)

subprocess.run("scons platform=ios arch=arm64 target=template_release", shell = True, check=True)
import_generate_bindings("arm64")
subprocess.run(["scons", "platform=ios", "arch=arm64"] + options, check=True)

subprocess.run("lipo -create ../Godot/addons/effekseer/bin/ios/libeffekseer.arm64.dylib -output ../Godot/addons/effekseer/bin/ios/libeffekseer.dylib", shell = True, check=True)
os.remove("../Godot/addons/effekseer/bin/ios/libeffekseer.arm64.dylib")
os.rename("../Godot/addons/effekseer/bin/ios/libeffekseer.arm64.dylib", "../Godot/addons/effekseer/bin/ios/libeffekseer.dylib")

elif "platform=linux" in sys.argv:
os.makedirs("../Godot/addons/effekseer/bin/linux", exist_ok = True)

subprocess.run("scons platform=linux arch=x86_32 target=template_release", shell = True, check=True)
subprocess.run("scons platform=linux arch=x86_64 target=template_release", shell = True, check=True)
for arch in ["x86_32", "x86_64"]:
import_generate_bindings(arch)
subprocess.run(["scons", "platform=linux", f"arch={arch}"] + options, check=True)

elif "platform=web" in sys.argv:
os.makedirs("../Godot/addons/effekseer/bin/web", exist_ok = True)

subprocess.run("scons platform=web arch=wasm32 target=template_release", shell = True, check=True)
import_generate_bindings("wasm32")
subprocess.run(["scons", "platform=web", "arch=wasm32"] + options, check=True)

os.rename("../Godot/addons/effekseer/bin/web/libeffekseer.wasm32.wasm", "../Godot/addons/effekseer/bin/web/libeffekseer.wasm")

0 comments on commit f74df8d

Please sign in to comment.