Skip to content

Commit

Permalink
Travis ci (#8)
Browse files Browse the repository at this point in the history
* TravisCI : try to download FMOD legally with travis build

* TravisCI : add language in travis.yml

* TravisCI: try to construct libs folder

* TravisCI: try to setup godot-cpp binding repo

* TravisCI: try to build bindings and fmod-gdnative

* TravisCI : add clang path option to tell scons where clang is when needed

* CrossPlatformBuild: Added target release option in SConstruct

* TravisCI : Add osx build

* TravisCI : add windows target to cd
  • Loading branch information
piiertho authored Apr 28, 2019
1 parent 68a51b8 commit 7e3b524
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

bin/
*.os
*.o

# Clion specific

Expand Down
55 changes: 55 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
language: cpp
os:
- linux
- osx
- windows
python:
- "2.7"
env:
global:
- LINUX_BINDINGS_ARGS="use_llvm=yes platform=linux generate_bindings=yes bits=64 target=release clang-path=/usr/local/clang-5.0.0/bin/"
- LINUX_DRIVER_ARGS="p=linux use_llvm=yes target=release clang-path=/usr/local/clang-5.0.0/bin/"
- OSX_BINDINGS_ARGS="platform=osx generate_bindings=yes bits=64 target=release"
- OSX_DRIVER_ARGS="p=osx target=release"
- WIN_BINDINGS_ARGS="platform=windows generate_bindings=yes bits=64 target=release"
- WIN_DRIVER_ARGS="p=windows target=release"
addons:
homebrew:
packages:
- jq
- scons
update: true
compiler:
- clang
before_install:
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then wget -O Python27.zip http://prdownloads.sourceforge.net/scons/scons-local-3.0.5.zip && mv Python27.zip C:/Python27.zip && 7z x C:/Python27.zip -oC:/ && export PATH="/c/Python27:/c/Python27/Scripts:$PATH"; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then wget -O scons.zip http://prdownloads.sourceforge.net/scons/scons-local-3.0.5.zip && mv scons.zip C:/scons.zip && 7z x C:/scons.zip -oC:/scons; fi
- cd ..
- mkdir libs && cd libs
- mkdir fmod && cd fmod
- wget https://gist.githubusercontent.com/piiertho/cfa1d9820f149b612dd60ec642ccb137/raw/157dc6233c77e18963a0a5e2d849926fa531216a/getFmodAPI.sh
- chmod +x getFmodAPI.sh
- ./getFmodAPI.sh $FMODUSER $FMODPASS $TRAVIS_OS_NAME
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xvf fmodstudioapi11012linux.tar.gz; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then hdiutil attach fmodstudioapi11012osx.dmg; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then 7z x fmodstudioapi11012win-installer.exe; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv fmodstudioapi11012linux/api linux; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp -r "/Volumes/FMOD Programmers API Mac/FMOD Programmers API/api" osx; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then mv api/ windows && mv windows/lowlevel/lib/fmod_vc.lib windows/lowlevel/lib/fmod.lib && mv windows/lowlevel/lib/fmod64_vc.lib windows/lowlevel/lib/fmod64.lib && mv windows/studio/lib/fmodstudio_vc.lib windows/studio/lib/fmodstudio.lib && mv windows/studio/lib/fmodstudio64_vc.lib windows/studio/lib/fmodstudio64.lib; fi
- cd ../../
- git clone --recursive https://github.com/utopia-rise/godot-cpp godot-cpp
- cd godot-cpp
- git checkout 3.1-utopia
install: if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then scons $LINUX_BINDINGS_ARGS && cd ../fmod-gdnative; elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then scons $OSX_BINDINGS_ARGS && cd ../fmod-gdnative; elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then C:/scons/scons.bat $WIN_BINDINGS_ARGS && cd ../fmod-gdnative; fi
script: if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then scons $LINUX_DRIVER_ARGS; elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then scons $OSX_DRIVER_ARGS; elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then C:/scons/scons.bat $WIN_DRIVER_ARGS; fi
deploy:
provider: releases
api_key:
secure: $TRAVIS_TOKEN
file:
- "bin/libGodotFmod.linux.so"
- "bin/libGodotFmod.osx.dylib"
- "bin/libGodotFmod.windows.dll"
skip_cleanup: true
on:
tags: true
44 changes: 33 additions & 11 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ dynamic = ARGUMENTS.get("dynamic", "yes")
ndk_path = ARGUMENTS.get("ndk-path", "/Users/piertho/Library/android-sdks/ndk-bundle/")
ndk_toolchain = ARGUMENTS.get("ndk-toolchain", "/tmp/android-21-toolchain/")

# This makes sure to keep the session environment variables on windows,
clang_path = ARGUMENTS.get("clang-path", "")

if target != "debug":
target = "release"
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
env = Environment()
if platform == "windows":
Expand All @@ -34,18 +38,21 @@ elif platform == "android":
env["STRIP"] = ndk_toolchain + "/bin/arm-linux-androideabi-strip"

if ARGUMENTS.get("use_llvm", "no") == "yes" and platform != "ios" and platform != "android":
env["CXX"] = "clang++"
env["CXX"] = "%sclang++" % clang_path

# put stuff that is the same for all first, saves duplication
cpp_bindings_libname = 'libgodot-cpp.%s.64.a' % platform
cpp_bindings_libname = 'libgodot-cpp.%s' % platform
cpp_bindings_libname += '.%s.64' % target
if platform == "osx":
cpp_bindings_libname = 'libgodot-cpp.osx.64.a'
cpp_bindings_libname += '.a'
env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-arch', 'x86_64'])
env.Append(LINKFLAGS = ['-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup'])
elif platform == "ios":
cpp_bindings_libname += '.a'
env.Append(CCFLAGS = ['-g','-O3', '-std=c++11', '-arch', 'arm64', '-arch', 'armv7', '-arch', 'armv7s', '-isysroot', '%s/iPhoneOS.platform/Developer/SDKs/iPhoneOS%s.sdk' % (IOS_PLATFORM_SDK, SDK_VERSION) , '-miphoneos-version-min=%s' % SDK_MIN_VERSION])
env.Append(LINKFLAGS = ['-arch', 'arm64', '-arch', 'armv7', '-arch', 'armv7s', '-isysroot', '%s/iPhoneOS.platform/Developer/SDKs/iPhoneOS%s.sdk' % (IOS_PLATFORM_SDK, SDK_VERSION) , '-miphoneos-version-min=%s' % SDK_MIN_VERSION])
elif platform == "android":
cpp_bindings_libname += '.a'
env.Append(CCFLAGS = ['-fPIE', '-fPIC', '-mfpu=neon', '-march=armv7-a'])
env.Append(LDFLAGS = ['-pie', '-Wl'])
elif platform == "linux":
Expand All @@ -59,7 +66,7 @@ elif platform == "windows":
else:
env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '/MD'])
env.Append(LINKFLAGS = ['/WX'])
cpp_bindings_libname = 'godot_cpp_bindings'
cpp_bindings_libname += '.lib'

