@@ -154,11 +154,11 @@ else()
154
154
set (TINT_DEFAULT_GLSL OFF )
155
155
endif ()
156
156
157
- option_if_not_defined(TINT_BUILD_SAMPLES "Build samples" ${DAWN_BUILD_SAMPLES} )
157
+ option_if_not_defined(TINT_BUILD_CMD_TOOLS "Build the Tint command line tools" ON )
158
158
option_if_not_defined(TINT_BUILD_DOCS "Build documentation" ON )
159
159
option_if_not_defined(TINT_DOCS_WARN_AS_ERROR "When building documentation, treat warnings as errors" OFF )
160
160
161
- if (NOT DAWN_USE_GLFW AND (TINT_BUILD_SAMPLES OR DAWN_BUILD_SAMPLES))
161
+ if (NOT DAWN_USE_GLFW AND (TINT_BUILD_CMD_TOOLS OR DAWN_BUILD_SAMPLES))
162
162
message (SEND_ERROR "Dawn samples require GLFW" )
163
163
endif ()
164
164
@@ -304,7 +304,7 @@ message(STATUS "Dawn build with TSAN: ${DAWN_ENABLE_TSAN}")
304
304
message (STATUS "Dawn build with MSAN: ${DAWN_ENABLE_MSAN} " )
305
305
message (STATUS "Dawn build with UBSAN: ${DAWN_ENABLE_UBSAN} " )
306
306
307
- message (STATUS "Tint build samples : ${TINT_BUILD_SAMPLES } " )
307
+ message (STATUS "Tint build command line executable tools : ${TINT_BUILD_CMD_TOOLS } " )
308
308
message (STATUS "Tint build docs: ${TINT_BUILD_DOCS} " )
309
309
message (STATUS "Tint build docs with warn as error: ${TINT_DOCS_WARN_AS_ERROR} " )
310
310
message (STATUS "Tint build SPIR-V reader: ${TINT_BUILD_SPV_READER} " )
@@ -461,6 +461,8 @@ set(CMAKE_CXX_STANDARD "17")
461
461
set (TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS "" CACHE STRING "Used by OSS-Fuzz to control, via link options, which fuzzing engine should be used" )
462
462
463
463
set (TINT_ROOT_SOURCE_DIR ${PROJECT_SOURCE_DIR} )
464
+ set (TINT_SPIRV_HEADERS_DIR ${DAWN_SPIRV_HEADERS_DIR} )
465
+ set (TINT_SPIRV_TOOLS_DIR ${DAWN_SPIRV_TOOLS_DIR} )
464
466
465
467
# CMake < 3.15 sets /W3 in CMAKE_CXX_FLAGS. Remove it if it's there.
466
468
# See https://gitlab.kitware.com/cmake/cmake/-/issues/18317
@@ -474,10 +476,6 @@ if (${TINT_CHECK_CHROMIUM_STYLE})
474
476
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -add-plugin -Xclang find-bad-constructs" )
475
477
endif ()
476
478
477
- if (${TINT_BUILD_SPV_READER} )
478
- include_directories ("${DAWN_THIRD_PARTY_DIR} /vulkan-deps/spirv-tools/include" )
479
- endif ()
480
-
481
479
if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) AND (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC" ))
482
480
set (COMPILER_IS_CLANG_CL TRUE )
483
481
endif ()
@@ -497,17 +495,6 @@ if (MSVC AND NOT COMPILER_IS_CLANG_CL)
497
495
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
498
496
endif ()
499
497
500
- set (TINT_OS_CC_SUFFIX "other" )
501
- if (NOT TINT_BUILD_AS_OTHER_OS)
502
- if (UNIX OR APPLE )
503
- set (TINT_OS_CC_SUFFIX "posix" )
504
- set (TINT_OS_CC_SUFFIX "posix" )
505
- elseif (WIN32 )
506
- set (TINT_OS_CC_SUFFIX "windows" )
507
- set (TINT_OS_CC_SUFFIX "windows" )
508
- endif ()
509
- endif ()
510
-
511
498
if (${TINT_BUILD_DOCS} )
512
499
find_package (Doxygen)
513
500
if (DOXYGEN_FOUND)
@@ -536,121 +523,6 @@ if(${TINT_BUILD_DOCS})
536
523
endif (DOXYGEN_FOUND)
537
524
endif ()
538
525
539
- function (tint_core_compile_options TARGET )
540
- target_include_directories (${TARGET} PUBLIC "${TINT_ROOT_SOURCE_DIR} " )
541
- target_include_directories (${TARGET} PUBLIC "${TINT_ROOT_SOURCE_DIR} /include" )
542
-
543
- if (${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER} )
544
- target_include_directories (${TARGET} PUBLIC
545
- "${DAWN_THIRD_PARTY_DIR} /spirv-headers/include" )
546
- endif ()
547
-
548
- target_compile_definitions (${TARGET} PUBLIC -DTINT_BUILD_SPV_READER=$<BOOL :${TINT_BUILD_SPV_READER} >)
549
- target_compile_definitions (${TARGET} PUBLIC -DTINT_BUILD_WGSL_READER=$<BOOL :${TINT_BUILD_WGSL_READER} >)
550
- target_compile_definitions (${TARGET} PUBLIC -DTINT_BUILD_GLSL_WRITER=$<BOOL :${TINT_BUILD_GLSL_WRITER} >)
551
- target_compile_definitions (${TARGET} PUBLIC -DTINT_BUILD_HLSL_WRITER=$<BOOL :${TINT_BUILD_HLSL_WRITER} >)
552
- target_compile_definitions (${TARGET} PUBLIC -DTINT_BUILD_MSL_WRITER=$<BOOL :${TINT_BUILD_MSL_WRITER} >)
553
- target_compile_definitions (${TARGET} PUBLIC -DTINT_BUILD_SPV_WRITER=$<BOOL :${TINT_BUILD_SPV_WRITER} >)
554
- target_compile_definitions (${TARGET} PUBLIC -DTINT_BUILD_WGSL_WRITER=$<BOOL :${TINT_BUILD_WGSL_WRITER} >)
555
- target_compile_definitions (${TARGET} PUBLIC
556
- -DTINT_BUILD_SYNTAX_TREE_WRITER=$<BOOL :${TINT_BUILD_SYNTAX_TREE_WRITER} >)
557
- target_compile_definitions (${TARGET} PUBLIC -DTINT_BUILD_IR=$<BOOL :${TINT_BUILD_IR} >)
558
-
559
- common_compile_options(${TARGET} )
560
- endfunction ()
561
-
562
- function (tint_default_compile_options TARGET )
563
- tint_core_compile_options(${TARGET} )
564
-
565
- set (COMMON_GNU_OPTIONS
566
- -Wall
567
- -Werror
568
- -Wextra
569
- -Wno-documentation-unknown-command
570
- -Wno-padded
571
- -Wno-switch-enum
572
- -Wno-unknown-pragmas
573
- )
574
-
575
- set (COMMON_CLANG_OPTIONS
576
- -Wno-c++98-compat
577
- -Wno-c++98-compat-pedantic
578
- -Wno-format-pedantic
579
- -Wno-poison-system -directories
580
- -Wno-return-std-move-in-c++11
581
- -Wno-unknown-warning-option
582
- -Wno-undefined-var-template
583
- -Wno-unsafe-buffer-usage
584
- -Wno-used-but-marked-unused
585
- -Weverything
586
- )
587
-
588
- if (COMPILER_IS_LIKE_GNU)
589
- target_compile_options (${TARGET} PRIVATE
590
- -pedantic-errors
591
- ${COMMON_GNU_OPTIONS}
592
- )
593
-
594
- if (COMPILER_IS_CLANG)
595
- target_compile_options (${TARGET} PRIVATE
596
- ${COMMON_CLANG_OPTIONS}
597
- )
598
- endif ()
599
- endif (COMPILER_IS_LIKE_GNU)
600
-
601
- if (MSVC )
602
- # Specify /EHs for exception handling.
603
- target_compile_options (${TARGET} PRIVATE
604
- /bigobj
605
- /EHsc
606
- /W4
607
- /WX
608
- /wd4068 # unknown pragma
609
- /wd4127 # conditional expression is constant
610
- /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
611
- /wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
612
- /wd4324 # 'struct_name' : structure was padded due to __declspec(align())
613
- /wd4459 # declaration of 'identifier' hides global declaration
614
- /wd4458 # declaration of 'identifier' hides class member
615
- /wd4514 # 'function' : unreferenced inline function has been removed
616
- /wd4571 # catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
617
- /wd4625 # 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
618
- /wd4626 # 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
619
- /wd4710 # 'function' : function not inlined
620
- /wd4774 # 'function' : format string 'string' requires an argument of type 'type', but variadic argument number has type 'type'
621
- /wd4820 # 'bytes' bytes padding added after construct 'member_name'
622
- /wd5026 # 'type': move constructor was implicitly defined as deleted
623
- /wd5027 # 'type': move assignment operator was implicitly defined as deleted
624
- )
625
-
626
- # When building with clang-cl on Windows, try to match our clang build
627
- # options as much as possible.
628
- if (COMPILER_IS_CLANG_CL)
629
- target_compile_options (${TARGET} PRIVATE
630
- ${COMMON_GNU_OPTIONS}
631
- ${COMMON_CLANG_OPTIONS}
632
- # Disable warnings that are usually disabled in downstream deps for
633
- # gcc/clang, but aren't for clang-cl.
634
- -Wno-global -constructors
635
- -Wno-zero-as-null-pointer-constant
636
- -Wno-shorten-64-to-32
637
- -Wno-shadow-field-in-constructor
638
- -Wno-reserved-id-macro
639
- -Wno-language -extension-token
640
- )
641
- endif ()
642
- endif ()
643
-
644
- if (TINT_RANDOMIZE_HASHES)
645
- if (NOT DEFINED TINT_HASH_SEED)
646
- string (RANDOM LENGTH 16 ALPHABET "0123456789abcdef" seed)
647
- set (TINT_HASH_SEED "0x${seed} " CACHE STRING "Tint hash seed value" )
648
- message ("Using TINT_HASH_SEED: ${TINT_HASH_SEED} " )
649
- endif ()
650
- target_compile_definitions (${TARGET} PUBLIC "-DTINT_HASH_SEED=${TINT_HASH_SEED} " )
651
- endif ()
652
- endfunction ()
653
-
654
526
################################################################################
655
527
# Run on all subdirectories
656
528
################################################################################
@@ -670,15 +542,6 @@ add_subdirectory(src/dawn)
670
542
################################################################################
671
543
# Samples
672
544
################################################################################
673
-
674
- if (TINT_BUILD_SAMPLES)
675
- add_subdirectory (src/tint/cmd)
676
- endif ()
677
-
678
- if (TINT_BUILD_FUZZERS)
679
- add_subdirectory (src/tint/fuzzers)
680
- endif ()
681
-
682
545
add_custom_target (tint-lint
683
546
COMMAND ./tools/lint
684
547
WORKING_DIRECTORY ${TINT_ROOT_SOURCE_DIR}
0 commit comments