Make all headers public and add #ifdef __cplusplus (#1150)
Summary: This change is mostly needed to support the new react-native architecture with Swift. Some private yoga headers end up being included in the swift build and result in compilation failure since swift cannot compile c++ modules. See https://github.com/facebook/react-native/pull/33381. The most reliable fix is to include all headers as public headers, and add `#ifdef __cplusplus` to those that include c++. This is already what we do for other headers, this applies this to all headers. Tested in the YogaKitSample, and also in a react-native app. Changelog: [iOS] [Changed] - Make all Yoga headers public and add #ifdef __cplusplus Pull Request resolved: https://github.com/facebook/yoga/pull/1150 Reviewed By: dmitryrykun Differential Revision: D36966687 Pulled By: cortinico fbshipit-source-id: a34a54d56df43ab4934715070bab8e790b9abd39
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4d089ecc79
commit
bfcd15e4a9
@@ -1,8 +1,9 @@
|
|||||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
#
|
#
|
||||||
# This source code is licensed under the MIT license found in the
|
# This source code is licensed under the MIT license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
Pod::Spec.new do |spec|
|
Pod::Spec.new do |spec|
|
||||||
spec.name = 'Yoga'
|
spec.name = 'Yoga'
|
||||||
spec.version = '1.14.0'
|
spec.version = '1.14.0'
|
||||||
@@ -33,6 +34,6 @@ Pod::Spec.new do |spec|
|
|||||||
'-fPIC'
|
'-fPIC'
|
||||||
]
|
]
|
||||||
spec.source_files = 'yoga/**/*.{c,h,cpp}'
|
spec.source_files = 'yoga/**/*.{c,h,cpp}'
|
||||||
spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGNode,YGStyle,YGValue}.h'
|
spec.public_header_files = 'yoga/*.h'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "YGEnums.h"
|
#include "YGEnums.h"
|
||||||
@@ -65,3 +67,5 @@ inline void setBooleanData(uint8_t& flags, size_t index, bool value) {
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace yoga
|
} // namespace yoga
|
||||||
} // namespace facebook
|
} // namespace facebook
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "YGValue.h"
|
#include "YGValue.h"
|
||||||
#include "YGMacros.h"
|
#include "YGMacros.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -182,3 +184,5 @@ constexpr bool operator!=(CompactValue a, CompactValue b) noexcept {
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace yoga
|
} // namespace yoga
|
||||||
} // namespace facebook
|
} // namespace facebook
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -6,6 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "YGNode.h"
|
#include "YGNode.h"
|
||||||
#include "Yoga-internal.h"
|
#include "Yoga-internal.h"
|
||||||
#include "CompactValue.h"
|
#include "CompactValue.h"
|
||||||
@@ -145,3 +148,5 @@ inline YGFloatOptional YGResolveValueMargin(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void throwLogicalErrorWithMessage(const char* message);
|
void throwLogicalErrorWithMessage(const char* message);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -6,6 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "Yoga-internal.h"
|
#include "Yoga-internal.h"
|
||||||
#include "Yoga.h"
|
#include "Yoga.h"
|
||||||
|
|
||||||
@@ -74,3 +77,5 @@ public:
|
|||||||
setCloneNodeCallback(YGCloneNodeFunc{nullptr});
|
setCloneNodeCallback(YGCloneNodeFunc{nullptr});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include "Yoga-internal.h"
|
#include "Yoga-internal.h"
|
||||||
@@ -68,3 +70,5 @@ inline bool operator>=(YGFloatOptional lhs, YGFloatOptional rhs) {
|
|||||||
inline bool operator<=(YGFloatOptional lhs, YGFloatOptional rhs) {
|
inline bool operator<=(YGFloatOptional lhs, YGFloatOptional rhs) {
|
||||||
return lhs < rhs || lhs == rhs;
|
return lhs < rhs || lhs == rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -6,6 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "BitUtils.h"
|
#include "BitUtils.h"
|
||||||
#include "YGFloatOptional.h"
|
#include "YGFloatOptional.h"
|
||||||
#include "Yoga-internal.h"
|
#include "Yoga-internal.h"
|
||||||
@@ -85,3 +88,5 @@ public:
|
|||||||
bool operator==(YGLayout layout) const;
|
bool operator==(YGLayout layout) const;
|
||||||
bool operator!=(YGLayout layout) const { return !(*this == layout); }
|
bool operator!=(YGLayout layout) const { return !(*this == layout); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -6,7 +6,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Yoga.h"
|
#include "Yoga.h"
|
||||||
@@ -22,4 +26,7 @@ void YGNodeToString(
|
|||||||
|
|
||||||
} // namespace yoga
|
} // namespace yoga
|
||||||
} // namespace facebook
|
} // namespace facebook
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -6,6 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -148,3 +151,5 @@ static const float kDefaultFlexShrink = 0.0f;
|
|||||||
static const float kWebDefaultFlexShrink = 1.0f;
|
static const float kWebDefaultFlexShrink = 1.0f;
|
||||||
|
|
||||||
extern bool YGFloatsEqual(const float a, const float b);
|
extern bool YGFloatsEqual(const float a, const float b);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "YGEnums.h"
|
#include "YGEnums.h"
|
||||||
|
|
||||||
struct YGNode;
|
struct YGNode;
|
||||||
@@ -36,3 +38,5 @@ struct Log {
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace yoga
|
} // namespace yoga
|
||||||
} // namespace facebook
|
} // namespace facebook
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user