options, while others take a string as input. The following is a table of all
on/off options currently supported by this repository:
-| Option | Platform | Default | Description |
-| ------ | -------- | ------- | ----------- |
-| BUILD_CUBE | All | `ON` | Controls whether or not the vkcube demo is built. |
-| BUILD_VULKANINFO | All | `ON` | Controls whether or not the vulkaninfo utility is built. |
-| BUILD_ICD | All | `ON` | Controls whether or not the mock ICD is built. |
-| INSTALL_ICD | All | `OFF` | Controls whether or not the mock ICD is installed as part of the install target. |
-| BUILD_WSI_XCB_SUPPORT | Linux | `ON` | Build the components with XCB support. |
-| BUILD_WSI_XLIB_SUPPORT | Linux | `ON` | Build the components with Xlib support. |
-| BUILD_WSI_WAYLAND_SUPPORT | Linux | `ON` | Build the components with Wayland support. |
-| BUILD_WSI_DIRECTFB_SUPPORT | Linux | `OFF` | Build the components with DirectFB support. |
+| Option | Platform | Default | Description |
+| -------------------------- | -------- | ------- | -------------------------------------------------------------------------------- |
+| BUILD_TESTS | All | `OFF` | Controls whether the tests are built. |
+| BUILD_CUBE | All | `ON` | Controls whether or not the vkcube demo is built. |
+| BUILD_VULKANINFO | All | `ON` | Controls whether or not the vulkaninfo utility is built. |
+| BUILD_ICD | All | `ON` | Controls whether or not the mock ICD is built. |
+| INSTALL_ICD | All | `OFF` | Controls whether or not the mock ICD is installed as part of the install target. |
+| BUILD_WSI_XCB_SUPPORT | Linux | `ON` | Build the components with XCB support. |
+| BUILD_WSI_XLIB_SUPPORT | Linux | `ON` | Build the components with Xlib support. |
+| BUILD_WSI_WAYLAND_SUPPORT | Linux | `ON` | Build the components with Wayland support. |
+| BUILD_WSI_DIRECTFB_SUPPORT | Linux | `OFF` | Build the components with DirectFB support. |
The following is a table of all string options currently supported by this repository:
-| Option | Platform | Default | Description |
-| ------ | -------- | ------- | ----------- |
-| VULKANINFO_BUILD_DLL_VERSIONINFO | Windows | `""` | Set the Windows specific version information for Vulkaninfo. Format is "major.minor.patch.build". |
+| Option | Platform | Default | Description |
+| -------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------- |
+| VULKANINFO_BUILD_DLL_VERSIONINFO | Windows | `""` | Set the Windows specific version information for Vulkaninfo. Format is "major.minor.patch.build". |
These variables should be set using the `-D` option when invoking CMake to
generate the native platform files.
include:
| Build Platform | 64-bit Generator | 32-bit Generator |
-|------------------------------|-------------------------------|-------------------------|
+| ---------------------------- | ----------------------------- | ----------------------- |
| Microsoft Visual Studio 2013 | "Visual Studio 12 2013 Win64" | "Visual Studio 12 2013" |
| Microsoft Visual Studio 2015 | "Visual Studio 14 2015 Win64" | "Visual Studio 14 2015" |
| Microsoft Visual Studio 2017 | "Visual Studio 15 2017 Win64" | "Visual Studio 15 2017" |
endif()
add_subdirectory(windows-runtime-installer)
+
+option(BUILD_TESTS "Build the tests")
+if(BUILD_TESTS)
+ enable_testing()
+ add_subdirectory(tests)
+endif()
--- /dev/null
+# ~~~
+# Copyright (c) 2023 Valve Corporation
+# Copyright (c) 2023 LunarG, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ~~~
+
+find_package(GTest REQUIRED CONFIG QUIET)
+
+add_executable(vulkan_tools_tests)
+target_sources(vulkan_tools_tests PRIVATE
+ main.cpp
+ icd/mock_icd_tests.cpp
+)
+get_target_property(TEST_SOURCES vulkan_tools_tests SOURCES)
+source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${TEST_SOURCES})
+
+# make sure tests are built after all of the following are built
+add_dependencies(vulkan_tools_tests vkcube vkcubepp VkICD_mock_icd vulkaninfo)
+
+target_link_libraries(vulkan_tools_tests GTest::gtest)
+
+include(GoogleTest)
+gtest_discover_tests(vulkan_tools_tests DISCOVERY_TIMEOUT 100)
--- /dev/null
+/*
+ * Copyright (c) 2023 The Khronos Group Inc.
+ * Copyright (c) 2023 Valve Corporation
+ * Copyright (c) 2023 LunarG, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "gtest/gtest.h"
+
+TEST(MockICD, Basic) {
+ // only to make sure tests can be run
+ ASSERT_TRUE(true);
+}
--- /dev/null
+/*
+ * Copyright (c) 2023 The Khronos Group Inc.
+ * Copyright (c) 2023 Valve Corporation
+ * Copyright (c) 2023 LunarG, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#if defined(_WIN32) && !defined(NDEBUG)
+#include <crtdbg.h>
+#endif
+
+#include "gtest/gtest.h"
+
+int main(int argc, char **argv) {
+ int result;
+
+#if defined(_WIN32)
+#if !defined(NDEBUG)
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+#endif
+ // Avoid "Abort, Retry, Ignore" dialog boxes
+ _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
+ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+#endif
+
+ ::testing::InitGoogleTest(&argc, argv);
+
+ result = RUN_ALL_TESTS();
+
+ return result;
+}