CMake: split out test and benchmark targets

Moved out code from the root CMakeLists into new CMakeLists for each
test and benchmark directory. For Reactor, both the unit test and
benchmark source files are in src/Reactor, so for now, I created folders
for these under tests with a CMakeLists that includes the source files
from src/Reactor. This will be cleaned up eventually when we move
Reactor out of src (b/154013190).

Bug: b/145758253
Change-Id: Ic6bbc394e49d3bdc3105509a19458722fcfe68ee
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43868
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a903e19..f818244 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -755,88 +755,11 @@
 ###########################################################
 
 if(SWIFTSHADER_BUILD_TESTS)
-    set(REACTOR_UNIT_TESTS_LIST
-        ${SOURCE_DIR}/Reactor/ReactorUnitTests.cpp
-    )
-
-    add_executable(ReactorUnitTests ${REACTOR_UNIT_TESTS_LIST})
-    set_target_properties(ReactorUnitTests PROPERTIES
-        COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
-        LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
-        FOLDER "Tests"
-    )
-    target_link_libraries(ReactorUnitTests ${Reactor} ${OS_LIBS} gtest)
-
-    set(GLES_UNITTESTS_LIST
-        ${TESTS_DIR}/GLESUnitTests/main.cpp
-        ${TESTS_DIR}/GLESUnitTests/unittests.cpp
-    )
-
-    set(GLES_UNITTESTS_INCLUDE_DIR
-        ${CMAKE_CURRENT_SOURCE_DIR}/include/
-    )
-
-    add_executable(gles-unittests ${GLES_UNITTESTS_LIST})
-    set_target_properties(gles-unittests PROPERTIES
-        INCLUDE_DIRECTORIES "${GLES_UNITTESTS_INCLUDE_DIR}"
-        FOLDER "Tests"
-        COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
-        COMPILE_DEFINITIONS "STANDALONE"
-        LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
-    )
-
-    target_link_libraries(gles-unittests libEGL libGLESv2 ${OS_LIBS} ${SWIFTSHADER_LIBS} gtest gmock)
-    if(ANDROID)
-        target_link_libraries(gles-unittests -landroid)
-    endif()
-
-    # Math unit tests
-    set(MATH_UNITTESTS_LIST
-        ${TESTS_DIR}/MathUnitTests/main.cpp
-        ${TESTS_DIR}/MathUnitTests/unittests.cpp
-    )
-
-    set(MATH_UNITTESTS_INCLUDE_DIR
-        ${CMAKE_CURRENT_SOURCE_DIR}/src/
-    )
-
-    add_executable(math-unittests ${MATH_UNITTESTS_LIST})
-    set_target_properties(math-unittests PROPERTIES
-        INCLUDE_DIRECTORIES "${MATH_UNITTESTS_INCLUDE_DIR}"
-        FOLDER "Tests"
-        COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
-        LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
-    )
-
-    target_link_libraries(math-unittests gtest gmock)
-    if(NOT WIN32)
-        target_link_libraries(math-unittests pthread ${SWIFTSHADER_LIBS})
-    endif()
-
-    # System unit tests
-    set(SYSTEM_UNITTESTS_LIST
-        ${TESTS_DIR}/SystemUnitTests/main.cpp
-        ${TESTS_DIR}/SystemUnitTests/unittests.cpp
-    )
-
-    set(SYSTEM_UNITTESTS_INCLUDE_DIR
-        ${CMAKE_CURRENT_SOURCE_DIR}/src/
-    )
-
-    add_executable(system-unittests ${SYSTEM_UNITTESTS_LIST})
-    set_target_properties(system-unittests PROPERTIES
-        INCLUDE_DIRECTORIES "${SYSTEM_UNITTESTS_INCLUDE_DIR}"
-        FOLDER "Tests"
-        COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
-        LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
-    )
-
-    target_link_libraries(system-unittests vk_system gtest gmock)
-    if(NOT WIN32)
-        target_link_libraries(system-unittests pthread ${SWIFTSHADER_LIBS})
-    endif()
-
-endif(SWIFTSHADER_BUILD_TESTS)
+    add_subdirectory(${TESTS_DIR}/ReactorUnitTests) # Add ReactorUnitTests target
+    add_subdirectory(${TESTS_DIR}/GLESUnitTests) # Add gles-unittests target
+    add_subdirectory(${TESTS_DIR}/MathUnitTests) # Add math-unittests target
+    add_subdirectory(${TESTS_DIR}/SystemUnitTests) # Add system-unittests target
+endif()
 
 if(SWIFTSHADER_BUILD_BENCHMARKS)
     if (NOT TARGET benchmark::benchmark)
@@ -844,70 +767,13 @@
         add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/benchmark)
     endif()
 
