diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000..4088ca6f --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,77 @@ +image: Visual Studio 2015 +build: off + +before_build: + - git submodule update --init --recursive --depth 1 + - git clone https://github.com/FWGS/hlsdk-portable --depth 1 + - git clone https://github.com/FWGS/xash3d-android-project -b android-legacy --depth 1 + # setup NDK + - curl -fsS -o android-ndk-r10e-windows-x86_64.zip https://dl.google.com/android/repository/android-ndk-r10e-windows-x86_64.zip + - 7z x android-ndk-r10e-windows-x86_64.zip + # setup SDK + - mkdir android-sdk + - cd android-sdk + - mkdir build-tools + - cd build-tools + # build tools 19 seems to have good compatibility + - curl -fsS -o android-4.4.2.zip https://dl-ssl.google.com/android/repository/build-tools_r19.1-windows.zip + - 7z x android-4.4.2.zip + - move android-4.4.2 19 + - del android-4.4.2.zip + # sdk dx.bat seems to be broken java detection on appveyor, but java is in PATH already + # and i do not know how to escape "$*" in yaml+cmd, so use python + - python -c print('java\x20-jar\x20\x25APPVEYOR_BUILD_FOLDER\x25\\android-sdk\\build-tools\\19\\lib\\dx.jar\x20\x25\x2a') > 19\dx.bat + - type 19\dx.bat + - cd .. + - mkdir platforms + - cd platforms + # platform 29 should be enough for now + - curl -fsS -o android-10.zip https://dl-ssl.google.com/android/repository/platform-29_r05.zip + - 7z x android-10.zip + - move android-10 android-29 + - del android-10.zip + - cd .. + # very many random build tools versions missing apksinger, maybe package it somewhere? + - curl -fsS -o apksigner.jar https://devel.data-in-motion.biz/repository/android/build-tools/27.0.1/apksigner.jar + - cd .. + # xz-utils only need for minidbg + - mkdir xz-utils + - cd xz-utils + - curl -fsS -o xz-5.2.3-windows.zip https://tukaani.org/xz/xz-5.2.3-windows.zip + - 7z x xz-5.2.3-windows.zip + - del xz-5.2.3-windows.zip + - cd .. + # what the hell with zip? + - curl -fsS -o zip300xn-x64_1.zip ftp://ftp.info-zip.org/pub/infozip/win32/zip300xn-x64.zip + - 7z x zip300xn-x64_1.zip zip300xn-x64.zip + - del zip300xn-x64_1.zip + - 7z x zip300xn-x64.zip zip.exe + - del zip300xn-x64.zip + +build_script: + - set ANDROID_NDK_HOME=%APPVEYOR_BUILD_FOLDER%/android-ndk-r10e + - set ANDROID_SDK_HOME=%APPVEYOR_BUILD_FOLDER%/android-sdk + # appveyor seems to have 32-bit python, so autodetection fails + - set HOST_TOOLCHAIN=windows-x86_64 + # check that our dx script works and java do not need to be detected separately + - set APKSIGNER=%APPVEYOR_BUILD_FOLDER%/apksigner.jar + - set XZ=%APPVEYOR_BUILD_FOLDER%/xz-utils/bin_x86-64/xz.exe + - android-sdk\build-tools\19\dx.bat --version + - python waf configure --enable-android-legacy --android aarch64,4.9,21 --disable-werror --extra-projects hlsdk-portable,xash3d-android-project ZIP=%APPVEYOR_BUILD_FOLDER%/zip.exe -T debug + - python waf -v + +on_failure: + - appveyor PushArtifact build/config.log + - 7z a c4che.7z build\c4che + - appveyor PushArtifact c4che.7z + - appveyor PushArtifact build/compile_commands.json + - appveyor PushArtifact build/xash3d-android-project/android/xashdroid.unaligned.noclasses.nojni.apk + - appveyor PushArtifact build/xash3d-android-project/android/xashdroid.unaligned.noclasses.apk + - appveyor PushArtifact build/xash3d-android-project/android/xashdroid.unaligned.apk + - appveyor PushArtifact build/xash3d-android-project/android/xashdroid.apk + + +artifacts: + - path: build\xash3d-android-project\android\xashdroid-signed.apk + name: xashdroid-legacy-aarch64-debug.apk + - path: build/compile_commands.json \ No newline at end of file diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py index 37905afc..86508a3f 100644 --- a/scripts/waifulib/xcompile.py +++ b/scripts/waifulib/xcompile.py @@ -34,6 +34,12 @@ NSWITCH_ENVVARS = ['DEVKITPRO'] PSVITA_ENVVARS = ['VITASDK'] +def host_exe_suffix(): + if sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): + return '.exe' + return '' + + # This class does support ONLY r10e and r19c/r20 NDK class Android: ctx = None # waf context @@ -209,25 +215,25 @@ class Android: def cc(self): if self.is_host(): - s = 'clang' + s = 'clang' + host_exe_suffix() environ = getattr(self.ctx, 'environ', os.environ) if 'CC' in environ: s = environ['CC'] return '%s --target=%s' % (s, self.ndk_triplet()) #%s%d' % (s, self.ndk_triplet(), self.api) - return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc') + return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc' + host_exe_suffix()) def cxx(self): if self.is_host(): - s = 'clang++' + s = 'clang++' + host_exe_suffix() environ = getattr(self.ctx, 'environ', os.environ) if 'CXX' in environ: s = environ['CXX'] return '%s --target=%s' % (s, self.ndk_triplet()) #%s%d' % (s, self.ndk_triplet(), self.api) - return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++') + return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++' + host_exe_suffix()) def strip(self): if self.is_host() and not self.ndk_binutils: @@ -235,11 +241,11 @@ class Android: if 'STRIP' in environ: return environ['STRIP'] - return 'llvm-strip' + return 'llvm-strip' + host_exe_suffix() if self.ndk_rev >= 23: - return os.path.join(self.gen_binutils_path(), 'llvm-strip') - return os.path.join(self.gen_binutils_path(), 'strip') + return os.path.join(self.gen_binutils_path(), 'llvm-strip' + host_exe_suffix()) + return os.path.join(self.gen_binutils_path(), 'strip' + host_exe_suffix()) def objcopy(self): if self.is_host() and not self.ndk_binutils: @@ -247,11 +253,23 @@ class Android: if 'OBJCOPY' in environ: return environ['OBJCOPY'] - return 'llvm-objcopy' + return 'llvm-objcopy' + host_exe_suffix() if self.ndk_rev >= 23: - return os.path.join(self.gen_binutils_path(), 'llvm-objcopy') - return os.path.join(self.gen_binutils_path(), 'objcopy') + return os.path.join(self.gen_binutils_path(), 'llvm-objcopy' + host_exe_suffix()) + return os.path.join(self.gen_binutils_path(), 'objcopy' + host_exe_suffix()) + + def ar(self): + if self.is_host() and not self.ndk_binutils: + environ = getattr(self.ctx, 'environ', os.environ) + + if 'AR' in environ: + return environ['AR'] + return 'llvm-ar' + host_exe_suffix() + + if self.ndk_rev >= 23: + return os.path.join(self.gen_binutils_path(), 'llvm-ar' + host_exe_suffix()) + return os.path.join(self.gen_binutils_path(), 'ar' + host_exe_suffix()) def system_stl(self): # TODO: proper STL support @@ -563,10 +581,13 @@ def configure(conf): conf.environ['CXX'] = android.cxx() conf.environ['STRIP'] = android.strip() conf.environ['OBJCOPY'] = android.objcopy() + conf.environ['AR'] = android.ar() conf.env.CFLAGS += android.cflags() conf.env.CXXFLAGS += android.cflags(True) conf.env.LINKFLAGS += android.linkflags() conf.env.LDFLAGS += android.ldflags() + conf.options.check_cxx_compiler = conf.options.check_cxx_compiler or 'g++,clang++' + conf.options.check_c_compiler = conf.options.check_c_compiler or 'gcc,clang' conf.env.HAVE_M = True if android.is_hardfp(): diff --git a/wscript b/wscript index 5d5c4882..36776a0e 100644 --- a/wscript +++ b/wscript @@ -116,7 +116,7 @@ def process_extra_projects_conf(ctx): ctx.env.EXTRA_PROJECTS = projs for proj in projs.split(','): - tools_orig = ctx.tools.copy() + tools_orig = ctx.tools[:] ctx.add_subproject(proj) waifulib_path = os.path.join(proj, 'scripts', 'waifulib') if os.path.isdir(waifulib_path):