Skip to content

Commit 03f87b7

Browse files
authored
Various Unrelated Build Fixes (KhronosGroup#450)
* Build loadtests in MacOS sse build as they are no longer built in the main (now universal binary) build. * Update gtest to replace deprecated copy constructors. * Reset compiler version with new warnings to be suppressed to 12.0.5. Reverts commit 313fe8. It seems that the new warnings are due to a a compiler option being set by Xcode 12.5 rather than the new version of the compiler. However CMake provides no insight into the Xcode version so revert to not trying to turn off the warnings for version 12.0.0 to avoid the "unknown command option" warnings in CI which currently uses Xcode 12.4 and clang 12.0.0. We'll tolerate the compile warnings, that we are trying to disable, in local builds in the event that CMake/Xcode 12.5 somehow selects clang 12.0.0 instead of 12.0.5. * Make build_macos.sh usable locally as well as in CI. * Don't build docs in CI for iOS. * Rename MOLTEN_VK variables to MOLTENVK. * Add CMakeUserPresets.json to .gitignore. * Fix bad comparison & VS201[57] compile error.
1 parent 2b2b48f commit 03f87b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7098
-16231
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*~
77
*.bak
88

9+
/CMakeUserPresets.json
910
/build*/
1011
/install*/
1112

CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if(APPLE)
5050
set(PRODUCTBUILD_KEYCHAIN_PATH "" CACHE FILEPATH "pkgbuild keychain file")
5151
if(IOS)
5252
set(XCODE_PROVISIONING_PROFILE_SPECIFIER "" CACHE STRING "Xcode provisioning profile specifier")
53-
set(MOLTEN_VK_SDK "$ENV{VULKAN_SDK}/../MoltenVK" CACHE STRING "MoltenVK directory inside the Vulkan SDK")
53+
set(MOLTENVK_SDK "$ENV{VULKAN_SDK}/../MoltenVK" CACHE STRING "MoltenVK directory inside the Vulkan SDK")
5454
endif()
5555
endif()
5656

@@ -491,12 +491,13 @@ elseif(EMSCRIPTEN)
491491
PROPERTIES COMPILE_OPTIONS "-Wno-sign-compare;-Wno-unused-function;-Wno-unused-variable;"
492492
)
493493
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
494+
#message(STATUS "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}")
494495
set_source_files_properties(
495496
lib/basisu/transcoder/basisu_transcoder.cpp
496497
lib/basisu/encoder/basisu_enc.cpp
497498
PROPERTIES COMPILE_OPTIONS "-Wno-unused-variable;-Wno-sign-compare;-Wno-shorten-64-to-32"
498499
)
499-
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "12.0.0")
500+
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "12.0.5")
500501
set_source_files_properties( lib/basisu/encoder/basisu_kernels_sse.cpp
501502
PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-deprecated-copy;-Wno-uninitialized-const-reference"
502503
)

ci_scripts/build_macos.sh

+29-13
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,27 @@ OSX_XCODE_OPTIONS=(-alltargets -destination "platform=OS X,arch=x86_64")
1111
IOS_XCODE_OPTIONS=(-alltargets -destination "generic/platform=iOS" -destination "platform=iOS Simulator,OS=latest")
1212
XCODE_CODESIGN_ENV='CODE_SIGN_IDENTITY= CODE_SIGN_ENTITLEMENTS= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO'
1313

14+
if [ -z "$VULKAN_SDK" ]; then
15+
export VULKAN_SDK=~/VulkanSDK/1.2.176.1/macOS
16+
fi
17+
1418
# Ensure that Vulkan SDK's glslc is in PATH
1519
export PATH="${VULKAN_SDK}/bin:$PATH"
1620

1721
if [ -z "$DEPLOY_BUILD_DIR" ]; then
1822
DEPLOY_BUILD_DIR=build-macos-universal
1923
fi
2024

