Permalink
Browse files

Android port builds

- cmake
  * correct root is used to search for pkg-config files (PKG_CONFIG_PATH env var)
- ports
  * Android ports fixed
  * ports.sh fixes paths in pkg-config files on installation
  • Loading branch information...
1 parent e2798b4 commit c97f152c06884d7d22d6f30a3c974480aa3f8881 @ducakar committed Dec 11, 2012
View
@@ -73,16 +73,17 @@ endif()
# Set-up include and library directories for different toolchains.
if( ANDROID )
- include_directories( SYSTEM ${PLATFORM_PREFIX}/usr/include ) # For KDevelop.
include_directories( SYSTEM ${PLATFORM_PORTS_PREFIX}/usr/include )
-
link_directories( ${PLATFORM_PORTS_PREFIX}/usr/lib )
+
+ set( ENV{PKG_CONFIG_PATH} ${PLATFORM_PORTS_PREFIX}/usr/lib/pkgconfig )
elseif( NACL )
- include_directories( SYSTEM ${PLATFORM_PREFIX}/include ) # For KDevelop.
include_directories( SYSTEM ${PLATFORM_PORTS_PREFIX}/usr/include )
-
link_directories( ${PLATFORM_PORTS_PREFIX}/usr/lib )
+
+ set( ENV{PKG_CONFIG_PATH} ${PLATFORM_PORTS_PREFIX}/usr/lib/pkgconfig )
elseif( WIN32 )
+ set( ENV{PKG_CONFIG_PATH} ${PLATFORM_PREFIX}/lib/pkgconfig )
else()
if( CMAKE_SYSTEM_NAME STREQUAL Linux )
find_package( ALSA REQUIRED )
View
@@ -161,6 +161,7 @@ The following commands may be given (`build` is assumed if none):
- `clean`: Delete all builds.
- `conf`: Delete all builds and configure (but not build) them anew.
- `build`: Configure (if necessary) and build all builds.
+- `pnacl`: Run `pnacl-translate` to convert client `.pexe` to platform-dependent `.nexe`s.
### `capture.sh` ###
@@ -245,6 +246,8 @@ The following alternative launches are available:
archives, HTML pages ...), starts a simple python web server in that directory at port 8000
(`python -m http.server`) and opens `localhost:8000` in chromium browser to test the web-based
NaCl port. If `strip` is passed as the second option, binaries are stripped too.
+- `pnacl`: Same as `nacl` command but create links `.nexe`s that were created from a `.pexe`
+ (use `./build.sh pnacl`).
Documentation
-------------
View
@@ -8,14 +8,15 @@
# - `clean`: Delete all builds.
# - `conf`: Delete all builds and configure (but not build) them anew.
# - `build`: Configure (if necessary) and build all builds.
+# - `pnacl`: Run `pnacl-translate` to convert client `.pexe` to platform-dependent `.nexe`s.
#
buildType=Debug
platforms=(
Linux-x86_64 Linux-x86_64-Clang Linux-i686 Linux-i686-Clang
Windows-i686
NaCl-x86_64 NaCl-i686 PNaCl
- #Android14-i686 Android14-ARM Android14-ARMv7a Android14-MIPS
+ Android14-i686 Android14-ARM Android14-ARMv7a Android14-MIPS
)
# Extract path to PNaCl SDK from CMake toolchain file.
@@ -8,8 +8,8 @@ set( PLATFORM_TOOL_PREFIX "/opt/android-ndk/toolchains/arm-linux-androidea
set( PLATFORM_STL_PREFIX "/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6" )
set( PLATFORM_PORTS_PREFIX "${CMAKE_SOURCE_DIR}/ports/Android14-ARM" )
set( PLATFORM_FLAGS "-fPIC -Wno-psabi --sysroot=${PLATFORM_PREFIX}" )
-set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isysroot ${PLATFORM_STL_PREFIX}/include" )
-set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isysroot ${PLATFORM_STL_PREFIX}/libs/armeabi/include" )
+set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isystem ${PLATFORM_STL_PREFIX}/include" )
+set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isystem ${PLATFORM_STL_PREFIX}/libs/armeabi/include" )
set( PLATFORM_STL_LIBRARY "${PLATFORM_STL_PREFIX}/libs/armeabi/libgnustl_shared.so" )
set( CMAKE_SYSTEM_NAME "Linux" CACHE STRING "Target system." )
@@ -8,8 +8,8 @@ set( PLATFORM_TOOL_PREFIX "/opt/android-ndk/toolchains/arm-linux-androidea
set( PLATFORM_STL_PREFIX "/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6" )
set( PLATFORM_PORTS_PREFIX "${CMAKE_SOURCE_DIR}/ports/Android14-ARMv7a" )
set( PLATFORM_FLAGS "-fPIC -Wno-psabi --sysroot=${PLATFORM_PREFIX}" )
-set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isysroot ${PLATFORM_STL_PREFIX}/include" )
-set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isysroot ${PLATFORM_STL_PREFIX}/libs/armeabi-v7a/include" )
+set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isystem ${PLATFORM_STL_PREFIX}/include" )
+set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isystem ${PLATFORM_STL_PREFIX}/libs/armeabi-v7a/include" )
set( PLATFORM_STL_LIBRARY "${PLATFORM_STL_PREFIX}/libs/armeabi-v7a/libgnustl_shared.so" )
set( CMAKE_SYSTEM_NAME "Linux" CACHE STRING "Target system." )
@@ -8,8 +8,8 @@ set( PLATFORM_TOOL_PREFIX "/opt/android-ndk/toolchains/mipsel-linux-androi
set( PLATFORM_STL_PREFIX "/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6" )
set( PLATFORM_PORTS_PREFIX "${CMAKE_SOURCE_DIR}/ports/Android14-MIPS" )
set( PLATFORM_FLAGS "-fPIC --sysroot=${PLATFORM_PREFIX}" )
-set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isysroot ${PLATFORM_STL_PREFIX}/include" )
-set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isysroot ${PLATFORM_STL_PREFIX}/libs/mips/include" )
+set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isystem ${PLATFORM_STL_PREFIX}/include" )
+set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isystem ${PLATFORM_STL_PREFIX}/libs/mips/include" )
set( PLATFORM_STL_LIBRARY "${PLATFORM_STL_PREFIX}/libs/mips/libgnustl_shared.so" )
set( CMAKE_SYSTEM_NAME "Linux" CACHE STRING "Target system." )
@@ -8,8 +8,8 @@ set( PLATFORM_TOOL_PREFIX "/opt/android-ndk/toolchains/x86-4.6/prebuilt/li
set( PLATFORM_STL_PREFIX "/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6" )
set( PLATFORM_PORTS_PREFIX "${CMAKE_SOURCE_DIR}/ports/Android14-i686" )
set( PLATFORM_FLAGS "-fPIC --sysroot=${PLATFORM_PREFIX}" )
-set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isysroot ${PLATFORM_STL_PREFIX}/include" )
-set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isysroot ${PLATFORM_STL_PREFIX}/libs/x86/include" )
+set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isystem ${PLATFORM_STL_PREFIX}/include" )
+set( PLATFORM_FLAGS "${PLATFORM_FLAGS} -isystem ${PLATFORM_STL_PREFIX}/libs/x86/include" )
set( PLATFORM_STL_LIBRARY "${PLATFORM_STL_PREFIX}/libs/x86/libgnustl_shared.so" )
set( CMAKE_SYSTEM_NAME "Linux" CACHE STRING "Target system." )
@@ -1,3 +1,5 @@
+set( PLATFORM_PREFIX "" )
+
set( CMAKE_SYSTEM_NAME "Linux" CACHE STRING "Target system." )
set( CMAKE_SYSTEM_PROCESSOR "i686" CACHE STRING "Target processor." )
set( CMAKE_C_COMPILER "/usr/bin/clang" )
@@ -1,3 +1,5 @@
+set( PLATFORM_PREFIX "" )
+
set( CMAKE_SYSTEM_NAME "Linux" CACHE STRING "Target system." )
set( CMAKE_SYSTEM_PROCESSOR "i686" CACHE STRING "Target processor." )
set( CMAKE_C_FLAGS "-march=i686 -m32 -msse3 -mfpmath=sse" CACHE STRING "" )
@@ -1,3 +1,5 @@
+set( PLATFORM_PREFIX "" )
+
set( CMAKE_SYSTEM_NAME "Linux" CACHE STRING "Target system." )
set( CMAKE_SYSTEM_PROCESSOR "x86_64" CACHE STRING "Target processor." )
set( CMAKE_C_COMPILER "/usr/bin/clang" )
@@ -1,3 +1,5 @@
+set( PLATFORM_PREFIX "" )
+
set( CMAKE_SYSTEM_NAME "Linux" CACHE STRING "Target system." )
set( CMAKE_SYSTEM_PROCESSOR "x86_64" CACHE STRING "Target processor." )
set( CMAKE_C_FLAGS "-march=x86-64 -m64 -msse3" CACHE STRING "" )
View
@@ -2,12 +2,23 @@ cat << EOF > CMakeLists.txt
cmake_minimum_required( VERSION 2.8 )
project( SDL2 )
+set( prefix "$buildDir/usr" )
+set( exec_prefix "$buildDir/usr" )
+set( libdir "$buildDir/usr/lib" )
+set( includedir "$buildDir/usr/include" )
+set( SDL_VERSION 2.0.0 )
+set( SDL_LIBS -lSDL2 )
+set( SDL_STATIC_LIBS -lSDL2 )
+set( ENABLE_SHARED_TRUE "#" )
+set( ENABLE_SHARED_FALSE "" )
+set( ENABLE_STATIC_TRUE "" )
+set( ENABLE_STATIC_FALE "#" )
+configure_file( sdl2.pc.in sdl2.pc @ONLY )
+configure_file( sdl2-config.in sdl2-config )
+
include_directories( ./include )
add_definitions( -DANDROID -U__LINUX__ )
-set( public_headers
- `echo include/*.h \
- | sed 's/ /\n /g' | grep -v 'SDL_config_'` )
set( sources
`echo src/*.c \
src/audio/*.c \
@@ -35,13 +46,15 @@ set( sources
src/timer/unix/*.c \
src/video/*.c \
src/video/android/*.c \
- | sed 's/ /\n /g'` )
+ | sed -r 's| |\n |g'` )
add_library( SDL2 STATIC \${sources} )
set_target_properties( SDL2 PROPERTIES PUBLIC_HEADER "\${public_headers}" )
-install( TARGETS SDL2 ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
- PUBLIC_HEADER DESTINATION include/SDL2 )
+install( TARGETS SDL2 ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
+install( DIRECTORY include/ DESTINATION include/SDL2 )
+install( FILES \${CMAKE_CURRENT_BINARY_DIR}/sdl2.pc DESTINATION lib/pkgconfig )
+install( PROGRAMS \${CMAKE_CURRENT_BINARY_DIR}/sdl2-config DESTINATION bin )
+
EOF
sed -r 's|Java_org_libsdl_app_|Java_com_openzone_|g' -i src/core/android/SDL_android.cpp
View
@@ -1,167 +1,19 @@
-diff -Naur SDL/include/SDL_config.h SDL-nacl/include/SDL_config.h
---- SDL/include/SDL_config.h 2012-10-15 01:40:56.717786080 +0200
-+++ SDL-nacl/include/SDL_config.h 2012-10-17 14:33:15.269020493 +0200
-@@ -1,6 +1,6 @@
- /*
- Simple DirectMedia Layer
-- Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
-+ Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
-@@ -26,26 +26,115 @@
-
- /**
- * \file SDL_config.h
-+ *
-+ * This is a configuration that can be used to build SDL for Android
- */
--
--/* Add any platform that doesn't build using the configure system. */
--#if defined(__WIN32__)
--#include "SDL_config_windows.h"
--#elif defined(__MACOSX__)
--#include "SDL_config_macosx.h"
--#elif defined(__IPHONEOS__)
--#include "SDL_config_iphoneos.h"
--#elif defined(__ANDROID__)
--#include "SDL_config_android.h"
--#elif defined(__NINTENDODS__)
--#include "SDL_config_nintendods.h"
--#else
--/* This is a minimal configuration just to get SDL running on new platforms */
--#include "SDL_config_minimal.h"
--#endif /* platform config */
-
--#ifdef USING_GENERATED_CONFIG_H
--#error Wrong SDL_config.h, check your include path?
-+#include <stdarg.h>
-+
-+#define HAVE_ALLOCA_H 1
-+#define HAVE_SYS_TYPES_H 1
-+#define HAVE_STDIO_H 1
-+#define STDC_HEADERS 1
-+#define HAVE_STRING_H 1
-+#define HAVE_INTTYPES_H 1
-+#define HAVE_STDINT_H 1
-+#define HAVE_CTYPE_H 1
-+#define HAVE_MATH_H 1
-+#define HAVE_SIGNAL_H 1
-+
-+/* C library functions */
-+#define HAVE_MALLOC 1
-+#define HAVE_CALLOC 1
-+#define HAVE_REALLOC 1
-+#define HAVE_FREE 1
-+#define HAVE_ALLOCA 1
-+#define HAVE_GETENV 1
-+#define HAVE_SETENV 1
-+#define HAVE_PUTENV 1
-+#define HAVE_SETENV 1
-+#define HAVE_UNSETENV 1
-+#define HAVE_QSORT 1
-+#define HAVE_ABS 1
-+#define HAVE_BCOPY 1
-+#define HAVE_MEMSET 1
-+#define HAVE_MEMCPY 1
-+#define HAVE_MEMMOVE 1
-+#define HAVE_MEMCMP 1
-+#define HAVE_STRLEN 1
-+#define HAVE_STRLCPY 1
-+#define HAVE_STRLCAT 1
-+#define HAVE_STRDUP 1
-+#define HAVE_STRCHR 1
-+#define HAVE_STRRCHR 1
-+#define HAVE_STRSTR 1
-+#define HAVE_STRTOL 1
-+#define HAVE_STRTOUL 1
-+#define HAVE_STRTOLL 1
-+#define HAVE_STRTOULL 1
-+#define HAVE_STRTOD 1
-+#define HAVE_ATOI 1
-+#define HAVE_ATOF 1
-+#define HAVE_STRCMP 1
-+#define HAVE_STRNCMP 1
-+#define HAVE_STRCASECMP 1
-+#define HAVE_STRNCASECMP 1
-+#define HAVE_SSCANF 1
-+#define HAVE_SNPRINTF 1
-+#define HAVE_VSNPRINTF 1
-+#define HAVE_M_PI 1
-+#define HAVE_ATAN 1
-+#define HAVE_ATAN2 1
-+#define HAVE_CEIL 1
-+#define HAVE_COPYSIGN 1
-+#define HAVE_COS 1
-+#define HAVE_COSF 1
-+#define HAVE_FABS 1
-+#define HAVE_FLOOR 1
-+#define HAVE_LOG 1
-+#define HAVE_POW 1
-+#define HAVE_SCALBN 1
-+#define HAVE_SIN 1
-+#define HAVE_SINF 1
-+#define HAVE_SQRT 1
-+#define HAVE_SIGACTION 1
-+#define HAVE_SETJMP 1
-+#define HAVE_NANOSLEEP 1
-+#define HAVE_SYSCONF 1
-+
-+#define SIZEOF_VOIDP 4
-+
-+/* Allow disabling of core subsystems */
-+#ifdef __mips__
-+#define SDL_ATOMIC_DISABLED 1
- #endif
-
--#endif /* _SDL_config_h */
-+/* Enable various audio drivers */
-+#define SDL_AUDIO_DRIVER_ANDROID 1
-+#define SDL_AUDIO_DRIVER_DUMMY 1
-+
-+/* Enable various input drivers */
-+#define SDL_JOYSTICK_ANDROID 1
-+#define SDL_HAPTIC_DUMMY 1
-+
-+/* Enable various shared object loading systems */
-+#define SDL_LOADSO_DLOPEN 1
-+
-+/* Enable various threading systems */
-+#define SDL_THREAD_PTHREAD 1
-+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-+
-+/* Enable various timer systems */
-+#define SDL_TIMER_UNIX 1
-+
-+/* Enable various video drivers */
-+#define SDL_VIDEO_DRIVER_ANDROID 1
-+
-+/* Enable OpenGL ES */
-+#define SDL_VIDEO_OPENGL_ES 1
-+#define SDL_VIDEO_RENDER_OGL_ES2 1
-+
-+/* Enable system power support */
-+#define SDL_POWER_ANDROID 1
-+
-+#endif /* _SDL_config_android_h */
-diff -Naur SDL/include/SDL_system.h SDL-nacl/include/SDL_system.h
---- SDL/include/SDL_system.h 2012-10-15 01:40:56.717786080 +0200
-+++ SDL-nacl/include/SDL_system.h 2012-10-17 14:29:48.512873852 +0200
-@@ -30,7 +30,7 @@
-
- #include "SDL_stdinc.h"
-
--#if __IPHONEOS__
-+#ifdef __IPHONEOS__
- #include "SDL_video.h"
- #include "SDL_keyboard.h"
- #endif
-@@ -43,7 +43,7 @@
- /* *INDENT-ON* */
- #endif
-
--#if __IPHONEOS__
-+#ifdef __IPHONEOS__
-
- extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
- extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
+diff -r 1b5280cd5885 include/SDL_config_android.h
+--- a/include/SDL_config_android.h Sun Dec 09 17:56:19 2012 -0800
++++ b/include/SDL_config_android.h Mon Dec 10 20:54:06 2012 +0100
+@@ -42,6 +42,7 @@
+ #define HAVE_CTYPE_H 1
+ #define HAVE_MATH_H 1
+ #define HAVE_SIGNAL_H 1
++#define HAVE_GCC_ATOMICS 1
+
+ /* C library functions */
+ #define HAVE_MALLOC 1
+@@ -127,7 +128,6 @@
+
+ /* Enable OpenGL ES */
+ #define SDL_VIDEO_OPENGL_ES 1
+-#define SDL_VIDEO_RENDER_OGL_ES 1
+ #define SDL_VIDEO_RENDER_OGL_ES2 1
+
+ /* Enable system power support */
Oops, something went wrong.

0 comments on commit c97f152

Please sign in to comment.