Skip to content

xangcastle/polymeme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PolyMeme

PolyMeme is a cross-platform meme generation application powered by a shared C++ core (//core:meme_engine), demonstrating Bazel's ability to build for CLI, Android, and iOS from a single monorepo.

1. Build the CLI (Command Line Interface)

To build the terminal application, run the following command on your target operating system (Windows, Linux, or macOS). Bazel uses the local C++ toolchain by default.

bazel build //apps/cli:terminal_meme

Run the CLI:

bazel run //apps/cli:terminal_meme

2. Setup & Installation

Android Setup (Hermetic-ish)

Ideally, you want a clean setup. We use cmdline-tools to avoid installing the full Android Studio UI if not needed.

  1. Install Command Line Tools:

    brew install --cask android-commandlinetools
  2. Set Environment Variables: Add this to your ~/.zshrc (or ~/.bashrc) to configure SDK paths and add emulator and avdmanager to your PATH:

    export JAVA_HOME=$(/usr/libexec/java_home)
    export ANDROID_HOME="/opt/homebrew/share/android-commandlinetools"
    export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/27.2.12479018"
    export PATH="$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"

    Then run source ~/.zshrc.

  3. Install SDK Components:

    yes | sdkmanager --licenses
    sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" "ndk;27.2.12479018" "emulator"
  4. Create & Run Emulator (Pixel 8): Use the avdmanager CLI (now in your PATH) to create a device profile:

    1. List available device definitions (optional, to find "pixel_8")
    avdmanager list device
    1. Download system image (Android 34, ARM64 for Apple Silicon)
    sdkmanager "system-images;android-34;google_apis;arm64-v8a"

    3. Create Pixel 8 AVD

    echo "no" | avdmanager create avd -n pixel_8_avd -k "system-images;android-34;google_apis;arm64-v8a" -d "pixel_8" --force

    4. Run Emulator

    emulator -avd pixel_8_avd &

    
    *To list created emulators: `emulator -list-avds`*
    *To delete an emulator: `avdmanager delete avd -n pixel_8_avd`*
    
    

iOS Setup

  1. Install Xcode: Download and install Xcode from the Mac App Store.

  2. Select Xcode:

    sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
    sudo xcodebuild -license accept
  3. Install Simulators: Open Xcode, go to Settings > Platforms and ensure iOS Simulator runtime is installed. Or run:

    open -a Simulator

3. Build and Run on Android Emulator

Prerequisites:

  • Android SDK & NDK: Ensure you have the Android SDK and NDK installed.
  • Environment Variables: Set ANDROID_HOME and ANDROID_NDK_HOME.
    export ANDROID_HOME="$HOME/Library/Android/sdk" # Or your installation path
    export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/<version>"
  • Emulator: Start an Android emulator (e.g., via Android Studio or command line).

Build and Install:

Run the following command to build the app, install it on the running emulator, and launch it immediately. This command ensures the correct NDK toolchains and ABI (arm64-v8a) are used.

bazel mobile-install //apps/android:polymeme \
  --start_app \
  --extra_toolchains=@androidndk//:all \
  --android_platforms=@rules_android//:arm64-v8a \
  --tool_java_language_version=17 \
  --tool_java_runtime_version=17 \
  --java_language_version=17 \
  --java_runtime_version=17 \
  --adb="$ANDROID_HOME/platform-tools/adb"

Note: The --android_platforms flag ensures the native libraries are built for the emulator's architecture (ARM64).

4. Build and Run on iOS Simulator

Prerequisites:

  • Xcode: Install Xcode from the Mac App Store.
  • Accept License: sudo xcodebuild -license accept
  • Simulator: Ensure you have at least one iOS Simulator runtime installed.

Build and Run:

Use bazel run to build the app, boot the simulator, install, and launch the app.

For Apple Silicon Macs (M1/M2/M3), you must target the simulator architecture explicitly:

bazel run //apps/ios:polymeme --ios_multi_cpus=sim_arm64

For Intel Macs, use:

bazel run //apps/ios:polymeme --ios_multi_cpus=x86_64

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published