25+
if which -s xcpretty ; then
26+
function handle_compiler_output() {
27+
tee -a fullbuild.log | xcpretty
28+
}
29+
else
30+
function handle_compiler_output() {
31+
cat
32+
}
33+
fi
34+
2135
#
2236
# macOS
2337
#
@@ -29,27 +43,29 @@ fi
2943
echo "Configure KTX-Software (macOS universal binary) without SSE support"
3044
if [ -n "$MACOS_CERTIFICATES_P12" ]; then
3145
cmake -GXcode -B$DEPLOY_BUILD_DIR \
32-
-DKTX_FEATURE_DOC=ON \
3346
-DCMAKE_OSX_ARCHITECTURES="\$(ARCHS_STANDARD)" \
34-
-DBASISU_SUPPORT_SSE=OFF \
47+
-DKTX_FEATURE_DOC=ON \
3548
-DKTX_FEATURE_LOADTEST_APPS=ON \
49+
-DBASISU_SUPPORT_SSE=OFF \
3650
-DXCODE_CODE_SIGN_IDENTITY="${CODE_SIGN_IDENTITY}" \
3751
-DXCODE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
3852
-DPRODUCTBUILD_IDENTITY_NAME="${PKG_SIGN_IDENTITY}"
3953
else # No secure variables means a PR or fork build.
4054
echo "************* No Secure variables. ******************"
4155
cmake -GXcode -B$DEPLOY_BUILD_DIR \
42-
-DKTX_FEATURE_DOC=ON \
4356
-DCMAKE_OSX_ARCHITECTURES="\$(ARCHS_STANDARD)" \
44-
-DBASISU_SUPPORT_SSE=OFF \
45-
-DKTX_FEATURE_LOADTEST_APPS=ON
57+
-DKTX_FEATURE_DOC=ON \
58+
-DKTX_FEATURE_LOADTEST_APPS=ON \
59+
-DBASISU_SUPPORT_SSE=OFF
4660
fi
4761

4862
echo "Configure KTX-Software (macOS x86_64) with SSE support"
4963
cmake -GXcode -Bbuild-macos-sse \
5064
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
65+
-DKTX_FEATURE_LOADTEST_APPS=ON \
5166
-DBASISU_SUPPORT_SSE=ON
5267

68+
5369
# Cause the build pipes below to set the exit to the exit code of the
5470
# last program to exit non-zero.
5571
set -o pipefail
@@ -58,16 +74,16 @@ pushd $DEPLOY_BUILD_DIR
5874

5975
# Build and test Debug
6076
echo "Build KTX-Software (macOS universal binary Debug)"
61-
cmake --build . --config Debug -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee fullbuild.log | xcpretty
77+
cmake --build . --config Debug -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | handle_compiler_output
6278
echo "Test KTX-Software (macOS universal binary Debug)"
6379
ctest -C Debug # --verbose
6480

6581
# Build and test Release
6682
echo "Build KTX-Software (macOS universal binary Release)"
6783
if [ -n "$MACOS_CERTIFICATES_P12" ]; then
68-
cmake --build . --config Release | tee -a fullbuild.log | xcpretty
84+
cmake --build . --config Release | handle_compiler_output
6985
else
70-
cmake --build . --config Release -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee -a fullbuild.log | xcpretty
86+
cmake --build . --config Release -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | handle_compiler_output
7187
fi
7288
echo "Test KTX-Software (macOS universal binary Release)"
7389
ctest -C Release # --verbose
@@ -84,12 +100,12 @@ popd
84100
pushd build-macos-sse
85101

86102
echo "Build KTX-Software (macOS with SSE support Debug)"
87-
cmake --build . --config Debug -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee -a fullbuild.log | xcpretty
103+
cmake --build . --config Debug -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | handle_compiler_output
88104

89105
echo "Test KTX-Software (macOS with SSE support Debug)"
90106
ctest -C Debug # --verbose
91107
echo "Build KTX-Software (macOS with SSE support Release)"
92-
cmake --build . --config Release -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee -a fullbuild.log | xcpretty
108+
cmake --build . --config Release -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | handle_compiler_output
93109

