zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

blob eef03325 (37670B) - Raw


      1 cmake_minimum_required(VERSION 2.8.12)
      2 
      3 if(NOT CMAKE_BUILD_TYPE)
      4     set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
      5         "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
      6 endif()
      7 
      8 if(NOT CMAKE_INSTALL_PREFIX)
      9     set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/stage3" CACHE STRING
     10       "Directory to install zig to" FORCE)
     11 endif()
     12 
     13 # CMake recognizes the CMAKE_PREFIX_PATH environment variable for some things,
     14 # and also the CMAKE_PREFIX_PATH cache variable for other things. However, it
     15 # does not relate these two things, i.e. if the environment variable is set,
     16 # CMake does not populate the cache variable in a corresponding manner. Some
     17 # package systems, such as Homebrew, set the environment variable but not the
     18 # cache variable. Furthermore, the environment variable follows the system path
     19 # separator, such as ':' on POSIX and ';' on Windows, but the cache variable
     20 # follows CMake's array behavior, i.e. always ';' for a separator.
     21 list(APPEND ZIG_CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}")
     22 if(WIN32)
     23   list(APPEND ZIG_CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
     24 else()
     25   string(REGEX REPLACE ":" ";" ZIG_CMAKE_PREFIX_PATH_STRING "$ENV{CMAKE_PREFIX_PATH}")
     26   list(APPEND ZIG_CMAKE_PREFIX_PATH "${ZIG_CMAKE_PREFIX_PATH_STRING}")
     27 endif()
     28 
     29 set(CMAKE_USER_MAKE_RULES_OVERRIDE
     30    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
     31 set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
     32    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
     33 
     34 project(zig C CXX)
     35 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
     36 
     37 set(ZIG_VERSION_MAJOR 0)
     38 set(ZIG_VERSION_MINOR 11)
     39 set(ZIG_VERSION_PATCH 0)
     40 set(ZIG_VERSION "" CACHE STRING "Override Zig version string. Default is to find out with git.")
     41 
     42 if("${ZIG_VERSION}" STREQUAL "")
     43     set(RESOLVED_ZIG_VERSION "${ZIG_VERSION_MAJOR}.${ZIG_VERSION_MINOR}.${ZIG_VERSION_PATCH}")
     44     find_program(GIT_EXE NAMES git NAMES_PER_DIR)
     45     if(GIT_EXE)
     46         execute_process(
     47             COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} describe --match *.*.* --tags
     48             RESULT_VARIABLE EXIT_STATUS
     49             OUTPUT_VARIABLE GIT_DESCRIBE
     50             OUTPUT_STRIP_TRAILING_WHITESPACE
     51             ERROR_QUIET)
     52         if(EXIT_STATUS EQUAL "0")
     53             set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/.git/HEAD)
     54             if(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)$")
     55                 # Tagged release version.
     56                 set(GIT_TAG ${CMAKE_MATCH_1})
     57                 if(NOT GIT_TAG VERSION_EQUAL RESOLVED_ZIG_VERSION)
     58                     message(SEND_ERROR "Zig version (${RESOLVED_ZIG_VERSION}) does not match Git tag (${GIT_TAG}).")
     59                 endif()
     60             elseif(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-g(.+)$")
     61                 # Untagged pre-release. The Zig version is updated to include the number of commits
     62                 # since the last tagged version and the commit hash. The version is formatted in
     63                 # accordance with the https://semver.org specification.
     64                 set(GIT_TAG ${CMAKE_MATCH_1})
     65                 set(GIT_COMMITS_AFTER_TAG ${CMAKE_MATCH_2})
     66                 set(GIT_COMMIT ${CMAKE_MATCH_3})
     67                 if(NOT RESOLVED_ZIG_VERSION VERSION_GREATER GIT_TAG)
     68                     message(SEND_ERROR "Zig version (${RESOLVED_ZIG_VERSION}) must be greater than tagged ancestor (${GIT_TAG}).")
     69                 endif()
     70                 set(RESOLVED_ZIG_VERSION "${RESOLVED_ZIG_VERSION}-dev.${GIT_COMMITS_AFTER_TAG}+${GIT_COMMIT}")
     71             else()
     72                 message(WARNING "Failed to parse version from output of `git describe`.")
     73             endif()
     74         endif()
     75     endif()
     76 else()
     77     set(RESOLVED_ZIG_VERSION "${ZIG_VERSION}")
     78 endif()
     79 message(STATUS "Configuring zig version ${RESOLVED_ZIG_VERSION}")
     80 
     81 set(ZIG_NO_LIB off CACHE BOOL
     82     "Disable copying lib/ files to install prefix during the build phase")
     83 
     84 set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL "Deprecated. Use ZIG_NO_LIB")
     85 if(ZIG_SKIP_INSTALL_LIB_FILES)
     86   message(WARNING "ZIG_SKIP_INSTALL_LIB_FILES is deprecated. Use ZIG_NO_LIB instead.")
     87   set(ZIG_NO_LIB ON)
     88 endif()
     89 
     90 set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
     91 set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries")
     92 set(ZIG_STATIC_LLVM ${ZIG_STATIC} CACHE BOOL "Prefer linking against static LLVM libraries")
     93 set(ZIG_STATIC_ZLIB ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zlib")
     94 set(ZIG_STATIC_ZSTD ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zstd")
     95 set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache")
     96 
     97 if(ZIG_USE_CCACHE)
     98     find_program(CCACHE_PROGRAM ccache)
     99     if(CCACHE_PROGRAM)
    100       set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
    101     else()
    102       message(SEND_ERROR "ccache requested but not found")
    103     endif()
    104 endif()
    105 
    106 if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM)
    107     message(SEND_ERROR "-DZIG_SHARED_LLVM and -DZIG_STATIC_LLVM cannot both be enabled simultaneously")
    108 endif()
    109 
    110 string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_LIB_DIR_ESCAPED "${ZIG_LIBC_LIB_DIR}")
    111 string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_STATIC_LIB_DIR_ESCAPED "${ZIG_LIBC_STATIC_LIB_DIR}")
    112 string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_INCLUDE_DIR_ESCAPED "${ZIG_LIBC_INCLUDE_DIR}")
    113 
    114 set(ZIG_TARGET_TRIPLE "native" CACHE STRING "arch-os-abi to output binaries for")
    115 set(ZIG_TARGET_MCPU "native" CACHE STRING "-mcpu parameter to output binaries for")
    116 set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")
    117 set(ZIG_AR_WORKAROUND off CACHE BOOL "append 'ar' subcommand to CMAKE_AR")
    118 
    119 if("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
    120     set(ZIG_USE_LLVM_CONFIG ON CACHE BOOL "use llvm-config to find LLVM libraries")
    121 else()
    122     set(ZIG_USE_LLVM_CONFIG OFF CACHE BOOL "use llvm-config to find LLVM libraries")
    123 endif()
    124 
    125 if(ZIG_AR_WORKAROUND)
    126   string(REPLACE "<CMAKE_AR>" "<CMAKE_AR> ar" CMAKE_C_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
    127   string(REPLACE "<CMAKE_AR>" "<CMAKE_AR> ar" CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_CXX_ARCHIVE_CREATE})
    128 endif()
    129 
    130 find_package(llvm 15)
    131 find_package(clang 15)
    132 find_package(lld 15)
    133 
    134 if(ZIG_STATIC_ZLIB)
    135     if (MSVC)
    136         list(REMOVE_ITEM LLVM_LIBRARIES "z.lib")
    137     else()
    138         list(REMOVE_ITEM LLVM_LIBRARIES "-lz")
    139     endif()
    140 
    141     find_library(ZLIB NAMES libz.a libzlibstatic.a z zlib libz NAMES_PER_DIR)
    142     list(APPEND LLVM_LIBRARIES "${ZLIB}")
    143 endif()
    144 
    145 if(ZIG_STATIC_ZSTD)
    146     if (MSVC)
    147         list(REMOVE_ITEM LLVM_LIBRARIES "zstd.lib")
    148     else()
    149         list(REMOVE_ITEM LLVM_LIBRARIES "-lzstd")
    150     endif()
    151 
    152     find_library(ZSTD NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR)
    153     list(APPEND LLVM_LIBRARIES "${ZSTD}")
    154 endif()
    155 
    156 if(APPLE AND ZIG_STATIC)
    157     list(REMOVE_ITEM LLVM_LIBRARIES "-lcurses")
    158     find_library(CURSES NAMES libcurses.a libncurses.a NAMES_PER_DIR
    159       PATHS
    160         /usr/local/opt/ncurses/lib
    161         /opt/homebrew/opt/ncurses/lib)
    162     list(APPEND LLVM_LIBRARIES "${CURSES}")
    163 endif()
    164 
    165 set(ZIG_CPP_LIB_DIR "${CMAKE_BINARY_DIR}/zigcpp")
    166 
    167 # Handle multi-config builds and place each into a common lib. The VS generator
    168 # for example will append a Debug folder by default if not explicitly specified.
    169 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ZIG_CPP_LIB_DIR})
    170 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ZIG_CPP_LIB_DIR})
    171 foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES})
    172     string(TOUPPER ${CONFIG_TYPE} CONFIG_TYPE)
    173     set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_TYPE} ${ZIG_CPP_LIB_DIR})
    174     set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIG_TYPE} ${ZIG_CPP_LIB_DIR})
    175     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_TYPE} ${CMAKE_BINARY_DIR})
    176 endforeach(CONFIG_TYPE CMAKE_CONFIGURATION_TYPES)
    177 
    178 include_directories(${LLVM_INCLUDE_DIRS})
    179 include_directories(${LLD_INCLUDE_DIRS})
    180 include_directories(${CLANG_INCLUDE_DIRS})
    181 
    182 find_package(Threads)
    183 
    184 set(ZIG_LIB_DIR "lib/zig")
    185 set(C_HEADERS_DEST "${ZIG_LIB_DIR}/include")
    186 set(LIBC_FILES_DEST "${ZIG_LIB_DIR}/libc")
    187 set(LIBUNWIND_FILES_DEST "${ZIG_LIB_DIR}/libunwind")
    188 set(LIBCXX_FILES_DEST "${ZIG_LIB_DIR}/libcxx")
    189 set(ZIG_STD_DEST "${ZIG_LIB_DIR}/std")
    190 set(ZIG_CONFIG_H_OUT "${CMAKE_BINARY_DIR}/config.h")
    191 set(ZIG_CONFIG_ZIG_OUT "${CMAKE_BINARY_DIR}/config.zig")
    192 
    193 set(ZIG_WASM2C_SOURCES
    194     "${CMAKE_SOURCE_DIR}/stage1/wasm2c.c"
    195 )
    196 set(ZIG_CPP_SOURCES
    197     # These are planned to stay even when we are self-hosted.
    198     "${CMAKE_SOURCE_DIR}/src/zig_llvm.cpp"
    199     "${CMAKE_SOURCE_DIR}/src/zig_llvm-ar.cpp"
    200     "${CMAKE_SOURCE_DIR}/src/zig_clang.cpp"
    201     "${CMAKE_SOURCE_DIR}/src/zig_clang_driver.cpp"
    202     "${CMAKE_SOURCE_DIR}/src/zig_clang_cc1_main.cpp"
    203     "${CMAKE_SOURCE_DIR}/src/zig_clang_cc1as_main.cpp"
    204     # https://github.com/ziglang/zig/issues/6363
    205     "${CMAKE_SOURCE_DIR}/src/windows_sdk.cpp"
    206 )
    207 # Needed because we use cmake, not the zig build system, to build zig2.o.
    208 set(ZIG_STAGE2_SOURCES
    209     "${ZIG_CONFIG_ZIG_OUT}"
    210     "${CMAKE_SOURCE_DIR}/lib/std/array_hash_map.zig"
    211     "${CMAKE_SOURCE_DIR}/lib/std/array_list.zig"
    212     "${CMAKE_SOURCE_DIR}/lib/std/ascii.zig"
    213     "${CMAKE_SOURCE_DIR}/lib/std/atomic.zig"
    214     "${CMAKE_SOURCE_DIR}/lib/std/atomic/Atomic.zig"
    215     "${CMAKE_SOURCE_DIR}/lib/std/atomic/queue.zig"
    216     "${CMAKE_SOURCE_DIR}/lib/std/atomic/stack.zig"
    217     "${CMAKE_SOURCE_DIR}/lib/std/base64.zig"
    218     "${CMAKE_SOURCE_DIR}/lib/std/buf_map.zig"
    219     "${CMAKE_SOURCE_DIR}/lib/std/Build.zig"
    220     "${CMAKE_SOURCE_DIR}/lib/std/Build/Cache.zig"
    221     "${CMAKE_SOURCE_DIR}/lib/std/Build/Cache/DepTokenizer.zig"
    222     "${CMAKE_SOURCE_DIR}/lib/std/builtin.zig"
    223     "${CMAKE_SOURCE_DIR}/lib/std/c.zig"
    224     "${CMAKE_SOURCE_DIR}/lib/std/c/linux.zig"
    225     "${CMAKE_SOURCE_DIR}/lib/std/c/tokenizer.zig"
    226     "${CMAKE_SOURCE_DIR}/lib/std/child_process.zig"
    227     "${CMAKE_SOURCE_DIR}/lib/std/coff.zig"
    228     "${CMAKE_SOURCE_DIR}/lib/std/comptime_string_map.zig"
    229     "${CMAKE_SOURCE_DIR}/lib/std/crypto.zig"
    230     "${CMAKE_SOURCE_DIR}/lib/std/crypto/blake3.zig"
    231     "${CMAKE_SOURCE_DIR}/lib/std/crypto/siphash.zig"
    232     "${CMAKE_SOURCE_DIR}/lib/std/debug.zig"
    233     "${CMAKE_SOURCE_DIR}/lib/std/dwarf.zig"
    234     "${CMAKE_SOURCE_DIR}/lib/std/dwarf/AT.zig"
    235     "${CMAKE_SOURCE_DIR}/lib/std/dwarf/ATE.zig"
    236     "${CMAKE_SOURCE_DIR}/lib/std/dwarf/FORM.zig"
    237     "${CMAKE_SOURCE_DIR}/lib/std/dwarf/LANG.zig"
    238     "${CMAKE_SOURCE_DIR}/lib/std/dwarf/OP.zig"
    239     "${CMAKE_SOURCE_DIR}/lib/std/dwarf/TAG.zig"
    240     "${CMAKE_SOURCE_DIR}/lib/std/elf.zig"
    241     "${CMAKE_SOURCE_DIR}/lib/std/event.zig"
    242     "${CMAKE_SOURCE_DIR}/lib/std/event/batch.zig"
    243     "${CMAKE_SOURCE_DIR}/lib/std/event/loop.zig"
    244     "${CMAKE_SOURCE_DIR}/lib/std/fifo.zig"
    245     "${CMAKE_SOURCE_DIR}/lib/std/fmt.zig"
    246     "${CMAKE_SOURCE_DIR}/lib/std/fmt/errol.zig"
    247     "${CMAKE_SOURCE_DIR}/lib/std/fmt/errol/enum3.zig"
    248     "${CMAKE_SOURCE_DIR}/lib/std/fmt/errol/lookup.zig"
    249     "${CMAKE_SOURCE_DIR}/lib/std/fmt/parse_float.zig"
    250     "${CMAKE_SOURCE_DIR}/lib/std/fs.zig"
    251     "${CMAKE_SOURCE_DIR}/lib/std/fs/file.zig"
    252     "${CMAKE_SOURCE_DIR}/lib/std/fs/get_app_data_dir.zig"
    253     "${CMAKE_SOURCE_DIR}/lib/std/fs/path.zig"
    254     "${CMAKE_SOURCE_DIR}/lib/std/hash.zig"
    255     "${CMAKE_SOURCE_DIR}/lib/std/hash/auto_hash.zig"
    256     "${CMAKE_SOURCE_DIR}/lib/std/hash/wyhash.zig"
    257     "${CMAKE_SOURCE_DIR}/lib/std/hash_map.zig"
    258     "${CMAKE_SOURCE_DIR}/lib/std/heap.zig"
    259     "${CMAKE_SOURCE_DIR}/lib/std/heap/arena_allocator.zig"
    260     "${CMAKE_SOURCE_DIR}/lib/std/io.zig"
    261     "${CMAKE_SOURCE_DIR}/lib/std/io/buffered_atomic_file.zig"
    262     "${CMAKE_SOURCE_DIR}/lib/std/io/buffered_writer.zig"
    263     "${CMAKE_SOURCE_DIR}/lib/std/io/change_detection_stream.zig"
    264     "${CMAKE_SOURCE_DIR}/lib/std/io/counting_reader.zig"
    265     "${CMAKE_SOURCE_DIR}/lib/std/io/counting_writer.zig"
    266     "${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_writer.zig"
    267     "${CMAKE_SOURCE_DIR}/lib/std/io/fixed_buffer_stream.zig"
    268     "${CMAKE_SOURCE_DIR}/lib/std/io/limited_reader.zig"
    269     "${CMAKE_SOURCE_DIR}/lib/std/io/reader.zig"
    270     "${CMAKE_SOURCE_DIR}/lib/std/io/seekable_stream.zig"
    271     "${CMAKE_SOURCE_DIR}/lib/std/io/writer.zig"
    272     "${CMAKE_SOURCE_DIR}/lib/std/json.zig"
    273     "${CMAKE_SOURCE_DIR}/lib/std/json/write_stream.zig"
    274     "${CMAKE_SOURCE_DIR}/lib/std/leb128.zig"
    275     "${CMAKE_SOURCE_DIR}/lib/std/linked_list.zig"
    276     "${CMAKE_SOURCE_DIR}/lib/std/log.zig"
    277     "${CMAKE_SOURCE_DIR}/lib/std/macho.zig"
    278     "${CMAKE_SOURCE_DIR}/lib/std/math.zig"
    279     "${CMAKE_SOURCE_DIR}/lib/std/math/big.zig"
    280     "${CMAKE_SOURCE_DIR}/lib/std/math/big/int.zig"
    281     "${CMAKE_SOURCE_DIR}/lib/std/math/float.zig"
    282     "${CMAKE_SOURCE_DIR}/lib/std/math/frexp.zig"
    283     "${CMAKE_SOURCE_DIR}/lib/std/math/isinf.zig"
    284     "${CMAKE_SOURCE_DIR}/lib/std/math/isnan.zig"
    285     "${CMAKE_SOURCE_DIR}/lib/std/math/ln.zig"
    286     "${CMAKE_SOURCE_DIR}/lib/std/math/log.zig"
    287     "${CMAKE_SOURCE_DIR}/lib/std/math/log10.zig"
    288     "${CMAKE_SOURCE_DIR}/lib/std/math/log2.zig"
    289     "${CMAKE_SOURCE_DIR}/lib/std/math/nan.zig"
    290     "${CMAKE_SOURCE_DIR}/lib/std/math/signbit.zig"
    291     "${CMAKE_SOURCE_DIR}/lib/std/math/sqrt.zig"
    292     "${CMAKE_SOURCE_DIR}/lib/std/mem.zig"
    293     "${CMAKE_SOURCE_DIR}/lib/std/mem/Allocator.zig"
    294     "${CMAKE_SOURCE_DIR}/lib/std/meta.zig"
    295     "${CMAKE_SOURCE_DIR}/lib/std/meta/trailer_flags.zig"
    296     "${CMAKE_SOURCE_DIR}/lib/std/meta/trait.zig"
    297     "${CMAKE_SOURCE_DIR}/lib/std/multi_array_list.zig"
    298     "${CMAKE_SOURCE_DIR}/lib/std/os.zig"
    299     "${CMAKE_SOURCE_DIR}/lib/std/os/linux.zig"
    300     "${CMAKE_SOURCE_DIR}/lib/std/os/linux/errno/generic.zig"
    301     "${CMAKE_SOURCE_DIR}/lib/std/os/linux/x86_64.zig"
    302     "${CMAKE_SOURCE_DIR}/lib/std/os/linux.zig"
    303     "${CMAKE_SOURCE_DIR}/lib/std/os/linux/io_uring.zig"
    304     "${CMAKE_SOURCE_DIR}/lib/std/os/linux/x86_64.zig"
    305     "${CMAKE_SOURCE_DIR}/lib/std/os/windows.zig"
    306     "${CMAKE_SOURCE_DIR}/lib/std/os/windows/ntstatus.zig"
    307     "${CMAKE_SOURCE_DIR}/lib/std/os/windows/win32error.zig"
    308     "${CMAKE_SOURCE_DIR}/lib/std/Progress.zig"
    309     "${CMAKE_SOURCE_DIR}/lib/std/pdb.zig"
    310     "${CMAKE_SOURCE_DIR}/lib/std/process.zig"
    311     "${CMAKE_SOURCE_DIR}/lib/std/rand.zig"
    312     "${CMAKE_SOURCE_DIR}/lib/std/sort.zig"
    313     "${CMAKE_SOURCE_DIR}/lib/compiler_rt.zig"
    314     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/absv.zig"
    315     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/absvdi2.zig"
    316     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/absvsi2.zig"
    317     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/absvti2.zig"
    318     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/adddf3.zig"
    319     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/addf3.zig"
    320     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/addo.zig"
    321     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/addsf3.zig"
    322     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/addtf3.zig"
    323     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/addxf3.zig"
    324     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/arm.zig"
    325     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/atomics.zig"
    326     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/aulldiv.zig"
    327     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/aullrem.zig"
    328     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/bswap.zig"
    329     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/ceil.zig"
    330     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/clear_cache.zig"
    331     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/cmp.zig"
    332     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/cmpdf2.zig"
    333     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/cmpsf2.zig"
    334     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/cmptf2.zig"
    335     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/cmpxf2.zig"
    336     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/common.zig"
    337     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/comparef.zig"
    338     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/cos.zig"
    339     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/count0bits.zig"
    340     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divdf3.zig"
    341     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divsf3.zig"
    342     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divtf3.zig"
    343     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divti3.zig"
    344     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divxf3.zig"
    345     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/emutls.zig"
    346     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/exp.zig"
    347     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/exp2.zig"
    348     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extenddftf2.zig"
    349     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extenddfxf2.zig"
    350     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendf.zig"
    351     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendhfsf2.zig"
    352     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendhftf2.zig"
    353     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendhfxf2.zig"
    354     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendsfdf2.zig"
    355     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendsftf2.zig"
    356     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendsfxf2.zig"
    357     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendxftf2.zig"
    358     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fabs.zig"
    359     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixdfdi.zig"
    360     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixdfsi.zig"
    361     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixdfti.zig"
    362     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixhfdi.zig"
    363     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixhfsi.zig"
    364     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixhfti.zig"
    365     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixsfdi.zig"
    366     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixsfsi.zig"
    367     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixsfti.zig"
    368     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixtfdi.zig"
    369     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixtfsi.zig"
    370     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixtfti.zig"
    371     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunsdfdi.zig"
    372     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunsdfsi.zig"
    373     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunsdfti.zig"
    374     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunshfdi.zig"
    375     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunshfsi.zig"
    376     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunshfti.zig"
    377     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunssfdi.zig"
    378     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunssfsi.zig"
    379     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunssfti.zig"
    380     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunstfdi.zig"
    381     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunstfsi.zig"
    382     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunstfti.zig"
    383     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunsxfdi.zig"
    384     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunsxfsi.zig"
    385     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixunsxfti.zig"
    386     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfdi.zig"
    387     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfsi.zig"
    388     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfti.zig"
    389     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/float_to_int.zig"
    390     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdidf.zig"
    391     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdihf.zig"
    392     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdisf.zig"
    393     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatditf.zig"
    394     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdixf.zig"
    395     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatsidf.zig"
    396     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatsihf.zig"
    397     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatsisf.zig"
    398     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatsitf.zig"
    399     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatsixf.zig"
    400     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floattidf.zig"
    401     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floattihf.zig"
    402     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floattisf.zig"
    403     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floattitf.zig"
    404     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floattixf.zig"
    405     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatundidf.zig"
    406     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatundihf.zig"
    407     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatundisf.zig"
    408     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatunditf.zig"
    409     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatundixf.zig"
    410     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatunsidf.zig"
    411     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatunsihf.zig"
    412     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatunsisf.zig"
    413     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatunsitf.zig"
    414     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatunsixf.zig"
    415     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatuntidf.zig"
    416     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatuntihf.zig"
    417     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatuntisf.zig"
    418     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatuntitf.zig"
    419     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatuntixf.zig"
    420     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floor.zig"
    421     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fma.zig"
    422     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fmax.zig"
    423     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fmin.zig"
    424     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fmod.zig"
    425     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/gedf2.zig"
    426     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/gesf2.zig"
    427     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/getf2.zig"
    428     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/gexf2.zig"
    429     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/int.zig"
    430     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/int_to_float.zig"
    431     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log.zig"
    432     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log10.zig"
    433     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log2.zig"
    434     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/modti3.zig"
    435     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/mulXi3.zig"
    436     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/muldf3.zig"
    437     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/mulf3.zig"
    438     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/mulo.zig"
    439     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/mulsf3.zig"
    440     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/multf3.zig"
    441     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/mulxf3.zig"
    442     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negXi2.zig"
    443     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negv.zig"
    444     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/os_version_check.zig"
    445     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/parity.zig"
    446     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/popcount.zig"
    447     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/rem_pio2.zig"
    448     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/rem_pio2_large.zig"
    449     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/rem_pio2f.zig"
    450     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/round.zig"
    451     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/shift.zig"
    452     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/sin.zig"
    453     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/sincos.zig"
    454     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/sqrt.zig"
    455     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/stack_probe.zig"
    456     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/subo.zig"
    457     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/subsf3.zig"
    458     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/subdf3.zig"
    459     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/subtf3.zig"
    460     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/subxf3.zig"
    461     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negsf2.zig"
    462     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negdf2.zig"
    463     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negtf2.zig"
    464     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negxf2.zig"
    465     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/tan.zig"
    466     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trig.zig"
    467     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trunc.zig"
    468     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/truncdfhf2.zig"
    469     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/truncdfsf2.zig"
    470     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/truncf.zig"
    471     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/truncsfhf2.zig"
    472     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trunctfdf2.zig"
    473     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trunctfhf2.zig"
    474     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trunctfsf2.zig"
    475     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trunctfxf2.zig"
    476     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/truncxfdf2.zig"
    477     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/truncxfhf2.zig"
    478     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/truncxfsf2.zig"
    479     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/udivmod.zig"
    480     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/udivmodei4.zig"
    481     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/udivmodti4.zig"
    482     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/udivti3.zig"
    483     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/umodti3.zig"
    484     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/unorddf2.zig"
    485     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/unordsf2.zig"
    486     "${CMAKE_SOURCE_DIR}/lib/compiler_rt/unordtf2.zig"
    487     "${CMAKE_SOURCE_DIR}/lib/std/start.zig"
    488     "${CMAKE_SOURCE_DIR}/lib/std/std.zig"
    489     "${CMAKE_SOURCE_DIR}/lib/std/target.zig"
    490     "${CMAKE_SOURCE_DIR}/lib/std/target/aarch64.zig"
    491     "${CMAKE_SOURCE_DIR}/lib/std/target/amdgpu.zig"
    492     "${CMAKE_SOURCE_DIR}/lib/std/target/arm.zig"
    493     "${CMAKE_SOURCE_DIR}/lib/std/target/avr.zig"
    494     "${CMAKE_SOURCE_DIR}/lib/std/target/bpf.zig"
    495     "${CMAKE_SOURCE_DIR}/lib/std/target/hexagon.zig"
    496     "${CMAKE_SOURCE_DIR}/lib/std/target/mips.zig"
    497     "${CMAKE_SOURCE_DIR}/lib/std/target/msp430.zig"
    498     "${CMAKE_SOURCE_DIR}/lib/std/target/nvptx.zig"
    499     "${CMAKE_SOURCE_DIR}/lib/std/target/powerpc.zig"
    500     "${CMAKE_SOURCE_DIR}/lib/std/target/riscv.zig"
    501     "${CMAKE_SOURCE_DIR}/lib/std/target/sparc.zig"
    502     "${CMAKE_SOURCE_DIR}/lib/std/target/s390x.zig"
    503     "${CMAKE_SOURCE_DIR}/lib/std/target/wasm.zig"
    504     "${CMAKE_SOURCE_DIR}/lib/std/target/x86.zig"
    505     "${CMAKE_SOURCE_DIR}/lib/std/Thread.zig"
    506     "${CMAKE_SOURCE_DIR}/lib/std/Thread/Futex.zig"
    507     "${CMAKE_SOURCE_DIR}/lib/std/Thread/Mutex.zig"
    508     "${CMAKE_SOURCE_DIR}/lib/std/Thread/Pool.zig"
    509     "${CMAKE_SOURCE_DIR}/lib/std/Thread/ResetEvent.zig"
    510     "${CMAKE_SOURCE_DIR}/lib/std/Thread/WaitGroup.zig"
    511     "${CMAKE_SOURCE_DIR}/lib/std/time.zig"
    512     "${CMAKE_SOURCE_DIR}/lib/std/treap.zig"
    513     "${CMAKE_SOURCE_DIR}/lib/std/unicode.zig"
    514     "${CMAKE_SOURCE_DIR}/lib/std/zig.zig"
    515     "${CMAKE_SOURCE_DIR}/lib/std/zig/Ast.zig"
    516     "${CMAKE_SOURCE_DIR}/lib/std/zig/CrossTarget.zig"
    517     "${CMAKE_SOURCE_DIR}/lib/std/zig/c_builtins.zig"
    518     "${CMAKE_SOURCE_DIR}/lib/std/zig/Parse.zig"
    519     "${CMAKE_SOURCE_DIR}/lib/std/zig/render.zig"
    520     "${CMAKE_SOURCE_DIR}/lib/std/zig/Server.zig"
    521     "${CMAKE_SOURCE_DIR}/lib/std/zig/string_literal.zig"
    522     "${CMAKE_SOURCE_DIR}/lib/std/zig/system.zig"
    523     "${CMAKE_SOURCE_DIR}/lib/std/zig/system/NativePaths.zig"
    524     "${CMAKE_SOURCE_DIR}/lib/std/zig/system/NativeTargetInfo.zig"
    525     "${CMAKE_SOURCE_DIR}/lib/std/zig/system/x86.zig"
    526     "${CMAKE_SOURCE_DIR}/lib/std/zig/tokenizer.zig"
    527     "${CMAKE_SOURCE_DIR}/src/Air.zig"
    528     "${CMAKE_SOURCE_DIR}/src/AstGen.zig"
    529     "${CMAKE_SOURCE_DIR}/src/Compilation.zig"
    530     "${CMAKE_SOURCE_DIR}/src/Liveness.zig"
    531     "${CMAKE_SOURCE_DIR}/src/Module.zig"
    532     "${CMAKE_SOURCE_DIR}/src/Package.zig"
    533     "${CMAKE_SOURCE_DIR}/src/RangeSet.zig"
    534     "${CMAKE_SOURCE_DIR}/src/Sema.zig"
    535     "${CMAKE_SOURCE_DIR}/src/TypedValue.zig"
    536     "${CMAKE_SOURCE_DIR}/src/Zir.zig"
    537     "${CMAKE_SOURCE_DIR}/src/arch/aarch64/CodeGen.zig"
    538     "${CMAKE_SOURCE_DIR}/src/arch/aarch64/Emit.zig"
    539     "${CMAKE_SOURCE_DIR}/src/arch/aarch64/Mir.zig"
    540     "${CMAKE_SOURCE_DIR}/src/arch/aarch64/bits.zig"
    541     "${CMAKE_SOURCE_DIR}/src/arch/aarch64/abi.zig"
    542     "${CMAKE_SOURCE_DIR}/src/arch/arm/CodeGen.zig"
    543     "${CMAKE_SOURCE_DIR}/src/arch/arm/Emit.zig"
    544     "${CMAKE_SOURCE_DIR}/src/arch/arm/Mir.zig"
    545     "${CMAKE_SOURCE_DIR}/src/arch/arm/bits.zig"
    546     "${CMAKE_SOURCE_DIR}/src/arch/arm/abi.zig"
    547     "${CMAKE_SOURCE_DIR}/src/arch/riscv64/CodeGen.zig"
    548     "${CMAKE_SOURCE_DIR}/src/arch/riscv64/Emit.zig"
    549     "${CMAKE_SOURCE_DIR}/src/arch/riscv64/Mir.zig"
    550     "${CMAKE_SOURCE_DIR}/src/arch/riscv64/bits.zig"
    551     "${CMAKE_SOURCE_DIR}/src/arch/riscv64/abi.zig"
    552     "${CMAKE_SOURCE_DIR}/src/arch/sparc64/CodeGen.zig"
    553     "${CMAKE_SOURCE_DIR}/src/arch/sparc64/Emit.zig"
    554     "${CMAKE_SOURCE_DIR}/src/arch/sparc64/Mir.zig"
    555     "${CMAKE_SOURCE_DIR}/src/arch/sparc64/bits.zig"
    556     "${CMAKE_SOURCE_DIR}/src/arch/sparc64/abi.zig"
    557     "${CMAKE_SOURCE_DIR}/src/arch/wasm/CodeGen.zig"
    558     "${CMAKE_SOURCE_DIR}/src/arch/wasm/Emit.zig"
    559     "${CMAKE_SOURCE_DIR}/src/arch/wasm/Mir.zig"
    560     "${CMAKE_SOURCE_DIR}/src/arch/x86_64/CodeGen.zig"
    561     "${CMAKE_SOURCE_DIR}/src/arch/x86_64/Emit.zig"
    562     "${CMAKE_SOURCE_DIR}/src/arch/x86_64/Encoding.zig"
    563     "${CMAKE_SOURCE_DIR}/src/arch/x86_64/Mir.zig"
    564     "${CMAKE_SOURCE_DIR}/src/arch/x86_64/abi.zig"
    565     "${CMAKE_SOURCE_DIR}/src/arch/x86_64/bits.zig"
    566     "${CMAKE_SOURCE_DIR}/src/arch/x86_64/encoder.zig"
    567     "${CMAKE_SOURCE_DIR}/src/arch/x86_64/encodings.zig"
    568     "${CMAKE_SOURCE_DIR}/src/clang.zig"
    569     "${CMAKE_SOURCE_DIR}/src/clang_options.zig"
    570     "${CMAKE_SOURCE_DIR}/src/clang_options_data.zig"
    571     "${CMAKE_SOURCE_DIR}/src/codegen.zig"
    572     "${CMAKE_SOURCE_DIR}/src/codegen/c.zig"
    573     "${CMAKE_SOURCE_DIR}/src/codegen/c/type.zig"
    574     "${CMAKE_SOURCE_DIR}/src/codegen/llvm.zig"
    575     "${CMAKE_SOURCE_DIR}/src/codegen/llvm/bindings.zig"
    576     "${CMAKE_SOURCE_DIR}/src/glibc.zig"
    577     "${CMAKE_SOURCE_DIR}/src/introspect.zig"
    578     "${CMAKE_SOURCE_DIR}/src/libc_installation.zig"
    579     "${CMAKE_SOURCE_DIR}/src/libcxx.zig"
    580     "${CMAKE_SOURCE_DIR}/src/libtsan.zig"
    581     "${CMAKE_SOURCE_DIR}/src/libunwind.zig"
    582     "${CMAKE_SOURCE_DIR}/src/link.zig"
    583     "${CMAKE_SOURCE_DIR}/src/link/C.zig"
    584     "${CMAKE_SOURCE_DIR}/src/link/Coff.zig"
    585     "${CMAKE_SOURCE_DIR}/src/link/Coff/Atom.zig"
    586     "${CMAKE_SOURCE_DIR}/src/link/Coff/ImportTable.zig"
    587     "${CMAKE_SOURCE_DIR}/src/link/Coff/Object.zig"
    588     "${CMAKE_SOURCE_DIR}/src/link/Coff/lld.zig"
    589     "${CMAKE_SOURCE_DIR}/src/link/Elf.zig"
    590     "${CMAKE_SOURCE_DIR}/src/link/MachO.zig"
    591     "${CMAKE_SOURCE_DIR}/src/link/MachO/Archive.zig"
    592     "${CMAKE_SOURCE_DIR}/src/link/MachO/Atom.zig"
    593     "${CMAKE_SOURCE_DIR}/src/link/MachO/CodeSignature.zig"
    594     "${CMAKE_SOURCE_DIR}/src/link/MachO/DebugSymbols.zig"
    595     "${CMAKE_SOURCE_DIR}/src/link/MachO/DwarfInfo.zig"
    596     "${CMAKE_SOURCE_DIR}/src/link/MachO/Dylib.zig"
    597     "${CMAKE_SOURCE_DIR}/src/link/MachO/Object.zig"
    598     "${CMAKE_SOURCE_DIR}/src/link/MachO/Relocation.zig"
    599     "${CMAKE_SOURCE_DIR}/src/link/MachO/Trie.zig"
    600     "${CMAKE_SOURCE_DIR}/src/link/MachO/UnwindInfo.zig"
    601     "${CMAKE_SOURCE_DIR}/src/link/MachO/ZldAtom.zig"
    602     "${CMAKE_SOURCE_DIR}/src/link/MachO/dyld_info/bind.zig"
    603     "${CMAKE_SOURCE_DIR}/src/link/MachO/dyld_info/Rebase.zig"
    604     "${CMAKE_SOURCE_DIR}/src/link/MachO/dead_strip.zig"
    605     "${CMAKE_SOURCE_DIR}/src/link/MachO/eh_frame.zig"
    606     "${CMAKE_SOURCE_DIR}/src/link/MachO/fat.zig"
    607     "${CMAKE_SOURCE_DIR}/src/link/MachO/load_commands.zig"
    608     "${CMAKE_SOURCE_DIR}/src/link/MachO/thunks.zig"
    609     "${CMAKE_SOURCE_DIR}/src/link/MachO/zld.zig"
    610     "${CMAKE_SOURCE_DIR}/src/link/Plan9.zig"
    611     "${CMAKE_SOURCE_DIR}/src/link/Plan9/aout.zig"
    612     "${CMAKE_SOURCE_DIR}/src/link/Wasm.zig"
    613     "${CMAKE_SOURCE_DIR}/src/link/msdos-stub.bin"
    614     "${CMAKE_SOURCE_DIR}/src/link/strtab.zig"
    615     "${CMAKE_SOURCE_DIR}/src/link/tapi.zig"
    616     "${CMAKE_SOURCE_DIR}/src/link/tapi/Tokenizer.zig"
    617     "${CMAKE_SOURCE_DIR}/src/link/tapi/parse.zig"
    618     "${CMAKE_SOURCE_DIR}/src/link/tapi/yaml.zig"
    619     "${CMAKE_SOURCE_DIR}/src/main.zig"
    620     "${CMAKE_SOURCE_DIR}/src/mingw.zig"
    621     "${CMAKE_SOURCE_DIR}/src/musl.zig"
    622     "${CMAKE_SOURCE_DIR}/src/print_air.zig"
    623     "${CMAKE_SOURCE_DIR}/src/print_env.zig"
    624     "${CMAKE_SOURCE_DIR}/src/print_targets.zig"
    625     "${CMAKE_SOURCE_DIR}/src/print_zir.zig"
    626     "${CMAKE_SOURCE_DIR}/src/register_manager.zig"
    627     "${CMAKE_SOURCE_DIR}/src/target.zig"
    628     "${CMAKE_SOURCE_DIR}/src/tracy.zig"
    629     "${CMAKE_SOURCE_DIR}/src/translate_c.zig"
    630     "${CMAKE_SOURCE_DIR}/src/translate_c/ast.zig"
    631     "${CMAKE_SOURCE_DIR}/src/type.zig"
    632     "${CMAKE_SOURCE_DIR}/src/value.zig"
    633     "${CMAKE_SOURCE_DIR}/src/wasi_libc.zig"
    634     "${CMAKE_SOURCE_DIR}/src/windows_sdk.zig"
    635 )
    636 
    637 if(MSVC)
    638     set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
    639     if(IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
    640         set(ZIG_DIA_GUIDS_LIB "${MSVC_DIA_SDK_DIR}/lib/amd64/diaguids.lib")
    641         string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_DIA_GUIDS_LIB_ESCAPED "${ZIG_DIA_GUIDS_LIB}")
    642     endif()
    643 endif()
    644 
    645 configure_file (
    646     "${CMAKE_SOURCE_DIR}/stage1/config.h.in"
    647     "${ZIG_CONFIG_H_OUT}"
    648 )
    649 configure_file (
    650     "${CMAKE_SOURCE_DIR}/stage1/config.zig.in"
    651     "${ZIG_CONFIG_ZIG_OUT}"
    652 )
    653 
    654 include_directories(
    655     ${CMAKE_SOURCE_DIR}
    656     ${CMAKE_BINARY_DIR}
    657     "${CMAKE_SOURCE_DIR}/src"
    658 )
    659 
    660 if(MSVC)
    661   set(EXE_CXX_FLAGS "/std:c++14")
    662   set(EXE_LDFLAGS "/STACK:16777216")
    663   if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
    664     set(EXE_LDFLAGS "${EXE_LDFLAGS} /debug:fastlink")
    665   endif()
    666 else()
    667   set(EXE_CXX_FLAGS "-std=c++14 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces -Wno-comment")
    668   set(EXE_LDFLAGS " ")
    669   if(MINGW)
    670     set(EXE_CXX_FLAGS "${EXE_CXX_FLAGS} -Wno-format")
    671     set(EXE_LDFLAGS "${EXE_LDFLAGS} -Wl,--stack,16777216")
    672   endif()
    673 endif()
    674 
    675 if(ZIG_STATIC)
    676     if(APPLE)
    677         set(EXE_LDFLAGS "${EXE_LDFLAGS} -static-libgcc -static-libstdc++")
    678     elseif(MINGW)
    679         set(EXE_LDFLAGS "${EXE_LDFLAGS} -static-libgcc -static-libstdc++ -Wl,-Bstatic, -lwinpthread -lz3 -lz -lgomp")
    680     elseif(NOT MSVC)
    681         set(EXE_LDFLAGS "${EXE_LDFLAGS} -static")
    682     endif()
    683 endif()
    684 
    685 add_library(zigcpp STATIC ${ZIG_CPP_SOURCES})
    686 set_target_properties(zigcpp PROPERTIES COMPILE_FLAGS ${EXE_CXX_FLAGS})
    687 
    688 target_link_libraries(zigcpp LINK_PUBLIC
    689     ${CLANG_LIBRARIES}
    690     ${LLD_LIBRARIES}
    691     ${LLVM_LIBRARIES}
    692     ${CMAKE_THREAD_LIBS_INIT}
    693 )
    694 
    695 string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" HOST_TARGET_ARCH)
    696 if(HOST_TARGET_ARCH STREQUAL "amd64")
    697   set(HOST_TARGET_ARCH "x86_64")
    698 elseif(HOST_TARGET_ARCH STREQUAL "arm64")
    699   set(HOST_TARGET_ARCH "aarch64")
    700 endif()
    701 string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" HOST_TARGET_OS)
    702 if(HOST_TARGET_OS STREQUAL "darwin")
    703   set(HOST_TARGET_OS "macos")
    704 endif()
    705 set(HOST_TARGET_TRIPLE "${HOST_TARGET_ARCH}-${HOST_TARGET_OS}")
    706 
    707 if(MSVC)
    708   set(ZIG_WASM2C_COMPILE_FLAGS "")
    709   set(ZIG1_COMPILE_FLAGS "/Os")
    710   set(ZIG2_COMPILE_FLAGS "/Od")
    711   set(ZIG2_LINK_FLAGS "/STACK:16777216 /FORCE:MULTIPLE")
    712 else()
    713   set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -O2")
    714   set(ZIG1_COMPILE_FLAGS "-std=c99 -Os")
    715   set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-stack-protector")
    716   if(APPLE)
    717     set(ZIG2_LINK_FLAGS "-Wl,-stack_size,0x10000000")
    718   else()
    719     set(ZIG2_LINK_FLAGS "-Wl,-z,stack-size=0x10000000")
    720   endif()
    721 endif()
    722 
    723 set(ZIG1_WASM_MODULE "${CMAKE_SOURCE_DIR}/stage1/zig1.wasm")
    724 set(ZIG1_C_SOURCE "${CMAKE_BINARY_DIR}/zig1.c")
    725 set(ZIG2_C_SOURCE "${CMAKE_BINARY_DIR}/zig2.c")
    726 set(ZIG_COMPILER_RT_C_SOURCE "${CMAKE_BINARY_DIR}/compiler_rt.c")
    727 
    728 add_executable(zig-wasm2c ${ZIG_WASM2C_SOURCES})
    729 set_target_properties(zig-wasm2c PROPERTIES COMPILE_FLAGS "${ZIG_WASM2C_COMPILE_FLAGS}")
    730 
    731 add_custom_command(
    732   OUTPUT "${ZIG1_C_SOURCE}"
    733   COMMAND zig-wasm2c "${ZIG1_WASM_MODULE}" "${ZIG1_C_SOURCE}"
    734   DEPENDS zig-wasm2c "${ZIG1_WASM_MODULE}"
    735   COMMENT STATUS "Converting ${ZIG1_WASM_MODULE} to ${ZIG1_C_SOURCE}"
    736   WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
    737 )
    738 
    739 add_executable(zig1 ${ZIG1_C_SOURCE} "${CMAKE_SOURCE_DIR}/stage1/wasi.c")
    740 set_target_properties(zig1 PROPERTIES COMPILE_FLAGS ${ZIG1_COMPILE_FLAGS})
    741 
    742 if(MSVC)
    743   target_link_options(zig1 PRIVATE /STACK:0x10000000)
    744 else()
    745   target_link_libraries(zig1 LINK_PUBLIC m)
    746 endif()
    747 
    748 set(BUILD_ZIG2_ARGS
    749   "${CMAKE_SOURCE_DIR}/lib"
    750   build-exe src/main.zig -ofmt=c -lc
    751   -OReleaseSmall
    752   --name zig2 -femit-bin="${ZIG2_C_SOURCE}"
    753   --mod "build_options::${ZIG_CONFIG_ZIG_OUT}"
    754   --deps build_options
    755   -target "${HOST_TARGET_TRIPLE}"
    756 )
    757 
    758 add_custom_command(
    759   OUTPUT "${ZIG2_C_SOURCE}"
    760   COMMAND zig1 ${BUILD_ZIG2_ARGS}
    761   DEPENDS zig1 "${ZIG_STAGE2_SOURCES}"
    762   COMMENT STATUS "Running zig1.wasm to produce ${ZIG2_C_SOURCE}"
    763   WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
    764 )
    765 
    766 set(BUILD_COMPILER_RT_ARGS
    767   "${CMAKE_SOURCE_DIR}/lib"
    768   build-obj lib/compiler_rt.zig -ofmt=c
    769   -OReleaseSmall
    770   --name compiler_rt -femit-bin="${ZIG_COMPILER_RT_C_SOURCE}"
    771   --mod "build_options::${ZIG_CONFIG_ZIG_OUT}"
    772   --deps build_options
    773   -target "${HOST_TARGET_TRIPLE}"
    774 )
    775 
    776 add_custom_command(
    777   OUTPUT "${ZIG_COMPILER_RT_C_SOURCE}"
    778   COMMAND zig1 ${BUILD_COMPILER_RT_ARGS}
    779   DEPENDS zig1 "${ZIG_STAGE2_SOURCES}"
    780   COMMENT STATUS "Running zig1.wasm to produce ${ZIG_COMPILER_RT_C_SOURCE}"
    781   WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
    782 )
    783 
    784 add_executable(zig2 ${ZIG2_C_SOURCE} ${ZIG_COMPILER_RT_C_SOURCE})
    785 set_target_properties(zig2 PROPERTIES
    786   COMPILE_FLAGS ${ZIG2_COMPILE_FLAGS}
    787   LINK_FLAGS ${ZIG2_LINK_FLAGS}
    788 )
    789 target_include_directories(zig2 PUBLIC "${CMAKE_SOURCE_DIR}/stage1")
    790 target_link_libraries(zig2 LINK_PUBLIC zigcpp)
    791 
    792 if(MSVC)
    793   target_link_libraries(zig2 LINK_PUBLIC ntdll.lib)
    794 elseif(MINGW)
    795   target_link_libraries(zig2 LINK_PUBLIC ntdll)
    796 endif()
    797 
    798 if(NOT MSVC)
    799     target_link_libraries(zig2 LINK_PUBLIC ${LIBXML2})
    800 endif()
    801 
    802 if(ZIG_DIA_GUIDS_LIB)
    803     target_link_libraries(zig2 LINK_PUBLIC ${ZIG_DIA_GUIDS_LIB})
    804 endif()
    805 
    806 if(MSVC OR MINGW)
    807     target_link_libraries(zig2 LINK_PUBLIC version)
    808 endif()
    809 
    810 if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
    811   set(ZIG_RELEASE_ARG "")
    812 elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
    813   set(ZIG_RELEASE_ARG -Drelease)
    814 else()
    815   set(ZIG_RELEASE_ARG -Drelease -Dstrip)
    816 endif()
    817 if(ZIG_NO_LIB)
    818   set(ZIG_NO_LIB_ARG "-Dno-lib")
    819 else()
    820   set(ZIG_NO_LIB_ARG "")
    821 endif()
    822 if(ZIG_SINGLE_THREADED)
    823   set(ZIG_SINGLE_THREADED_ARG "-fsingle-threaded")
    824 else()
    825   set(ZIG_SINGLE_THREADED_ARG "")
    826 endif()
    827 if(ZIG_STATIC AND NOT MSVC)
    828   set(ZIG_STATIC_ARG "-Duse-zig-libcxx")
    829 else()
    830   set(ZIG_STATIC_ARG "")
    831 endif()
    832 
    833 if(CMAKE_POSITION_INDEPENDENT_CODE)
    834   set(ZIG_PIE_ARG="-Dpie")
    835 else()
    836   set(ZIG_PIE_ARG="")
    837 endif()
    838 
    839 set(ZIG_BUILD_ARGS
    840   --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
    841   "-Dconfig_h=${ZIG_CONFIG_H_OUT}"
    842   "-Denable-llvm"
    843   ${ZIG_RELEASE_ARG}
    844   ${ZIG_STATIC_ARG}
    845   ${ZIG_NO_LIB_ARG}
    846   ${ZIG_SINGLE_THREADED_ARG}
    847   ${ZIG_PIE_ARG}
    848   "-Dtarget=${ZIG_TARGET_TRIPLE}"
    849   "-Dcpu=${ZIG_TARGET_MCPU}"
    850   "-Dversion-string=${RESOLVED_ZIG_VERSION}"
    851 )
    852 
    853 add_custom_target(stage3 ALL
    854   COMMAND zig2 build compile ${ZIG_BUILD_ARGS}
    855   DEPENDS zig2
    856   COMMENT STATUS "Building stage3"
    857   WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
    858 )
    859 
    860 if(WIN32)
    861   set(ZIG_EXECUTABLE "${CMAKE_BINARY_DIR}/zig2.exe")
    862 else()
    863   set(ZIG_EXECUTABLE "${CMAKE_BINARY_DIR}/zig2")
    864 endif()
    865 
    866 install(CODE "set(ZIG_EXECUTABLE \"${ZIG_EXECUTABLE}\")")
    867 install(CODE "set(ZIG_BUILD_ARGS \"${ZIG_BUILD_ARGS}\")")
    868 install(CODE "set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")")
    869 install(CODE "set(CMAKE_SOURCE_DIR \"${CMAKE_SOURCE_DIR}\")")
    870 install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/install.cmake")