├── .github └── workflows │ └── x64-embedder-engine.yml ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md └── cmake ├── depot_tools.cmake ├── engine.cmake ├── engine_options.cmake ├── files ├── LICENSE ├── icu.patch └── toolchain.custom.BUILD.gn ├── options.cmake ├── packaging.cmake └── target.clang.toolchain.cmake.in /.github/workflows/x64-embedder-engine.yml: -------------------------------------------------------------------------------- 1 | name: x64-embedder-engine 2 | 3 | 4 | on: 5 | pull_request: 6 | types: [ opened, synchronize, reopened, closed ] 7 | release: 8 | types: [ published, created, edited ] 9 | repository_dispatch: 10 | workflow_dispatch: 11 | schedule: 12 | # daily 13 | - cron: '0 0 * * *' 14 | 15 | jobs: 16 | x86_64-linux-gcc: 17 | runs-on: [self-hosted, linux] 18 | 19 | container: 20 | image: ghcr.io/meta-flutter/ubuntu-20-dev:main 21 | options: 22 | --user 1018 23 | 24 | steps: 25 | 26 | - name: Event Information 27 | run: | 28 | echo "Event '${{ github.event.action }}' received from '${{ github.event.client_payload.repository }}'" 29 | 30 | - name: Set Ownership 31 | run: | 32 | chown -R dev:dev $HOME . 33 | 34 | - uses: actions/checkout@v2 35 | 36 | - name: Flutter Channel Rolled 37 | if: github.event.action == 'channel_roll' 38 | run: | 39 | TRIPLET=x86_64-linux-gcc 40 | mkdir -p build/debug && cd build/debug 41 | echo "Create Debug Packages" 42 | cmake ../.. \ 43 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 44 | -DTARGET_TRIPLE=${TRIPLET} \ 45 | -DTARGET_ARCH=x64 \ 46 | -DCHANNEL=stable \ 47 | -DENGINE_RUNTIME_MODE=debug 48 | echo "ENGINE_VERSION_DEBUG=$(cat engine.version | cut -c1-10)" >> $GITHUB_ENV 49 | make package -j 50 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.gz -not -path "./_CPack_Packages/*"` 51 | echo $PACKAGE_FILE 52 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 53 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.deb -not -path "./_CPack_Packages/*"` 54 | echo $PACKAGE_FILE 55 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 56 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.rpm -not -path "./_CPack_Packages/*"` 57 | echo $PACKAGE_FILE 58 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 59 | cd .. 60 | mkdir release && cd release 61 | echo "Create Release Packages" 62 | cmake ../.. \ 63 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 64 | -DTARGET_TRIPLE=${TRIPLET} \ 65 | -DTARGET_ARCH=x64 \ 66 | -DCHANNEL=stable \ 67 | -DENGINE_RUNTIME_MODE=release 68 | echo "ENGINE_VERSION_RELEASE=$(cat engine.version | cut -c1-10)" >> $GITHUB_ENV 69 | make package -j 70 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.gz -not -path "./_CPack_Packages/*"` 71 | echo $PACKAGE_FILE 72 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 73 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.deb -not -path "./_CPack_Packages/*"` 74 | echo $PACKAGE_FILE 75 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 76 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.rpm -not -path "./_CPack_Packages/*"` 77 | echo $PACKAGE_FILE 78 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 79 | cd .. 80 | mkdir profile && cd profile 81 | echo "Create Profile Packages" 82 | cmake ../.. \ 83 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 84 | -DTARGET_TRIPLE=${TRIPLET} \ 85 | -DTARGET_ARCH=x64 \ 86 | -DCHANNEL=stable \ 87 | -DENGINE_RUNTIME_MODE=profile 88 | echo "ENGINE_VERSION_PROFILE=$(cat engine.version | cut -c1-10)" >> $GITHUB_ENV 89 | make package -j 90 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.gz -not -path "./_CPack_Packages/*"` 91 | echo $PACKAGE_FILE 92 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 93 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.deb -not -path "./_CPack_Packages/*"` 94 | echo $PACKAGE_FILE 95 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 96 | PACKAGE_FILE=`find -iname flutter-engine-*-debug-*-Linux-*.rpm -not -path "./_CPack_Packages/*"` 97 | echo $PACKAGE_FILE 98 | md5sum $PACKAGE_FILE > ${PACKAGE_FILE}-MD5SUMS.txt 99 | 100 | - name: Build 101 | run: | 102 | TRIPLET=x86_64-linux-gcc 103 | mkdir -p build/debug && cd build/debug 104 | echo "Create Debug Packages" 105 | cmake ../.. \ 106 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 107 | -DTARGET_TRIPLE=${TRIPLET} \ 108 | -DTARGET_ARCH=x64 \ 109 | -DCHANNEL=stable \ 110 | -DENGINE_RUNTIME_MODE=debug 111 | echo "ENGINE_VERSION_DEBUG=$(cat engine.version | cut -c1-10)" >> $GITHUB_ENV 112 | make package -j 113 | cd .. 114 | mkdir release && cd release 115 | echo "Create Release Packages" 116 | cmake ../.. \ 117 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 118 | -DTARGET_TRIPLE=${TRIPLET} \ 119 | -DTARGET_ARCH=x64 \ 120 | -DCHANNEL=stable \ 121 | -DENGINE_RUNTIME_MODE=release 122 | echo "ENGINE_VERSION_RELEASE=$(cat engine.version | cut -c1-10)" >> $GITHUB_ENV 123 | make package -j 124 | cd .. 125 | mkdir profile && cd profile 126 | echo "Create Profile Packages" 127 | cmake ../.. \ 128 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 129 | -DTARGET_TRIPLE=${TRIPLET} \ 130 | -DTARGET_ARCH=x64 \ 131 | -DCHANNEL=stable \ 132 | -DENGINE_RUNTIME_MODE=profile 133 | echo "ENGINE_VERSION_PROFILE=$(cat engine.version | cut -c1-10)" >> $GITHUB_ENV 134 | make package -j 135 | 136 | - name: Runtime Debug artifacts TGZ 137 | uses: actions/upload-artifact@v2 138 | with: 139 | name: ${{ env.ENGINE_VERSION_DEBUG }}.x86_64-linux-gcc.debug.tgz 140 | path: | 141 | build/debug/_packages/*.tar.gz 142 | 143 | - name: Runtime Release artifacts TGZ 144 | uses: actions/upload-artifact@v2 145 | with: 146 | name: ${{ env.ENGINE_VERSION_RELEASE }}.x86_64-linux-gcc.release.tgz 147 | path: | 148 | build/release/_packages/*.tar.gz 149 | 150 | - name: Runtime Profile artifacts TGZ 151 | uses: actions/upload-artifact@v2 152 | with: 153 | name: ${{ env.ENGINE_VERSION_PROFILE }}.x86_64-linux-gcc.profile.tgz 154 | path: | 155 | build/profile/_packages/*.tar.gz 156 | 157 | - name: Runtime Debug artifacts Debian 158 | uses: actions/upload-artifact@v2 159 | with: 160 | name: ${{ env.ENGINE_VERSION_DEBUG }}.x86_64-linux-gcc.debug.deb 161 | path: | 162 | build/debug/_packages/*.deb 163 | 164 | - name: Runtime Release artifacts Debian 165 | uses: actions/upload-artifact@v2 166 | with: 167 | name: ${{ env.ENGINE_VERSION_RELEASE }}.x86_64-linux-gcc.release.deb 168 | path: | 169 | build/release/_packages/*.deb 170 | 171 | - name: Runtime Profile artifacts Debian 172 | uses: actions/upload-artifact@v2 173 | with: 174 | name: ${{ env.ENGINE_VERSION_PROFILE }}.x86_64-linux-gcc.profile.deb 175 | path: | 176 | build/profile/_packages/*.deb 177 | 178 | - name: Runtime Debug artifacts RPM 179 | uses: actions/upload-artifact@v2 180 | with: 181 | name: ${{ env.ENGINE_VERSION_DEBUG }}.x86_64-linux-gcc.debug.rpm 182 | path: | 183 | build/debug/_packages/*.rpm 184 | 185 | - name: Runtime Release artifacts RPM 186 | uses: actions/upload-artifact@v2 187 | with: 188 | name: ${{ env.ENGINE_VERSION_RELEASE }}.x86_64-linux-gcc.release.rpm 189 | path: | 190 | build/release/_packages/*.rpm 191 | 192 | - name: Runtime Profile artifacts RPM 193 | uses: actions/upload-artifact@v2 194 | with: 195 | name: ${{ env.ENGINE_VERSION_PROFILE }}.x86_64-linux-gcc.profile.rpm 196 | path: | 197 | build/profile/_packages/*.rpm 198 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | build 3 | third_party 4 | sysroot -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2018-2020 Joel Winarske 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | cmake_minimum_required(VERSION 3.15) 26 | 27 | if(NOT CMAKE_BUILD_TYPE) 28 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) 29 | message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to Release.") 30 | endif() 31 | 32 | set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake") 33 | 34 | if(NOT BUILD_NUMBER) 35 | set(BUILD_NUMBER 0) 36 | endif() 37 | set(FLUTTER_ENGINE_VERSION 1.0.${BUILD_NUMBER}) 38 | 39 | project(flutter-engine VERSION "${FLUTTER_ENGINE_VERSION}" LANGUAGES C) 40 | 41 | message(STATUS "Generator .............. ${CMAKE_GENERATOR}") 42 | message(STATUS "Build Type ............. ${CMAKE_BUILD_TYPE}") 43 | 44 | include(ProcessorCount) 45 | ProcessorCount(NUM_PROC) 46 | 47 | 48 | include(options) 49 | include(depot_tools) 50 | include(engine) 51 | include(packaging) 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2020 Joel Winarske 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_embedded 2 | 3 | This repo is used for CI automation to build flutter-engine embedder for Linux. 4 | 5 | # Project Status 6 | 7 | x86_86 and aarch64 functional 8 | 9 | No external toolchain is required, it uses toolchain pulled as part of engine build - Clang Toolchain. 10 | 11 | If your are using a sysroot different than that included as default, you will need to override a few variables. See examples below. 12 | 13 | The original Yocto Layer to build Engine with variety of Flutter embedders: [meta-flutter](https://github.com/jwinarske/meta-flutter) 14 | 15 | 16 | # Build Example 17 | 18 | See CI build jobs here: https://github.com/jwinarske/flutter_embedded/blob/ci/.github/workflows/blank.yml 19 | 20 | ## Switching channels 21 | To switch channels add variable CHANNEL to cmake invocation. Like this 22 | 23 | cmake .. -DCHANNEL=beta 24 | make package -j8 25 | 26 | To build all channels of Engine/GLFW shell for Raspberry Pi armv7 in your nightly CI build job, you could do this 27 | 28 | git clone https://github.com/jwinarske/flutter_embedded 29 | cd flutter_embedded 30 | mkdir build && cd build 31 | cmake .. 32 | make package -j8 33 | cmake .. -DCHANNEL=beta 34 | make package -j8 35 | cmake .. -DCHANNEL=dev 36 | make package -j8 37 | cmake .. -DCHANNEL=master 38 | make package -j8 39 | cmake .. -DCHANNEL=stable -DENGINE_RUNTIME_MODE=release 40 | make package -j8 41 | cmake .. -DCHANNEL=beta 42 | make package -j8 43 | cmake .. -DCHANNEL=dev 44 | make package -j8 45 | cmake .. -DCHANNEL=master 46 | make package -j8 47 | 48 | # Override Variables 49 | To use the override variables, pass them in with the cmake command. One example 50 | 51 | cmake -DTOOLCHAIN_DIR=~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64 -DTARGET_SYSROOT=~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DENGINE_REPO=https://github.com/jwinarske/engine -DCMAKE_BUILD_TYPE=Release 52 | 53 | ### TARGET_SYSROOT 54 | This is the location of the target sysroot. The default value is "${CMAKE_SOURCE_DIR}/sdk/sysroot". One approach would be to download target image such as a Raspberry Pi image, and mount it. Setting TARGET_SYSROOT to the rootfs directory. 55 | 56 | ### TARGET_ARCH 57 | This is the target architecture of your build. It must match your toolchain, and that which the flutter engine build supports. 58 | 59 | ### ENGINE_REPO 60 | This is the repo of the flutter engine. The default value is https://github.com/flutter/engine.git. If you want to use your own fork, set this variable to point to your fork's url. 61 | 62 | ### ENGINE_UNOPTIMIZED 63 | Unoptimized flag, defaults to OFF 64 | 65 | ### ENGINE_RUNTIME_MODE 66 | If ENGINE_RUNTIME_MODE is not set to `debug`, `profile`, or `release`, it defaults to `debug`. 67 | 68 | ### ENGINE_SIMULATOR 69 | Enable simulator, defaults to OFF 70 | 71 | ### ENGINE_INTERPRETER 72 | Enable interpreter, defaults to OFF 73 | 74 | ### ENGINE_DART_DEBUG 75 | Enable dart-debug, defaults to OFF 76 | 77 | ### ENGINE_CLANG 78 | Enable clang, defaults to ON 79 | 80 | ### ENGINE_GOMA 81 | Enable goma, defaults to OFF 82 | 83 | ### ENGINE_LTO 84 | Enable link-time optimization, defaults to ON 85 | 86 | ### ENGINE_EMBEDDER_FOR_TARGET 87 | Embedder for Target, defaults to ON 88 | 89 | ### ENGINE_ENABLE_VULKAN 90 | Enable Vulkan, defaults to OFF 91 | 92 | ## Native Flutter Target Debug 93 | I am successfully able to single step the Flutter Embedder using Host Side gdb-multiarch, and latest Eclipse release. Target side requires gdbserver installed. LLDB will be at a later date. 94 | 95 | sudo apt-get install gdbserver 96 | 97 | Change build flags in this file 98 | 99 | {build folder}/engine-prefix/src/engine/src/build/config/compiler/BUILD.gn 100 | 101 | To include 102 | 103 | if (is_linux) { 104 | if (current_cpu != "x86") { 105 | cflags_cc += [ 106 | "-ggdb", 107 | "-ggdb3", 108 | 109 | Rebuild Engine 110 | 111 | Copy Artifact 112 | 113 | scp {absolute build folder}/engine-prefix/src/engine/src/out/linux_debug_arm/so.unstripped/libflutter_engine.so pi@raspberrypi.local:/home/pi/lib 114 | 115 | Inside Eclipse - Import C/C++ Executable, and select the Flutter binary. 116 | 117 | 118 | *Configuration - via Debugger Dialog* 119 | 120 | Main / C/C++ Application: flutter 121 | 122 | Main / Connection: Remote Host 123 | 124 | Main / Remote Absolute File Path for C/C++ Application: /home/pi/bin/flutter 125 | 126 | Main / Commands to execute before application 127 | 128 | export LD_LIBRARY_PATH=/home/pi/lib 129 | 130 | Main / Skip download to target path [TRUE] 131 | 132 | Arguments: /home/pi/build/flutter_assets/ 133 | 134 | Debugger / Main / GDB Debugger 135 | 136 | gdb-multiarch 137 | 138 | Debugger / Shared Libraries 139 | 140 | {absolute build folder}/engine-prefix/src/engine/src/out/linux_debug_arm/so.unstripped 141 | {absolute sdk folder}/sysroot/lib 142 | {absolute sdk folder}/toolchain/lib 143 | 144 | Debugger / Shared Libraries / Load shared library symbols automatically [TRUE] 145 | 146 | 147 | Set breakpoint at FlutterEngineRun(). 148 | 149 | Run the debugger, once breakpoint hits, change to the Debugger Console window, and issue 150 | 151 | set step-mode on 152 | 153 | Step into FlutterEngineRun() 154 | -------------------------------------------------------------------------------- /cmake/depot_tools.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2018-2020 Joel Winarske 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | include (ExternalProject) 26 | 27 | ExternalProject_Add(depot_tools 28 | GIT_REPOSITORY https://chromium.googlesource.com/chromium/tools/depot_tools.git 29 | GIT_TAG main 30 | GIT_SHALLOW 1 31 | SOURCE_DIR ${DEPOT_TOOLS_DIR} 32 | UPDATE_COMMAND "" 33 | BUILD_IN_SOURCE 1 34 | CONFIGURE_COMMAND "" 35 | BUILD_COMMAND pwd && 36 | export DEPOT_TOOLS_UPDATE=0 && 37 | export GCLIENT_PY3=1 && 38 | ./gclient --version 39 | INSTALL_COMMAND "" 40 | ) 41 | -------------------------------------------------------------------------------- /cmake/engine.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2018-2020 Joel Winarske 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | if(NOT ENGINE_REPO) 26 | set(ENGINE_REPO https://github.com/flutter/engine.git) 27 | endif() 28 | MESSAGE(STATUS "Engine Repo ............ ${ENGINE_REPO}") 29 | 30 | find_program(GIT git REQUIRED) 31 | 32 | set(ENGINE_SRC_PATH ${THIRD_PARTY_DIR}/engine) 33 | 34 | include(engine_options) 35 | 36 | ExternalProject_Add(engine 37 | DOWNLOAD_COMMAND 38 | export PATH=${THIRD_PARTY_DIR}/depot_tools:$ENV{PATH} && 39 | virtualenv --python /usr/bin/python2.7 .env && 40 | . .env/bin/activate && 41 | ${CMAKE_COMMAND} -E make_directory ${ENGINE_SRC_PATH} && 42 | cd ${ENGINE_SRC_PATH} && 43 | echo ${GCLIENT_CONFIG} > .gclient && 44 | gclient sync --no-history --revision ${FLUTTER_ENGINE_SHA} -R -D -j ${NUM_PROC} && 45 | cd ${ENGINE_SRC_PATH}/src/third_party/dart && 46 | git describe > ${CMAKE_BINARY_DIR}/dart.version 47 | BUILD_IN_SOURCE 0 48 | CONFIGURE_COMMAND 49 | export PATH=${THIRD_PARTY_DIR}/depot_tools:$ENV{PATH} && 50 | export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} && 51 | virtualenv --python /usr/bin/python2.7 .env && 52 | . .env/bin/activate && 53 | ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/toolchain.custom.BUILD.gn ${THIRD_PARTY_DIR}/engine/src/build/toolchain/custom/BUILD.gn && 54 | cd ${ENGINE_SRC_PATH}/src && 55 | ./flutter/tools/gn ${ENGINE_FLAGS} && 56 | ${CMAKE_COMMAND} -E echo ${ARGS_GN_APPEND} >> ${ARGS_GN_FILE} 57 | BUILD_COMMAND 58 | export PATH=${THIRD_PARTY_DIR}/depot_tools:$ENV{PATH} && 59 | export PKG_CONFIG_PATH=${PKG_CONFIG_PATH} && 60 | virtualenv --python /usr/bin/python2.7 .env && 61 | . .env/bin/activate && 62 | cd ${ENGINE_SRC_PATH}/src && 63 | autoninja -C ${ENGINE_OUT_DIR} 64 | INSTALL_COMMAND 65 | echo ${BUILD_DIR} && 66 | ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${ENGINE_RUNTIME_MODE}/${CHANNEL} && 67 | cd ${ENGINE_SRC_PATH}/src && 68 | ${CMAKE_COMMAND} -E copy ${ENGINE_OUT_DIR}/icudtl.dat ${CMAKE_BINARY_DIR}/${ENGINE_RUNTIME_MODE}/${CHANNEL} && 69 | ${CMAKE_COMMAND} -E copy ${ENGINE_OUT_DIR}/${ENGINE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/${ENGINE_RUNTIME_MODE}/${CHANNEL} && 70 | ${ENGINE_COPY_HEADER} 71 | ) 72 | 73 | add_dependencies(engine depot_tools) 74 | if(BUILD_PLATFORM_SYSROOT) 75 | add_dependencies(engine symlink_fixups) 76 | endif() 77 | 78 | set(ENGINE_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${ENGINE_RUNTIME_MODE}/${CHANNEL}) 79 | set(ENGINE_LIBRARIES_DIR ${CMAKE_BINARY_DIR}/${ENGINE_RUNTIME_MODE}/${CHANNEL}) 80 | include_directories(${ENGINE_INCLUDE_DIR}) 81 | link_directories(${ENGINE_LIBRARIES_DIR}) 82 | 83 | # 84 | # Install 85 | # 86 | set(BUILD_DIR ${THIRD_PARTY_DIR}/engine/src/${ENGINE_OUT_DIR}) 87 | 88 | install(FILES ${CMAKE_BINARY_DIR}/engine.version DESTINATION share/flutter/sdk) 89 | install(FILES ${CMAKE_BINARY_DIR}/dart.version DESTINATION share/flutter/sdk) 90 | install(FILES ${BUILD_DIR}/${ENGINE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION lib) 91 | install(FILES ${BUILD_DIR}/${ENGINE_HEADER} DESTINATION include) 92 | install(FILES ${BUILD_DIR}/icudtl.dat DESTINATION share/flutter) 93 | 94 | install(DIRECTORY ${BUILD_DIR}/flutter_patched_sdk DESTINATION share/flutter/sdk FILES_MATCHING PATTERN "*") 95 | 96 | if(CMAKE_CROSSCOMPILING) 97 | install(FILES ${BUILD_DIR}/dart-sdk/bin/snapshots/frontend_server.dart.snapshot DESTINATION share/flutter/sdk) 98 | install(FILES ${BUILD_DIR}/clang_x64/dart DESTINATION share/flutter/sdk/clang_x64) 99 | install(FILES ${BUILD_DIR}/clang_x64/gen_snapshot DESTINATION share/flutter/sdk/clang_x64) 100 | else() 101 | install(FILES ${BUILD_DIR}/dart-sdk/bin/snapshots/frontend_server.dart.snapshot DESTINATION share/flutter/sdk) 102 | install(FILES ${BUILD_DIR}/dart-sdk/bin/dart DESTINATION share/flutter/sdk/clang_x64) 103 | install(FILES ${BUILD_DIR}/gen_snapshot DESTINATION share/flutter/sdk/clang_x64) 104 | endif() 105 | -------------------------------------------------------------------------------- /cmake/engine_options.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2018-2020 Joel Winarske 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | 26 | option(ENGINE_UNOPTIMIZED "Unoptimized flag" OFF) 27 | option(ENGINE_INTERPRETER "Enable interpreter" OFF) 28 | option(ENGINE_DART_DEBUG "Enable dart-debug" OFF) 29 | option(ENGINE_FULL_DART_DEBUG "Enable full-dart-debug" OFF) 30 | option(ENGINE_SIMULATOR "Enable Simulator" OFF) 31 | option(ENGINE_GOMA "Enable goma" OFF) 32 | option(ENGINE_LTO "Enable lto" ON) 33 | option(ENGINE_CLANG "Enable clang" ON) 34 | option(ENGINE_EMBEDDER_FOR_TARGET "Embedder for Target" ON) 35 | option(ENGINE_ENABLE_VULKAN "Enable Vulkan" OFF) 36 | option(ENGINE_ENABLE_FONTCONFIG "Enable Font Config" ON) 37 | option(ENGINE_ENABLE_SKSHAPER "Enable skshaper" OFF) 38 | option(ENGINE_ENABLE_VULKAN_VALIDATION_LAYERS "Enable Vulkan Validation Layers" OFF) 39 | option(ENGINE_COVERAGE "Enable Code Coverage" OFF) 40 | option(ENGINE_FULL_DART_SDK "Enable Full Dart SDK" ON) 41 | option(ENGINE_DISABLE_DESKTOP "Disable Desktop" ON) 42 | 43 | 44 | if(NOT ENGINE_PATCH_CLR) 45 | set(ENGINE_PATCH_CLR) 46 | endif() 47 | 48 | if(NOT ENGINE_PATCH_SET) 49 | set(ENGINE_PATCH_SET) 50 | endif() 51 | if(NOT CHANNEL) 52 | set(CHANNEL "beta" CACHE STRING "Choose the channel, options are: master, dev, beta, stable" FORCE) 53 | message(STATUS "Flutter Channel not set, defaulting to beta") 54 | endif() 55 | 56 | if(${PREV_CHANNEL} NOT STREQUAL ${CHANNEL}) 57 | message(STATUS "Switching Flutter Channel") 58 | set(PREV_CHANNEL ${CHANNEL}) 59 | set(ENGINE_FORCE_DOWNLOAD ON) 60 | endif() 61 | 62 | message(STATUS "Flutter Channel ........ ${CHANNEL}") 63 | 64 | include(FetchContent) 65 | FetchContent_Declare(engine-version 66 | URL https://raw.githubusercontent.com/flutter/flutter/${CHANNEL}/bin/internal/engine.version 67 | DOWNLOAD_NAME engine.version 68 | DOWNLOAD_NO_EXTRACT TRUE 69 | DOWNLOAD_DIR ${CMAKE_BINARY_DIR} 70 | ) 71 | 72 | FetchContent_GetProperties(engine-version) 73 | if(NOT engine-version_POPULATED) 74 | FetchContent_Populate(engine-version) 75 | file(READ ${CMAKE_BINARY_DIR}/engine.version FLUTTER_ENGINE_SHA) 76 | string(REPLACE "\n" "" FLUTTER_ENGINE_SHA ${FLUTTER_ENGINE_SHA}) 77 | else() 78 | MESSAGE(FATAL "Unable to determine engine-version, please override FLUTTER_ENGINE_SHA") 79 | endif() 80 | 81 | message(STATUS "Engine SHA1 ............ ${FLUTTER_ENGINE_SHA}") 82 | 83 | 84 | if(ENGINE_UNOPTIMIZED) 85 | list(APPEND ENGINE_FLAGS --unoptimized) 86 | endif() 87 | 88 | if(NOT ENGINE_RUNTIME_MODE) 89 | set(ENGINE_RUNTIME_MODE "debug" CACHE STRING "Choose the runtime mode, options are: debug, profile, release, or jit_release." FORCE) 90 | message(STATUS "ENGINE_RUNTIME_MODE not set, defaulting to debug") 91 | endif() 92 | if(${PREV_ENGINE_RUNTIME_MODE} NOT STREQUAL ${ENGINE_RUNTIME_MODE}) 93 | message(STATUS "Switching Engine Runtime Mode") 94 | set(PREV_ENGINE_RUNTIME_MODE ${ENGINE_RUNTIME_MODE}) 95 | set(ENGINE_FORCE_DOWNLOAD ON) 96 | endif() 97 | 98 | list(APPEND ENGINE_FLAGS --runtime-mode ${ENGINE_RUNTIME_MODE}) 99 | 100 | if(ENGINE_INTERPRETER) 101 | list(APPEND ENGINE_FLAGS --interpreter) 102 | endif() 103 | 104 | if(ENGINE_DART_DEBUG) 105 | list(APPEND ENGINE_FLAGS --dart-debug) 106 | endif() 107 | 108 | if(ENGINE_FULL_DART_DEBUG) 109 | list(APPEND ENGINE_FLAGS --full-dart-debug) 110 | endif() 111 | 112 | if(ENGINE_SIMULATOR) 113 | list(APPEND ENGINE_FLAGS --simulator) 114 | endif() 115 | 116 | if(ENGINE_GOMA) 117 | list(APPEND ENGINE_FLAGS --goma) 118 | else() 119 | list(APPEND ENGINE_FLAGS --no-goma) 120 | endif() 121 | 122 | if(ENGINE_LTO) 123 | list(APPEND ENGINE_FLAGS --lto) 124 | else() 125 | list(APPEND ENGINE_FLAGS --no-lto) 126 | endif() 127 | 128 | if(ENGINE_CLANG) 129 | list(APPEND ENGINE_FLAGS --clang) 130 | else() 131 | list(APPEND ENGINE_FLAGS --no-clang) 132 | endif() 133 | 134 | if(ENGINE_ENABLE_VULKAN) 135 | list(APPEND ENGINE_FLAGS --enable-vulkan) 136 | endif() 137 | 138 | if(ENGINE_ENABLE_FONTCONFIG) 139 | list(APPEND ENGINE_FLAGS --enable-fontconfig) 140 | endif() 141 | 142 | if(ENGINE_ENABLE_SKSHAPER) 143 | list(APPEND ENGINE_FLAGS --enable-skshaper) 144 | endif() 145 | 146 | if(ENGINE_ENABLE_VULKAN_VALIDATION_LAYERS) 147 | list(APPEND ENGINE_FLAGS --enable-vulkan-validation-layers) 148 | endif() 149 | 150 | if(ENGINE_EMBEDDER_FOR_TARGET) 151 | list(APPEND ENGINE_FLAGS --embedder-for-target) 152 | endif() 153 | 154 | if(ENGINE_COVERAGE) 155 | list(APPEND ENGINE_FLAGS --coverage) 156 | endif() 157 | 158 | if(ENGINE_FULL_DART_SDK) 159 | list(APPEND ENGINE_FLAGS --full-dart-sdk) 160 | else() 161 | list(APPEND ENGINE_FLAGS --no-full-dart-sdk) 162 | endif() 163 | 164 | # flag not present in stable 165 | if(NOT ${CHANNEL} STREQUAL "stable") 166 | if(ENGINE_DISABLE_DESKTOP) 167 | list(APPEND ENGINE_FLAGS --disable-desktop-embeddings) 168 | endif() 169 | endif() 170 | 171 | set(ENGINE_LIB_FLAGS) 172 | 173 | if(ANDROID) 174 | 175 | set(TARGET_OS android) 176 | 177 | # "ANDROID_" prefixed variables are set in android.toolchain.cmake 178 | set(TOOLCHAIN_DIR ${ANDROID_TOOLCHAIN_ROOT}) 179 | set(TARGET_SYSROOT ${ANDROID_SYSROOT}) 180 | set(TARGET_TRIPLE ${ANDROID_LLVM_TRIPLE}) 181 | 182 | # arm,x64,x86,arm64 183 | if(ANDROID_SYSROOT_ABI STREQUAL "x86_64") 184 | set(TARGET_ARCH x64) 185 | else() 186 | set(TARGET_ARCH ${ANDROID_SYSROOT_ABI}) 187 | endif() 188 | 189 | list(APPEND ENGINE_FLAGS --android --android-cpu ${TARGET_ARCH}) 190 | 191 | elseif(DARWIN) 192 | list(APPEND ENGINE_FLAGS --ios --ios-cpu ${TARGET_ARCH}) # arm,arm64 193 | set(TARGET_OS ios) 194 | else() 195 | # Use toolchain base triple, tuning will happen elsewhere 196 | if(${TARGET_ARCH} STREQUAL "arm") 197 | 198 | set(TARGET_TRIPLE armv7-unknown-linux-gnueabihf) 199 | set(TARGET_TRIPLE_RUNTIME arm-linux-gnueabihf) 200 | 201 | # if must match target arch or it will fail install 202 | set(PACKAGE_ARCH armhf) 203 | 204 | if(NOT PKG_CONFIG_PATH) 205 | set(PKG_CONFIG_PATH ${TARGET_SYSROOT}/usr/lib/${TARGET_TRIPLE_RUNTIME}/pkgconfig:/usr/share/pkgconfig) 206 | endif() 207 | 208 | set(ENGINE_OUT_DIR out/linux_${ENGINE_RUNTIME_MODE}_arm) 209 | if(ENGINE_ENABLE_VULKAN) 210 | set(ENGINE_OUT_DIR ${ENGINE_OUT_DIR}_vulkan) 211 | endif() 212 | 213 | if(BUILD_PLATFORM_SYSROOT_RPI) 214 | set(TARGET_TRIPLE armv7-neon-vfpv4-linux-gnueabihf) 215 | set(TUNEABI cortex-a53+crc) # RPI3, for RPI4 use cortex-a72+crc+crypto 216 | set(PACKAGE_LIB_PATH_SUFFIX /${TARGET_TRIPLE_RUNTIME}) 217 | set(INSTALL_TRIPLE_SUFFIX /tls/v7l/neon/vfp) 218 | endif() 219 | 220 | # missing in stable channel 221 | if(${CHANNEL} STREQUAL "stable") 222 | set(LLVM_VERSION 8.0.0) 223 | else() 224 | set(LLVM_VERSION 11.0.0) 225 | endif() 226 | 227 | configure_file(cmake/files/libclang_rt.builtins-armhf.a 228 | ${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang/lib/clang/${LLVM_VERSION}/lib/linux/libclang_rt.builtins-armhf.a 229 | COPYONLY 230 | ) 231 | 232 | # Engine Link Flags 233 | # list(APPEND ENGINE_LIB_FLAGS -Wl,-z,notext) 234 | list(APPEND ENGINE_LIB_FLAGS -nostdlib++) 235 | list(APPEND ENGINE_LIB_FLAGS -fuse-ld=lld) 236 | list(APPEND ENGINE_LIB_FLAGS -rtlib=compiler-rt) 237 | list(APPEND ENGINE_LIB_FLAGS -Wl,--build-id=sha1) 238 | string(REPLACE ";" " " ENGINE_LIB_FLAGS "${ENGINE_LIB_FLAGS}") 239 | 240 | # Target CXX Flags 241 | list(APPEND TARGET_CXX_FLAGS -I${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang/include) 242 | if(BUILD_FLUTTER_RPI) 243 | list(APPEND TARGET_CXX_FLAGS -I${TARGET_SYSROOT}/opt/vc/include) 244 | list(APPEND TARGET_CXX_LINK_FLAGS -Wl,-rpath,'$ORIGIN/usr/lib/${TARGET_TRIPLE_RUNTIME}/') 245 | endif() 246 | if(BUILD_GLFW_FLUTTER) 247 | list(APPEND TARGET_CXX_FLAGS -DGLFW_EXPOSE_NATIVE_EGL) 248 | list(APPEND TARGET_CXX_FLAGS -DGLFW_INCLUDE_ES2) 249 | endif() 250 | list(APPEND TARGET_CXX_FLAGS -flto) 251 | list(APPEND TARGET_CXX_FLAGS -fPIC) 252 | string(REPLACE ";" " " TARGET_CXX_FLAGS "${TARGET_CXX_FLAGS}") 253 | 254 | # Target Link Flags 255 | if(${CHANNEL} STREQUAL "stable") 256 | list(APPEND TARGET_CXX_LINK_FLAGS -L${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang/lib/clang/${LLVM_VERSION}/armv7-linux-gnueabihf/lib) 257 | list(APPEND TARGET_CXX_LINK_FLAGS -lpthread -ldl) 258 | else() 259 | list(APPEND TARGET_CXX_LINK_FLAGS ${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang/lib/armv7-unknown-linux-gnueabihf/c++/libc++.a) 260 | list(APPEND TARGET_CXX_LINK_FLAGS -L${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang/lib/clang/${LLVM_VERSION}/lib/armv7-unknown-linux-gnueabihf) 261 | list(APPEND TARGET_CXX_LINK_FLAGS -nostdlib++) 262 | endif() 263 | list(APPEND TARGET_CXX_LINK_FLAGS -fuse-ld=lld) 264 | list(APPEND TARGET_CXX_LINK_FLAGS -L${TARGET_SYSROOT}/lib/arm-linux-gnueabihf) 265 | string(REPLACE ";" " " TARGET_CXX_LINK_FLAGS "${TARGET_CXX_LINK_FLAGS}") 266 | 267 | elseif(${TARGET_ARCH} STREQUAL "arm64") 268 | 269 | set(TARGET_TRIPLE aarch64-agl-linux) 270 | set(TARGET_TRIPLE_RUNTIME aarch64-agl-linux) 271 | 272 | # if must match target arch or it will fail install 273 | set(PACKAGE_ARCH aarch64) 274 | 275 | if(NOT PKG_CONFIG_PATH) 276 | set(PKG_CONFIG_PATH ${TARGET_SYSROOT}/lib/pkgconfig:${TARGET_SYSROOT}/usr/lib/pkgconfig:${TARGET_SYSROOT}/usr/share/pkgconfig) 277 | endif() 278 | 279 | set(ENGINE_OUT_DIR out/linux_${ENGINE_RUNTIME_MODE}_arm64) 280 | if(ENGINE_ENABLE_VULKAN) 281 | set(ENGINE_OUT_DIR ${ENGINE_OUT_DIR}_vulkan) 282 | endif() 283 | 284 | # missing in stable channel 285 | if(${CHANNEL} STREQUAL "stable") 286 | set(LLVM_VERSION 8.0.0) 287 | else() 288 | set(LLVM_VERSION 11.0.0) 289 | endif() 290 | 291 | # Engine Link Flags 292 | # list(APPEND ENGINE_LIB_FLAGS -Wl,-z,notext) 293 | list(APPEND ENGINE_LIB_FLAGS -nostdlib) 294 | list(APPEND ENGINE_LIB_FLAGS -nostdlib++) 295 | list(APPEND ENGINE_LIB_FLAGS -fuse-ld=lld) 296 | list(APPEND ENGINE_LIB_FLAGS -rtlib=compiler-rt) 297 | list(APPEND ENGINE_LIB_FLAGS -L${TARGET_SYSROOT}/usr/lib/aarch64-agl-linux/9.3.0) 298 | string(REPLACE ";" " " ENGINE_LIB_FLAGS "${ENGINE_LIB_FLAGS}") 299 | 300 | # Target CXX Flags 301 | list(APPEND TARGET_CXX_FLAGS -I${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang/include) 302 | list(APPEND TARGET_CXX_FLAGS -flto) 303 | list(APPEND TARGET_CXX_FLAGS -fPIC) 304 | string(REPLACE ";" " " TARGET_CXX_FLAGS "${TARGET_CXX_FLAGS}") 305 | 306 | # Target Link Flags 307 | if(${CHANNEL} STREQUAL "stable") 308 | list(APPEND TARGET_CXX_LINK_FLAGS -L${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang/lib/clang/${LLVM_VERSION}/aarch64-unknown-linux-gnu/lib) 309 | list(APPEND TARGET_CXX_LINK_FLAGS -lpthread -ldl) 310 | else() 311 | list(APPEND TARGET_CXX_LINK_FLAGS ${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang/lib/aarch64-unknown-linux-gnu/c++/libc++.a) 312 | list(APPEND TARGET_CXX_LINK_FLAGS -nostdlib++) 313 | endif() 314 | list(APPEND TARGET_CXX_LINK_FLAGS -fuse-ld=lld) 315 | list(APPEND TARGET_CXX_LINK_FLAGS -L${TARGET_SYSROOT}/usr/lib/aarch64-agl-linux/9.3.0) 316 | string(REPLACE ";" " " TARGET_CXX_LINK_FLAGS "${TARGET_CXX_LINK_FLAGS}") 317 | 318 | elseif(${TARGET_ARCH} STREQUAL "x64") 319 | set(TARGET_TRIPLE x86_64-linux-gnu) 320 | if(NOT PKG_CONFIG_PATH) 321 | set(PKG_CONFIG_PATH /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig) 322 | endif() 323 | set(ENGINE_OUT_DIR out/linux_${ENGINE_RUNTIME_MODE}_x64) 324 | if(ENGINE_ENABLE_VULKAN) 325 | set(ENGINE_OUT_DIR ${ENGINE_OUT_DIR}_vulkan) 326 | endif() 327 | 328 | # if must match target arch or it will fail install 329 | set(PACKAGE_ARCH x86_64) 330 | 331 | elseif(${TARGET_ARCH} STREQUAL "x86") 332 | set(TARGET_TRIPLE i386-unknown-linux-gnu) 333 | set(ENGINE_OUT_DIR out/linux_${ENGINE_RUNTIME_MODE}_x86) 334 | endif() 335 | 336 | set(ENGINE_HEADER flutter_embedder.h) 337 | if(ENGINE_DISABLE_DESKTOP AND ENGINE_EMBEDDER_FOR_TARGET) 338 | set(ENGINE_NAME libflutter_engine) 339 | set(ENGINE_COPY_HEADER ${CMAKE_COMMAND} -E copy ${ENGINE_OUT_DIR}/${ENGINE_HEADER} ${CMAKE_BINARY_DIR}/${ENGINE_RUNTIME_MODE}/${CHANNEL}) 340 | else() 341 | set(ENGINE_NAME libflutter_linux_gtk) 342 | set(ENGINE_COPY_HEADER ${CMAKE_COMMAND} -E copy_directory ${THIRD_PARTY_DIR}/engine/src/${ENGINE_OUT_DIR}/flutter_linux ${CMAKE_BINARY_DIR}/${ENGINE_RUNTIME_MODE}/${CHANNEL}) 343 | endif() 344 | 345 | list(APPEND ENGINE_FLAGS --target-os linux) 346 | list(APPEND ENGINE_FLAGS --linux-cpu ${TARGET_ARCH}) 347 | list(APPEND ENGINE_FLAGS --target-triple ${TARGET_TRIPLE}) 348 | 349 | if(NOT ${TARGET_SYSROOT} STREQUAL "") 350 | list(APPEND ENGINE_FLAGS --target-sysroot ${TARGET_SYSROOT}) 351 | endif() 352 | 353 | if(NOT ${TARGET_ARCH} STREQUAL "x64") 354 | list(APPEND ENGINE_FLAGS --target-toolchain ${TOOLCHAIN_DIR}) 355 | endif() 356 | 357 | set(TARGET_OS linux) 358 | 359 | endif() 360 | 361 | MESSAGE(STATUS "ENGINE_LIB_FLAGS........ ${ENGINE_LIB_FLAGS}") 362 | 363 | #set(ENV{PKG_CONFIG_PATH} ${PKG_CONFIG_PATH}) 364 | message(STATUS "PKG_CONFIG_PATH ........ ${PKG_CONFIG_PATH}") 365 | 366 | if(TARGET_ARCH MATCHES "^arm") 367 | if(NOT ENGINE_ARM_FP) 368 | if(${TARGET_TRIPLE} MATCHES "hf$") 369 | list(APPEND ENGINE_FLAGS --arm-float-abi hard) 370 | elseif(${TARGET_TRIPLE} MATCHES "eabi$") 371 | list(APPEND ENGINE_FLAGS --arm-float-abi soft) 372 | endif() 373 | elseif(ENGINE_ARM_FP) 374 | if(ENGINE_ARM_FP STREQUAL "hard" OR ENGINE_ARM_FP STREQUAL "soft" OR ENGINE_ARM_FP STREQUAL "softfp") 375 | list(APPEND ENGINE_FLAGS --arm-float-abi ${ENGINE_ARM_FP}) 376 | endif() 377 | endif() 378 | endif() 379 | 380 | 381 | if(NOT ANDROID) 382 | set(DOWNLOAD_ANDROID_DEPS "False") 383 | else() 384 | set(DOWNLOAD_ANDROID_DEPS "True") 385 | endif() 386 | 387 | if(NOT MSVC) 388 | set(DOWNLOAD_MSVC_DEPS "False") 389 | else() 390 | set(DOWNLOAD_MSVC_DEPS "True") 391 | endif() 392 | 393 | set(GCLIENT_CONFIG "solutions = [{\"managed\": False,\"name\": \"src/flutter\",\"url\": \"https://github.com/flutter/engine.git\",\"deps_file\":\"DEPS\",\"custom_vars\":{\"download_android_deps\":${DOWNLOAD_ANDROID_DEPS},\"download_windows_deps\":${DOWNLOAD_MSVC_DEPS},\"download_linux_deps\":True},},]") 394 | 395 | set(ARGS_GN_FILE ${ENGINE_SRC_PATH}/src/${ENGINE_OUT_DIR}/args.gn) 396 | 397 | if(${TARGET_ARCH} STREQUAL "x64") 398 | set(ARGS_GN_APPEND "enable_unittests = false") 399 | else() 400 | set(ARGS_GN_APPEND "arm_tune = \"${TUNEABI}\"") 401 | endif() 402 | 403 | string(REPLACE ";" " " ENGINE_FLAGS_PRETTY "${ENGINE_FLAGS}") 404 | message(STATUS "Engine Flags ........... ${ENGINE_FLAGS_PRETTY}") 405 | 406 | 407 | if(ENGINE_FORCE_DOWNLOAD) 408 | set(ENGINE_FORCE_DOWNLOAD OFF) 409 | execute_process( 410 | COMMAND ${CMAKE_COMMAND} -E remove engine-prefix/src/engine-stamp/* 411 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 412 | ) 413 | endif() 414 | 415 | 416 | configure_file(${CMAKE_SOURCE_DIR}/cmake/files/toolchain.custom.BUILD.gn ${CMAKE_BINARY_DIR}/toolchain.custom.BUILD.gn @ONLY) 417 | -------------------------------------------------------------------------------- /cmake/files/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 The Flutter Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, 4 | are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above 9 | copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of Google Inc. nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /cmake/files/icu.patch: -------------------------------------------------------------------------------- 1 | diff --git a/source/i18n/plurrule.cpp b/source/i18n/plurrule.cpp 2 | index fd193560..09200fb8 100644 3 | --- a/source/i18n/plurrule.cpp 4 | +++ b/source/i18n/plurrule.cpp 5 | @@ -1661,7 +1661,7 @@ int64_t FixedDecimal::getFractionalDigits(double n, int32_t v) { 6 | case 3: return (int64_t)(fract*1000.0 + 0.5); 7 | default: 8 | double scaled = floor(fract * pow(10.0, (double)v) + 0.5); 9 | - if (scaled > U_INT64_MAX) { 10 | + if ((int64_t)scaled > U_INT64_MAX) { 11 | return U_INT64_MAX; 12 | } else { 13 | return (int64_t)scaled; 14 | 15 | -------------------------------------------------------------------------------- /cmake/files/toolchain.custom.BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Flutter Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import("//build/toolchain/custom/custom.gni") 6 | 7 | toolchain("custom") { 8 | toolchain_bin = "${custom_toolchain}/bin" 9 | 10 | # We can't do string interpolation ($ in strings) on things with dots in 11 | # them. To allow us to use $cc below, for example, we create copies of 12 | # these values in our scope. 13 | cc = "${toolchain_bin}/clang" 14 | cxx = "${toolchain_bin}/clang++" 15 | ar = "${toolchain_bin}/llvm-ar" 16 | ld = "${toolchain_bin}/clang++" 17 | readelf = "${toolchain_bin}/llvm-readelf" 18 | nm = "${toolchain_bin}/llvm-nm" 19 | strip = "${toolchain_bin}/llvm-strip" 20 | 21 | target_triple_flags = "--target=${custom_target_triple}" 22 | sysroot_flags = "--sysroot ${custom_sysroot}" 23 | 24 | 25 | # These library switches can apply to all tools below. 26 | lib_switch = "-l" 27 | lib_dir_switch = "-L" 28 | 29 | tool("cc") { 30 | depfile = "{{output}}.d" 31 | command = "$cc -MD -MF $depfile $target_triple_flags $sysroot_flags {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -nostdlib++ -flto -fuse-ld=lld -Wno-unused-command-line-argument -c {{source}} -o {{output}}" 32 | depsformat = "gcc" 33 | description = "CC {{output}}" 34 | outputs = [ 35 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", 36 | ] 37 | } 38 | 39 | tool("cxx") { 40 | depfile = "{{output}}.d" 41 | command = "$cxx -MD -MF $depfile $target_triple_flags $sysroot_flags {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -nostdlib++ -flto -fuse-ld=lld -Wno-unused-command-line-argument -c {{source}} -o {{output}}" 42 | depsformat = "gcc" 43 | description = "CXX {{output}}" 44 | outputs = [ 45 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", 46 | ] 47 | } 48 | 49 | tool("asm") { 50 | depfile = "{{output}}.d" 51 | command = "$cc -MD -MF $depfile $target_triple_flags $sysroot_flags {{defines}} {{include_dirs}} {{asmflags}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" 52 | depsformat = "gcc" 53 | description = "ASM {{output}}" 54 | outputs = [ 55 | "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", 56 | ] 57 | } 58 | 59 | tool("alink") { 60 | rspfile = "{{output}}.rsp" 61 | command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile" 62 | description = "AR {{output}}" 63 | rspfile_content = "{{inputs}}" 64 | outputs = [ 65 | "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", 66 | ] 67 | default_output_extension = ".a" 68 | output_prefix = "lib" 69 | } 70 | 71 | tool("solink") { 72 | soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". 73 | sofile = "{{root_out_dir}}/$soname" # Possibly including toolchain dir. 74 | unstripped_sofile = "{{root_out_dir}}/so.unstripped/$soname" # Possibly including toolchain dir. 75 | rspfile = sofile + ".rsp" 76 | 77 | # These variables are not built into GN but are helpers that implement 78 | # (1) linking to produce a .so, (2) extracting the symbols from that file 79 | # to a temporary file, (3) if the temporary file has differences from the 80 | # existing .TOC file, overwrite it, otherwise, don't change it. 81 | tocfile = sofile + ".TOC" 82 | temporary_tocname = sofile + ".tmp" 83 | 84 | link_command = "$ld $target_triple_flags $sysroot_flags @ENGINE_LIB_FLAGS@ -shared -Wl,--build-id=sha1 -Wl,-soname=$soname -o $unstripped_sofile @$rspfile -v" 85 | toc_command = "{ $readelf -d $unstripped_sofile | grep SONAME ; $nm -gD -f posix $unstripped_sofile | cut -f1-2 -d' '; } > $temporary_tocname" 86 | replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi" 87 | strip_command = "$strip -o $sofile $unstripped_sofile" 88 | 89 | command = "$link_command && $toc_command && $replace_command && $strip_command" 90 | rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" 91 | 92 | description = "SOLINK $sofile" 93 | 94 | default_output_extension = ".so" 95 | 96 | output_prefix = "lib" 97 | 98 | # Since the above commands only updates the .TOC file when it changes, ask 99 | # Ninja to check if the timestamp actually changed to know if downstream 100 | # dependencies should be recompiled. 101 | restat = true 102 | 103 | # Tell GN about the output files. It will link to the sofile but use the 104 | # tocfile for dependency management. 105 | outputs = [ 106 | sofile, 107 | unstripped_sofile, 108 | tocfile, 109 | ] 110 | 111 | link_output = sofile 112 | depend_output = tocfile 113 | } 114 | 115 | tool("link") { 116 | exename = "{{target_output_name}}{{output_extension}}" 117 | outfile = "{{root_out_dir}}/$exename" 118 | rspfile = "$outfile.rsp" 119 | unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename" 120 | command = "$ld $target_triple_flags $sysroot_flags {{ldflags}} @ENGINE_LIB_FLAGS@ -o $unstripped_outfile -Wl,--build-id=sha1 -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}} && ${strip} -o $outfile $unstripped_outfile" 121 | description = "LINK $outfile" 122 | rspfile_content = "{{inputs}}" 123 | outputs = [ 124 | unstripped_outfile, 125 | outfile, 126 | ] 127 | } 128 | 129 | tool("stamp") { 130 | command = "touch {{output}}" 131 | description = "STAMP {{output}}" 132 | } 133 | 134 | tool("copy") { 135 | command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" 136 | description = "COPY {{source}} {{output}}" 137 | } 138 | 139 | # When invoking this toolchain not as the default one, these args will be 140 | # passed to the build. They are ignored when this is the default toolchain. 141 | toolchain_args = { 142 | current_cpu = target_cpu 143 | current_os = target_os 144 | 145 | # These values need to be passed through unchanged. 146 | target_os = target_os 147 | target_cpu = target_cpu 148 | 149 | is_clang = true 150 | } 151 | } 152 | 153 | -------------------------------------------------------------------------------- /cmake/options.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2018-2020 Joel Winarske 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | if(NOT TARGET_ARCH) 26 | set(TARGET_ARCH "arm64" CACHE STRING "Choose the target arch, options are: x64, x86, arm64, or arm." FORCE) 27 | message(STATUS "TARGET_ARCH not set, defaulting to arm64") 28 | endif() 29 | 30 | if(NOT THIRD_PARTY_DIR) 31 | SET(THIRD_PARTY_DIR "${CMAKE_SOURCE_DIR}/third_party") 32 | endif() 33 | 34 | if(NOT TOOLCHAIN_DIR) 35 | set(TOOLCHAIN_DIR "${THIRD_PARTY_DIR}/engine/src/buildtools/linux-x64/clang") 36 | endif() 37 | 38 | if(NOT DEPOT_TOOLS_DIR) 39 | SET(DEPOT_TOOLS_DIR "${THIRD_PARTY_DIR}/depot_tools") 40 | endif() 41 | 42 | set(EXT_CMAKE_STAGING_PREFIX ${CMAKE_BINARY_DIR}/staging_ext${CMAKE_INSTALL_PREFIX}) 43 | -------------------------------------------------------------------------------- /cmake/packaging.cmake: -------------------------------------------------------------------------------- 1 | set(CPACK_GENERATOR "TGZ;RPM;DEB") 2 | 3 | if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") 4 | set(CPACK_PACKAGE_NAME ${PROJECT_NAME}-dbg) 5 | else() 6 | set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) 7 | endif() 8 | 9 | set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "Flutter Engine - ${CMAKE_BUILD_TYPE}") 10 | set(CPACK_PACKAGE_VENDOR "Toyota Motor Corporation") 11 | set(CPACK_PACKAGE_CONTACT "joel.winarske@woven-planet.global") 12 | 13 | set(CPACK_VERBATIM_VARIABLES YES) 14 | 15 | set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) 16 | set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_BINARY_DIR}/_packages") 17 | 18 | set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) 19 | 20 | set(CPACK_DEB_COMPONENT_INSTALL YES) 21 | 22 | set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Joel Winarske ") 23 | set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES) 24 | set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) 25 | 26 | set(CPACK_RPM_COMPONENT_INSTALL YES) 27 | set(CPACK_RPM_FILE_NAME RPM-DEFAULT) 28 | set(CPACK_RPM_PACKAGE_LICENSE "BSD-3-Clause License") 29 | set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") 30 | set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY}") 31 | 32 | set(CPACK_TGZ_FILE_NAME TGZ-DEFAULT) 33 | 34 | if(${CMAKE_BUILD_TYPE} STREQUAL "Release") 35 | set(CPACK_STRIP_FILES homescreen) 36 | endif() 37 | 38 | if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") 39 | set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON) 40 | set(CMAKE_RPM_DEBUGINFO_PACKAGE ON) 41 | set(CMAKE_TGZ_DEBUGINFO_PACKAGE ON) 42 | endif() 43 | 44 | include(CPack) 45 | -------------------------------------------------------------------------------- /cmake/target.clang.toolchain.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2018-2020 Joel Winarske 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | SET(CMAKE_SYSTEM_VERSION 1) 26 | set(CMAKE_SYSTEM_PROCESSOR @TARGET_ARCH@) 27 | 28 | # sysroot 29 | SET(CMAKE_SYSROOT @TARGET_SYSROOT@) 30 | SET(CMAKE_FIND_ROOT_PATH @TARGET_SYSROOT@) 31 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 32 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 33 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 34 | 35 | #compiler 36 | SET(CMAKE_ASM_COMPILER @TOOLCHAIN_DIR@/bin/clang) 37 | SET(CMAKE_C_COMPILER @TOOLCHAIN_DIR@/bin/clang) 38 | SET(CMAKE_CXX_COMPILER @TOOLCHAIN_DIR@/bin/clang++) 39 | 40 | SET(CMAKE_AR @TOOLCHAIN_DIR@/bin/llvm-ar CACHE FILEPATH "Archiver") 41 | SET(CMAKE_RANLIB @TOOLCHAIN_DIR@/bin/llvm-ranlib CACHE FILEPATH "Ranlib") 42 | 43 | SET(CMAKE_NM @TOOLCHAIN_DIR@/bin/llvm-nm CACHE FILEPATH "nm") 44 | SET(CMAKE_OBJCOPY @TOOLCHAIN_DIR@/bin/llvm-objcopy CACHE FILEPATH "objcopy") 45 | SET(CMAKE_OBJDUMP @TOOLCHAIN_DIR@/bin/llvm-objdump CACHE FILEPATH "objdump") 46 | SET(CMAKE_CXX_COMPILER_AR @TOOLCHAIN_DIR@/bin/llvm-ar CACHE FILEPATH "Archiver") 47 | SET(CMAKE_CXX_COMPILER_RANLIB @TOOLCHAIN_DIR@/bin/llvm-ranlib CACHE FILEPATH "Ranlib") 48 | SET(CMAKE_C_COMPILER_AR @TOOLCHAIN_DIR@/bin/llvm-ar CACHE FILEPATH "Archiver") 49 | SET(CMAKE_C_COMPILER_RANLIB @TOOLCHAIN_DIR@/bin/llvm-ranlib CACHE FILEPATH "Ranlib") 50 | 51 | SET(CMAKE_ASM_COMPILER_TARGET @TARGET_TRIPLE@) 52 | SET(CMAKE_C_COMPILER_TARGET @TARGET_TRIPLE@) 53 | SET(CMAKE_CXX_COMPILER_TARGET @TARGET_TRIPLE@) 54 | 55 | # compiler flags 56 | SET(CMAKE_ASM_FLAGS "-fno-integrated-as") 57 | SET(CMAKE_CXX_FLAGS "@TARGET_CXX_FLAGS@") 58 | SET(CMAKE_EXE_LINKER_FLAGS "@TARGET_CXX_LINK_FLAGS@") 59 | 60 | SET(CMAKE_POSITION_INDEPENDENT_CODE ON) 61 | 62 | --------------------------------------------------------------------------------