info-tool: add simple json-like information query
This commit is contained in:
parent
2c0f3f4df4
commit
e6a4529e59
@ -91,6 +91,8 @@ list (APPEND sources
|
||||
|
||||
##-----------------------------------------------------------------------------
|
||||
add_library (cruft-vk STATIC ${sources})
|
||||
target_link_libraries (cruft-vk cruft-util vulkan)
|
||||
|
||||
|
||||
###############################################################################
|
||||
get_directory_property (HAS_PARENT PARENT_DIRECTORY)
|
||||
@ -99,6 +101,18 @@ if (HAS_PARENT)
|
||||
endif ()
|
||||
|
||||
|
||||
###############################################################################
|
||||
foreach (t info)
|
||||
add_executable (vk_${t} "tools/${t}.cpp")
|
||||
set_target_properties(vk_${t} PROPERTIES
|
||||
OUTPUT_NAME
|
||||
${t})
|
||||
set_target_properties(vk_${t} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/tools")
|
||||
target_link_libraries (vk_${t} cruft-vk)
|
||||
endforeach ()
|
||||
|
||||
###############################################################################
|
||||
configure_file(libcruft-vk-system.pc.in libcruft-vk.pc)
|
||||
configure_file(Doxyfile.in Doxyfile)
|
||||
|
36
tools/info.cpp
Normal file
36
tools/info.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Copyright:
|
||||
* 2017, Danny Robson <danny@nerdcruft.net>
|
||||
*/
|
||||
|
||||
#include <cruft/vk/instance.hpp>
|
||||
#include <cruft/vk/physical_device.hpp>
|
||||
#include <cruft/vk/ostream.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int
|
||||
main (int, char**)
|
||||
{
|
||||
cruft::vk::instance instance (cruft::vk::instance::create_info {});
|
||||
std::cout << "instance: " << instance << '\n';
|
||||
|
||||
auto devices = cruft::vk::physical_device::find (instance);
|
||||
|
||||
for (const auto &d: devices) {
|
||||
std::cout << d << '\n';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user