diff --git a/AUTHORS b/AUTHORS index d8fed62..8f2d7dc 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,3 +6,4 @@ Sony Group Corporation Michael Lamers (info@devmil.de) +Andrea Daoud (andreadaoud6@gmail.com) diff --git a/lib/elinux_build_target.dart b/lib/elinux_build_target.dart index 72b09c8..7623c91 100644 --- a/lib/elinux_build_target.dart +++ b/lib/elinux_build_target.dart @@ -351,24 +351,25 @@ class NativeBundle { // Run the native build. final String cmakeBuildType = buildMode.isPrecompiled ? 'Release' : 'Debug'; - final String targetArch = buildInfo.targetArch; + final String targetArch = + buildInfo.targetArch == 'arm64' ? 'aarch64' : 'x86_64'; final String hostArch = _getCurrentHostPlatformArchName(); final String targetCompilerTriple = buildInfo.targetCompilerTriple; final String targetSysroot = buildInfo.targetSysroot; final String systemIncludeDirectories = buildInfo.systemIncludeDirectories; - final bool needCrossBuild = targetArch != hostArch; - final bool needCrossBuildOptionsForArm64 = targetArch == 'arm64'; RunResult result = await _processUtils.run( [ 'cmake', '-DCMAKE_BUILD_TYPE=$cmakeBuildType', '-DFLUTTER_TARGET_BACKEND_TYPE=${buildInfo.targetBackendType}', - if (needCrossBuild) '-DFLUTTER_TARGET_PLATFORM_SYSROOT=$targetSysroot', - if (needCrossBuild && systemIncludeDirectories != null) + if (targetSysroot != '/') '-DCMAKE_SYSROOT=$targetSysroot', + if (buildInfo.targetArch != hostArch) + '-DCMAKE_SYSTEM_PROCESSOR=$targetArch', + if (systemIncludeDirectories != null) '-DFLUTTER_SYSTEM_INCLUDE_DIRECTORIES=$systemIncludeDirectories', - if (needCrossBuildOptionsForArm64 && targetCompilerTriple != null) + if (targetCompilerTriple != null) '-DCMAKE_C_COMPILER_TARGET=$targetCompilerTriple', - if (needCrossBuildOptionsForArm64 && targetCompilerTriple != null) + if (targetCompilerTriple != null) '-DCMAKE_CXX_COMPILER_TARGET=$targetCompilerTriple', eLinuxDir.path, ], diff --git a/templates/app/CMakeLists.txt.tmpl b/templates/app/CMakeLists.txt.tmpl index 4fb714a..72807e3 100644 --- a/templates/app/CMakeLists.txt.tmpl +++ b/templates/app/CMakeLists.txt.tmpl @@ -7,21 +7,13 @@ cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") -# Root filesystem for cross-building. -if(FLUTTER_TARGET_PLATFORM_SYSROOT) - set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - - # Basically we use this include when we got the following error: - # fatal error: 'bits/c++config.h' file not found - if(FLUTTER_TARGET_PLATFORM_SYSROOT) - include_directories(SYSTEM ${FLUTTER_SYSTEM_INCLUDE_DIRECTORIES}) - endif() -endif() +# Basically we use this include when we got the following error: +# fatal error: 'bits/c++config.h' file not found +include_directories(SYSTEM ${FLUTTER_SYSTEM_INCLUDE_DIRECTORIES}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Configure build options. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)