[Android] Moved getActivity(ActivitySttates*) to the system module

Somehow this function gets stripped by compilators if I put this in the main module (which is what we want).
To solve this issue (and to avoid additional dependencies on sfml-window), I moved it to the system module since all SFML modules depend on it.
This commit is contained in:
Jonathan De Wachter 2013-09-23 16:15:41 +02:00
parent 4180e6b31f
commit c77b8a3496
14 changed files with 47 additions and 25 deletions

View File

@ -64,6 +64,6 @@ sfml_add_library(sfml-audio
else()
sfml_add_library(sfml-audio
SOURCES ${SRC}
DEPENDS sfml-system sfml-window
DEPENDS sfml-system
EXTERNAL_LIBS ${AUDIO_EXT_LIBS})
endif()

View File

@ -27,7 +27,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Audio/SoundFile.hpp>
#ifdef SFML_SYSTEM_ANDROID
#include <SFML/Window/Android/Activity.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/System/Lock.hpp>
#endif
#include <SFML/System/InputStream.hpp>

View File

@ -41,11 +41,11 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/")
set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib")
# add the modules subdirectories
add_subdirectory(System)
add_subdirectory(Window)
add_subdirectory(System)
if(SFML_OS_WINDOWS OR SFML_OS_ANDROID OR SFML_OS_IOS)
add_subdirectory(Main)
endif()
add_subdirectory(Window)
add_subdirectory(Network)
add_subdirectory(Graphics)
if(NOT SFML_OS_IOS OR NOT (SFML_OS_ANDROID AND ${ANDROID_ABI} MATCHES "mips"))

View File

@ -28,7 +28,7 @@
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/GLCheck.hpp>
#ifdef SFML_SYSTEM_ANDROID
#include <SFML/Window/Android/Activity.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/System/Lock.hpp>
#endif
#include <SFML/System/InputStream.hpp>

View File

@ -28,7 +28,7 @@
#include <SFML/Graphics/Image.hpp>
#include <SFML/Graphics/ImageLoader.hpp>
#ifdef SFML_SYSTEM_ANDROID
#include <SFML/Window/Android/Activity.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/System/Lock.hpp>
#endif
#include <SFML/System/Err.hpp>

View File

@ -23,13 +23,24 @@
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Android specific: we define the ANativeActivity_onCreate
// entry point, handling all the native activity stuff, then
// we call the user defined (and poratble) main function in
// an external thread so developers can keep a portable code
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#ifdef SFML_SYSTEM_ANDROID
#include <SFML/Window/Android/Activity.hpp>
#include <SFML/Window/EGLCheck.hpp>
#include <SFML/Window/Keyboard.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/System/Sleep.hpp>
#include <SFML/System/Thread.hpp>
#include <SFML/System/Lock.hpp>
@ -41,7 +52,6 @@ namespace sf
{
namespace priv
{
Keyboard::Key mapAndroidKeyToSFMLKey(int32_t key)
{
switch (key)

View File

@ -1,6 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2013 Jonathan De Wachter (dewachter.jonathan@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
@ -22,20 +23,24 @@
//
////////////////////////////////////////////////////////////
#include <SFML/Window/Android/Activity.hpp>
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/Android/Activity.hpp>
namespace sf
{
namespace priv
namespace priv
{
ActivityStates* getActivity(ActivityStates* initializedStates)
{
static ActivityStates* states = NULL;
ActivityStates* getActivity(ActivityStates* initializedStates)
{
static ActivityStates* states = NULL;
if (!states)
states = initializedStates;
if (!states)
states = initializedStates;
return states;
}
return states;
}
}
}

View File

@ -70,7 +70,8 @@ struct ActivityStates
bool updated;
};
SFML_WINDOW_API ActivityStates* getActivity(ActivityStates* initializedStates=NULL);
SFML_SYSTEM_API ActivityStates* getActivity(ActivityStates* initializedStates=NULL);
} // namespace priv
} // namespace sf

View File

@ -66,6 +66,14 @@ else()
${SRCROOT}/Unix/ThreadLocalImpl.cpp
${SRCROOT}/Unix/ThreadLocalImpl.hpp
)
if(ANDROID)
set(PLATFORM_SRC ${PLATFORM_SRC}
${SRCROOT}/Android/Activity.hpp
${SRCROOT}/Android/Activity.cpp
)
endif()
source_group("unix" FILES ${PLATFORM_SRC})
endif()

View File

@ -27,7 +27,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Android/EglContext.hpp>
#include <SFML/Window/Android/Activity.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/OpenGL.hpp>
#include <SFML/System/Err.hpp>
#include <SFML/System/Sleep.hpp>

View File

@ -26,7 +26,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Android/InputImpl.hpp>
#include <SFML/Window/Android/Activity.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/System/Lock.hpp>
#include <jni.h>

View File

@ -26,7 +26,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/VideoModeImpl.hpp>
#include <SFML/Window/Android/Activity.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/System/Sleep.hpp>
#include <SFML/System/Lock.hpp>

View File

@ -29,7 +29,7 @@
#include <SFML/Window/WindowStyle.hpp> // important to be included first (conflict with None)
#include <SFML/Window/Android/WindowImplAndroid.hpp>
#include <SFML/Window/Event.hpp>
#include <SFML/Window/Android/Activity.hpp>
#include <SFML/System/Android/Activity.hpp>
#include <SFML/System/Lock.hpp>

View File

@ -148,9 +148,7 @@ elseif(ANDROID)
${SRCROOT}/Android/InputImpl.hpp
${SRCROOT}/Android/InputImpl.cpp
${SRCROOT}/Android/JoystickImpl.hpp
${SRCROOT}/Android/JoystickImpl.cpp
${SRCROOT}/Android/Activity.hpp
${SRCROOT}/Android/Activity.cpp)
${SRCROOT}/Android/JoystickImpl.cpp)
source_group("android" FILES ${PLATFORM_SRC})
endif()