mirror of
https://github.com/edubart/otclient.git
synced 2025-11-03 12:16:23 +01:00
Android compilation added.
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
#include <jni.h>
|
||||
#include <main.cpp>
|
||||
|
||||
void android_main( struct android_app* state ) {
|
||||
int argc = 0;
|
||||
char* argv[] = char[1];
|
||||
argv[0] = "";
|
||||
|
||||
main(argc, argv);
|
||||
}
|
||||
@@ -126,10 +126,10 @@ set(framework_SOURCES ${framework_SOURCES}
|
||||
|
||||
# crash handler
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/crashhandler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp
|
||||
#${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/win32crashhandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/win32platform.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/unixplatform.cpp
|
||||
#${CMAKE_CURRENT_LIST_DIR}/platform/unixplatform.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/platform.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/platform.h
|
||||
)
|
||||
@@ -206,7 +206,12 @@ if(WIN32)
|
||||
endif()
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_LIBS ${USE_STATIC_LIBS})
|
||||
find_package(Boost 1.48.0 COMPONENTS ${REQUIRED_BOOST_COMPONENTS} REQUIRED)
|
||||
|
||||
if(ANDROID)
|
||||
|
||||
else()
|
||||
find_package(Boost 1.48.0 COMPONENTS ${REQUIRED_BOOST_COMPONENTS} REQUIRED)
|
||||
endif()
|
||||
|
||||
#find lua
|
||||
if(LUAJIT)
|
||||
@@ -226,8 +231,10 @@ find_package(PhysFS REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
# android already has zlib
|
||||
if(NOT __ANDROID__)
|
||||
if(NOT ANDROID)
|
||||
find_package(ZLIB REQUIRED)
|
||||
else()
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} android)
|
||||
endif()
|
||||
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES}
|
||||
@@ -296,18 +303,26 @@ endif()
|
||||
|
||||
if(FRAMEWORK_GRAPHICS)
|
||||
set(OPENGLES "OFF" CACHE "Use OpenGL ES 1.0 or 2.0 (for mobiles devices)" STRING)
|
||||
if(OPENGLES STREQUAL "2.0")
|
||||
find_package(OpenGLES2 REQUIRED)
|
||||
find_package(EGL REQUIRED)
|
||||
if(OPENGLES STREQUAL "2.0" OR ANDROID_NATIVE_API_LEVEL VERSION_GREATER 7)
|
||||
if(NOT ANDROID)
|
||||
find_package(OpenGLES2 REQUIRED)
|
||||
find_package(EGL REQUIRED)
|
||||
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES2_INCLUDE_DIR})
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES2_LIBRARY})
|
||||
else()
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} GLESv2)
|
||||
endif()
|
||||
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DOPENGL_ES=2)
|
||||
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES2_INCLUDE_DIR})
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES2_LIBRARY})
|
||||
ELSEif(OPENGLES STREQUAL "1.0")
|
||||
find_package(OpenGLES1 REQUIRED)
|
||||
find_package(EGL REQUIRED)
|
||||
ELSEif(OPENGLES STREQUAL "1.0" OR ANDROID_NATIVE_API_LEVEL VERSION_LESS 8)
|
||||
if(NOT ANDROID)
|
||||
find_package(OpenGLES1 REQUIRED)
|
||||
find_package(EGL REQUIRED)
|
||||
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES1_INCLUDE_DIR})
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES1_LIBRARY})
|
||||
else()
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} GLESv1_CM)
|
||||
endif()
|
||||
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DOPENGL_ES=1)
|
||||
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES1_INCLUDE_DIR})
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES1_LIBRARY})
|
||||
else()
|
||||
## TODO: CMake Documentation says that this is not the right
|
||||
# Thing for Mac OS X, but it works for now.
|
||||
@@ -344,8 +359,8 @@ if(FRAMEWORK_GRAPHICS)
|
||||
${CMAKE_CURRENT_LIST_DIR}/graphics/dx/painterdx9.h
|
||||
)
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
elseif(NOT ANDROID)
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} X11)
|
||||
endif()
|
||||
|
||||
@@ -445,6 +460,8 @@ if(FRAMEWORK_GRAPHICS)
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/win32window.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/sdlplatform.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/sdlplatform.h
|
||||
|
||||
# window input
|
||||
${CMAKE_CURRENT_LIST_DIR}/input/mouse.cpp
|
||||
|
||||
@@ -15,4 +15,4 @@ ELSE()
|
||||
ENDIF()
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua DEFAULT_MSG LUA_LIBRARY LUA_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(LUA_LIBRARY LUA_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(LUA_LIBRARY LUA_INCLUDE_DIR)
|
||||
@@ -35,7 +35,7 @@
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
#define swap16(data) _byteswap_ushort(data)
|
||||
#define swap32(data) _byteswap_ulong(data)
|
||||
#elif __linux__
|
||||
#elif __linux__ && !defined ANDROID
|
||||
#include <byteswap.h>
|
||||
#define swap16(data) bswap_16(data)
|
||||
#define swap32(data) bswap_32(data)
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#ifdef WIN32
|
||||
#include "win32window.h"
|
||||
WIN32Window window;
|
||||
#elif defined ANDROID
|
||||
#include "sdlplatform.h"
|
||||
SDLPlatform window;
|
||||
#else
|
||||
#include "x11window.h"
|
||||
#include <framework/core/clock.h>
|
||||
|
||||
75
src/framework/platform/sdlplatform.cpp
Normal file
75
src/framework/platform/sdlplatform.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include "sdlplatform.h"
|
||||
|
||||
void SDLPlatform::init() {
|
||||
}
|
||||
|
||||
void SDLPlatform::terminate() {
|
||||
}
|
||||
|
||||
void SDLPlatform::move(const Point& pos) {
|
||||
}
|
||||
|
||||
void SDLPlatform::resize(const Size& size) {
|
||||
}
|
||||
|
||||
void SDLPlatform::show() {
|
||||
}
|
||||
|
||||
void SDLPlatform::hide() {
|
||||
}
|
||||
|
||||
void SDLPlatform::maximize() {
|
||||
}
|
||||
|
||||
void SDLPlatform::poll() {
|
||||
}
|
||||
|
||||
void SDLPlatform::swapBuffers() {
|
||||
}
|
||||
|
||||
void SDLPlatform::showMouse() {
|
||||
}
|
||||
|
||||
void SDLPlatform::hideMouse() {
|
||||
}
|
||||
|
||||
int SDLPlatform::internalLoadMouseCursor(const ImagePtr& image, const Point& hotSpot) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SDLPlatform::setMouseCursor(int cursorId) {
|
||||
}
|
||||
|
||||
void SDLPlatform::restoreMouseCursor() {
|
||||
}
|
||||
|
||||
void SDLPlatform::setTitle(const std::string& title) {
|
||||
}
|
||||
|
||||
void SDLPlatform::setMinimumSize(const Size& minimumSize) {
|
||||
}
|
||||
|
||||
void SDLPlatform::setFullscreen(bool fullscreen) {
|
||||
}
|
||||
|
||||
void SDLPlatform::setVerticalSync(bool enable) {
|
||||
}
|
||||
|
||||
void SDLPlatform::setIcon(const std::string& iconFile) {
|
||||
}
|
||||
|
||||
void SDLPlatform::setClipboardText(const std::string& text) {
|
||||
}
|
||||
|
||||
Size SDLPlatform::getDisplaySize() {
|
||||
Size TODO;
|
||||
return TODO;
|
||||
}
|
||||
|
||||
std::string SDLPlatform::getClipboardText() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string SDLPlatform::getPlatformType() {
|
||||
return nullptr;
|
||||
}
|
||||
39
src/framework/platform/sdlplatform.h
Normal file
39
src/framework/platform/sdlplatform.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef SDL_PLATFORM_H
|
||||
#define SDL_PLATFORM_H
|
||||
|
||||
#include "platformwindow.h"
|
||||
|
||||
class SDLPlatform : public PlatformWindow
|
||||
{
|
||||
public:
|
||||
void init();
|
||||
void terminate();
|
||||
|
||||
void move(const Point& pos);
|
||||
void resize(const Size& size);
|
||||
void show();
|
||||
void hide();
|
||||
void maximize();
|
||||
void poll();
|
||||
void swapBuffers();
|
||||
void showMouse();
|
||||
void hideMouse();
|
||||
|
||||
void setMouseCursor(int cursorId);
|
||||
void restoreMouseCursor();
|
||||
|
||||
void setTitle(const std::string& title);
|
||||
void setMinimumSize(const Size& minimumSize);
|
||||
void setFullscreen(bool fullscreen);
|
||||
void setVerticalSync(bool enable);
|
||||
void setIcon(const std::string& iconFile);
|
||||
void setClipboardText(const std::string& text);
|
||||
|
||||
Size getDisplaySize();
|
||||
std::string getClipboardText();
|
||||
std::string getPlatformType();
|
||||
protected:
|
||||
int internalLoadMouseCursor(const ImagePtr& image, const Point& hotSpot);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -20,7 +20,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
#if !defined WIN32 && !defined ANDROID
|
||||
|
||||
#include "x11window.h"
|
||||
#include <framework/core/resourcemanager.h>
|
||||
|
||||
Reference in New Issue
Block a user