diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9ed88eb4b..20285f92fd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,6 +92,89 @@ jobs: lime create SimpleAudio -verbose -nocolor lime build SimpleAudio linux -release -verbose -nocolor + linuxarm64: + runs-on: ubuntu-20.04 + steps: + + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libdrm-dev libegl1-mesa-dev libgles2-mesa-dev libasound2-dev libx11-dev libxext-dev libxi-dev libxrandr-dev libxinerama-dev libpulse-dev libmbedtls-dev libpng-dev libturbojpeg-dev libuv1-dev libvorbis-dev + wget -q http://mirrors.ocf.berkeley.edu/ubuntu-ports/pool/main/libd/libdrm/libdrm2_2.4.101-2_arm64.deb + sudo dpkg-deb -x libdrm2_2.4.101-2_arm64.deb / + wget -q http://mirrors.ocf.berkeley.edu/ubuntu-ports/pool/main/libd/libdrm/libdrm-dev_2.4.101-2_arm64.deb + sudo dpkg-deb -x libdrm-dev_2.4.101-2_arm64.deb / + wget -q http://mirrors.ocf.berkeley.edu/ubuntu-ports/pool/main/libg/libglvnd/libegl1_1.3.1-1_arm64.deb + sudo dpkg-deb -x libegl1_1.3.1-1_arm64.deb / + wget -q http://mirrors.ocf.berkeley.edu/ubuntu-ports/pool/main/libg/libglvnd/libegl-dev_1.3.1-1_arm64.deb + sudo dpkg-deb -x libegl-dev_1.3.1-1_arm64.deb / + wget -q http://mirrors.ocf.berkeley.edu/ubuntu-ports/pool/main/libg/libglvnd/libgles2_1.3.1-1_arm64.deb + sudo dpkg-deb -x libgles2_1.3.1-1_arm64.deb / + wget -q http://mirrors.ocf.berkeley.edu/ubuntu-ports/pool/main/libg/libglvnd/libgles-dev_1.3.1-1_arm64.deb + sudo dpkg-deb -x libgles-dev_1.3.1-1_arm64.deb / + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + # TODO: change this to release version when hxcpp releases the patch + haxelib git hxcpp https://github.com/mcagabe19/hxcpp 47526979c193c6659d053018fb178366b6ff6f72 --quiet + haxelib install format --quiet + haxelib install hxp --quiet + + - name: Enable HXCPP compile cache + run: | + echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV + + - name: Rebuild Lime tools + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime rebuild tools -nocolor -verbose -nocffi + haxelib run lime setup -alias -y -nocffi + lime rebuild hxcpp -nocolor -verbose -nocffi + + - name: Rebuild Lime (Linux) + run: | + lime rebuild linux -64 -release -nocolor -verbose -nocffi + CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ HXCPP_STRIP=aarch64-linux-gnu-strip lime rebuild linux -arm64 -release -nocolor -verbose -nocffi -D HXCPP_ARM64 + + - uses: actions/upload-artifact@v3 + with: + name: LinuxArm64-NDLL + path: | + ndll/LinuxArm64/ + !**/.gitignore + if-no-files-found: error + + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld linux -arm64 -release -verbose -nocolor -D HXCPP_ARM64 + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage linux -arm64 -release -verbose -nocolor -D HXCPP_ARM64 + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio linux -arm64 -release -verbose -nocolor -D HXCPP_ARM64 + macos: runs-on: macos-12 steps: @@ -196,6 +279,10 @@ jobs: with: haxe-version: ${{ env.HAXE_VERSION }} + - uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: amd64_arm64 + - name: Set HAXEPATH run: | echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV @@ -221,6 +308,7 @@ jobs: run: | lime rebuild windows -32 -release -nocolor -verbose -nocffi lime rebuild windows -64 -release -nocolor -verbose -nocffi + lime rebuild windows -arm64 -release -nocolor -verbose -nocffi -D HXCPP_ARM64 lime rebuild hl -clean -release -nocolor -verbose -nocffi - uses: actions/upload-artifact@v4 @@ -416,7 +504,7 @@ jobs: lime build SimpleAudio ios -release -nosign -verbose -nocolor -eval package-haxelib: - needs: [linux, macos, windows, android, ios] + needs: [linux, linuxarm64, macos, windows, android, ios] runs-on: ubuntu-20.04 steps: @@ -864,7 +952,7 @@ jobs: notify: runs-on: ubuntu-20.04 - needs: [package-haxelib, docs, android, flash-samples, air-samples, hashlink-samples, html5-samples, ios, linux, macos, neko-samples, windows] + needs: [package-haxelib, docs, android, flash-samples, air-samples, hashlink-samples, html5-samples, ios, linux, linuxarm64, macos, neko-samples, windows] if: ${{ github.repository == 'openfl/lime' && github.event_name != 'pull_request' }} steps: - name: Notify Discord diff --git a/ndll/Mac/.gitignore b/ndll/LinuxArm64/.gitignore similarity index 100% rename from ndll/Mac/.gitignore rename to ndll/LinuxArm64/.gitignore diff --git a/ndll/WindowsArm64/.gitignore b/ndll/WindowsArm64/.gitignore new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/ndll/WindowsArm64/.gitignore @@ -0,0 +1 @@ + diff --git a/project/Build.xml b/project/Build.xml index 4f82125bab..9cf74e01a3 100755 --- a/project/Build.xml +++ b/project/Build.xml @@ -233,7 +233,7 @@ -
+
@@ -500,14 +500,12 @@
-
- +
-
diff --git a/project/lib/custom/openal/include/config-linux-arm.h b/project/lib/custom/openal/include/config-linux-arm.h new file mode 100644 index 0000000000..6a7664d67b --- /dev/null +++ b/project/lib/custom/openal/include/config-linux-arm.h @@ -0,0 +1,147 @@ +/* API declaration export attribute */ +#define AL_API __attribute__((visibility("protected"))) +#define ALC_API __attribute__((visibility("protected"))) + +/* Define any available alignment declaration */ +#define ALIGN(x) __attribute__((aligned(x))) + +/* Define a restrict macro for non-aliased pointers */ +#define RESTRICT __restrict + +/* Define if HRTF data is embedded in the library */ +#define ALSOFT_EMBED_HRTF_DATA + +/* Define if we have the posix_memalign function */ +#define HAVE_POSIX_MEMALIGN + +/* Define if we have the _aligned_malloc function */ +/* #undef HAVE__ALIGNED_MALLOC */ + +/* Define if we have the proc_pidpath function */ +/* #undef HAVE_PROC_PIDPATH */ + +/* Define if we have the getopt function */ +/* #undef HAVE_GETOPT */ + +/* Define if we have SSE CPU extensions */ +/* #ifndef RASPBERRYPI +#define HAVE_SSE +#define HAVE_SSE2 +#define HAVE_SSE3 +#undef HAVE_SSE4_1 +#endif */ + +/* Define if we have ARM Neon CPU extensions */ +#define HAVE_NEON + +/* Define if we have the ALSA backend */ +#define HAVE_ALSA + +/* Define if we have the OSS backend */ +#define HAVE_OSS + +/* Define if we have the Solaris backend */ +/* #undef HAVE_SOLARIS */ + +/* Define if we have the SndIO backend */ +/* #undef HAVE_SNDIO */ + +/* Define if we have the QSA backend */ +/* #undef HAVE_QSA */ + +/* Define if we have the WASAPI backend */ +/* #undef HAVE_WASAPI */ + +/* Define if we have the DSound backend */ +/* #undef HAVE_DSOUND */ + +/* Define if we have the Windows Multimedia backend */ +/* #undef HAVE_WINMM */ + +/* Define if we have the PortAudio backend */ +/* #undef HAVE_PORTAUDIO */ + +/* Define if we have the PulseAudio backend */ +#define HAVE_PULSEAUDIO + +/* Define if we have the JACK backend */ +/* #undef HAVE_JACK */ + +/* Define if we have the CoreAudio backend */ +/* #undef HAVE_COREAUDIO */ + +/* Define if we have the OpenSL backend */ +/* #undef HAVE_OPENSL */ + +/* Define if we have the Wave Writer backend */ +#define HAVE_WAVE + +/* Define if we have the SDL2 backend */ +/* #undef HAVE_SDL2 */ + +/* Define if we have the stat function */ +#define HAVE_STAT + +/* Define to the size of a long int type */ +#if HXCPP_ARM64 +#define SIZEOF_LONG 8 +#else +#define SIZEOF_LONG 4 +#endif + +/* Define if we have GCC's format attribute */ +#define HAVE_GCC_FORMAT + +/* Define if we have dlfcn.h */ +#define HAVE_DLFCN_H + +/* Define if we have pthread_np.h */ +/* #undef HAVE_PTHREAD_NP_H */ + +/* Define if we have malloc.h */ +#define HAVE_MALLOC_H + +/* Define if we have dirent.h */ +#define HAVE_DIRENT_H + +/* Define if we have cpuid.h */ +/* #define HAVE_CPUID_H */ + +/* Define if we have intrin.h */ +/* #undef HAVE_INTRIN_H */ + +/* Define if we have sys/sysconf.h */ +/* #undef HAVE_SYS_SYSCONF_H */ + +/* Define if we have guiddef.h */ +/* #undef HAVE_GUIDDEF_H */ + +/* Define if we have initguid.h */ +/* #undef HAVE_INITGUID_H */ + +/* Define if we have GCC's __get_cpuid() */ +#define HAVE_GCC_GET_CPUID + +/* Define if we have the __cpuid() intrinsic */ +/* #undef HAVE_CPUID_INTRINSIC */ + +/* Define if we have the _BitScanForward64() intrinsic */ +/* #undef HAVE_BITSCANFORWARD64_INTRINSIC */ + +/* Define if we have the _BitScanForward() intrinsic */ +/* #undef HAVE_BITSCANFORWARD_INTRINSIC */ + +/* Define if we have pthread_setschedparam() */ +#define HAVE_PTHREAD_SETSCHEDPARAM + +/* Define if we have pthread_setname_np() */ +/* #undef HAVE_PTHREAD_SETNAME_NP */ + +/* Define if pthread_setname_np() only accepts one parameter */ +/* #undef PTHREAD_SETNAME_NP_ONE_PARAM */ + +/* Define if pthread_setname_np() accepts three parameters */ +/* #undef PTHREAD_SETNAME_NP_THREE_PARAMS */ + +/* Define if we have pthread_set_name_np() */ +/* #undef HAVE_PTHREAD_SET_NAME_NP */ diff --git a/project/lib/custom/openal/include/config-windows-arm64.h b/project/lib/custom/openal/include/config-windows-arm64.h new file mode 100644 index 0000000000..5922e3791b --- /dev/null +++ b/project/lib/custom/openal/include/config-windows-arm64.h @@ -0,0 +1,138 @@ +/* API declaration export attribute */ +#define AL_API __declspec(dllexport) +#define ALC_API __declspec(dllexport) + +/* Define a restrict macro for non-aliased pointers */ +#define RESTRICT __restrict + +/* Define if HRTF data is embedded in the library */ +#define ALSOFT_EMBED_HRTF_DATA + +/* Define if we have the posix_memalign function */ +/* #undef HAVE_POSIX_MEMALIGN */ + +/* Define if we have the _aligned_malloc function */ +#define HAVE__ALIGNED_MALLOC + +/* Define if we have the proc_pidpath function */ +/* #undef HAVE_PROC_PIDPATH */ + +/* Define if we have the getopt function */ +/* #undef HAVE_GETOPT */ + +/* Define if we have SSE CPU extensions */ +/* #define HAVE_SSE */ +/* #define HAVE_SSE2 */ +/* #undef HAVE_SSE3 */ +/* #undef HAVE_SSE4_1 */ + +/* Define if we have ARM Neon CPU extensions */ +#undef HAVE_NEON + +/* Define if we have the ALSA backend */ +/* #undef HAVE_ALSA */ + +/* Define if we have the OSS backend */ +/* #undef HAVE_OSS */ + +/* Define if we have the Solaris backend */ +/* #undef HAVE_SOLARIS */ + +/* Define if we have the SndIO backend */ +/* #undef HAVE_SNDIO */ + +/* Define if we have the QSA backend */ +/* #undef HAVE_QSA */ + +/* Define if we have the WASAPI backend */ +#define HAVE_WASAPI + +/* Define if we have the DSound backend */ +/* #undef HAVE_DSOUND */ + +/* Define if we have the Windows Multimedia backend */ +#define HAVE_WINMM + +/* Define if we have the PortAudio backend */ +/* #undef HAVE_PORTAUDIO */ + +/* Define if we have the PulseAudio backend */ +/* #undef HAVE_PULSEAUDIO */ + +/* Define if we have the JACK backend */ +/* #undef HAVE_JACK */ + +/* Define if we have the CoreAudio backend */ +/* #undef HAVE_COREAUDIO */ + +/* Define if we have the OpenSL backend */ +/* #undef HAVE_OPENSL */ + +/* Define if we have the Wave Writer backend */ +#define HAVE_WAVE + +/* Define if we have the SDL2 backend */ +/* #undef HAVE_SDL2 */ + +/* Define if we have the stat function */ +#define HAVE_STAT + +/* Define to the size of a long int type */ +#define SIZEOF_LONG 4 + +/* Define if we have GCC's format attribute */ +/* #undef HAVE_GCC_FORMAT */ + +/* Define if we have dlfcn.h */ +/* #undef HAVE_DLFCN_H */ + +/* Define if we have pthread_np.h */ +/* #undef HAVE_PTHREAD_NP_H */ + +/* Define if we have malloc.h */ +#define HAVE_MALLOC_H + +/* Define if we have dirent.h */ +/* #undef HAVE_DIRENT_H */ + +/* Define if we have cpuid.h */ +/* #undef HAVE_CPUID_H */ + +/* Define if we have intrin.h */ +#define HAVE_INTRIN_H + +/* Define if we have sys/sysconf.h */ +/* #undef HAVE_SYS_SYSCONF_H */ + +/* Define if we have guiddef.h */ +#define HAVE_GUIDDEF_H + +/* Define if we have initguid.h */ +/* #undef HAVE_INITGUID_H */ + +/* Define if we have GCC's __get_cpuid() */ +/* #undef HAVE_GCC_GET_CPUID */ + +/* Define if we have the __cpuid() intrinsic */ +#define HAVE_CPUID_INTRINSIC + +/* Define if we have the _BitScanForward64() intrinsic */ +/* #undef HAVE_BITSCANFORWARD64_INTRINSIC */ + +/* Define if we have the _BitScanForward() intrinsic */ +#define HAVE_BITSCANFORWARD_INTRINSIC + +/* Define if we have pthread_setschedparam() */ +/* #undef HAVE_PTHREAD_SETSCHEDPARAM */ + +/* Define if we have pthread_setname_np() */ +/* #undef HAVE_PTHREAD_SETNAME_NP */ + +/* Define if pthread_setname_np() only accepts one parameter */ +/* #undef PTHREAD_SETNAME_NP_ONE_PARAM */ + +/* Define if pthread_setname_np() accepts three parameters */ +/* #undef PTHREAD_SETNAME_NP_THREE_PARAMS */ + +/* Define if we have pthread_set_name_np() */ +/* #undef HAVE_PTHREAD_SET_NAME_NP */ diff --git a/project/lib/custom/openal/include/config.h b/project/lib/custom/openal/include/config.h index 89959b23e3..cd54137eb4 100644 --- a/project/lib/custom/openal/include/config.h +++ b/project/lib/custom/openal/include/config.h @@ -8,7 +8,9 @@ #elif defined(HX_WINDOWS) -#ifdef HXCPP_M64 +#if defined(HXCPP_ARM64) +#include "config-windows-arm64.h" +#elif defined(HXCPP_M64) #include "config-windows-x86_64.h" #else #include "config-windows-x86.h" @@ -16,7 +18,11 @@ #elif defined(HX_LINUX) +#if defined(HXCPP_ARM64) || defined(HXCPP_ARMV7) +#include "config-linux-arm.h" +#else #include "config-linux-x86_64.h" +#endif #elif defined (HX_ANDROID) diff --git a/project/lib/custom/pixman/config.h b/project/lib/custom/pixman/config.h index c2829330bd..c2344a220f 100644 --- a/project/lib/custom/pixman/config.h +++ b/project/lib/custom/pixman/config.h @@ -293,14 +293,14 @@ /* #undef USE_OPENMP */ /* use SSE2 compiler intrinsics */ -#if defined(HX_WINDOWS) || (defined(HX_MACOS) && !defined(HXCPP_ARM64)) || (defined(HX_LINUX) && !defined(RASPBERRYPI)) +#if (defined(HX_WINDOWS) && !defined(HXCPP_ARM64)) || (defined(HX_MACOS) && !defined(HXCPP_ARM64)) || (defined(HX_LINUX) && !defined(RASPBERRYPI) && !defined(HXCPP_ARMV7) && !defined(HXCPP_ARM64)) #define USE_SSE2 1 #else /* #undef USE_SSE2 */ #endif /* use SSSE3 compiler intrinsics */ -#if defined(HX_WINDOWS) || (defined(HX_MACOS) && !defined(HXCPP_ARM64)) || (defined(HX_LINUX) && !defined(RASPBERRYPI)) +#if (defined(HX_WINDOWS) && !defined(HXCPP_ARM64)) || (defined(HX_MACOS) && !defined(HXCPP_ARM64)) || (defined(HX_LINUX) && !defined(RASPBERRYPI) && !defined(HXCPP_ARMV7) && !defined(HXCPP_ARM64)) #define USE_SSE3 1 #else /* #undef USE_SSE3 */ @@ -310,7 +310,7 @@ /* #undef USE_VMX */ /* use x86 MMX compiler intrinsics */ -#if (defined(HX_WINDOWS) || /*defined(HX_MACOS) ||*/ (defined(HX_LINUX) && !defined(RASPBERRYPI)) ) && !defined(HXCPP_M64) +#if ((defined(HX_WINDOWS) && !defined(HXCPP_ARM64)) || /*defined(HX_MACOS) ||*/ (defined(HX_LINUX) && !defined(RASPBERRYPI)) ) && !defined(HXCPP_M64) && !defined(HXCPP_ARMV7) && !defined(HXCPP_ARM64) #define USE_X86_MMX 1 #else /* #undef USE_X86_MMX */ diff --git a/project/lib/openal-files.xml b/project/lib/openal-files.xml index d07ad13bae..7f92e2b909 100644 --- a/project/lib/openal-files.xml +++ b/project/lib/openal-files.xml @@ -57,10 +57,10 @@ - - - - + + + + @@ -94,12 +94,12 @@ - - - - - - + + + + + + @@ -112,11 +112,11 @@ - - - - - + + + + +
diff --git a/project/lib/pixman-files.xml b/project/lib/pixman-files.xml index 01fb83b21b..8af8aae448 100644 --- a/project/lib/pixman-files.xml +++ b/project/lib/pixman-files.xml @@ -1,9 +1,8 @@ - - - - + + + @@ -19,15 +18,16 @@ + - - - - - + + + + + @@ -36,7 +36,9 @@ - + + + @@ -57,15 +59,15 @@ - + - - + + diff --git a/project/lib/sdl-files.xml b/project/lib/sdl-files.xml index 836b94df4a..977f2c56a2 100755 --- a/project/lib/sdl-files.xml +++ b/project/lib/sdl-files.xml @@ -101,7 +101,7 @@ - + @@ -127,31 +127,11 @@
- - - - - - - - - - - - - - -
- -
- +
- - - @@ -159,19 +139,34 @@ -
+ + + + + + + + + + + + + + +
+
- - - - - + + + + +
@@ -294,7 +289,7 @@
-
+
@@ -303,7 +298,7 @@
-
+
@@ -357,15 +352,6 @@
-
- - - - - - -
-
@@ -387,6 +373,14 @@
+
+ + + + + +
+ @@ -435,19 +429,6 @@
-
- - - - - - - - - - -
-
@@ -625,6 +606,15 @@
+ +
+ + + + + + +
diff --git a/src/lime/tools/HTML5Helper.hx b/src/lime/tools/HTML5Helper.hx index d7550381f1..d1959efd0f 100644 --- a/src/lime/tools/HTML5Helper.hx +++ b/src/lime/tools/HTML5Helper.hx @@ -60,6 +60,10 @@ class HTML5Helper { suffix += "32"; } + else if (System.hostArchitecture == ARM64) + { + suffix += "arm64"; + } else { suffix += "64"; @@ -107,11 +111,11 @@ class HTML5Helper { suffix += "32"; } - else if( System.hostArchitecture == ARMV7) + else if (System.hostArchitecture == ARMV7) { suffix += "Arm"; } - else if( System.hostArchitecture == ARM64) + else if (System.hostArchitecture == ARM64) { suffix += "Arm64"; } @@ -189,6 +193,10 @@ class HTML5Helper { suffix += "32"; } + else if (System.hostArchitecture == ARM64) + { + suffix += "arm64"; + } else { suffix += "64"; diff --git a/templates/bin/node/node-linuxarm64 b/templates/bin/node/node-linuxarm64 new file mode 100755 index 0000000000..18a9e43c5b Binary files /dev/null and b/templates/bin/node/node-linuxarm64 differ diff --git a/templates/bin/webify-linuxarm64 b/templates/bin/webify-linuxarm64 new file mode 100644 index 0000000000..25723ab07f Binary files /dev/null and b/templates/bin/webify-linuxarm64 differ diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index a5a11fadb9..569335793b 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -497,17 +497,17 @@ class CommandLineTools case LINUX: var arguments = Sys.args(); - if (System.hostArchitecture == ARMV7 ) + if (System.hostArchitecture == X64) { - untyped $loader.path = $array(path + "LinuxArm/", $loader.path); + untyped $loader.path = $array(path + "Linux64/", $loader.path); } else if (System.hostArchitecture == ARM64) { untyped $loader.path = $array(path + "LinuxArm64/", $loader.path); } - else if (System.hostArchitecture == X64) + else if (System.hostArchitecture == ARMV7) { - untyped $loader.path = $array(path + "Linux64/", $loader.path); + untyped $loader.path = $array(path + "LinuxArm/", $loader.path); } else { diff --git a/tools/SVGExport.hx b/tools/SVGExport.hx index 4bb62d0bdf..f90c82dca9 100644 --- a/tools/SVGExport.hx +++ b/tools/SVGExport.hx @@ -79,17 +79,17 @@ class SVGExport case LINUX: var arguments = Sys.args(); - if ( System.hostArchitecture == ARMV7 ) + if (System.hostArchitecture == X64) { - untyped $loader.path = $array(path + "LinuxArm/", $loader.path); + untyped $loader.path = $array(path + "Linux64/", $loader.path); } else if (System.hostArchitecture == ARM64) { untyped $loader.path = $array(path + "LinuxArm64/", $loader.path); } - else if (System.hostArchitecture == X64) + else if (System.hostArchitecture == ARMV7) { - untyped $loader.path = $array(path + "Linux64/", $loader.path); + untyped $loader.path = $array(path + "LinuxArm/", $loader.path); } else { diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx index 61b00e828f..f8c4aa47fd 100644 --- a/tools/platforms/LinuxPlatform.hx +++ b/tools/platforms/LinuxPlatform.hx @@ -29,7 +29,7 @@ class LinuxPlatform extends PlatformTarget private var applicationDirectory:String; private var executablePath:String; private var is64:Bool; - private var isRaspberryPi:Bool; + private var isArm:Bool; private var targetType:String; public function new(command:String, _project:HXProject, targetFlags:Map) @@ -126,8 +126,14 @@ class LinuxPlatform extends PlatformTarget { is64 = true; } + else if (architecture == Architecture.ARM64) + { + isArm = true; + is64 = true; + } else if (architecture == Architecture.ARMV7) { + isArm = true; is64 = false; } } @@ -183,9 +189,16 @@ class LinuxPlatform extends PlatformTarget { ProjectHelper.copyLibrary(project, ndll, "Linux" + (is64 ? "64" : ""), "", ".hdll", applicationDirectory, project.debug, targetSuffix); } + else if (isArm) + { + ProjectHelper.copyLibrary(project, ndll, "LinuxArm" + (is64 ? "64" : ""), "", + (ndll.haxelib != null + && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, + project.debug, targetSuffix); + } else { - ProjectHelper.copyLibrary(project, ndll, "Linux" + (( System.hostArchitecture == ARMV7 || System.hostArchitecture == ARM64)?"Arm":"") + (is64 ? "64" : ""), "", + ProjectHelper.copyLibrary(project, ndll, "Linux" + (isArm ? "Arm" : "") + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug, targetSuffix); @@ -199,9 +212,8 @@ class LinuxPlatform extends PlatformTarget if (noOutput) return; - NekoHelper.createExecutable(project.templatePaths, "linux" + (( System.hostArchitecture == ARMV7 || System.hostArchitecture == ARM64)?"Arm":"") + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - NekoHelper.copyLibraries(project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory); - + NekoHelper.createExecutable(project.templatePaths, "linux" + (isArm ? "arm" : "") + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); + NekoHelper.copyLibraries(project.templatePaths, "linux" + (isArm ? "arm" : "") + (is64 ? "64" : ""), applicationDirectory); } else if (targetType == "hl") { @@ -232,8 +244,8 @@ class LinuxPlatform extends PlatformTarget else if (targetType == "nodejs") { System.runCommand("", "haxe", [hxml]); - // NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - // NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory); + // NekoHelper.createExecutable (project.templatePaths, "linux" + (isArm ? "arm" : "") + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); + // NekoHelper.copyLibraries (project.templatePaths, "linux" + (isArm ? "arm" : "") + (is64 ? "64" : ""), applicationDirectory); } else if (targetType == "java") { @@ -258,7 +270,7 @@ class LinuxPlatform extends PlatformTarget System.recursiveCopy(targetDirectory + "/obj/lib", Path.combine(applicationDirectory, "lib")); System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", Path.combine(applicationDirectory, project.app.file + ".jar")); - JavaHelper.copyLibraries(project.templatePaths, "Linux" + (is64 ? "64" : ""), applicationDirectory); + JavaHelper.copyLibraries(project.templatePaths, "Linux" + (isArm ? "Arm" : "") + (is64 ? "64" : ""), applicationDirectory); } else { @@ -267,7 +279,7 @@ class LinuxPlatform extends PlatformTarget if (is64) { - if (System.hostArchitecture == ARM64) + if (isArm) { haxeArgs.push("-D"); haxeArgs.push("HXCPP_ARM64"); @@ -282,9 +294,18 @@ class LinuxPlatform extends PlatformTarget } else { - haxeArgs.push("-D"); - haxeArgs.push("HXCPP_M32"); - flags.push("-DHXCPP_M32"); + if (isArm) + { + haxeArgs.push("-D"); + haxeArgs.push("HXCPP_ARMV7"); + flags.push("-DHXCPP_ARMV7"); + } + else + { + haxeArgs.push("-D"); + haxeArgs.push("HXCPP_M32"); + flags.push("-DHXCPP_M32"); + } } if (project.target != System.hostPlatform) @@ -409,7 +430,7 @@ class LinuxPlatform extends PlatformTarget context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js"; context.HL_FILE = targetDirectory + "/obj/ApplicationMain" + (project.defines.exists("hlc") ? ".c" : ".hl"); context.CPP_DIR = targetDirectory + "/obj/"; - context.BUILD_DIR = project.app.path + "/linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : ""); + context.BUILD_DIR = project.app.path + "/linux" + (isArm ? "arm" : "") + (is64 ? "64" : ""); context.WIN_ALLOW_SHADERS = false; return context; @@ -455,35 +476,7 @@ class LinuxPlatform extends PlatformTarget { var commands = []; - if (System.hostArchitecture == ARM64 ) - { - commands.push([ - "-Dlinux", - "-Drpi", - "-Dtoolchain=linux", - "-DBINDIR=LinuxArm64", - "-DHXCPP_ARM64", - "-DCXX=aarch64-linux-gnu-g++", - "-DHXCPP_STRIP=aarch64-linux-gnu-strip", - "-DHXCPP_AR=aarch64-linux-gnu-ar", - "-DHXCPP_RANLIB=aarch64-linux-gnu-ranlib" - ]); - } - else if (System.hostArchitecture == ARMV7) - { - commands.push([ - "-Dlinux", - "-Drpi", - "-Dtoolchain=linux", - "-DBINDIR=LinuxArm", - "-DHXCPP_M32", - "-DCXX=arm-linux-gnueabihf-g++", - "-DHXCPP_STRIP=arm-linux-gnueabihf-strip", - "-DHXCPP_AR=arm-linux-gnueabihf-ar", - "-DHXCPP_RANLIB=arm-linux-gnueabihf-ranlib" - ]); - } - else if (targetFlags.exists("hl") && System.hostArchitecture == X64) + if (targetFlags.exists("hl") && System.hostArchitecture == X64) { // TODO: Support single binary commands.push(["-Dlinux", "-DHXCPP_M64", "-Dhashlink"]); @@ -495,10 +488,25 @@ class LinuxPlatform extends PlatformTarget commands.push(["-Dlinux", "-DHXCPP_M64"]); } - if (!targetFlags.exists("64") && !targetFlags.exists("x86_64") && (command == "rebuild" || System.hostArchitecture == X86)) + if (!targetFlags.exists("64") && !targetFlags.exists("x86_64") && (command == "rebuild" && (System.hostArchitecture == X86 || System.hostArchitecture == X64))) { commands.push(["-Dlinux", "-DHXCPP_M32"]); } + + if (!targetFlags.exists("armv7") && System.hostArchitecture == ARM64) + { + commands.push(["-Dlinux", "-DHXCPP_ARM64"]); + } + + if (!targetFlags.exists("arm64") && System.hostArchitecture == ARMV7) + { + commands.push(["-Dlinux", "-DHXCPP_ARMV7"]); + } + } + + if (targetFlags.exists("rpi")) + { + commands.push(["-Drpi"]); } if (targetFlags.exists("hl")) @@ -567,7 +575,7 @@ class LinuxPlatform extends PlatformTarget if (ndll.path == null || ndll.path == "") { - context.ndlls[i].path = NDLL.getLibraryPath(ndll, "Linux" + (( System.hostArchitecture == ARMV7 || System.hostArchitecture == ARM64) ? "Arm" : "") + (is64 ? "64" : ""), "lib", ".a", project.debug); + context.ndlls[i].path = NDLL.getLibraryPath(ndll, "Linux" + (isArm ? "Arm" : "") + (is64 ? "64" : ""), "lib", ".a", project.debug); } } } diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 9cf73d685f..60a693ffde 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -36,6 +36,7 @@ class WindowsPlatform extends PlatformTarget private var applicationDirectory:String; private var executablePath:String; private var is64:Bool; + private var isArm:Bool; private var targetType:String; private var outputFile:String; @@ -110,6 +111,8 @@ class WindowsPlatform extends PlatformTarget defaults.architectures = [ARMV6]; case ARMV7: defaults.architectures = [ARMV7]; + case ARM64: + defaults.architectures = [ARM64]; case X86: defaults.architectures = [X86]; case X64: @@ -175,7 +178,7 @@ class WindowsPlatform extends PlatformTarget for (architecture in project.architectures) { - if (architecture == Architecture.X64) + if (architecture == Architecture.X64 || architecture == Architecture.ARM64) { if ((targetType == "cpp" || targetType == "winrt")) { @@ -302,7 +305,7 @@ class WindowsPlatform extends PlatformTarget { for (ndll in project.ndlls) { - ProjectHelper.copyLibrary(project, ndll, "WinRT" + (is64 ? "64" : ""), "", + ProjectHelper.copyLibrary(project, ndll, "WinRT" + (isArm ? "Arm" : "") + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug, null); } @@ -317,14 +320,14 @@ class WindowsPlatform extends PlatformTarget // TODO: Support single binary for HashLink if (targetType == "hl") { - ProjectHelper.copyLibrary(project, ndll, "Windows" + (is64 ? "64" : ""), "", ".hdll", applicationDirectory, project.debug, + ProjectHelper.copyLibrary(project, ndll, "Windows" + (isArm ? "Arm" : "") + (is64 ? "64" : ""), "", ".hdll", applicationDirectory, project.debug, targetSuffix); - ProjectHelper.copyLibrary(project, ndll, "Windows" + (is64 ? "64" : ""), "", ".lib", applicationDirectory, project.debug, + ProjectHelper.copyLibrary(project, ndll, "Windows" + (isArm ? "Arm" : "") + (is64 ? "64" : ""), "", ".lib", applicationDirectory, project.debug, ".lib"); } else { - ProjectHelper.copyLibrary(project, ndll, "Windows" + (is64 ? "64" : ""), "", + ProjectHelper.copyLibrary(project, ndll, "Windows" + (isArm ? "Arm" : "") + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug, targetSuffix); } @@ -347,7 +350,7 @@ class WindowsPlatform extends PlatformTarget } NekoHelper.createWindowsExecutable(project.templatePaths, targetDirectory + "/obj/ApplicationMain.n", executablePath, iconPath); - NekoHelper.copyLibraries(project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory); + NekoHelper.copyLibraries(project.templatePaths, "windows" + (isArm ? "arm" : "") + (is64 ? "64" : ""), applicationDirectory); } else if (targetType == "hl") { @@ -430,7 +433,7 @@ class WindowsPlatform extends PlatformTarget if (noOutput) return; - System.copyFile(Path.combine(Haxelib.getPath(new Haxelib("hxcpp")), "bin/Windows64/Cppia.exe"), executablePath); + System.copyFile(Path.combine(Haxelib.getPath(new Haxelib("hxcpp")), "bin/Windows" + (isArm ? "Arm" : "") + "64/Cppia.exe"), executablePath); System.copyFile(targetDirectory + "/obj/ApplicationMain.cppia", Path.combine(applicationDirectory, "script.cppia")); var iconPath = Path.combine(applicationDirectory, "icon.ico"); @@ -485,7 +488,7 @@ class WindowsPlatform extends PlatformTarget System.recursiveCopy(targetDirectory + "/obj/lib", Path.combine(applicationDirectory, "lib")); System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", Path.combine(applicationDirectory, project.app.file + ".jar")); - JavaHelper.copyLibraries(project.templatePaths, "Windows" + (is64 ? "64" : ""), applicationDirectory); + JavaHelper.copyLibraries(project.templatePaths, "Windows" + (isArm ? "Arm" : "") + (is64 ? "64" : ""), applicationDirectory); } else if (targetType == "winrt") { @@ -554,13 +557,29 @@ class WindowsPlatform extends PlatformTarget if (is64) { - haxeArgs.push("-D"); - haxeArgs.push("HXCPP_M64"); - flags.push("-DHXCPP_M64"); + if (isArm) + { + haxeArgs.push("-D"); + haxeArgs.push("HXCPP_ARM64"); + flags.push("-DHXCPP_ARM64"); + } + else + { + haxeArgs.push("-D"); + haxeArgs.push("HXCPP_M64"); + flags.push("-DHXCPP_M64"); + } } else { - flags.push("-DHXCPP_M32"); + if (isArm) + { + flags.push("-DHXCPP_ARMV7"); + } + else + { + flags.push("-DHXCPP_M32"); + } } if (!project.environment.exists("SHOW_CONSOLE")) @@ -674,7 +693,7 @@ class WindowsPlatform extends PlatformTarget else if (targetType == "winrt") { context.CPP_DIR = targetDirectory + "/obj"; - context.BUILD_DIR = project.app.path + "/winrt" + (is64 ? "64" : ""); + context.BUILD_DIR = project.app.path + "/winrt" + (isArm ? "arm" : "") + (is64 ? "64" : ""); context.DC = "::"; } else @@ -684,7 +703,7 @@ class WindowsPlatform extends PlatformTarget context.HL_FILE = targetDirectory + "/obj/ApplicationMain" + (project.defines.exists("hlc") ? ".c" : ".hl"); context.CPPIA_FILE = targetDirectory + "/obj/ApplicationMain.cppia"; context.CPP_DIR = targetDirectory + "/obj"; - context.BUILD_DIR = project.app.path + "/windows" + (is64 ? "64" : ""); + context.BUILD_DIR = project.app.path + "/windows" + (isArm ? "arm" : "") + (is64 ? "64" : ""); } return context; @@ -785,6 +804,32 @@ class WindowsPlatform extends PlatformTarget commands.push(["-Dwindows", "-DHXCPP_M64"]); } } + + if (!targetFlags.exists("armv7") && System.hostArchitecture == ARM64 + && (command != "rebuild" || targetType == "cpp" || targetType == "winrt")) + { + if (targetType == "winrt") + { + commands.push(["-Dwinrt", "-DHXCPP_ARM64"]); + } + else + { + commands.push(["-Dwindows", "-DHXCPP_ARM64"]); + } + } + + if (!targetFlags.exists("arm64") && System.hostArchitecture == ARMV7 + && (command == "rebuild" || (targetType != "cpp" && targetType != "winrt"))) + { + if (targetType == "winrt") + { + commands.push(["-Dwinrt", "-DHXCPP_ARMV7"]); + } + else + { + commands.push(["-Dwindows", "-DHXCPP_ARMV7"]); + } + } } if (targetFlags.exists("hl")) @@ -958,7 +1003,7 @@ class WindowsPlatform extends PlatformTarget if (ndll.path == null || ndll.path == "") { - context.ndlls[i].path = NDLL.getLibraryPath(ndll, (targetType == "winrt" ? "WinRT" : "Windows") + (is64 ? "64" : ""), "lib", suffix, + context.ndlls[i].path = NDLL.getLibraryPath(ndll, (targetType == "winrt" ? "WinRT" : "Windows") + (isArm ? "Arm" : "") + (is64 ? "64" : ""), "lib", suffix, project.debug); } } diff --git a/tools/utils/CreateTemplate.hx b/tools/utils/CreateTemplate.hx index 7ef2a15676..c6c364cdca 100644 --- a/tools/utils/CreateTemplate.hx +++ b/tools/utils/CreateTemplate.hx @@ -66,8 +66,10 @@ class CreateTemplate System.mkdir(title + "/ndll"); System.mkdir(title + "/ndll/Linux"); System.mkdir(title + "/ndll/Linux64"); + System.mkdir(title + "/ndll/LinuxArm64"); System.mkdir(title + "/ndll/Mac"); System.mkdir(title + "/ndll/Mac64"); + System.mkdir(title + "/ndll/MacArm64"); System.mkdir(title + "/ndll/Windows"); } }