mirror of
https://gitee.com/openharmony/third_party_spirv-tools
synced 2024-11-23 07:20:28 +00:00
Group targets into folders
This plays nicer with IDEs.
This commit is contained in:
parent
dec3f5e231
commit
5c3c054c1f
@ -19,6 +19,7 @@ if (POLICY CMP0054)
|
||||
# https://cmake.org/cmake/help/v3.1/policy/CMP0054.html
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
project(spirv-tools)
|
||||
enable_testing()
|
||||
|
@ -12,4 +12,24 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Add a SPIR-V Tools example. Signature:
|
||||
# add_spvtools_example(
|
||||
# TARGET target_name
|
||||
# SRCS src_file1.cpp src_file2.cpp
|
||||
# LIBS lib_target1 lib_target2
|
||||
# )
|
||||
function(add_spvtools_example)
|
||||
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
set(one_value_args TARGET)
|
||||
set(multi_value_args SRCS LIBS)
|
||||
cmake_parse_arguments(
|
||||
ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN})
|
||||
|
||||
add_executable(${ARG_TARGET} ${ARG_SRCS})
|
||||
spvtools_default_compile_options(${ARG_TARGET})
|
||||
target_link_libraries(${ARG_TARGET} PRIVATE ${ARG_LIBS})
|
||||
set_property(TARGET ${ARG_TARGET} PROPERTY FOLDER "SPIRV-Tools examples")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
add_subdirectory(cpp-interface)
|
||||
|
@ -12,8 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
add_executable(spirv-tools-cpp-example main.cpp)
|
||||
spvtools_default_compile_options(spirv-tools-cpp-example)
|
||||
target_link_libraries(spirv-tools-cpp-example PRIVATE SPIRV-Tools-opt)
|
||||
endif()
|
||||
add_spvtools_example(
|
||||
TARGET spirv-tools-cpp-example
|
||||
SRCS main.cpp
|
||||
LIBS SPIRV-Tools-opt
|
||||
)
|
11
external/CMakeLists.txt
vendored
11
external/CMakeLists.txt
vendored
@ -43,4 +43,15 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
add_subdirectory(${GMOCK_DIR})
|
||||
endif()
|
||||
endif()
|
||||
if (TARGET gmock)
|
||||
set(GTEST_TARGETS
|
||||
gtest
|
||||
gtest_main
|
||||
gmock
|
||||
gmock_main
|
||||
)
|
||||
foreach(target ${GTEST_TARGETS})
|
||||
set_property(TARGET ${target} PROPERTY FOLDER GoogleTest)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -106,6 +106,7 @@ macro(spvtools_vendor_tables VENDOR_TABLE)
|
||||
COMMENT "Generate extended instruction tables for ${VENDOR_TABLE}.")
|
||||
list(APPEND EXTINST_CPP_DEPENDS ${INSTS_FILE})
|
||||
add_custom_target(spirv-tools-${VENDOR_TABLE} DEPENDS ${INSTS_FILE})
|
||||
set_property(TARGET spirv-tools-${VENDOR_TABLE} PROPERTY FOLDER "SPIRV-Tools build")
|
||||
endmacro(spvtools_vendor_tables)
|
||||
|
||||
spvtools_core_tables("1.0")
|
||||
@ -117,7 +118,7 @@ spvtools_vendor_tables("spv-amd-gcn-shader")
|
||||
|
||||
spvtools_vimsyntax("1.1" "1.0")
|
||||
add_custom_target(spirv-tools-vimsyntax DEPENDS ${VIMSYNTAX_FILE})
|
||||
|
||||
set_property(TARGET spirv-tools-vimsyntax PROPERTY FOLDER "SPIRV-Tools utilities")
|
||||
|
||||
# Extract the list of known generators from the SPIR-V XML registry file.
|
||||
set(GENERATOR_INC_FILE ${spirv-tools_BINARY_DIR}/generators.inc)
|
||||
@ -181,6 +182,7 @@ add_custom_command(OUTPUT ${SPIRV_TOOLS_BUILD_VERSION_INC}
|
||||
# This is not required for any dependence chain.
|
||||
add_custom_target(spirv-tools-build-version
|
||||
DEPENDS ${SPIRV_TOOLS_BUILD_VERSION_INC})
|
||||
set_property(TARGET spirv-tools-build-version PROPERTY FOLDER "SPIRV-Tools build")
|
||||
|
||||
add_subdirectory(opt)
|
||||
|
||||
@ -276,6 +278,7 @@ target_include_directories(${SPIRV_TOOLS}
|
||||
PRIVATE ${spirv-tools_BINARY_DIR}
|
||||
PRIVATE ${SPIRV_HEADER_INCLUDE_DIR}
|
||||
)
|
||||
set_property(TARGET ${SPIRV_TOOLS} PROPERTY FOLDER "SPIRV-Tools libraries")
|
||||
|
||||
install(TARGETS ${SPIRV_TOOLS}
|
||||
RUNTIME DESTINATION bin
|
||||
|
@ -66,6 +66,8 @@ target_include_directories(SPIRV-Tools-opt
|
||||
target_link_libraries(SPIRV-Tools-opt
|
||||
PUBLIC ${SPIRV_TOOLS})
|
||||
|
||||
set_property(TARGET SPIRV-Tools-opt PROPERTY FOLDER "SPIRV-Tools libraries")
|
||||
|
||||
install(TARGETS SPIRV-Tools-opt
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
|
@ -59,6 +59,7 @@ function(add_spvtools_unittest)
|
||||
target_link_libraries(${target} PRIVATE ${ARG_LIBS})
|
||||
target_link_libraries(${target} PRIVATE gmock_main)
|
||||
add_test(NAME spirv-tools-${target} COMMAND ${target})
|
||||
set_property(TARGET ${target} PROPERTY FOLDER "SPIRV-Tools tests")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -34,6 +34,7 @@ function(add_spvtools_tool)
|
||||
${spirv-tools_SOURCE_DIR}
|
||||
${spirv-tools_BINARY_DIR}
|
||||
)
|
||||
set_property(TARGET ${ARG_TARGET} PROPERTY FOLDER "SPIRV-Tools executables")
|
||||
endfunction()
|
||||
|
||||
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
|
Loading…
Reference in New Issue
Block a user