AshampooSystems / boden
- вторник, 4 декабря 2018 г. в 00:16:25
C++
Truly native C++ cross-platform framework for Android and iOS development
Rock solid and truly native C++ cross-platform framework for Android and iOS development
🚧 👷♂️ We are happy to release our first preview of the Boden framework. Please be aware that this is an early preview release featuring a small set of widgets and limited layout functionality. We’re happy about your feedback.
You can use macOS to build both iOS and Android apps. Windows and Linux can be used to build Android apps only. This guide will help you set up your system for developing Boden apps.
Which platform do you want to set up for development?
Choose your target platform: iOS or Android.
To build iOS apps on macOS, the following dependencies need to be installed:
If you are not sure whether all of the dependencies listed above are installed, jump to the Dependency Installation Guide for iOS on macOS and follow the steps listed there.
Follow these steps to set up Boden for iOS development:
Open the Terminal app and clone the git repository:
git clone https://github.com/AshampooSystems/boden.git
Run the boden
build tool to generate an Xcode project:
cd boden
./boden prepare -p ios
Open the generated project in Xcode:
open build/ios/std/Xcode/boden.xcodeproj
In Xcode select the uidemo
target and press Cmd+R to build and run the example application.
Continue to the Getting Started section to learn how to create your first boden app.
To build Android apps on macOS, the following dependencies need to be installed:
If you are not sure whether all of the dependencies listed above are installed, jump to the Dependency Installation Guide for Android on macOS and follow the steps listed there to install them.
Follow these steps to set up Boden for Android development on the Mac:
Open the terminal and clone the git repository:
git clone https://github.com/AshampooSystems/boden.git
Run the boden
build tool to prepare an Android Studio project:
cd boden
./boden prepare -p android
Run Android Studio and open boden/build/android/std/AndroidStudio
.
Wait for Android Studio to finish its gradle sync and configuration, then select the uidemo
target and press Ctrl+R to build and run the example application.
Continue to the Getting Started section to learn how to create your first boden app.
To build Android apps on Windows, the following dependencies need to be installed:
If you are not sure whether all of the dependencies listed above are installed, jump to the Dependency Installation Guide for Android on Windows and follow the steps listed there to install them.
Follow these steps to set up Boden for Android development on Windows 10:
Open a Command Prompt: Hit Win+R, type cmd
and then hit Enter.
Clone the git repository:
git clone https://github.com/AshampooSystems/boden.git
Run the boden.py
build tool to generate an Android Studio project:
cd boden
python boden.py prepare
Run Android Studio and open boden/build/android/std/AndroidStudio
.
Wait for Android Studio to finish its gradle sync and configuration, then select the uidemo
target and press Shift+F10 to build and run the example application.
Continue to the Getting Started section to learn how to create your first boden app.
To build Android apps on Linux, the following dependencies need to be installed:
python3-distutils
)If you are not sure whether all of the dependencies listed above are installed, jump to the Dependency Installation Guide for Android on Linux and follow the steps listed there to install them.
Follow these steps to set up Boden for Android development on Ubuntu:
Open up a terminal and clone the git repository:
git clone https://github.com/AshampooSystems/boden.git
Run the boden
build tool to generate an Xcode project:
cd boden
./boden prepare
Run Android Studio and open boden/build/android/std/AndroidStudio
.
Wait for Android Studio to finish its gradle sync and configuration, select the uidemo
target and press Shift+F10 to build and run the example application.
If Android Studio displays an error stating that permission to
/dev/kvm
is denied, make sure that you have added your user to thekvm
group.
To create your first Boden project, open up a terminal (or command prompt), change to your local boden
directory, and execute the following commands:
python boden.py new -n AwesomeApp
cd AwesomeApp
python ../boden.py open
This will create a new folder named AwesomeApp
and generate source and project files for a simple Hello World cross-platform application. The last command will prepare and open an Xcode project on the Mac or an Android Studio project on Linux/Windows.
In Xcode, select the AwesomeApp
target and then press Cmd+R to build and run the Hello World application.
In Android Studio, wait for Gradle to finish its sync and configuration processes and then select the uidemo
target and press Cmd+R to build and run the example application, then select the AwesomeApp
target and then press Ctrl+R on Mac or Shift+F10 on Linux/Windows to build an run the Hello World application.
Note: On macOS and Linux you can also simply type
./boden
instead of callingpython boden.py
explicitly. If you want to build the Android version of the app on macOS, run../boden open -p android
.
Let's take a quick look at the source code generated by the boden new
command:
// MainViewController.cpp
#include <bdn/init.h>
#include <bdn/Button.h>
#include "MainViewController.h"
MainViewController::MainViewController()
{
_window = bdn::newObj<bdn::Window>();
_window->setTitle("AwesomeApp");
bdn::P<bdn::Button> button = bdn::newObj<bdn::Button>();
button->setLabel("Hello World");
_window->setContentView(button);
_window->requestAutoSize();
_window->requestCenter();
_window->setVisible(true);
}
MainViewController.cpp
is the most interesting part of the source generated for the Hello World application. The main view controller will be instantiated at application launch. It's responsible for setting up the application's user interface. Let's take a deeper look at the source:
First, we create a new Window
and set its title to AwesomeApp
.
_window = bdn::newObj<bdn::Window>();
_window->setTitle("AwesomeApp");
We then instantiate a new Button
and set its label to "Hello World".
bdn::P<bdn::Button> button = bdn::newObj<bdn::Button>();
button->setLabel("Hello World");
As the button is the only control which we will be displaying in this example, we'll set it as the window's content view.
_window->setContentView(button);
Finally, we need some boilerplate code to set the window's geometry and visibility.
_window->requestAutoSize();
_window->requestCenter();
_window->setVisible(true);
sudo xcodeselect -s /Applications/Xcode.app/Contents/Developer
.Install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Python and CMake:
brew install python3 cmake
Install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Java 8:
brew tap caskroom/versions
brew cask install java8
Install Python and CMake:
brew install python3 cmake
For Boden, it's sufficient to select the default setup type in the Android Studio Setup wizard. When asked, grant permission to the Intel HAXM installer to allow for Android device emulation.
Download and install Python3 from https://www.python.org/downloads/ (ca. 25MB).
Important: Make sure to activate the “Add Python to PATH" checkbox at the bottom of the installer window.
Download and install CMake from https://cmake.org/download/ (ca. 19MB). We recommend using the latest win64-x64 stable release installer binary.
Download and install git from https://git-scm.com/download/win (ca. 42MB). If you’re unsure about the available options presented in the installer, just keep the default settings.
Important: When installing CMake, make sure to choose “Add the Cmake binary to the PATH environment variable”.
Dowload and install JDK 8 from https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html (ca. 200MB).
For Boden, it's sufficient to select the default setup type in the Android Studio Setup wizard. When asked, grant permission to the Intel HAXM installer to allow for Android device emulation.
Open up a terminal and run the following command:
sudo apt update && sudo apt install git cmake python3-distutils openjdk-8-jdk qemu-kvm
Download Android Studio from https://developer.android.com/studio/ (ca. 1GB) and unpack the downloaded ZIP file.
Open up a terminal and change to the directory to which you unpacked the ZIP file. To start Android Studio, run the following commands:
cd android-studio/bin
./studio.sh
Follow the steps in the setup wizard to complete the installation.
If you want to run Android Applications in the Android Emulator, follow the steps below.
Open up a terminal and run the following command:
sudo adduser YOUR_USERNAME kvm
Log out of Ubuntu by typing:
gnome-session-quit
Log back in. Android Emulator should now work on your system.
Make sure that the qemu-kvm
package is installed and your user is a member of the kvm
group. See Configure Ubuntu for Running Android Emulator for further instructions.
boden prepare
fails with a CMake error when setting up a Windows machine for Android developmentDouble-check whether the right Java version is installed. Android Studio requires the openjdk-8-jdk
package on Ubuntu Linux or Oracle JDK 8 on Windows. Other Java versions are not supported.
Android Studio needs several minutes for its initial preparation (gradle sync, etc.) when the project is first opened. If the build and run functions remain disabled after the preparation has finished please wait an additional minute or two. If they remain disabled then you may be experiencing a sporadically occurring Android Studio bug. Solution: click on the "N processes running" entry in the status bar and then on the play button next to "Indexing paused due to batch update".
We are happy about your feedback!
If you find something that is missing or doesn't work, please consider opening a GitHub issue.
If you want to talk to us directly, please send us an email to boden-team@ashampoo-systems.com.