GithubHelp home page GithubHelp logo

Compile support for iOS & Android about flecs.net HOT 7 OPEN

oix7 avatar oix7 commented on July 17, 2024
Compile support for iOS & Android

from flecs.net.

Comments (7)

BeanCheeseBurrito avatar BeanCheeseBurrito commented on July 17, 2024 3

IOS static libraries were added in the latest package pushed to the GitLab feed. https://gitlab.com/BeanCheeseBurrito/Flecs.NET/-/packages/20154174

from flecs.net.

BeanCheeseBurrito avatar BeanCheeseBurrito commented on July 17, 2024 2

I will look into adding them!

from flecs.net.

BeanCheeseBurrito avatar BeanCheeseBurrito commented on July 17, 2024

Flecs.NET uses zig to cross-compile native libraries for all target platforms. Trying to compile flecs with -Dtarget=aarch64-linux-android or -Dtarget=aarch64-ios doesn't seem to work out of the box due to missing headers. I'm assuming zig doesn't include them for those targets.

fatal error: 'assert.h' file not found

I'm not familiar enough with c/c++ and mobile development to get the build script to compile for those platforms but I'm open to contributions if anyone knows how to get it working. These are the relevant files for anyone interested in adding support for mobile targets.

https://github.com/BeanCheeseBurrito/Flecs.NET/blob/main/src/Flecs.NET.Native/build.zig
https://github.com/BeanCheeseBurrito/Flecs.NET/blob/main/src/Flecs.NET.Native/Flecs.NET.Native.csproj

from flecs.net.

oix7 avatar oix7 commented on July 17, 2024

Thanks! Can we avoid exotic targets like linux android for now and just add the more vanilla stuff that zig does support? Or for modern ios at least?
ziglang/zig#5145

from flecs.net.

oix7 avatar oix7 commented on July 17, 2024

from flecs.net.

BeanCheeseBurrito avatar BeanCheeseBurrito commented on July 17, 2024

Thanks! Can we avoid exotic targets like linux android for now and just add the more vanilla stuff that zig does support? Or for modern ios at least? ziglang/zig#5145

Zig doesn't provide(?) the headers needed to cross-compile for android and ios. The build script needs to be changed to allow the user to manually provide them but I'm not experienced enough with mobile development to set it up myself.

from flecs.net.

oix7 avatar oix7 commented on July 17, 2024

In case it helps, I made this example github action that will output a static library via https://github.com/leetal/ios-cmake without needing any code signing.

name: Build Flecs for iOS

on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:

jobs:
  build:
    runs-on: macos-latest
    strategy:
      matrix:
        config: [Debug, Release]
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        
      - name: Setup environment
        run: |
          echo "FLECS_REPO=https://github.com/SanderMertens/flecs.git" >> $GITHUB_ENV
          echo "FLECS_DIR=$GITHUB_WORKSPACE/flecs" >> $GITHUB_ENV
          echo "DEBUG_DIR=$GITHUB_WORKSPACE/build_ios/debug" >> $GITHUB_ENV
          echo "RELEASE_DIR=$GITHUB_WORKSPACE/build_ios/release" >> $GITHUB_ENV
          echo "TOOLCHAIN_FILE=$GITHUB_WORKSPACE/ios.toolchain.cmake" >> $GITHUB_ENV
          
      - name: Clone Flecs Repository
        run: git clone ${{ env.FLECS_REPO }} ${{ env.FLECS_DIR }}
          
      - name: Download dependencies
        run: |
          if [ ! -f "$TOOLCHAIN_FILE" ]; then
            curl -O https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake
          fi
          
      - name: Build static library
        run: |
          mkdir -p $DEBUG_DIR
          mkdir -p $RELEASE_DIR
          cd $DEBUG_DIR
          cmake -DCMAKE_BUILD_TYPE=Debug $FLECS_DIR
          make
          mv libflecs_static.a libflecs.a
          cd $RELEASE_DIR
          cmake -DCMAKE_BUILD_TYPE=Release $FLECS_DIR
          make
          mv libflecs_static.a libflecs.a
          
      - name: Upload artifact (Debug)
        if: matrix.config == 'Debug'
        uses: actions/upload-artifact@v2
        with:
          name: libflecs-debug
          path: ${{ env.DEBUG_DIR }}/libflecs.a
          
      - name: Upload artifact (Release)
        if: matrix.config == 'Release'
        uses: actions/upload-artifact@v2
        with:
          name: libflecs-release
          path: ${{ env.RELEASE_DIR }}/libflecs.a

from flecs.net.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.