Skip to content

loki-47-6F-64/superglue

Repository files navigation

Djinni requires the Java Development Kit.

On the MAC, these packages must be installed, preferably through [brew install]

cmake, autogen, autoconf, automake, autogen

Building superglue

  1. Download and build https://github.com/loki-47-6F-64/superglue
  2. Copy config.json.example to config.json and modify it to your needs.
  3. Execute: superglue init
  4. Execute: superglue external [debug | release]

To rebuild: execute superglue build [debug | release]

To update djinni:

  • Execute: git subtree pull --prefix djinni [email protected]:dropbox/djinni.git master --squash

To update kitty:

  • Execute: git subtree pull --prefix kitty [email protected]:loki-47-6F-64/kitty.git master --squash

Debugging superglue

Android

  1. Add a breakpoint at the start of the app.
  2. Start the app in debug mode.
  3. Execute: superglue gdb

Developing using superglue

Make sure to call System.loadLibrary("superglue"); before using libsuperglue in Android

Add the following settings in your xcode project

  1. Add dependencies: libc++.dylib, Any libs in "$(PROJECT_DIR)/superglue/libs"
  2. Add search header: "$(PROJECT_DIR)/superglue/include"

Modules

In BuildExternal.cmake, simply add include(Module[Name]) Superglue will automatically install the modules in the root folder of your project.

If modules contain views, simply start that view, the module will handle the rest.

Android Studio

in settings.gradle, simply add all modules installed in your root directory.

Xcode

Add a reference to 'superglue/[ModuleName]/xcodeproj/[ModuleName].xcodeproj' The README.md will specify what must be added in:

  • info.plist
  • Libraries and frameworks
  • Module specific instructions.

Compiling subtleties

This must be updated if you encounter a difference compiling c++ between iOS and Android.

  • iOS lacks support for Thread Local Storage.
  • Android lacks support for std::to_string.

Developing

Mac

  1. Generate project files using superglue.
  2. Open the project in XCode.
  3. Build using superglue

Linux

  1. Use KDevelop or Clion, they support cmake based project natively.
  2. Build using superglue

The Code

project structure

root
    cmake <- [Contains cmake files for including the modules]
        patch <- [Contains any patches for third party libraries]
    djinni <- [The tool to create the glue between c++ and java/objc]
    jni <- [Building and installing the layer between superglue and android]
    objc <- [Building and installing the layer between superglue and iOS]
    src <- [Building superglue]
    wrappers <- [Wrappers that simplify or enhance the interfaces for third party libraries]
    modules <- [Android studio project, open this if you wish to change any code for modules for android]
        superglue <- [Android Studio project where all java files generated by djinni get dumped]
        [module] <- [Android Studio project for the module]
            djinni <- [Contains any djinni files for the module]
            native <- [Contains native code for the module]
            xcodeproj <- [Xcode project for the module]
    kitty <- [Library containing useful snippets of code]
    
    android.cmake <- [Toolchain file]
    iOS.cmake <- [Toolchain file]
    run_djinni.sh <- [Script to run djinni]

Download[LIB].cmake

These cmake files will automatically download and build third party libraries.

  • [HEADER_INCLUDE_DIRS]
  • [TARGET_LIBRARIES] <- [Any libraries build]
  • [WRAPPER_SOURCES] <- [Any wrappers for the library]

Please check the documentation on the library you wish to include on how to build for android and iOS.

If you want to use an entire module, simple include Module[NAME] in BuildExternal.cmake

Adding a custom 3rd party library.

If the project is header-only, use DownloadHeaderOnlyDummy.cmake as a reference instead of DownloadDummy.cmake

  • In the subfolder cmake copy DownloadDummy.cmake to Download[LIB].cmake
  • Modify it to suit your needs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published