Skip to content

Commit

Permalink
Merge pull request #2 from fdetro/os-ios
Browse files Browse the repository at this point in the history
Add support for Apple iOS and improve detection of arm architecture. Thanks to Franz Detro for the changes.
  • Loading branch information
grafikrobot committed Mar 20, 2014
2 parents c161ad4 + 9e5f797 commit 699b660
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/boost/predef/architecture/arm.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright Rene Rivera 2008-2013
Copyright Franz Detro 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -20,20 +21,25 @@ Distributed under the Boost Software License, Version 1.0.
[[__predef_symbol__] [__predef_version__]]
[[`__arm__`] [__predef_detection__]]
[[`__arm64`] [__predef_detection__]]
[[`__thumb__`] [__predef_detection__]]
[[`__TARGET_ARCH_ARM`] [__predef_detection__]]
[[`__TARGET_ARCH_THUMB`] [__predef_detection__]]
[[`__arm64`] [8.0.0]]
[[`__TARGET_ARCH_ARM`] [V.0.0]]
[[`__TARGET_ARCH_THUMB`] [V.0.0]]
]
*/

#define BOOST_ARCH_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE

#if defined(__arm__) || defined(__thumb__) || \
#if defined(__arm__) || defined(__arm64) || defined(__thumb__) || \
defined(__TARGET_ARCH_ARM) || defined(__TARGET_ARCH_THUMB)
# undef BOOST_ARCH_ARM
# if !defined(BOOST_ARCH_ARM) && defined(__arm64)
# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(8,0,0)
# endif
# if !defined(BOOST_ARCH_ARM) && defined(__TARGET_ARCH_ARM)
# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(__TARGET_ARCH_ARM,0,0)
# endif
Expand Down
2 changes: 2 additions & 0 deletions include/boost/predef/os.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright Rene Rivera 2008-2012
Copyright Franz Detro 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -16,6 +17,7 @@ Distributed under the Boost Software License, Version 1.0.
#include <boost/predef/os/cygwin.h>
#include <boost/predef/os/hpux.h>
#include <boost/predef/os/irix.h>
#include <boost/predef/os/ios.h>
#include <boost/predef/os/linux.h>
#include <boost/predef/os/macos.h>
#include <boost/predef/os/os400.h>
Expand Down
51 changes: 51 additions & 0 deletions include/boost/predef/os/ios.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
Copyright Franz Detro 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/

#ifndef BOOST_PREDEF_OS_IOS_H
#define BOOST_PREDEF_OS_IOS_H

#include <boost/predef/version_number.h>
#include <boost/predef/make.h>

/*`
[heading `BOOST_OS_IOS`]
[@http://en.wikipedia.org/wiki/iOS iOS] operating system.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__APPLE__`] [__predef_detection__]]
[[`__MACH__`] [__predef_detection__]]
[[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__predef_detection__]]
[[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000]]
]
*/

#define BOOST_OS_IOS BOOST_VERSION_NUMBER_NOT_AVAILABLE

#if !BOOST_PREDEF_DETAIL_OS_DETECTED && ( \
defined(__APPLE__) && defined(__MACH__) && \
defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) \
)
# undef BOOST_OS_IOS
# define BOOST_OS_IOS (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000)
#endif

#if BOOST_OS_IOS
# define BOOST_OS_IOS_AVAILABLE
# include <boost/predef/detail/os_detected.h>
#endif

#define BOOST_OS_IOS_NAME "iOS"

#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_OS_IOS,BOOST_OS_IOS_NAME)


#endif
8 changes: 8 additions & 0 deletions include/boost/predef/os/macos.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright Rene Rivera 2008-2013
Copyright Franz Detro 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -8,6 +9,13 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef BOOST_PREDEF_OS_MACOS_H
#define BOOST_PREDEF_OS_MACOS_H

/* Special case: iOS will define the same predefs as MacOS, and additionally
'__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__'. We can guard against that,
but only if we detect iOS first. Hence we will force include iOS detection
* before doing any MacOS detection.
*/
#include <boost/predef/os/ios.h>

#include <boost/predef/version_number.h>
#include <boost/predef/make.h>

Expand Down

0 comments on commit 699b660

Please sign in to comment.