94110
echo "Test KTX-Software (macOS with SSE support Release)"
95111
ctest -C Release # --verbose
@@ -101,14 +117,14 @@ popd
101117
#
102118

103119
echo "Configure KTX-Software (iOS)"
104-
cmake -GXcode -Bbuild-ios -DCMAKE_SYSTEM_NAME=iOS -DKTX_FEATURE_LOADTEST_APPS=ON -DKTX_FEATURE_DOC=ON
120+
cmake -GXcode -Bbuild-ios -DCMAKE_SYSTEM_NAME=iOS -DKTX_FEATURE_LOADTEST_APPS=ON -DKTX_FEATURE_DOC=OFF
105121
pushd build-ios
106122
echo "Build KTX-Software (iOS Debug)"
107-
cmake --build . --config Debug -- -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO | tee -a fullbuild.log | xcpretty
123+
cmake --build . --config Debug -- -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO | handle_compiler_output
108124
# echo "Build KTX-Software (iOS Simulator Debug)"
109125
# cmake --build . --config Debug -- -sdk iphonesimulator
110126
echo "Build KTX-Software (iOS Release)"
111-
cmake --build . --config Release -- -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO | tee -a fullbuild.log | xcpretty
127+
cmake --build . --config Release -- -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO | handle_compiler_output
112128
# echo "Build KTX-Software (iOS Simulator Release)"
113129
# cmake --build . --config Release -- -sdk iphonesimulator
114130
popd

tests/gtest/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ PUBLIC
1414
.
1515
)
1616

17+
target_compile_features(gtest PUBLIC cxx_std_11)
18+
1719
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
1820
set_source_files_properties(
1921
src/gtest-all.cc

tests/gtest/include/gtest/gtest-death-test.h

+40-36
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2727
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
2930
//
30-
// Author: [email protected] (Zhanyong Wan)
31-
//
32-
// The Google C++ Testing Framework (Google Test)
31+
// The Google C++ Testing and Mocking Framework (Google Test)
3332
//
3433
// This header file defines the public API for death tests. It is
3534
// #included by gtest.h so a user doesn't need to include this
3635
// directly.
36+
// GOOGLETEST_CM0001 DO NOT DELETE
3737

38-
#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
39-
#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
38+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
39+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
4040

4141
#include "gtest/internal/gtest-death-test-internal.h"
4242

@@ -97,8 +97,13 @@ GTEST_API_ bool InDeathTestChild();
9797
//
9898
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
9999
//
100+
// The final parameter to each of these macros is a matcher applied to any data
101+
// the sub-process wrote to stderr. For compatibility with existing tests, a
102+
// bare string is interpreted as a regular expression matcher.
103+
//
100104
// On the regular expressions used in death tests:
101105
//
106+
// GOOGLETEST_CM0005 DO NOT DELETE
102107
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
103108
// which uses the POSIX extended regex syntax.
104109
//
@@ -160,47 +165,46 @@ GTEST_API_ bool InDeathTestChild();
160165
// is rarely a problem as people usually don't put the test binary
161166
// directory in PATH.
162167
//
163-
// TODO([email protected]): make thread-safe death tests search the PATH.
164168

165-
// Asserts that a given statement causes the program to exit, with an
166-
// integer exit status that satisfies predicate, and emitting error output
167-
// that matches regex.
168-
# define ASSERT_EXIT(statement, predicate, regex) \
169-
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
169+
// Asserts that a given `statement` causes the program to exit, with an
170+
// integer exit status that satisfies `predicate`, and emitting error output
171+
// that matches `matcher`.
172+
# define ASSERT_EXIT(statement, predicate, matcher) \
173+
GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_FATAL_FAILURE_)
170174

171-
// Like ASSERT_EXIT, but continues on to successive tests in the
172-
// test case, if any:
173-
# define EXPECT_EXIT(statement, predicate, regex) \
174-
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
175+
// Like `ASSERT_EXIT`, but continues on to successive tests in the
176+
// test suite, if any:
177+
# define EXPECT_EXIT(statement, predicate, matcher) \
178+
GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
175179