-    # Reactor benchmarks
-    set(REACTOR_BENCHMARK_LIST
-        ${SOURCE_DIR}/Reactor/ReactorBenchmarks.cpp
-    )
-
-    add_executable(ReactorBenchmarks ${REACTOR_BENCHMARK_LIST})
-    target_link_libraries(ReactorBenchmarks benchmark::benchmark marl ${Reactor})
-    set_target_properties(ReactorBenchmarks PROPERTIES
-        COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
-        LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
-        FOLDER "Benchmarks"
-    )
-
-    # System benchmarks
-    set(SYSTEM_BENCHMARKS_LIST
-        ${TESTS_DIR}/SystemBenchmarks/main.cpp
-        ${TESTS_DIR}/SystemBenchmarks/LRUCacheBenchmarks.cpp
-    )
-
-    set(SYSTEM_BENCHMARKS_INCLUDE_DIR
-        ${CMAKE_CURRENT_SOURCE_DIR}/src/
-    )
-
-    add_executable(system-benchmarks ${SYSTEM_BENCHMARKS_LIST})
-    target_link_libraries(system-benchmarks benchmark::benchmark)
-    set_target_properties(system-benchmarks PROPERTIES
-        INCLUDE_DIRECTORIES "${SYSTEM_BENCHMARKS_INCLUDE_DIR}"
-        COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
-        LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
-        FOLDER "Benchmarks"
-    )
-
-    target_link_libraries(system-benchmarks vk_system gtest gmock)
-    if(NOT WIN32)
-        target_link_libraries(system-benchmarks pthread ${SWIFTSHADER_LIBS})
-    endif()
-endif(SWIFTSHADER_BUILD_BENCHMARKS)
+    add_subdirectory(${TESTS_DIR}/ReactorBenchmarks) # Add ReactorBenchmarks target
+    add_subdirectory(${TESTS_DIR}/SystemBenchmarks) # Add system-benchmarks target
+endif()
 
 if(SWIFTSHADER_BUILD_TESTS AND SWIFTSHADER_BUILD_VULKAN)
-    set(VK_UNITTESTS_LIST
-        ${TESTS_DIR}/VulkanUnitTests/Device.cpp
-        ${TESTS_DIR}/VulkanUnitTests/Driver.cpp
-        ${TESTS_DIR}/VulkanUnitTests/main.cpp
-        ${TESTS_DIR}/VulkanUnitTests/unittests.cpp
-    )
-
-    set(VK_UNITTESTS_INCLUDE_DIR
-        ${THIRD_PARTY_DIR}/SPIRV-Tools/include
-        ${CMAKE_CURRENT_SOURCE_DIR}/include/
-    )
-
-    add_executable(vk-unittests ${VK_UNITTESTS_LIST})
-    add_dependencies(vk-unittests vk_swiftshader)
-
-    set_target_properties(vk-unittests PROPERTIES
-        INCLUDE_DIRECTORIES "${VK_UNITTESTS_INCLUDE_DIR}"
-        FOLDER "Tests"
-        COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
-        COMPILE_DEFINITIONS "STANDALONE"
-        LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
-    )
-
-    target_link_libraries(vk-unittests SPIRV-Tools ${OS_LIBS} ${SWIFTSHADER_LIBS} gtest gmock)
-endif(SWIFTSHADER_BUILD_TESTS AND SWIFTSHADER_BUILD_VULKAN)
+    add_subdirectory(${TESTS_DIR}/VulkanUnitTests) # Add VulkanUnitTests target
+endif()
 
 if(HAVE_PVR_SUBMODULE AND SWIFTSHADER_BUILD_PVR)
     if(UNIX AND NOT APPLE)
