1
0
mirror of https://github.com/blupi-games/planetblupi-dev synced 2024-12-30 13:55:36 +01:00

Started work on Android port

This commit is contained in:
krzys-h 2017-10-29 13:28:04 +01:00
parent 5c969f0cd6
commit 5f26678ce2
79 changed files with 3831 additions and 29 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,9 @@ include (${CMAKE_ROOT}/Modules/ExternalProject.cmake)
include_directories (${CMAKE_BINARY_DIR}/include)
link_directories (${CMAKE_BINARY_DIR}/lib)
set (STATIC_BUILD true)
option (STATIC_BUILD "Build Planet Blupi statically" ON)
option (ANDROID "Enable when building for Android" OFF)
#project(planetblupi-dev)
# It's an hack in order to be able to link statically planetblupi on darwin.
if (APPLE)
@ -23,6 +25,35 @@ if (APPLE)
set (CMD_CPPFLAGS "-I${CMAKE_BINARY_DIR}/include")
endif ()
if (ANDROID)
# It's really hard to get non-CMake projects build with Android NDK directly, so we'll start by
# generating a standalone toolchain (at configure time)
execute_process(COMMAND ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh
--platform=${ANDROID_NATIVE_API_LEVEL}
--toolchain=${ANDROID_TOOLCHAIN_NAME}
--install-dir=${CMAKE_BINARY_DIR}/toolchain
--arch=${ANDROID_SYSROOT_ABI}
--stl=libc++ ) # TODO: Should probably use ANDROID_STL instead of hardcoding, but the names are different (libc++ vs c++_static)
# Prepare all cross-compilation options that need to be passed to child CMake projects
set (ADDITIONAL_CMAKE_OPTIONS
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
# Prepare all cross-compilation options needed for configure-based projects
set (ADDITIONAL_CONFIGURE_OPTIONS
--host=${ANDROID_HEADER_TRIPLE}
)
set (ADDITIONAL_TOOL_OPTIONS
CC=clang
CXX=clang++
)
set (CMD_PATH "${CMAKE_BINARY_DIR}/toolchain/bin")
set (CMD_CHOST "${ANDROID_HEADER_TRIPLE}")
endif()
configure_file (cmd.sh.in cmd.sh @ONLY)
set (CMD ${CMAKE_BINARY_DIR}/cmd.sh)
@ -44,7 +75,7 @@ else ()
ExternalProject_Add (zlib_Project
URL http://www.zlib.net/zlib-1.2.11.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--static
BUILD_COMMAND ${CMD} make
@ -61,7 +92,7 @@ endif ()
ExternalProject_Add (argagg_Project
URL https://github.com/vietjtnguyen/argagg/archive/0.4.6.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR} ${ADDITIONAL_CMAKE_OPTIONS}
)
##########
@ -71,7 +102,7 @@ ExternalProject_Add (argagg_Project
ExternalProject_Add (libcurl_Project
URL https://curl.haxx.se/download/curl-7.55.0.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
@ -110,6 +141,7 @@ ExternalProject_Add (libcurl_Project
--without-librtmp
--without-nghttp2
--without-libidn2
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
@ -125,10 +157,11 @@ if (NOT APPLE)
ExternalProject_Add (libiconv_Project
URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
@ -148,10 +181,11 @@ endif ()
ExternalProject_Add (gettext_Project
URL http://mirror.switch.ch/ftp/mirror/gnu/gettext/gettext-0.19.8.1.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND cd gettext-runtime && ${CMD} ./configure
CONFIGURE_COMMAND cd gettext-runtime && ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make -C gettext-runtime
INSTALL_COMMAND ${CMD} make -C gettext-runtime install
BUILD_IN_SOURCE 1
@ -164,12 +198,13 @@ ExternalProject_Add (gettext_Project
#########
ExternalProject_Add (libpng_Project
URL http://prdownloads.sourceforge.net/libpng/libpng-1.6.28.tar.xz?download
URL http://prdownloads.sourceforge.net/libpng/libpng-1.6.28.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
@ -181,6 +216,18 @@ ExternalProject_Add (libpng_Project
## FFmpeg
#########
if (ANDROID)
set (ADDITIONAL_FFMPEG_CONFIGURE_OPTIONS
--enable-cross-compile
--target-os=android
--arch=${ANDROID_SYSROOT_ABI}
--cross-prefix=${CMAKE_BINARY_DIR}/toolchain/bin/${ANDROID_HEADER_TRIPLE}-)
# TODO: We should really be using clang (gcc is deprecated in android NDK) but it doesn't work :(
# Try building with:
#--toolchain=clang-usan
#--as=${CMAKE_BINARY_DIR}/toolchain/bin/${ANDROID_HEADER_TRIPLE}-gcc # Workaround for missing as in clang, looks quite stupid but it works
endif ()
ExternalProject_Add (FFmpeg_Project
URL http://www.ffmpeg.org/releases/ffmpeg-3.2.4.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
@ -218,6 +265,7 @@ ExternalProject_Add (FFmpeg_Project
--disable-libxcb-shm
--disable-libxcb-xfixes
--disable-libxcb-shape
${ADDITIONAL_FFMPEG_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
@ -228,16 +276,17 @@ ExternalProject_Add (FFmpeg_Project
## libasound
############
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT ANDROID)
ExternalProject_Add (libasound_Project
URL ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.4.1.tar.bz2
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-old-symbols
--disable-python
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
@ -249,11 +298,11 @@ endif ()
## libpulse
###########
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT ANDROID)
ExternalProject_Add (libpulse_Project
URL https://freedesktop.org/software/pulseaudio/releases/pulseaudio-11.0.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
@ -291,6 +340,7 @@ if (UNIX AND NOT APPLE)
--without-speex
--without-soxr
--with-database=simple
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install INSTALLDIR=${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 1
@ -303,7 +353,7 @@ endif ()
## SDL2
#######
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT ANDROID)
set (SDL2_CONFIGURE --enable-video-x11
--enable-x11-shared
--enable-video-wayland
@ -323,23 +373,27 @@ elseif (MINGW)
elseif (APPLE)
set (SDL2_CONFIGURE --enable-video-opengl
--enable-video-cocoa)
elseif (ANDROID)
set (SDL2_CONFIGURE --disable-pulseaudio)
endif ()
set (SDL2_DEPENDS zlib_Project)
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT ANDROID)
set (SDL2_DEPENDS ${SDL2_DEPENDS} libasound_Project libpulse_Project)
endif ()
ExternalProject_Add (SDL2_Project
URL http://hg.libsdl.org/SDL/archive/3d0bbfe683a8.tar.bz2
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-joystick
#--disable-joystick
--enable-joystick # TODO: Default SDL2 android skeleton requires joystick to build, could be probably fixed by commenting out some things
--disable-haptic
${SDL2_CONFIGURE}
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
@ -354,11 +408,13 @@ ExternalProject_Add (SDL2_Project
ExternalProject_Add (SDL2_image_Project
URL https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
# SDL_MAIN_HANDLED fixes test program linking on Android
# TODO: Is there a better way to handle this?
CONFIGURE_COMMAND CFLAGS=-DSDL_MAIN_HANDLED ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-sdl-test
--disable-sdltest
--disable-bmp
--disable-gif
--disable-jpg
@ -376,6 +432,7 @@ ExternalProject_Add (SDL2_image_Project
--disable-xv
--disable-webp
--disable-webp-shared
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
@ -395,7 +452,9 @@ endif ()
ExternalProject_Add (SDL2_mixer_Project
URL https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
# SDL_MAIN_HANDLED fixes test program linking on Android
# TODO: Is there a better way to handle this?
CONFIGURE_COMMAND CFLAGS=-DSDL_MAIN_HANDLED ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
@ -422,6 +481,7 @@ ExternalProject_Add (SDL2_mixer_Project
--disable-music-mp3-smpeg-shared
--disable-smpegtest
--disable-music-mp3-mad-gpl
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
@ -438,8 +498,8 @@ ExternalProject_Add (SDL_kitchensink_Project
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/SDL_kitchensink
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_COMMAND ${CMD} cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
CMAKE_COMMAND ${CMD} ${CMAKE_COMMAND}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> ${ADDITIONAL_CMAKE_OPTIONS}
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_ALWAYS 1
DEPENDS SDL2_Project FFmpeg_Project
@ -480,7 +540,7 @@ set (planetblupi_DEPS
libpng_Project
gettext_Project
)
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT ANDROID)
list (APPEND planetblupi_DEPS libasound_Project libpulse_Project)
endif ()
@ -489,18 +549,32 @@ ExternalProject_Add (planetblupi_Project
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/planetblupi
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_COMMAND ${CMD} cmake
CMAKE_COMMAND ${CMD} ${CMAKE_COMMAND}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DAPPIMAGE_APPRUN_PROGRAM=${APPIMAGE_APPRUN_PROGRAM}
-DAPPIMAGE_ASSISTANT_PROGRAM=${APPIMAGE_TOOL_PROGRAM}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DSTATIC_BUILD=${STATIC_BUILD}
-DSIGN_APP=${SIGN_APP}
-DANDROID=${ANDROID}
${ADDITIONAL_CMAKE_OPTIONS}
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_ALWAYS 1
DEPENDS ${planetblupi_DEPS}
)
if (ANDROID)
#find_package (PkgConfig REQUIRED)
#pkg_search_module (SDL2 REQUIRED sdl2)
add_library(main SHARED android/SDL_android_main.c)
add_dependencies (main planetblupi_Project)
target_link_libraries (main PUBLIC planetblupi)
#add_dependencies (main SDL2_Project)
target_link_libraries (main PUBLIC -lintl -liconv -lSDL2 -lSDL2_image -lSDL2_mixer -lcurl -lSDL_kitchensink_static -lpng -lavformat -lavcodec -lavutil -lswscale -lswresample -lz -lGLESv1_CM -lGLESv2 -llog -landroid ${CMAKE_CXX_STANDARD_LIBRARIES_INIT})
endif ()
add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
set (CPACK_SOURCE_GENERATOR "TBZ2")

565
CMakeLists.txt.bkp Normal file
View File

@ -0,0 +1,565 @@
cmake_minimum_required (VERSION 3.2)
include (${CMAKE_ROOT}/Modules/ExternalProject.cmake)
include_directories (${CMAKE_BINARY_DIR}/include)
link_directories (${CMAKE_BINARY_DIR}/lib)
option (STATIC_BUILD "Build Planet Blupi statically" ON)
option (ANDROID "Enable when building for Android" OFF)
# It's an hack in order to be able to link statically planetblupi on darwin.
if (APPLE)
set (ISAPPLE 1)
set (CMD_LDFLAGS "-L${CMAKE_BINARY_DIR}/lib -framework AudioToolBox -framework AudioUnit -framework CoreAudio -framework CoreFoundation -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework Carbon")
if (OLD_SDK)
set (OSX_SDK_VERSION 10.9)
set (CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${OSX_SDK_VERSION}.sdk/")
set (CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_SDK_VERSION})
set (CMD_CXXFLAGS "--sysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${OSX_SDK_VERSION} ${CMAKE_CXX_FLAGS}")
set (CMD_CFLAGS "--sysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${OSX_SDK_VERSION} ${CMAKE_C_FLAGS}")
endif ()
set (CMD_CPPFLAGS "-I${CMAKE_BINARY_DIR}/include")
endif ()
if (ANDROID)
set (ADDITIONAL_CONFIGURE_OPTIONS
--host=${ANDROID_HEADER_TRIPLE}
)
set (ADDITIONAL_CMAKE_OPTIONS
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL}
)
set (ADDITIONAL_TOOL_OPTIONS
CC=${CMAKE_C_COMPILER}
CPP=${CMAKE_CXX_COMPILER}
)
#set(CMD_CFLAGS "--target=${ANDROID_HEADER_TRIPLE} ${ANDROID_COMPILER_FLAGS}")
#set(CMD_CPPFLAGS "--target=${ANDROID_HEADER_TRIPLE} ${ANDROID_COMPILER_FLAGS}")
#set(CMD_CXXFLAGS "--target=${ANDROID_HEADER_TRIPLE} ${ANDROID_COMPILER_FLAGS}")
#set(CMD_LDFLAGS "--target=${ANDROID_HEADER_TRIPLE} ${ANDROID_LINKER_FLAGS}")
set(CMD_CFLAGS "--target=armv5te-none-linux-androideabi --gcc-toolchain=/opt/android-sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-sdk/ndk-bundle/sysroot -Dnative_lib_EXPORTS -isystem /opt/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include -isystem /opt/android-sdk/ndk-bundle/sources/android/support/include -isystem /opt/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include -isystem /opt/android-sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=19 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security")
set(CMD_CPPFLAGS "${CMD_CFLAGS}")
set(CMD_CXXFLAGS "${CMD_CXXFLAGS}")
set(CMD_LDFLAGS "--target=armv5te-none-linux-androideabi --gcc-toolchain=/opt/android-sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-sdk/ndk-bundle/sysroot -fPIC -isystem /opt/android-sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=19 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -Os -DNDEBUG -Wl,--exclude-libs,libgcc.a --sysroot /opt/android-sdk/ndk-bundle/platforms/android-19/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -L/opt/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now")
set(CMD_CHOST "${ANDROID_HEADER_TRIPLE}")
endif()
configure_file (cmd.sh.in cmd.sh @ONLY)
set (CMD ${CMAKE_BINARY_DIR}/cmd.sh)
#########
## zlib
#########
if (WIN32)
ExternalProject_Add (zlib_Project
URL http://www.zlib.net/zlib-1.2.11.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND
BUILD_COMMAND ${CMD} make -fwin32/Makefile.gcc
INSTALL_COMMAND ${CMD} make install -fwin32/Makefile.gcc
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
else ()
ExternalProject_Add (zlib_Project
URL http://www.zlib.net/zlib-1.2.11.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--static
BUILD_COMMAND ${CMD} make libz.a # don't make test programs
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
endif ()
#########
## argagg
#########
ExternalProject_Add (argagg_Project
URL https://github.com/vietjtnguyen/argagg/archive/0.4.6.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR} ${ADDITIONAL_CMAKE_OPTIONS}
)
##########
## libcurl
##########
ExternalProject_Add (libcurl_Project
URL https://curl.haxx.se/download/curl-7.55.0.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--enable-http
--disable-ftp
--disable-file
--disable-ldap
--disable-ldaps
--disable-rtsp
--disable-proxy
--disable-dict
--disable-telnet
--disable-tftp
--disable-pop3
--disable-imap
--disable-smb
--disable-smtp
--disable-gopher
--disable-manual
--disable-libcurl-option
--enable-ipv6
--disable-sspi
--disable-ntlm-wb
--disable-unix-socket
--without-winssl
--without-darwinssl
--without-ssl
--without-gnutls
--without-polarssl
--without-mbedtls
--without-cyassl
--without-axtls
--without-libpsl
--without-libmetalink
--without-libssh2
--without-librtmp
--without-nghttp2
--without-libidn2
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS zlib_Project
)
###########
## libiconv
###########
if (NOT APPLE)
ExternalProject_Add (libiconv_Project
URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
endif ()
##########
## gettext
##########
set (gettext_DEPENDS)
if (NOT APPLE)
set (gettext_DEPENDS ${gettext_DEPENDS} libiconv_Project)
endif ()
ExternalProject_Add (gettext_Project
URL http://mirror.switch.ch/ftp/mirror/gnu/gettext/gettext-0.19.8.1.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND cd gettext-runtime && ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make -C gettext-runtime
INSTALL_COMMAND ${CMD} make -C gettext-runtime install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS ${gettext_DEPENDS}
)
#########
## libpng
#########
ExternalProject_Add (libpng_Project
URL http://prdownloads.sourceforge.net/libpng/libpng-1.6.28.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS zlib_Project
)
#########
## FFmpeg
#########
ExternalProject_Add (FFmpeg_Project
URL http://www.ffmpeg.org/releases/ffmpeg-3.2.4.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-iconv
--disable-programs
--disable-doc
--disable-yasm
--disable-avdevice
--disable-avfilter
--disable-network
--disable-everything
--enable-decoder=cinepak,msvideo1,vorbis
--enable-demuxer=matroska
--enable-protocol=file
--disable-crystalhd
--disable-xvmc
--disable-vaapi
--disable-videotoolbox
--disable-vdpau
--disable-vda
--disable-nvenc
--disable-dxva2
--disable-d3d11va
--disable-audiotoolbox
--disable-zlib
--disable-bzlib
--disable-lzma
--disable-xlib
--disable-sdl2
--disable-libxcb
--disable-libxcb-shm
--disable-libxcb-xfixes
--disable-libxcb-shape
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
############
## libasound
############
if (UNIX AND NOT APPLE AND NOT ANDROID)
ExternalProject_Add (libasound_Project
URL ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.4.1.tar.bz2
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-old-symbols
--disable-python
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
endif ()
###########
## libpulse
###########
if (UNIX AND NOT APPLE AND NOT ANDROID)
ExternalProject_Add (libpulse_Project
URL https://freedesktop.org/software/pulseaudio/releases/pulseaudio-11.0.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--enable-alsa
--disable-nls
--disable-x11
--disable-tests
--disable-esound
--disable-waveout
--disable-gconf
--disable-glib2
--disable-gtk3
--disable-jack
--disable-asyncns
--disable-avahi
--disable-openssl
--disable-tcpwrap
--disable-lirc
--disable-dbus
--disable-udev
--disable-bluez4
--disable-bluez5
--disable-hal-compat
--disable-ipv6
--disable-webrtc-aec
--disable-systemd-daemon
--disable-systemd-login
--disable-systemd-journal
--disable-manpages
--disable-default-build-tests
--disable-legacy-database-entry-format
--enable-static-bins
--without-caps
--without-fftw
--without-speex
--without-soxr
--with-database=simple
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install INSTALLDIR=${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS libasound_Project
)
endif ()
#######
## SDL2
#######
if (UNIX AND NOT APPLE AND NOT ANDROID)
set (SDL2_CONFIGURE --enable-video-x11
--enable-x11-shared
--enable-video-wayland
--enable-wayland-shared
--enable-video-opengl
--enable-oss
--enable-alsa
--disable-alsa-shared
--disable-sndio
--disable-sndio-shared
--enable-pulseaudio
--disable-pulseaudio-shared)
elseif (MINGW)
set (SDL2_CONFIGURE --enable-directx
--enable-render-d3d
--enable-video-opengl)
elseif (APPLE)
set (SDL2_CONFIGURE --enable-video-opengl
--enable-video-cocoa)
elseif (ANDROID)
set (SDL2_CONFIGURE --disable-video-x11
--disable-video-wayland
--disable-video-mir
--disable-oss
--disable-alsa
--disable-sndio
--disable-pulseaudio)
endif ()
set (SDL2_DEPENDS zlib_Project)
if (UNIX AND NOT APPLE AND NOT ANDROID)
set (SDL2_DEPENDS ${SDL2_DEPENDS} libasound_Project libpulse_Project)
endif ()
ExternalProject_Add (SDL2_Project
URL http://hg.libsdl.org/SDL/archive/3d0bbfe683a8.tar.bz2
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${ADDITIONAL_TOOL_OPTIONS} ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-joystick
--disable-haptic
${SDL2_CONFIGURE}
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS ${SDL2_DEPENDS}
)
#############
## SDL2_image
#############
ExternalProject_Add (SDL2_image_Project
URL https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-sdl-test
--disable-bmp
--disable-gif
--disable-jpg
--disable-jpg-shared
--disable-lbm
--disable-pcx
--enable-png
--disable-png-shared
--disable-pnm
--disable-tga
--disable-tif
--disable-tif-shared
--disable-xcf
--disable-xpm
--disable-xv
--disable-webp
--disable-webp-shared
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS SDL2_Project libpng_Project
)
#############
## SDL2_mixer
#############
set (SDL2_mixer_DEPENDS SDL2_Project)
if (NOT APPLE)
set (SDL2_mixer_DEPENDS ${SDL2_mixer_DEPENDS} libiconv_Project)
endif ()
ExternalProject_Add (SDL2_mixer_Project
URL https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-sdltest
--disable-music-cmd
--enable-music-wave
--disable-music-mod
--disable-music-mod-modplug
--disable-music-mod-modplug-shared
--disable-music-mod-mikmod
--disable-music-mod-mikmod-shared
--enable-music-midi
--enable-music-midi-timidity
--enable-music-midi-native
--disable-music-midi-fluidsynth
--disable-music-midi-fluidsynth-shared
--disable-music-ogg
--disable-music-ogg-tremor
--disable-music-ogg-shared
--disable-music-flac
--disable-music-flac-shared
--disable-music-mp3
--disable-music-mp3-smpeg
--disable-music-mp3-smpeg-shared
--disable-smpegtest
--disable-music-mp3-mad-gpl
${ADDITIONAL_CONFIGURE_OPTIONS}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS ${SDL2_mixer_DEPENDS}
)
##################
## SDL_kitchensink
##################
ExternalProject_Add (SDL_kitchensink_Project
URL ${CMAKE_SOURCE_DIR}/SDL_kitchensink
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/SDL_kitchensink
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_COMMAND ${CMD} cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> ${ADDITIONAL_CMAKE_OPTIONS}
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_ALWAYS 1
DEPENDS SDL2_Project FFmpeg_Project
)
##############
## planetblupi
##############
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (APPIMAGE_APPRUN_BIN "AppRun-x86_64")
set (APPIMAGE_APPRUN_URL "https://github.com/probonopd/AppImageKit/releases/download/continuous/${APPIMAGE_APPRUN_BIN}")
set (APPIMAGE_APPRUN_PROGRAM "${CMAKE_BINARY_DIR}/bin/${APPIMAGE_APPRUN_BIN}")
set (APPIMAGE_TOOL_BIN "appimagetool-x86_64.AppImage")
set (APPIMAGE_TOOL_URL "https://github.com/probonopd/AppImageKit/releases/download/continuous/${APPIMAGE_TOOL_BIN}")
set (APPIMAGE_TOOL_PROGRAM "${CMAKE_BINARY_DIR}/bin/${APPIMAGE_TOOL_BIN}")
if (NOT EXISTS "${APPIMAGE_APPRUN_PROGRAM}")
file (DOWNLOAD "${APPIMAGE_APPRUN_URL}" "${APPIMAGE_APPRUN_PROGRAM}")
endif ()
if (NOT EXISTS "${APPIMAGE_TOOL_PROGRAM}")
file (DOWNLOAD "${APPIMAGE_TOOL_URL}" "${APPIMAGE_TOOL_PROGRAM}")
endif ()
execute_process (COMMAND /bin/chmod 0755 "${APPIMAGE_APPRUN_PROGRAM}")
execute_process (COMMAND /bin/chmod 0755 "${APPIMAGE_TOOL_PROGRAM}")
endif ()
set (planetblupi_DEPS
argagg_Project
libcurl_Project
SDL2_Project
SDL2_image_Project
SDL2_mixer_Project
SDL_kitchensink_Project
libpng_Project
gettext_Project
)
if (UNIX AND NOT APPLE AND NOT ANDROID)
list (APPEND planetblupi_DEPS libasound_Project libpulse_Project)
endif ()
ExternalProject_Add (planetblupi_Project
URL ${CMAKE_SOURCE_DIR}/planetblupi
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/planetblupi
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_COMMAND ${CMD} cmake
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DAPPIMAGE_APPRUN_PROGRAM=${APPIMAGE_APPRUN_PROGRAM}
-DAPPIMAGE_ASSISTANT_PROGRAM=${APPIMAGE_TOOL_PROGRAM}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DSTATIC_BUILD=${STATIC_BUILD}
-DSIGN_APP=${SIGN_APP}
-DANDROID=${ANDROID}
${ADDITIONAL_CMAKE_OPTIONS}
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_ALWAYS 1
DEPENDS ${planetblupi_DEPS}
)
if (ANDROID)
find_package (PkgConfig REQUIRED)
pkg_search_module (SDL2 REQUIRED sdl2)
add_library(main SHARED android/SDL_android_main.c)
#add_dependencies(main planetblupi_Project SDL2_Project)
add_dependencies(main SDL2_Project)
#target_link_libraries (main PUBLIC ${CMAKE_BINARY_DIR}/bin/libplanetblupi.a)
target_link_libraries(main PUBLIC ${SDL2_STATIC_LIBRARIES})
endif ()
add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
set (CPACK_SOURCE_GENERATOR "TBZ2")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "planetblupi-dev")
set (CPACK_SOURCE_IGNORE_FILES "/build/;/Debug/;/Release/;/.git/;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack)

9
MyApplication/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild

22
MyApplication/.idea/compiler.xml generated Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

18
MyApplication/.idea/gradle.xml generated Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

62
MyApplication/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

9
MyApplication/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/MyApplication.iml" filepath="$PROJECT_DIR$/MyApplication.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

1
MyApplication/app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,45 @@
# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds it for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
# Associated headers in the same location as their source
# file are automatically included.
src/main/cpp/native-lib.cpp )
# Searches for a specified prebuilt library and stores the path as a
# variable. Because system libraries are included in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in the
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib} )

View File

@ -0,0 +1,40 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "pl.krzysh.myapplication"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
arguments "-DANDROID_STL=c++_static"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
testCompile 'junit:junit:4.12'
}

17
MyApplication/app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /opt/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -0,0 +1,26 @@
package pl.krzysh.myapplication;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("pl.krzysh.myapplication", appContext.getPackageName());
}
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="pl.krzysh.myapplication"
xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,11 @@
#include <jni.h>
#include <string>
extern "C"
jstring
Java_pl_krzysh_myapplication_MainActivity_stringFromJNI(
JNIEnv *env,
jobject /* this */) {
std::string hello = "Hello from C++";
return env->NewStringUTF(hello.c_str());
}

View File

@ -0,0 +1,29 @@
package pl.krzysh.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
// Used to load the 'native-lib' library on application startup.
static {
System.loadLibrary("native-lib");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Example of a call to a native method
TextView tv = (TextView) findViewById(R.id.sample_text);
tv.setText(stringFromJNI());
}
/**
* A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application.
*/
public native String stringFromJNI();
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/activity_main"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="pl.krzysh.myapplication.MainActivity">
<TextView
android:id="@+id/sample_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"/>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">My Application</string>
</resources>

View File

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@ -0,0 +1,17 @@
package pl.krzysh.myapplication;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

View File

@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@ -0,0 +1,17 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

160
MyApplication/gradlew vendored Executable file
View File

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
MyApplication/gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1 @@
include ':app'

9
android/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild

22
android/.idea/compiler.xml generated Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

18
android/.idea/gradle.xml generated Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

62
android/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

9
android/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/android.iml" filepath="$PROJECT_DIR$/android.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>

12
android/.idea/runConfigurations.xml generated Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -0,0 +1,84 @@
/*
SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14
*/
//#include "../../SDL_internal.h"
#ifdef __ANDROID__
/* Include the SDL main definition header */
//#include "SDL_main.h"
#include <SDL2/SDL.h>
/*******************************************************************************
Functions called by JNI
*******************************************************************************/
#include <jni.h>
/* Called before SDL_main() to initialize JNI bindings in SDL library */
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
/* This prototype is needed to prevent a warning about the missing prototype for global function below */
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array);
/* Start up the SDL app */
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array)
{
int i;
int argc;
int status;
int len;
char** argv;
/* This interface could expand with ABI negotiation, callbacks, etc. */
SDL_Android_Init(env, cls);
SDL_SetMainReady();
/* Prepare the arguments. */
len = (*env)->GetArrayLength(env, array);
argv = SDL_stack_alloc(char*, 1 + len + 1);
argc = 0;
/* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works.
https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start
*/
argv[argc++] = SDL_strdup("app_process");
for (i = 0; i < len; ++i) {
const char* utf;
char* arg = NULL;
jstring string = (*env)->GetObjectArrayElement(env, array, i);
if (string) {
utf = (*env)->GetStringUTFChars(env, string, 0);
if (utf) {
arg = SDL_strdup(utf);
(*env)->ReleaseStringUTFChars(env, string, utf);
}
(*env)->DeleteLocalRef(env, string);
}
if (!arg) {
arg = SDL_strdup("");
}
argv[argc++] = arg;
}
argv[argc] = NULL;
/* Run the application. */
status = SDL_main(argc, argv);
/* Release the arguments. */
for (i = 0; i < argc; ++i) {
SDL_free(argv[i]);
}
SDL_stack_free(argv);
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
/* exit(status); */
return status;
}
#endif /* __ANDROID__ */
/* vi: set ts=4 sw=4 expandtab: */

1
android/app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.4.1)
add_library(main SHARED src/main/cpp/SDL_android_main.c)
target_link_libraries(main libplanetblupi.a`)

43
android/app/build.gradle Normal file
View File

@ -0,0 +1,43 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "org.libsdl.app"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
//cppFlags "-std=c++11 -frtti -fexceptions"
arguments "-DANDROID=TRUE", "-DANDROID_STL=c++_static"
}
}
ndk {
abiFilters 'armeabi'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "../../CMakeLists.txt"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
testCompile 'junit:junit:4.12'
}

17
android/app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /opt/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -0,0 +1,26 @@
package org.libsdl.app;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("org.libsdl.app", appContext.getPackageName());
}
}

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Replace org.libsdl.app with the identifier of your game below, e.g.
com.gamemaker.game
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.libsdl.app"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<!-- Android 2.3.3 -->
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="12" />
<!-- OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" />
<!-- Allow writing to external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- if you want to capture audio, uncomment this. -->
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
<!-- Create a Java class extending SDLActivity and place it in a
directory under src matching the package, e.g.
src/com/gamemaker/game/MyGame.java
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
in the XML below.
An example Java class can be found in README-android.md
-->
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:allowBackup="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true" >
<activity android:name="SDLActivity"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Drop file event -->
<!--
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
-->
</activity>
</application>
</manifest>

View File

@ -0,0 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.libsdl.app">
<application android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
</application>
</manifest>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Planet Blupi</string>
</resources>

View File

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, SDLActivity"
/>
</LinearLayout>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">SDL App</string>
</resources>

View File

@ -0,0 +1,17 @@
package org.libsdl.app;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

23
android/build.gradle Normal file
View File

@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

17
android/gradle.properties Normal file
View File

@ -0,0 +1,17 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

160
android/gradlew vendored Executable file
View File

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
android/gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

1
android/settings.gradle Normal file
View File

@ -0,0 +1 @@
include ':app'

View File

@ -5,11 +5,16 @@ export INCLUDE_PATH="@CMAKE_BINARY_DIR@/include"
export LIBRARY_PATH="@CMAKE_BINARY_DIR@/lib"
export BINARY_PATH="@CMAKE_BINARY_DIR@/bin"
if [ "@ISAPPLE@" = "1" ]; then
export LDFLAGS="$LDFLAGS @CMD_LDFLAGS@"
export CXXFLAGS="$CXXFLAGS @CMD_CXXFLAGS@"
export CFLAGS="$CFLAGS @CMD_CFLAGS@"
export CPPFLAGS="$CPPFLAGS @CMD_CPPFLAGS@"
export LDFLAGS="$LDFLAGS @CMD_LDFLAGS@"
export CXXFLAGS="$CXXFLAGS @CMD_CXXFLAGS@"
export CFLAGS="$CFLAGS @CMD_CFLAGS@"
export CPPFLAGS="$CPPFLAGS @CMD_CPPFLAGS@"
export CHOST="@CMD_CHOST@"
export CMD_PATH="@CMD_PATH@"
if [ ! -z "CMD_PATH" ]; then
export PATH="$CMD_PATH:$PATH"
fi
cmd=$1

@ -1 +1 @@
Subproject commit 92d96d6ce2a7d52a0f6599fb87be5277df735b76
Subproject commit a87676f7f3067199e342487ade743e566155c4e9