Build statically when buiding examples

This commit is contained in:
dcvz 2024-05-13 13:49:29 +02:00
parent 52ff2c65d6
commit 5f80997e5c
2 changed files with 9 additions and 11 deletions

View File

@ -3,7 +3,10 @@ project(rt64)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
option(RT64_BUILD_EXAMPLES "Build examples for RT64" ON)
option(RT64_BUILD_EXAMPLES "Build examples for RT64" OFF)
if (${RT64_BUILD_EXAMPLES})
set(RT64_STATIC ON)
endif()
function(preprocess INFILE OUTFILE OPTIONS)
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")

View File

@ -6,20 +6,15 @@ namespace RT64 {
}
int main(int argc, char** argv) {
std::unique_ptr<RT64::RenderInterface> renderInterface;
std::unique_ptr<RT64::RenderInterface> renderInterface = RT64::CreateVulkanInterface();
// Create a render interface with the preferred backend.
#ifdef _WIN32
// Windows only: Can also use D3D12.
const bool useVulkan = true;
if (useVulkan) {
renderInterface = RT64::CreateVulkanInterface();
}
else {
#ifdef _WIN64
if (!useVulkan) {
renderInterface = RT64::CreateD3D12Interface();
#else
assert(false);
#endif
}
#endif
// Execute a blocking test that creates a window and draws some geometry to test the render interface.
RT64::RenderInterfaceTest(renderInterface.get());