diff options
| author | Simon McVittie <smcv@collabora.com> | 2022-11-09 15:32:39 +0000 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2022-11-09 10:57:59 -0700 |
| commit | e8234991418c5b0536e342bc849d5f8ed9eb6d6f (patch) | |
| tree | b177bee7e3596b1c39ae8e94d733241279bf5c12 | |
| parent | 6e5bd86b76c092fcd5d8a873260a8a96f43705d5 (diff) | |
| download | usermoji-e8234991418c5b0536e342bc849d5f8ed9eb6d6f.tar.xz | |
build: Compile vkcube and other demos, even when cross-compiling
When building software for a non-x86 processor on an x86 build machine,
or building 32-bit software on a 64-bit build machine, it's still useful
to compile demo programs that can be copied into the target environment
and run there, even if they won't necessarily be runnable on the build
machine.
This also addresses a build failure when cross-compiling and attempting
to leave the demos enabled:
CMake Error at cube/CMakeLists.txt:274 (install):
install TARGETS given target "vkcube" which does not exist.
(and similar for the other demos)
Resolves: https://github.com/KhronosGroup/Vulkan-Tools/issues/592
Signed-off-by: Simon McVittie <smcv@collabora.com>
| -rw-r--r-- | cube/CMakeLists.txt | 76 |
1 files changed, 35 insertions, 41 deletions
diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 72e0ae92..48805b3e 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -228,21 +228,19 @@ include_directories(${CUBE_INCLUDE_DIRS}) if(APPLE) include(macOS/cube/cube.cmake) elseif(NOT WIN32) - if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) - add_executable(vkcube - cube.c - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc - ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcube Vulkan::Vulkan) - target_compile_definitions(vkcube PUBLIC ${CUBE_PLATFORM}) - include(CheckLibraryExists) - CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) - if (NEED_RT) - target_link_libraries(vkcube rt) - endif() + add_executable(vkcube + cube.c + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc + ${OPTIONAL_WAYLAND_DATA_FILES}) + target_link_libraries(vkcube Vulkan::Vulkan) + target_compile_definitions(vkcube PUBLIC ${CUBE_PLATFORM}) + include(CheckLibraryExists) + CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) + if (NEED_RT) + target_link_libraries(vkcube rt) endif() else() if(CMAKE_CL_64) @@ -280,17 +278,15 @@ endif() if(APPLE) include(macOS/cubepp/cubepp.cmake) elseif(NOT WIN32) - if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) - add_executable(vkcubepp - cube.cpp - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc - ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcubepp Vulkan::Vulkan) - target_compile_definitions(vkcubepp PUBLIC ${CUBE_PLATFORM}) - endif() + add_executable(vkcubepp + cube.cpp + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc + ${OPTIONAL_WAYLAND_DATA_FILES}) + target_link_libraries(vkcubepp Vulkan::Vulkan) + target_compile_definitions(vkcubepp PUBLIC ${CUBE_PLATFORM}) else() if(CMAKE_CL_64) set(LIB_DIR "Win64") @@ -334,21 +330,19 @@ if(UNIX AND NOT APPLE) # i.e. Linux ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-code.c ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) - if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) - add_executable(vkcube-wayland - cube.c - ${PROJECT_SOURCE_DIR}/cube/cube.vert - ${PROJECT_SOURCE_DIR}/cube/cube.frag - cube.vert.inc - cube.frag.inc - ${OPTIONAL_WAYLAND_DATA_FILES}) - target_link_libraries(vkcube-wayland Vulkan::Vulkan) - target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR) - include(CheckLibraryExists) - CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) - if (NEED_RT) - target_link_libraries(vkcube-wayland rt) - endif() + add_executable(vkcube-wayland + cube.c + ${PROJECT_SOURCE_DIR}/cube/cube.vert + ${PROJECT_SOURCE_DIR}/cube/cube.frag + cube.vert.inc + cube.frag.inc + ${OPTIONAL_WAYLAND_DATA_FILES}) + target_link_libraries(vkcube-wayland Vulkan::Vulkan) + target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR) + include(CheckLibraryExists) + CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) + if (NEED_RT) + target_link_libraries(vkcube-wayland rt) endif() install(TARGETS vkcube-wayland RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() |
