Add iOS flags handling in cmake

This commit is contained in:
Benau 2019-07-12 14:53:55 +08:00
parent b185544518
commit c7308b82b0
6 changed files with 23 additions and 14 deletions

View File

@ -34,7 +34,7 @@ CMAKE_DEPENDENT_OPTION(USE_SYSTEM_SQUISH "Use system Squish library instead of t
CMAKE_DEPENDENT_OPTION(USE_WIIUSE "Support for wiimote input devices" ON
"NOT SERVER_ONLY;NOT MINGW;NOT CYGWIN" OFF)
if(APPLE)
if(APPLE AND NOT IOS)
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt)
include_directories(/usr/local/opt/fribidi/include/)
include_directories(/usr/local/opt/openssl@1.1/include/)
@ -43,6 +43,12 @@ if(APPLE)
include_directories(/usr/local/opt/harfbuzz/include/harfbuzz/)
endif()
if (IOS)
ADD_DEFINITIONS(-DMOBILE_STK)
ADD_DEFINITIONS(-DIOS_STK)
option(USE_GLES2 "Use OpenGL ES2 renderer" ON)
endif()
if((UNIX AND NOT APPLE) AND NOT SERVER_ONLY)
option(ENABLE_WAYLAND_DEVICE "Enable Wayland device for linux build" ON)
@ -166,7 +172,7 @@ else()
endif()
# Find system GLEW library or build it if missing
if (APPLE)
if (APPLE AND NOT IOS)
find_package(glew)
if(GLEW_FOUND)
@ -264,7 +270,7 @@ endif()
# Set include paths
include_directories(${STK_SOURCE_DIR})
if(APPLE)
if(APPLE AND NOT IOS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks")
elseif(MSVC)
@ -430,7 +436,7 @@ include(cmake/SourceGroupFunctions.cmake)
source_group_hierarchy(STK_SOURCES STK_HEADERS)
if(APPLE)
if(APPLE AND NOT IOS)
# icon files to copy in the bundle
set(OSX_ICON_FILES ${PROJECT_SOURCE_DIR}/data/supertuxkart.icns)
set_source_files_properties(${OSX_ICON_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

View File

@ -111,7 +111,9 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
enable_language(ASM)
if(CMAKE_ASM_COMPILER_WORKS)
set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_arm.cpp ../../source/as_callfunc_arm_gcc.S)
set_property(SOURCE ../../source/as_callfunc_arm_gcc.S APPEND PROPERTY COMPILE_FLAGS " -Wa,-mimplicit-it=always")
if (NOT IOS)
set_property(SOURCE ../../source/as_callfunc_arm_gcc.S APPEND PROPERTY COMPILE_FLAGS " -Wa,-mimplicit-it=always")
endif()
else()
message(FATAL ERROR "ARM target requires a working assembler")
endif()

View File

@ -2,7 +2,7 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/)
if(APPLE)
if(APPLE AND NOT IOS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks")
endif()

View File

@ -2,7 +2,7 @@
include_directories("include")
if(APPLE)
if(APPLE AND NOT IOS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks")
endif()

View File

@ -35,13 +35,13 @@ if(NOT SERVER_ONLY)
endif()
endif()
if(USE_GLES2 OR ENABLE_WAYLAND_DEVICE)
if(NOT APPLE AND (USE_GLES2 OR ENABLE_WAYLAND_DEVICE))
find_package(EGL)
if(EGL_FOUND)
include_directories(${EGL_INCLUDE_DIR})
else()
if(USE_GLES2)
if(USE_GLES2 AND NOT APPLE)
message(FATAL_ERROR "EGL not found.")
elseif(ENABLE_WAYLAND_DEVICE)
message(WARNING "EGL not found. Disable wayland support.")
@ -79,7 +79,7 @@ else()
add_definitions(-DNO_IRR_COMPILE_WITH_WAYLAND_DEVICE_)
endif()
if(APPLE)
if(APPLE AND NOT IOS)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht/MacOSX" "${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks")
@ -584,7 +584,7 @@ if(NOT SERVER_ONLY AND ENABLE_WAYLAND_DEVICE)
endif()
if(APPLE)
if(APPLE AND NOT IOS)
set(IRRLICHT_SOURCES
${IRRLICHT_SOURCES}
source/Irrlicht/MacOSX/AppDelegate.mm
@ -614,7 +614,7 @@ if(NOT SERVER_ONLY)
target_link_libraries(stkirrlicht ${X11_X11_LIB} ${X11_Xrandr_LIB})
endif()
if(USE_GLES2 OR ENABLE_WAYLAND_DEVICE)
if(NOT APPLE AND (USE_GLES2 OR ENABLE_WAYLAND_DEVICE))
target_link_libraries(stkirrlicht ${EGL_LIBRARY})
endif()

View File

@ -13,6 +13,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
OPTION(BUILD_SQUISH_WITH_OPENMP "Build with OpenMP." OFF)
if((${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") OR
(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64") OR
(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") OR
(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc") OR
(${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64") OR
@ -39,7 +40,7 @@ IF (BUILD_SQUISH_WITH_OPENMP)
ENDIF()
IF (CMAKE_GENERATOR STREQUAL "Xcode")
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
SET(CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR})
IF (BUILD_SQUISH_WITH_SSE2 AND WIN32)
ADD_DEFINITIONS(-DSQUISH_USE_SSE=2)
ENDIF (BUILD_SQUISH_WITH_SSE2 AND WIN32)