diff --git a/tests/GLESUnitTests/CMakeLists.txt b/tests/GLESUnitTests/CMakeLists.txt
new file mode 100644
index 0000000..1c51430
--- /dev/null
+++ b/tests/GLESUnitTests/CMakeLists.txt
@@ -0,0 +1,63 @@
+# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
+#
+# 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.
+
+set(ROOT_PROJECT_COMPILE_OPTIONS
+    ${SWIFTSHADER_COMPILE_OPTIONS}
+    ${WARNINGS_AS_ERRORS}
+)
+
+set(ROOT_PROJECT_LINK_LIBRARIES
+    ${OS_LIBS}
+    ${SWIFTSHADER_LIBS}
+)
+
+set(GLES_UNIT_TESTS_SRC_FILES
+    main.cpp
+    unittests.cpp
+)
+
+add_executable(gles-unittests
+    ${GLES_UNIT_TESTS_SRC_FILES}
+)
+
+set_target_properties(gles-unittests PROPERTIES
+    FOLDER "Tests"
+    LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+target_include_directories(gles-unittests
+    PRIVATE
+        "${CMAKE_SOURCE_DIR}/include"
+)
+
+target_compile_definitions(gles-unittests
+    PRIVATE
+        "STANDALONE"
+)
+
+target_compile_options(gles-unittests
+    PRIVATE
+        ${ROOT_PROJECT_COMPILE_OPTIONS}
+)
+
+target_link_libraries(gles-unittests
+    PRIVATE
+        libEGL
+        libGLESv2
+        gtest
+        gmock
+        ${ROOT_PROJECT_LINK_LIBRARIES}
+        $<$<BOOL:${ANDROID}>:-landroid>
+)
diff --git a/tests/MathUnitTests/CMakeLists.txt b/tests/MathUnitTests/CMakeLists.txt
new file mode 100644
index 0000000..6b6cfd5
--- /dev/null
+++ b/tests/MathUnitTests/CMakeLists.txt
@@ -0,0 +1,51 @@
+# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
+#
+# 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.
+
+set(ROOT_PROJECT_COMPILE_OPTIONS
+    ${SWIFTSHADER_COMPILE_OPTIONS}
+    ${WARNINGS_AS_ERRORS}
+)
+
+set(ROOT_PROJECT_LINK_LIBRARIES
+    ${OS_LIBS}
+    ${SWIFTSHADER_LIBS}
+)
+
+set(MATH_UNIT_TESTS_SRC_FILES
+    main.cpp
+    unittests.cpp
+)
+
+add_executable(math-unittests
+    ${MATH_UNIT_TESTS_SRC_FILES}
+)
+
+set_target_properties(math-unittests PROPERTIES
+    FOLDER "Tests"
+    LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+target_compile_options(math-unittests
+    PRIVATE
+        ${ROOT_PROJECT_COMPILE_OPTIONS}
+)
+
+target_link_libraries(math-unittests
+    PRIVATE
+        vk_system
+        gtest
+        gmock
+        ${ROOT_PROJECT_LINK_LIBRARIES}
+)
diff --git a/tests/ReactorBenchmarks/CMakeLists.txt b/tests/ReactorBenchmarks/CMakeLists.txt
new file mode 100644
index 0000000..7e80250
--- /dev/null
+++ b/tests/ReactorBenchmarks/CMakeLists.txt
@@ -0,0 +1,51 @@
+# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
+#
+# 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.
+
+set(ROOT_PROJECT_COMPILE_OPTIONS
+    ${SWIFTSHADER_COMPILE_OPTIONS}
+    ${WARNINGS_AS_ERRORS}
+)
+
+set(ROOT_PROJECT_LINK_LIBRARIES
+    ${OS_LIBS}
+    ${SWIFTSHADER_LIBS}
+)
+
+# TODO(b/154013190): move source file to separate folder for this target.
+set(REACTOR_BENCHMARKS_SRC_FILES
+    ../../src/Reactor/ReactorBenchmarks.cpp
+)
+
+add_executable(ReactorBenchmarks
+    ${REACTOR_BENCHMARKS_SRC_FILES}
+)
+
+set_target_properties(ReactorBenchmarks PROPERTIES
+    FOLDER "Benchmarks"
+    LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+target_compile_options(ReactorBenchmarks
+    PRIVATE
+        ${ROOT_PROJECT_COMPILE_OPTIONS}
+)
+
+target_link_libraries(ReactorBenchmarks
+    PRIVATE
+        benchmark::benchmark
+        marl
+        ${Reactor}
+        ${ROOT_PROJECT_LINK_LIBRARIES}
+)
diff --git a/tests/ReactorUnitTests/CMakeLists.txt b/tests/ReactorUnitTests/CMakeLists.txt
new file mode 100644
index 0000000..f607add
--- /dev/null
+++ b/tests/ReactorUnitTests/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
+#
+# 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.
+
+set(ROOT_PROJECT_COMPILE_OPTIONS
+    ${SWIFTSHADER_COMPILE_OPTIONS}
+    ${WARNINGS_AS_ERRORS}
+)
+
+set(ROOT_PROJECT_LINK_LIBRARIES
+    ${OS_LIBS}
+    ${SWIFTSHADER_LIBS}
+)
+
+# TODO(b/154013190): move source file to separate folder for this target.
+set(REACTOR_UNIT_TESTS_SRC_FILES
+    ../../src/Reactor/ReactorUnitTests.cpp
+)
+
+add_executable(ReactorUnitTests
+    ${REACTOR_UNIT_TESTS_SRC_FILES}
+)
+
+set_target_properties(ReactorUnitTests PROPERTIES
+    FOLDER "Tests"
+    LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+target_compile_options(ReactorUnitTests
+    PRIVATE
+        ${ROOT_PROJECT_COMPILE_OPTIONS}
+)
+
+target_link_libraries(ReactorUnitTests
+    PRIVATE
+        ${Reactor}
+        gtest
+        ${ROOT_PROJECT_LINK_LIBRARIES}
+)
diff --git a/tests/SystemBenchmarks/CMakeLists.txt b/tests/SystemBenchmarks/CMakeLists.txt
new file mode 100644
index 0000000..6d37825
--- /dev/null
+++ b/tests/SystemBenchmarks/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
+#
+# 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.
+
+set(ROOT_PROJECT_COMPILE_OPTIONS
+    ${SWIFTSHADER_COMPILE_OPTIONS}
+    ${WARNINGS_AS_ERRORS}
+)
+
+set(ROOT_PROJECT_LINK_LIBRARIES
+    ${OS_LIBS}
+    ${SWIFTSHADER_LIBS}
+)
+
+set(SYSTEM_BENCHMARKS_SRC_FILES
+    main.cpp
+    LRUCacheBenchmarks.cpp
+)
+
+add_executable(system-benchmarks
+    ${SYSTEM_BENCHMARKS_SRC_FILES}
+)
+
+set_target_properties(system-benchmarks PROPERTIES
+    FOLDER "Benchmarks"
+    LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+target_compile_options(system-benchmarks
+    PRIVATE
+        ${ROOT_PROJECT_COMPILE_OPTIONS}
+)
+
+target_link_libraries(system-benchmarks
+    PRIVATE
+        benchmark::benchmark
+        vk_system
+        gtest
+        gmock
+        ${ROOT_PROJECT_LINK_LIBRARIES}
+)
diff --git a/tests/SystemUnitTests/CMakeLists.txt b/tests/SystemUnitTests/CMakeLists.txt
new file mode 100644
index 0000000..ca32f15
--- /dev/null
+++ b/tests/SystemUnitTests/CMakeLists.txt
@@ -0,0 +1,51 @@
+# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
+#
+# 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.
+
+set(ROOT_PROJECT_COMPILE_OPTIONS
+    ${SWIFTSHADER_COMPILE_OPTIONS}
+    ${WARNINGS_AS_ERRORS}
+)
+
+set(ROOT_PROJECT_LINK_LIBRARIES
+    ${OS_LIBS}
+    ${SWIFTSHADER_LIBS}
+)
+
+set(SYSTEM_UNIT_TESTS_SRC_FILES
+    main.cpp
+    unittests.cpp
+)
+
+add_executable(system-unittests
+    ${SYSTEM_UNIT_TESTS_SRC_FILES}
+)
+
+set_target_properties(system-unittests PROPERTIES
+    FOLDER "Tests"
+    LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+target_compile_options(system-unittests
+    PRIVATE
+        ${ROOT_PROJECT_COMPILE_OPTIONS}
+)
+
+target_link_libraries(system-unittests
+    PRIVATE
+        vk_system
+        gtest
+        gmock
+        ${ROOT_PROJECT_LINK_LIBRARIES}
+)
diff --git a/tests/VulkanUnitTests/CMakeLists.txt b/tests/VulkanUnitTests/CMakeLists.txt
new file mode 100644
index 0000000..aa6c298
--- /dev/null
+++ b/tests/VulkanUnitTests/CMakeLists.txt
@@ -0,0 +1,72 @@
+# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
+#
+# 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.
+
+set(ROOT_PROJECT_COMPILE_OPTIONS
+    ${SWIFTSHADER_COMPILE_OPTIONS}
+    ${WARNINGS_AS_ERRORS}
+)
+
+set(ROOT_PROJECT_LINK_LIBRARIES
+    ${OS_LIBS}
+    ${SWIFTSHADER_LIBS}
+)
+
+set(VULKAN_UNIT_TESTS_SRC_FILES
+    Device.hpp
+    Driver.hpp
+    VkGlobalFuncs.hpp
+    VkInstanceFuncs.hpp
+    Device.cpp
+    Driver.cpp
+    main.cpp
+    unittests.cpp
+)
+
+add_executable(vk-unittests
+    ${VULKAN_UNIT_TESTS_SRC_FILES}
+)
+
+# vk-unittests loads vk_swiftshader, so make sure it gets built first
+add_dependencies(vk-unittests
+    vk_swiftshader
+)
+
+set_target_properties(vk-unittests PROPERTIES
+    FOLDER "Tests"
+    LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+target_include_directories(vk-unittests
+    PRIVATE
+        "${CMAKE_SOURCE_DIR}/include"
+)
+
+target_compile_definitions(vk-unittests
+    PRIVATE
+        "STANDALONE"
+)
+
+target_compile_options(vk-unittests
+    PRIVATE
+        ${ROOT_PROJECT_COMPILE_OPTIONS}
+)
+
+target_link_libraries(vk-unittests
+    PRIVATE
+        gtest
+        gmock
+        SPIRV-Tools
+        ${ROOT_PROJECT_LINK_LIBRARIES}
+)