Skip to content

Commit 63b8b74

Browse files
Cmake ANVIL_LINK_EXAMPLES include examples Alvin
1 parent e7df10d commit 63b8b74

6 files changed

Lines changed: 33 additions & 13 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project (Anvil)
44
option(ANVIL_INCLUDE_WIN3264_WINDOW_SYSTEM_SUPPORT "Includes 32-/64-bit Windows window system support (Windows builds only)" ON)
55
option(ANVIL_INCLUDE_XCB_WINDOW_SYSTEM_SUPPORT "Includes XCB window system support (Linux builds only)" ON)
66
option(ANVIL_LINK_WITH_GLSLANG "Links with glslang, instead of spawning a new process whenever GLSL->SPIR-V conversion is required" ON)
7+
option(ANVIL_LINK_EXAMPLES "Build examples showing how to use Anvil" OFF)
78

89

910
# Do not modify anything after this line, unless you know what you're doing.
@@ -238,6 +239,15 @@ if (ANVIL_LINK_WITH_GLSLANG)
238239
endif()
239240
endif()
240241

242+
243+
if (ANVIL_LINK_EXAMPLES)
244+
add_subdirectory("examples/DynamicBuffers")
245+
add_subdirectory("examples/MultiViewport")
246+
add_subdirectory("examples/OcclusionQuery")
247+
add_subdirectory("examples/OutOfOrderRasterization")
248+
add_subdirectory("examples/PushConstants")
249+
endif()
250+
241251
# Enable level-4 warnings
242252
if (MSVC)
243253
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)

examples/DynamicBuffers/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
1616
endif()
1717
endif()
1818

19-
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
19+
if (NOT ANVIL_LINK_EXAMPLES)
20+
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
21+
endif()
2022

2123
target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")
2224

2325
include_directories(${Anvil_SOURCE_DIR}/include
24-
${DynamicBuffers_SOURCE_DIR}/include)
26+
${DynamicBuffers_SOURCE_DIR}/include)
2527

2628
# Include the Vulkan header.
2729
if (WIN32)

examples/MultiViewport/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
1616
endif()
1717
endif()
1818

19-
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
19+
if (NOT ANVIL_LINK_EXAMPLES)
20+
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
21+
endif()
2022

2123
target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")
2224

23-
include_directories(${Anvil_SOURCE_DIR}/include
24-
${MultiViewport_SOURCE_DIR}/include)
25-
2625
if (WIN32)
2726
include_directories($ENV{VK_SDK_PATH}/Include
2827
$ENV{VULKAN_SDK}/Include)
@@ -47,6 +46,9 @@ else()
4746
$ENV{VULKAN_SDK}/x86_64/lib)
4847
endif()
4948

49+
include_directories(${Anvil_SOURCE_DIR}/include
50+
${MultiViewport_SOURCE_DIR}/include)
51+
5052
# Create the MultiViewport project.
5153
add_executable (MultiViewport include/app.h
5254
include/app.h

examples/OcclusionQuery/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
1616
endif()
1717
endif()
1818

19-
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
19+
if (NOT ANVIL_LINK_EXAMPLES)
20+
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
21+
endif()
2022

2123
target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")
2224

23-
include_directories(${Anvil_SOURCE_DIR}/include
24-
${OcclusionQuery_SOURCE_DIR}/include)
25-
2625
# Include the Vulkan header.
2726
if (WIN32)
2827
include_directories($ENV{VK_SDK_PATH}/Include
@@ -46,7 +45,10 @@ else()
4645
link_directories ($ENV{VK_SDK_PATH}/x86_64/lib
4746
$ENV{VULKAN_SDK}/lib
4847
$ENV{VULKAN_SDK}/x86_64/lib)
49-
endif()
48+
endif()
49+
50+
include_directories(${Anvil_SOURCE_DIR}/include
51+
${OcclusionQuery_SOURCE_DIR}/include)
5052

5153
# Create the OcclusionQuery project.
5254
add_executable (OcclusionQuery include/app.h

examples/OutOfOrderRasterization/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
1616
endif()
1717
endif()
1818

19-
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
19+
if (NOT ANVIL_LINK_EXAMPLES)
20+
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
21+
endif()
2022

2123
target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")
2224

examples/PushConstants/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
1616
endif()
1717
endif()
1818

19-
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
19+
if (NOT ANVIL_LINK_EXAMPLES)
20+
add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")
21+
endif()
2022

2123
target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")
2224

0 commit comments

Comments
 (0)