diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bca3973..a75bec57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,18 +28,18 @@ set(VERSION_PATCH 0) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) # add an option for choosing the build type (shared or static) -if(NOT (IOS OR ANDROID)) +if(NOT (SFML_OS_IOS OR SFML_OS_ANDROID)) sfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries") else() - if(IOS) + if(SFML_OS_IOS) set(BUILD_SHARED_LIBS FALSE) - elseif(ANDROID) + elseif(SFML_OS_ANDROID) set(BUILD_SHARED_LIBS TRUE) endif() endif() # add an option for building the examples -if(NOT (IOS OR ANDROID)) +if(NOT (SFML_OS_IOS OR SFML_OS_ANDROID)) sfml_set_option(SFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the SFML examples, FALSE to ignore them") else() set(SFML_BUILD_EXAMPLES FALSE) @@ -70,7 +70,7 @@ if(SFML_OS_MACOSX) endif() # Android options -if(ANDROID) +if(SFML_OS_ANDROID) # force usage of the STL port set(ANDROID_USE_STLPORT TRUE) diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 58c30cb7..b6f6d3e8 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -2,6 +2,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(SFML_OS_WINDOWS 1) + # don't use the OpenGL ES implementation on Windows + set(OPENGL_ES 0) + # detect the architecture (note: this test won't work for cross-compilation) include(CheckTypeSize) check_type_size(void* SIZEOF_VOID_PTR) @@ -16,14 +19,18 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(SFML_OS_UNIX 1) if(ANDROID) + set(SFML_OS_ANDROID 1) # use the OpenGL ES implementation on Android set(OPENGL_ES 1) - set(SFML_OS_ANDROID 1) else() set(SFML_OS_LINUX 1) + # don't use the OpenGL ES implementation on Linux + set(OPENGL_ES 0) endif() elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") set(SFML_OS_FREEBSD 1) + # don't use the OpenGL ES implementation on FreeBSD + set(OPENGL_ES 0) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(IOS) set(SFML_OS_IOS 1) @@ -39,7 +46,10 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # use the OpenGL ES implementation on iOS set(OPENGL_ES 1) else() - set(SFML_OS_MACOSX 1) + set(SFML_OS_MACOSX 1) + + # don't use the OpenGL ES implementation on Mac OS X + set(OPENGL_ES 0) # detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.) EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 9966c34c..4fda2135 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -41,7 +41,7 @@ macro(sfml_add_library target) # set the version and soversion of the target (for compatible systems -- mostly Linuxes) # except for Android which strips soversion suffixes - if(NOT ANDROID) + if(NOT SFML_OS_ANDROID) set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR}) set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) endif() @@ -93,13 +93,13 @@ macro(sfml_add_library target) endif() # enable automatic reference counting on iOS - if (IOS) + if (SFML_OS_IOS) set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES) endif() # sfml-activity library is our bootstrap activity and must not depend on stlport_shared # (otherwise Android will fail to load it) - if (ANDROID) + if (SFML_OS_ANDROID) if (${target} MATCHES "sfml-activity") set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fpermissive) set_target_properties(${target} PROPERTIES LINK_FLAGS "-landroid -llog") diff --git a/src/SFML/Audio/CMakeLists.txt b/src/SFML/Audio/CMakeLists.txt index a1a3737c..f6b03a6d 100644 --- a/src/SFML/Audio/CMakeLists.txt +++ b/src/SFML/Audio/CMakeLists.txt @@ -40,7 +40,7 @@ elseif(SFML_OS_MACOSX) endif() # find external libraries -if(NOT ANDROID) +if(NOT SFML_OS_ANDROID) find_package(OpenAL REQUIRED) find_package(Sndfile REQUIRED) set(AUDIO_EXT_LIBS ${OPENAL_LIBRARY} ${SNDFILE_LIBRARY}) @@ -56,7 +56,7 @@ endif() include_directories(${OPENAL_INCLUDE_DIR} ${SNDFILE_INCLUDE_DIR}) # define the sfml-audio target -if(NOT ANDROID) +if(NOT SFML_OS_ANDROID) sfml_add_library(sfml-audio SOURCES ${SRC} DEPENDS sfml-system diff --git a/src/SFML/CMakeLists.txt b/src/SFML/CMakeLists.txt index 9dcea0b0..94976f23 100644 --- a/src/SFML/CMakeLists.txt +++ b/src/SFML/CMakeLists.txt @@ -23,10 +23,10 @@ if (SFML_OS_WINDOWS) elseif(SFML_OS_MACOSX) set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers") set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-osx/lib/") -elseif(IOS) +elseif(SFML_OS_IOS) set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers") set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-ios/") -elseif(ANDROID) +elseif(SFML_OS_ANDROID) set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/android/extlibs/include") set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/android/extlibs/lib/${ANDROID_ABI}") endif() @@ -50,4 +50,4 @@ add_subdirectory(Network) add_subdirectory(Graphics) if(NOT SFML_OS_IOS AND NOT (SFML_OS_ANDROID AND "${ANDROID_ABI}" MATCHES "mips")) add_subdirectory(Audio) -endif() +endif() diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt index 72cd69a1..55573fc1 100644 --- a/src/SFML/Graphics/CMakeLists.txt +++ b/src/SFML/Graphics/CMakeLists.txt @@ -123,12 +123,12 @@ if(NOT OPENGL_ES) endif() endif() -if(IOS) +if(SFML_OS_IOS) find_package(JPEG REQUIRED) find_package(Freetype REQUIRED) set(GRAPHICS_EXT_INCLUDE_PATHS ${FREETYPE_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR}) set(GRAPHICS_EXT_LIBS "-framework OpenGLES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY}") -elseif(ANDROID) +elseif(SFML_OS_ANDROID) find_host_package(JPEG REQUIRED) find_host_package(Freetype REQUIRED) set(GRAPHICS_EXT_INCLUDE_PATHS ${FREETYPE_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR}) diff --git a/src/SFML/Main/CMakeLists.txt b/src/SFML/Main/CMakeLists.txt index 84070cde..c4c0d540 100644 --- a/src/SFML/Main/CMakeLists.txt +++ b/src/SFML/Main/CMakeLists.txt @@ -3,11 +3,11 @@ set(INCROOT ${PROJECT_SOURCE_DIR}/include/SFML/Main) set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Main) # sources -if(WINDOWS) +if(SFML_OS_WINDOWS) set(SRC ${SRC} ${SRCROOT}/MainWin32.cpp) -elseif(IOS) +elseif(SFML_OS_IOS) set(SRC ${SRC} ${SRCROOT}/MainiOS.mm) -elseif(ANDROID) +elseif(SFML_OS_ANDROID) set(SRC ${SRC} ${SRCROOT}/MainAndroid.cpp) else() return() @@ -32,6 +32,6 @@ install(TARGETS sfml-main ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel) # because of a current limitation on Android (which prevents one library # from depending on shared libraries), we need a boostrap activity which # will load our shared libraries manually -if(ANDROID) +if(SFML_OS_ANDROID) sfml_add_library(sfml-activity SOURCES ${PROJECT_SOURCE_DIR}/src/SFML/Main/SFMLActivity.cpp) endif() diff --git a/src/SFML/System/CMakeLists.txt b/src/SFML/System/CMakeLists.txt index f5b32e0a..a874293d 100644 --- a/src/SFML/System/CMakeLists.txt +++ b/src/SFML/System/CMakeLists.txt @@ -67,7 +67,7 @@ else() ${SRCROOT}/Unix/ThreadLocalImpl.hpp ) - if(ANDROID) + if(SFML_OS_ANDROID) set(PLATFORM_SRC ${PLATFORM_SRC} ${SRCROOT}/Android/Activity.hpp ${SRCROOT}/Android/Activity.cpp @@ -90,7 +90,7 @@ if(SFML_OS_WINDOWS) endif() # pthread is implicitly linked by the NDK -if(ANDROID) +if(SFML_OS_ANDROID) set(SYSTEM_EXT_LIBS "") endif() diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index 7caca16c..dba67760 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -65,6 +65,7 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD) ${SRCROOT}/Unix/VideoModeImpl.cpp ${SRCROOT}/Unix/WindowImplX11.cpp ${SRCROOT}/Unix/WindowImplX11.hpp + ) if(SFML_OS_LINUX) set(PLATFORM_SRC ${PLATFORM_SRC} @@ -117,7 +118,7 @@ elseif(SFML_OS_MACOSX) ${SRCROOT}/OSX/WindowImplDelegateProtocol.h ) source_group("mac" FILES ${PLATFORM_SRC}) -elseif(IOS) +elseif(SFML_OS_IOS) set(PLATFORM_SRC ${SRCROOT}/iOS/EaglContext.mm ${SRCROOT}/iOS/EaglContext.hpp @@ -139,7 +140,7 @@ elseif(IOS) ${SRCROOT}/iOS/SFMain.mm ) source_group("ios" FILES ${PLATFORM_SRC}) -elseif(ANDROID) +elseif(SFML_OS_ANDROID) set(PLATFORM_SRC ${SRCROOT}/Android/WindowImplAndroid.hpp ${SRCROOT}/Android/WindowImplAndroid.cpp