Skip to content

Commit 97507e4

Browse files
committed
build: eliminate Xcode 9.1 warnings
- 3rdparty/libjasper/jas_getopt.c:129:25: warning: this function declaration is not a prototype [-Wstrict-prototypes] - clang: warning: optimization flag '-fomit-frame-pointer' is not supported for target 'armv7' [-Wignored-optimization-argument] - clang: warning: optimization flag '-fomit-frame-pointer' is not supported for target 'armv7s' [-Wignored-optimization-argument] - backport IOS_ARCH toolchain option and setup CMAKE_SYSTEM_PROCESSOR: - adds '-mfpu=neon' compiler flag for ARM, SSE flags for i386/x86_64 - fixed proper libpng compilation (no ARM asm)
1 parent 91fe01b commit 97507e4

File tree

7 files changed

+17
-7
lines changed

7 files changed

+17
-7
lines changed

3rdparty/libjasper/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ endif(WIN32 AND NOT MINGW)
2525

2626
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes
2727
-Wno-unused-but-set-parameter -Wmissing-declarations -Wunused -Wshadow -Wsign-compare)
28-
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
28+
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wstrict-prototypes) # clang
2929
ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 /wd4018 /wd4101 /wd4244 /wd4267 /wd4715) # vs2005
3030

3131
if(UNIX)

3rdparty/libpng/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# ----------------------------------------------------------------------------
55

6-
if(ARM AND ENABLE_NEON AND NOT AARCH64)
6+
if(ARM AND ENABLE_NEON AND NOT AARCH64 AND NOT IOS)
77
project(${PNG_LIBRARY} ASM)
88
else()
99
project(${PNG_LIBRARY})
@@ -14,7 +14,7 @@ ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIR})
1414
file(GLOB lib_srcs *.c)
1515
file(GLOB lib_hdrs *.h)
1616

17-
if(ARM AND ENABLE_NEON AND NOT AARCH64)
17+
if(ARM AND ENABLE_NEON AND NOT AARCH64 AND NOT IOS)
1818
list(APPEND lib_srcs arm/filter_neon.S arm/arm_init.c)
1919
add_definitions(-DPNG_ARM_NEON_OPT=2)
2020
else()

cmake/OpenCVCompilerOptions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
164164
# Other optimizations
165165
if(ENABLE_OMIT_FRAME_POINTER)
166166
add_extra_compiler_option(-fomit-frame-pointer)
167-
else()
167+
elseif(DEFINED ENABLE_OMIT_FRAME_POINTER)
168168
add_extra_compiler_option(-fno-omit-frame-pointer)
169169
endif()
170170
if(ENABLE_FAST_MATH)

platforms/ios/build_framework.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def build_opencv(srcroot, buildroot, target, arch):
4949
# for some reason, if you do not specify CMAKE_BUILD_TYPE, it puts libs to "RELEASE" rather than "Release"
5050
cmakeargs = ("-GXcode " +
5151
"-DCMAKE_BUILD_TYPE=Release " +
52+
("-DIOS_ARCH=%s " % arch) +
5253
"-DCMAKE_TOOLCHAIN_FILE=%s/platforms/ios/cmake/Toolchains/Toolchain-%s_Xcode.cmake " +
5354
"-DBUILD_opencv_world=ON " +
5455
"-DCMAKE_C_FLAGS=\"-Wno-implicit-function-declaration\" " +

platforms/ios/cmake/Modules/Platform/iOS.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ set (no_warn "-Wno-unused-function -Wno-overloaded-virtual")
4343
set (CMAKE_C_FLAGS "${no_warn}")
4444
set (CMAKE_CXX_FLAGS "-stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hidden ${no_warn}")
4545

46-
set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math")
46+
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
47+
if(NOT IOS_ARCH STREQUAL "armv7" AND NOT IOS_ARCH STREQUAL "armv7s")
48+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
49+
endif()
4750

4851
if (HAVE_FLAG_SEARCH_PATHS_FIRST)
4952
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")

platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ message (STATUS "Setting up iPhoneOS toolchain")
22
set (IPHONEOS TRUE)
33

44
# Standard settings
5-
set (CMAKE_SYSTEM_NAME iOS)
5+
set(CMAKE_SYSTEM_NAME iOS)
6+
set(CMAKE_SYSTEM_VERSION 6.0)
7+
set(CMAKE_SYSTEM_PROCESSOR "${IOS_ARCH}")
8+
69
# Include extra modules for the iOS platform files
710
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/cmake/Modules")
811

platforms/ios/cmake/Toolchains/Toolchain-iPhoneSimulator_Xcode.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ message (STATUS "Setting up iPhoneSimulator toolchain")
22
set (IPHONESIMULATOR TRUE)
33

44
# Standard settings
5-
set (CMAKE_SYSTEM_NAME iOS)
5+
set(CMAKE_SYSTEM_NAME iOS)
6+
set(CMAKE_SYSTEM_VERSION 6.0)
7+
set(CMAKE_SYSTEM_PROCESSOR "${IOS_ARCH}")
8+
69
# Include extra modules for the iOS platform files
710
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/cmake/Modules")
811

0 commit comments

Comments
 (0)