176-
// Asserts that a given statement causes the program to exit, either by
180+
// Asserts that a given `statement` causes the program to exit, either by
177181
// explicitly exiting with a nonzero exit code or being killed by a
178-
// signal, and emitting error output that matches regex.
179-
# define ASSERT_DEATH(statement, regex) \
180-
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
182+
// signal, and emitting error output that matches `matcher`.
183+
# define ASSERT_DEATH(statement, matcher) \
184+
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
181185

182-
// Like ASSERT_DEATH, but continues on to successive tests in the
183-
// test case, if any:
184-
# define EXPECT_DEATH(statement, regex) \
185-
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
186+
// Like `ASSERT_DEATH`, but continues on to successive tests in the
187+
// test suite, if any:
188+
# define EXPECT_DEATH(statement, matcher) \
189+
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
186190

187191
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
188192

189193
// Tests that an exit code describes a normal exit with a given exit code.
190194
class GTEST_API_ ExitedWithCode {
191195
public:
192196
explicit ExitedWithCode(int exit_code);
197+
ExitedWithCode(const ExitedWithCode&) = default;
198+
void operator=(const ExitedWithCode& other) = delete;
193199
bool operator()(int exit_status) const;
194200
private:
195-
// No implementation - assignment is unsupported.
196-
void operator=(const ExitedWithCode& other);
197-
198201
const int exit_code_;
199202
};
200203

201204
# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
202205
// Tests that an exit code describes an exit due to termination by a
203206
// given signal.
207+
// GOOGLETEST_CM0006 DO NOT DELETE
204208
class GTEST_API_ KilledBySignal {
205209
public:
206210
explicit KilledBySignal(int signum);
@@ -226,7 +230,7 @@ class GTEST_API_ KilledBySignal {
226230
// return 12;
227231
// }
228232
//
229-
// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
233+
// TEST(TestSuite, TestDieOr12WorksInDgbAndOpt) {
230234
// int sideeffect = 0;
231235
// // Only asserts in dbg.
232236
// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
@@ -275,20 +279,20 @@ class GTEST_API_ KilledBySignal {
275279
// This macro is used for implementing macros such as
276280
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
277281
// death tests are not supported. Those macros must compile on such systems
278-
// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
279-
// systems that support death tests. This allows one to write such a macro
280-
// on a system that does not support death tests and be sure that it will
281-
// compile on a death-test supporting system. It is exposed publicly so that
282-
// systems that have death-tests with stricter requirements than
283-
// GTEST_HAS_DEATH_TEST can write their own equivalent of
284-
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED.
282+
// if and only if EXPECT_DEATH and ASSERT_DEATH compile with the same parameters
283+
// on systems that support death tests. This allows one to write such a macro on
284+
// a system that does not support death tests and be sure that it will compile
285+
// on a death-test supporting system. It is exposed publicly so that systems
286+
// that have death-tests with stricter requirements than GTEST_HAS_DEATH_TEST
287+
// can write their own equivalent of EXPECT_DEATH_IF_SUPPORTED and
288+
// ASSERT_DEATH_IF_SUPPORTED.
285289
//
286290
// Parameters:
287291
// statement - A statement that a macro such as EXPECT_DEATH would test
288292
// for program termination. This macro has to make sure this
289293
// statement is compiled but not executed, to ensure that
290294
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
291-
// parameter iff EXPECT_DEATH compiles with it.
295+
// parameter if and only if EXPECT_DEATH compiles with it.
292296
// regex - A regex that a macro such as EXPECT_DEATH would use to test
293297
// the output of statement. This parameter has to be
294298
// compiled but not evaluated by this macro, to ensure that
@@ -339,4 +343,4 @@ class GTEST_API_ KilledBySignal {
339343

340344
} // namespace testing
341345

342-
#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
346+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_

0 commit comments

Comments
 (0)