mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 00:50:40 +00:00
Print custom lines of API support on the version string of renderdoccmd
* An easy way to check what support is compiled into this binary.
This commit is contained in:
@@ -37,6 +37,14 @@ option(ENABLE_XCB "Enable xcb windowing support" ON)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
|
||||
if(ENABLE_GL)
|
||||
add_definitions(-DRENDERDOC_SUPPORT_GL)
|
||||
endif()
|
||||
|
||||
if(ENABLE_VULKAN)
|
||||
add_definitions(-DRENDERDOC_SUPPORT_VULKAN)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fstrict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
|
||||
@@ -12,8 +12,6 @@ elseif(UNIX)
|
||||
list(APPEND sources renderdoccmd_linux.cpp)
|
||||
|
||||
if(ENABLE_GL)
|
||||
add_definitions(-DRENDERDOC_SUPPORT_GL)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
list(APPEND includes PRIVATE ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND libraries PRIVATE ${OPENGL_gl_LIBRARY})
|
||||
|
||||
@@ -153,6 +153,8 @@ static int command_usage(std::string command = "")
|
||||
return 2;
|
||||
}
|
||||
|
||||
static std::vector<std::string> version_lines;
|
||||
|
||||
struct VersionCommand : public Command
|
||||
{
|
||||
virtual void AddOptions(cmdline::parser &parser) {}
|
||||
@@ -161,13 +163,21 @@ struct VersionCommand : public Command
|
||||
virtual bool IsCaptureCommand() { return false; }
|
||||
virtual int Execute(cmdline::parser &parser, const CaptureOptions &)
|
||||
{
|
||||
std::cout << "renderdoccmd " << RENDERDOC_GetVersionString()
|
||||
<< (sizeof(uintptr_t) == sizeof(uint64_t) ? " x64 " : " x86 ")
|
||||
<< RENDERDOC_GetCommitHash() << std::endl;
|
||||
std::cout << "renderdoccmd " << (sizeof(uintptr_t) == sizeof(uint64_t) ? "x64 " : "x86 ")
|
||||
<< RENDERDOC_GetVersionString() << "-" << RENDERDOC_GetCommitHash() << std::endl;
|
||||
|
||||
for(size_t i = 0; i < version_lines.size(); i++)
|
||||
std::cout << version_lines[i] << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
void add_version_line(const std::string &str)
|
||||
{
|
||||
version_lines.push_back(str);
|
||||
}
|
||||
|
||||
struct HelpCommand : public Command
|
||||
{
|
||||
virtual void AddOptions(cmdline::parser &parser) {}
|
||||
|
||||
@@ -50,6 +50,8 @@ struct Command
|
||||
extern bool usingKillSignal;
|
||||
extern volatile uint32_t killSignal;
|
||||
|
||||
void add_version_line(const std::string &str);
|
||||
|
||||
void add_command(const std::string &name, Command *cmd);
|
||||
void add_alias(const std::string &alias, const std::string &command);
|
||||
|
||||
|
||||
@@ -238,9 +238,67 @@ int main(int argc, char *argv[])
|
||||
signal(SIGINT, sig_handler);
|
||||
signal(SIGTERM, sig_handler);
|
||||
|
||||
// do any linux-specific setup here
|
||||
// add compiled-in support to version line
|
||||
{
|
||||
string support = "APIs supported at compile-time: ";
|
||||
int count = 0;
|
||||
|
||||
// process any linux-specific arguments here
|
||||
#if defined(RENDERDOC_SUPPORT_VULKAN)
|
||||
support += "Vulkan, ";
|
||||
count++;
|
||||
#endif
|
||||
|
||||
#if defined(RENDERDOC_SUPPORT_GL)
|
||||
support += "GL, ";
|
||||
count++;
|
||||
#endif
|
||||
|
||||
if(count == 0)
|
||||
{
|
||||
support += "None.";
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove trailing ', '
|
||||
support.pop_back();
|
||||
support.pop_back();
|
||||
support += ".";
|
||||
}
|
||||
|
||||
add_version_line(support);
|
||||
|
||||
support = "Windowing systems supported at compile-time: ";
|
||||
count = 0;
|
||||
|
||||
#if defined(RENDERDOC_WINDOWING_XLIB)
|
||||
support += "xlib, ";
|
||||
count++;
|
||||
#endif
|
||||
|
||||
#if defined(RENDERDOC_WINDOWING_XCB)
|
||||
support += "XCB, ";
|
||||
count++;
|
||||
#endif
|
||||
|
||||
#if defined(RENDERDOC_SUPPORT_VULKAN)
|
||||
support += "Vulkan KHR_display, ";
|
||||
count++;
|
||||
#endif
|
||||
|
||||
if(count == 0)
|
||||
{
|
||||
support += "None.";
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove trailing ', '
|
||||
support.pop_back();
|
||||
support.pop_back();
|
||||
support += ".";
|
||||
}
|
||||
|
||||
add_version_line(support);
|
||||
}
|
||||
|
||||
return renderdoccmd(argc, argv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user