def add_sources(sources, directory):
if os.path.isdir(directory):
Expand All @@ -69,16 +76,30 @@ def add_sources(sources, directory):
else:
sources.append(directory)

lfix = ""
if target == "debug":
lfix = "L"
if platform == "osx":
libfmod = 'libfmod%s.dylib' % lfix
libfmodstudio = 'libfmodstudio%s.dylib' % lfix
env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + 'include/', godot_bindings_path + 'include/core/',
godot_bindings_path + 'include/gen/', '../libs/fmod/osx/lowlevel/inc/', '../libs/fmod/osx/studio/inc/'])
env.Append(LIBS=[cpp_bindings_libname, 'libfmod.dylib', 'libfmodstudio.dylib'])
env.Append(LIBS=[cpp_bindings_libname, libfmod, libfmodstudio])
env.Append(LIBPATH=[ godot_bindings_path + 'bin/', '../libs/fmod/osx/lowlevel/lib/', '../libs/fmod/osx/studio/lib/' ])
else:
elif platform == "linux":
libfmod = 'libfmod%s.so'% lfix
libfmodstudio = 'libfmodstudio%s.so'% lfix
env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + 'include/', godot_bindings_path + 'include/core/',
godot_bindings_path + 'include/gen/', '../libs/fmod/linux/lowlevel/inc/', '../libs/fmod/linux/studio/inc/'])
env.Append(LIBS=[cpp_bindings_libname, 'libfmod.so', 'libfmodstudio.so'])
env.Append(LIBS=[cpp_bindings_libname, libfmod, libfmodstudio])
env.Append(LIBPATH=[ godot_bindings_path + 'bin/', '../libs/fmod/linux/lowlevel/lib/x86_64', '../libs/fmod/linux/studio/lib/x86_64' ])
elif platform == "windows":
libfmod = 'fmod%s64'% lfix
libfmodstudio = 'fmodstudio%s64'% lfix
env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + 'include/', godot_bindings_path + 'include/core/',
godot_bindings_path + 'include/gen/', '../libs/fmod/windows/lowlevel/inc/', '../libs/fmod/windows/studio/inc/'])
env.Append(LIBS=[cpp_bindings_libname, libfmod, libfmodstudio])
env.Append(LIBPATH=[ godot_bindings_path + 'bin/', '../libs/fmod/windows/lowlevel/lib/', '../libs/fmod/windows/studio/lib/' ])

sources = []
add_sources(sources, "./")
Expand All @@ -90,14 +111,15 @@ def change_id(self, arg, env):
if dynamic == "yes":
if platform == "osx":
library = env.SharedLibrary(target='bin/libGodotFmod.%s.dylib' % platform, source=sources)
change_id_action = Action('', change_id)
AddPostAction(library, change_id_action)
elif platform == "android" or platform == "linux":
library = env.SharedLibrary(target='bin/libGodotFmod.%s.so' % platform, source=sources)
elif platform == "windows":
library = env.SharedLibrary(target='bin/libGodotFmod.%s.dll' % platform, source=sources)
else:
library = env.StaticLibrary(target="bin/libGodotFmod.%s.a" % platform, source=sources)

# can't figure it out what type of parameter should be at 1st one
# send in '' and it works
if dynamic == "yes":
change_id_action = Action('', change_id)
AddPostAction(library, change_id_action)
Default(library)

0 comments on commit 7e3b524

Please sign in to comment.