UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Including files from one directory up with CMake or basic builders

    Scheduled Pinned Locked Moved App Development
    2 Posts 1 Posters 471 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • ValenoernV Offline
        Valenoern
        last edited by

        I have an in-progress app I've been trying to create from a godot game demo.

        Mostly I've been making great progress with this. I got a click package to build and "start" godot (with a crash), and I actually contributed a fix to the docker image for arm64 hosts so it's now easier to debug + build the game on an arm64 machine before sending it to the phone.

        One thing I've been having a lot of unnecessary trouble with is keeping a reasonable directory structure and still compiling my click package. I have things arranged like this:

        repository
        |
        `--- main branch directories
        |
        `--- zensekai (experimental branch directory)
              |
              `--- bin (compiled game)
              |
              `--- zensekai-click (click package)
        

        And the Makefile in zensekai copies/compiles all the game binaries that should be needed for either the desktop version or the click package.

        From reading the clickable documentation I felt like I should be able to set the project root to ../ aka zensekai and from the zensekai-click/CMakeLists.txt file copy in binaries from bin. But CMake seems to only want to put files in zensekai-click into the container for building, and I have no idea what command or "makefile" to use for the pure or custom builders much less whether they can do this, and I'm very confused.

        1 Reply Last reply Reply Quote 0
        • ValenoernV Offline
          Valenoern
          last edited by Valenoern

          The solution to this was laughably simple.
          all I had to do was touch CMakeLists.txt making a completely empty file in the zensekai directory, and then CMake automatically decided to continue in zensekai-click with the other CMakeLists.txt.


          edit 7-13:
          There was actually a little more required.

          in the top CMakeLists.txt I had to put

          add_subdirectory(zensekai-click)
          

          and in the zensekai-click one I accessed/disambiguated the two directories with

          # set $PR_ROOT to upper directory
          get_filename_component(PR_ROOT "../" ABSOLUTE)
          # set $CLICK_DIR to zensekai-click directory
          set(CLICK_DIR "${PR_ROOT}/zensekai-click")
          

          another thing you might run into developing a click package that copies binaries is permissions on binaries.
          I set them in the loop that copies the binaries like so:

          foreach(binary ${BINARIES})
                  install(FILES ${PR_ROOT}/bin/${binary}
                          # the important part
                          PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
                          # this might actually be unnecessarily permissive*.
                          # it might be enough to just have OWNER_READ and OWNER_EXECUTE
                          DESTINATION ${DATA_DIR}
                  )
          endforeach()
          

          (* I got sidetracked thinking the permissions weren't enough when I accidentally had my project copying the x86_64 godot binary for a bit - which had bash claiming it "wasn't permitted" to execute while it actually meant that was impossible.)

          1 Reply Last reply Reply Quote 3

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post