vulkaninfo: Move vulkaninfo from demos to top level
authorMark Lobodzinski <mark@lunarg.com>
Wed, 11 Apr 2018 18:26:57 +0000 (12:26 -0600)
committerMark Lobodzinski <mark@lunarg.com>
Sat, 12 May 2018 02:10:23 +0000 (20:10 -0600)
Change-Id: Ifb946c4eacd950f8c021399b87e9437edf5533bf

CMakeLists.txt
demos/CMakeLists.txt
vulkaninfo/CMakeLists.txt [new file with mode: 0644]
vulkaninfo/vulkaninfo.c [moved from demos/vulkaninfo.c with 100% similarity]
vulkaninfo/vulkaninfo.vcxproj.user [moved from demos/vulkaninfo.vcxproj.user with 100% similarity]

index 5019061..c13c099 100644 (file)
@@ -152,6 +152,7 @@ else()
 endif()
 
 option(BUILD_DEMOS "Build demos" ON)
+option(BUILD_VULKANINFO "Build vulkaninfo" ON)
 option(BUILD_ICD "Build icd" ON)
 
 find_program(GLSLANG_VALIDATOR NAMES glslangValidator
@@ -194,6 +195,9 @@ add_definitions(-DAPI_NAME="${API_NAME}")
 if(BUILD_DEMOS)
     add_subdirectory(demos)
 endif()
+if(BUILD_VULKANINFO)
+    add_subdirectory(vulkaninfo)
+endif()
 if(BUILD_ICD)
     add_subdirectory(icd)
 endif()
index 6ea7f45..46b1f6b 100644 (file)
@@ -114,7 +114,6 @@ if(WIN32)
     endforeach()
 
    file(COPY cube.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/demos)
-   file(COPY vulkaninfo.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/demos)
 endif()
 
 add_custom_command(
@@ -148,7 +147,6 @@ include_directories(
     ${DEMO_INCLUDE_DIRS}
     )
 
-######################################################################################
 # vulkaninfo
 if(WIN32)
     add_executable(vulkaninfo vulkaninfo.c vulkaninfo.rc)
diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a804b07
--- /dev/null
@@ -0,0 +1,26 @@
+# CMakeLists.txt file for building Vulkaninfo
+
+add_executable(vulkaninfo vulkaninfo.c)
+target_link_libraries(vulkaninfo Vulkan::Vulkan)
+
+if(WIN32)
+    target_compile_definitions(vulkaninfo PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS)
+
+    # Use static MSVCRT libraries
+    foreach(configuration in CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
+                             CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+        if(${configuration} MATCHES "/MD")
+            string(REGEX REPLACE "/MD" "/MT" ${configuration} "${${configuration}}")
+        endif()
+    endforeach()
+
+    file(COPY vulkaninfo.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/demos)
+endif()
+
+
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+    if(INSTALL_LVL_FILES)
+        install(TARGETS ${API_LOWERCASE}info DESTINATION ${CMAKE_INSTALL_BINDIR})
+    endif()
+endif()
+
similarity index 100%
rename from demos/vulkaninfo.c
rename to vulkaninfo/vulkaninfo.c