CMake/macOS: build arm files for libpng only on ARM

Remove macOS warning "ranlib: file ... has no symbols" although this
works only partially (see comment in png/CMakeLists.txt).
This commit is contained in:
Albrecht Schlosser 2022-02-05 21:37:37 +01:00
parent 6f09219c43
commit af4954aee3
1 changed files with 26 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#
# PNG library CMake configuration for the Fast Light Toolkit (FLTK).
#
# Copyright 1998-2021 by Bill Spitzak and others.
# Copyright 1998-2022 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
@ -31,13 +31,33 @@ set(PNG_SRCS
pngwrite.c
pngwtran.c
pngwutil.c
# build on ARM (Apple M1 systems)
arm/arm_init.c
arm/filter_neon_intrinsics.c
arm/palette_neon_intrinsics.c
)
#######################################################################
# Build some files on ARM (e.g. Apple M1 systems)
#######################################################################
# We can only determine the target architecture if it is set
# in CMAKE_OSX_ARCHITECTURES, otherwise we *assume* it is true and
# compile these files even if this results in some warnings.
# This includes all non-macOS platforms.
if (CMAKE_OSX_ARCHITECTURES)
string(REGEX MATCH "arm64" is_arm "${CMAKE_OSX_ARCHITECTURES}")
else ()
set (is_arm TRUE)
endif ()
if (is_arm)
LIST (APPEND PNG_SRCS
arm/arm_init.c
arm/filter_neon_intrinsics.c
arm/palette_neon_intrinsics.c
)
endif ()
unset (is_arm)
#######################################################################
# Build the static library
#######################################################################