Move CMake build targets for PowerVR samples before unit tests

This refactoring is part of a hack which will allow us to add glslang
for use by unit tests and benchmarks, but skip it when PowerVR already
provides glslang.

Bug: b/158655757
Change-Id: I1991ea5ea7524ba71ce9bc2c1d55114318ba434f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45648
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e06e4e..3bda399 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -732,28 +732,6 @@
 # Sample programs and tests
 ###########################################################
 
-if(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)
-        set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL FALSE FORCE)
-        add_subdirectory(${THIRD_PARTY_DIR}/benchmark)
-    endif()
-
-    add_subdirectory(${TESTS_DIR}/ReactorBenchmarks) # Add ReactorBenchmarks target
-    add_subdirectory(${TESTS_DIR}/SystemBenchmarks) # Add system-benchmarks target
-    add_subdirectory(${TESTS_DIR}/VulkanBenchmarks) # Add VulkanBenchmarks target
-endif()
-
-if(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)
         set(PVR_WINDOW_SYSTEM XCB)
@@ -872,3 +850,25 @@
         set_target_properties(${pvr_target} PROPERTIES FOLDER Samples/PowerVR-Build)
     endforeach()
 endif()
+
+if(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)
+        set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL FALSE FORCE)
+        add_subdirectory(${THIRD_PARTY_DIR}/benchmark)
+    endif()
+
+    add_subdirectory(${TESTS_DIR}/ReactorBenchmarks) # Add ReactorBenchmarks target
+    add_subdirectory(${TESTS_DIR}/SystemBenchmarks) # Add system-benchmarks target
+    add_subdirectory(${TESTS_DIR}/VulkanBenchmarks) # Add VulkanBenchmarks target
+endif()
+
+if(SWIFTSHADER_BUILD_TESTS AND SWIFTSHADER_BUILD_VULKAN)
+    add_subdirectory(${TESTS_DIR}/VulkanUnitTests) # Add VulkanUnitTests target
+endif()