| ... | @@ -258,6 +258,15 @@ set(SOFTFLOAT_LIBRARIES embedded_softfloat) | ... | @@ -258,6 +258,15 @@ set(SOFTFLOAT_LIBRARIES embedded_softfloat) |
| 258 | | 258 | |
| 259 | find_package(Threads) | 259 | find_package(Threads) |
| 260 | | 260 | |
| | 261 | set(ZIG_LIB_DIR "lib/zig") |
| | 262 | set(C_HEADERS_DEST "${ZIG_LIB_DIR}/include") |
| | 263 | set(LIBC_FILES_DEST "${ZIG_LIB_DIR}/libc") |
| | 264 | set(LIBUNWIND_FILES_DEST "${ZIG_LIB_DIR}/libunwind") |
| | 265 | set(LIBCXX_FILES_DEST "${ZIG_LIB_DIR}/libcxx") |
| | 266 | set(ZIG_STD_DEST "${ZIG_LIB_DIR}/std") |
| | 267 | set(ZIG_CONFIG_H_OUT "${CMAKE_BINARY_DIR}/config.h") |
| | 268 | set(ZIG_CONFIG_ZIG_OUT "${CMAKE_BINARY_DIR}/config.zig") |
| | 269 | |
| 261 | # This is our shim which will be replaced by stage1.zig. | 270 | # This is our shim which will be replaced by stage1.zig. |
| 262 | set(ZIG0_SOURCES | 271 | set(ZIG0_SOURCES |
| 263 | "${CMAKE_SOURCE_DIR}/src/stage1/zig0.cpp" | 272 | "${CMAKE_SOURCE_DIR}/src/stage1/zig0.cpp" |
| ... | @@ -299,6 +308,259 @@ set(ZIG_CPP_SOURCES | ... | @@ -299,6 +308,259 @@ set(ZIG_CPP_SOURCES |
| 299 | # https://github.com/ziglang/zig/issues/6363 | 308 | # https://github.com/ziglang/zig/issues/6363 |
| 300 | "${CMAKE_SOURCE_DIR}/src/windows_sdk.cpp" | 309 | "${CMAKE_SOURCE_DIR}/src/windows_sdk.cpp" |
| 301 | ) | 310 | ) |
| | 311 | # Needed because we use cmake, not the zig build system, to build zig1.o. |
| | 312 | # This list is generated by building zig and then clearing the zig-cache directory, |
| | 313 | # then manually running the build-obj command (see BUILD_ZIG1_ARGS), and then looking |
| | 314 | # in the zig-cache directory for the compiler-generated list of zig file dependencies. |
| | 315 | set(ZIG_STAGE2_SOURCES |
| | 316 | "${ZIG_CONFIG_ZIG_OUT}" |
| | 317 | "${CMAKE_SOURCE_DIR}/lib/std/array_hash_map.zig" |
| | 318 | "${CMAKE_SOURCE_DIR}/lib/std/array_list.zig" |
| | 319 | "${CMAKE_SOURCE_DIR}/lib/std/ascii.zig" |
| | 320 | "${CMAKE_SOURCE_DIR}/lib/std/atomic.zig" |
| | 321 | "${CMAKE_SOURCE_DIR}/lib/std/atomic/int.zig" |
| | 322 | "${CMAKE_SOURCE_DIR}/lib/std/atomic/queue.zig" |
| | 323 | "${CMAKE_SOURCE_DIR}/lib/std/atomic/stack.zig" |
| | 324 | "${CMAKE_SOURCE_DIR}/lib/std/auto_reset_event.zig" |
| | 325 | "${CMAKE_SOURCE_DIR}/lib/std/base64.zig" |
| | 326 | "${CMAKE_SOURCE_DIR}/lib/std/buf_map.zig" |
| | 327 | "${CMAKE_SOURCE_DIR}/lib/std/builtin.zig" |
| | 328 | "${CMAKE_SOURCE_DIR}/lib/std/c.zig" |
| | 329 | "${CMAKE_SOURCE_DIR}/lib/std/c/linux.zig" |
| | 330 | "${CMAKE_SOURCE_DIR}/lib/std/c/tokenizer.zig" |
| | 331 | "${CMAKE_SOURCE_DIR}/lib/std/child_process.zig" |
| | 332 | "${CMAKE_SOURCE_DIR}/lib/std/coff.zig" |
| | 333 | "${CMAKE_SOURCE_DIR}/lib/std/comptime_string_map.zig" |
| | 334 | "${CMAKE_SOURCE_DIR}/lib/std/crypto.zig" |
| | 335 | "${CMAKE_SOURCE_DIR}/lib/std/crypto/blake3.zig" |
| | 336 | "${CMAKE_SOURCE_DIR}/lib/std/crypto/siphash.zig" |
| | 337 | "${CMAKE_SOURCE_DIR}/lib/std/debug.zig" |
| | 338 | "${CMAKE_SOURCE_DIR}/lib/std/dwarf.zig" |
| | 339 | "${CMAKE_SOURCE_DIR}/lib/std/dwarf_bits.zig" |
| | 340 | "${CMAKE_SOURCE_DIR}/lib/std/elf.zig" |
| | 341 | "${CMAKE_SOURCE_DIR}/lib/std/event.zig" |
| | 342 | "${CMAKE_SOURCE_DIR}/lib/std/event/batch.zig" |
| | 343 | "${CMAKE_SOURCE_DIR}/lib/std/event/loop.zig" |
| | 344 | "${CMAKE_SOURCE_DIR}/lib/std/fifo.zig" |
| | 345 | "${CMAKE_SOURCE_DIR}/lib/std/fmt.zig" |
| | 346 | "${CMAKE_SOURCE_DIR}/lib/std/fmt/errol.zig" |
| | 347 | "${CMAKE_SOURCE_DIR}/lib/std/fmt/errol/enum3.zig" |
| | 348 | "${CMAKE_SOURCE_DIR}/lib/std/fmt/errol/lookup.zig" |
| | 349 | "${CMAKE_SOURCE_DIR}/lib/std/fmt/parse_float.zig" |
| | 350 | "${CMAKE_SOURCE_DIR}/lib/std/fs.zig" |
| | 351 | "${CMAKE_SOURCE_DIR}/lib/std/fs/file.zig" |
| | 352 | "${CMAKE_SOURCE_DIR}/lib/std/fs/get_app_data_dir.zig" |
| | 353 | "${CMAKE_SOURCE_DIR}/lib/std/fs/path.zig" |
| | 354 | "${CMAKE_SOURCE_DIR}/lib/std/hash.zig" |
| | 355 | "${CMAKE_SOURCE_DIR}/lib/std/hash/auto_hash.zig" |
| | 356 | "${CMAKE_SOURCE_DIR}/lib/std/hash/wyhash.zig" |
| | 357 | "${CMAKE_SOURCE_DIR}/lib/std/hash_map.zig" |
| | 358 | "${CMAKE_SOURCE_DIR}/lib/std/heap.zig" |
| | 359 | "${CMAKE_SOURCE_DIR}/lib/std/heap/arena_allocator.zig" |
| | 360 | "${CMAKE_SOURCE_DIR}/lib/std/io.zig" |
| | 361 | "${CMAKE_SOURCE_DIR}/lib/std/io/auto_indenting_stream.zig" |
| | 362 | "${CMAKE_SOURCE_DIR}/lib/std/io/buffered_atomic_file.zig" |
| | 363 | "${CMAKE_SOURCE_DIR}/lib/std/io/buffered_writer.zig" |
| | 364 | "${CMAKE_SOURCE_DIR}/lib/std/io/change_detection_stream.zig" |
| | 365 | "${CMAKE_SOURCE_DIR}/lib/std/io/counting_writer.zig" |
| | 366 | "${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_out_stream.zig" |
| | 367 | "${CMAKE_SOURCE_DIR}/lib/std/io/fixed_buffer_stream.zig" |
| | 368 | "${CMAKE_SOURCE_DIR}/lib/std/io/reader.zig" |
| | 369 | "${CMAKE_SOURCE_DIR}/lib/std/io/seekable_stream.zig" |
| | 370 | "${CMAKE_SOURCE_DIR}/lib/std/io/writer.zig" |
| | 371 | "${CMAKE_SOURCE_DIR}/lib/std/json.zig" |
| | 372 | "${CMAKE_SOURCE_DIR}/lib/std/json/write_stream.zig" |
| | 373 | "${CMAKE_SOURCE_DIR}/lib/std/leb128.zig" |
| | 374 | "${CMAKE_SOURCE_DIR}/lib/std/linked_list.zig" |
| | 375 | "${CMAKE_SOURCE_DIR}/lib/std/log.zig" |
| | 376 | "${CMAKE_SOURCE_DIR}/lib/std/macho.zig" |
| | 377 | "${CMAKE_SOURCE_DIR}/lib/std/math.zig" |
| | 378 | "${CMAKE_SOURCE_DIR}/lib/std/math/big.zig" |
| | 379 | "${CMAKE_SOURCE_DIR}/lib/std/math/big/int.zig" |
| | 380 | "${CMAKE_SOURCE_DIR}/lib/std/math/floor.zig" |
| | 381 | "${CMAKE_SOURCE_DIR}/lib/std/math/frexp.zig" |
| | 382 | "${CMAKE_SOURCE_DIR}/lib/std/math/inf.zig" |
| | 383 | "${CMAKE_SOURCE_DIR}/lib/std/math/isinf.zig" |
| | 384 | "${CMAKE_SOURCE_DIR}/lib/std/math/isnan.zig" |
| | 385 | "${CMAKE_SOURCE_DIR}/lib/std/math/ln.zig" |
| | 386 | "${CMAKE_SOURCE_DIR}/lib/std/math/log.zig" |
| | 387 | "${CMAKE_SOURCE_DIR}/lib/std/math/log10.zig" |
| | 388 | "${CMAKE_SOURCE_DIR}/lib/std/math/log2.zig" |
| | 389 | "${CMAKE_SOURCE_DIR}/lib/std/math/nan.zig" |
| | 390 | "${CMAKE_SOURCE_DIR}/lib/std/math/signbit.zig" |
| | 391 | "${CMAKE_SOURCE_DIR}/lib/std/math/sqrt.zig" |
| | 392 | "${CMAKE_SOURCE_DIR}/lib/std/mem.zig" |
| | 393 | "${CMAKE_SOURCE_DIR}/lib/std/mem/Allocator.zig" |
| | 394 | "${CMAKE_SOURCE_DIR}/lib/std/meta.zig" |
| | 395 | "${CMAKE_SOURCE_DIR}/lib/std/meta/trailer_flags.zig" |
| | 396 | "${CMAKE_SOURCE_DIR}/lib/std/meta/trait.zig" |
| | 397 | "${CMAKE_SOURCE_DIR}/lib/std/mutex.zig" |
| | 398 | "${CMAKE_SOURCE_DIR}/lib/std/os.zig" |
| | 399 | "${CMAKE_SOURCE_DIR}/lib/std/os/bits.zig" |
| | 400 | "${CMAKE_SOURCE_DIR}/lib/std/os/bits/linux.zig" |
| | 401 | "${CMAKE_SOURCE_DIR}/lib/std/os/bits/linux/errno-generic.zig" |
| | 402 | "${CMAKE_SOURCE_DIR}/lib/std/os/bits/linux/netlink.zig" |
| | 403 | "${CMAKE_SOURCE_DIR}/lib/std/os/bits/linux/prctl.zig" |
| | 404 | "${CMAKE_SOURCE_DIR}/lib/std/os/bits/linux/securebits.zig" |
| | 405 | "${CMAKE_SOURCE_DIR}/lib/std/os/bits/linux/x86_64.zig" |
| | 406 | "${CMAKE_SOURCE_DIR}/lib/std/os/linux.zig" |
| | 407 | "${CMAKE_SOURCE_DIR}/lib/std/os/linux/io_uring.zig" |
| | 408 | "${CMAKE_SOURCE_DIR}/lib/std/os/linux/x86_64.zig" |
| | 409 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows.zig" |
| | 410 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows/bits.zig" |
| | 411 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows/ntstatus.zig" |
| | 412 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows/win32error.zig" |
| | 413 | "${CMAKE_SOURCE_DIR}/lib/std/pdb.zig" |
| | 414 | "${CMAKE_SOURCE_DIR}/lib/std/process.zig" |
| | 415 | "${CMAKE_SOURCE_DIR}/lib/std/progress.zig" |
| | 416 | "${CMAKE_SOURCE_DIR}/lib/std/rand.zig" |
| | 417 | "${CMAKE_SOURCE_DIR}/lib/std/reset_event.zig" |
| | 418 | "${CMAKE_SOURCE_DIR}/lib/std/sort.zig" |
| | 419 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt.zig" |
| | 420 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/addXf3.zig" |
| | 421 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/atomics.zig" |
| | 422 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/clear_cache.zig" |
| | 423 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/clzsi2.zig" |
| | 424 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/compareXf2.zig" |
| | 425 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divdf3.zig" |
| | 426 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divsf3.zig" |
| | 427 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divtf3.zig" |
| | 428 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divti3.zig" |
| | 429 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/extendXfYf2.zig" |
| | 430 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixdfdi.zig" |
| | 431 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixdfsi.zig" |
| | 432 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixdfti.zig" |
| | 433 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixint.zig" |
| | 434 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixsfdi.zig" |
| | 435 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixsfsi.zig" |
| | 436 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixsfti.zig" |
| | 437 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixtfdi.zig" |
| | 438 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixtfsi.zig" |
| | 439 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixtfti.zig" |
| | 440 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixuint.zig" |
| | 441 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunsdfdi.zig" |
| | 442 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunsdfsi.zig" |
| | 443 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunsdfti.zig" |
| | 444 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunssfdi.zig" |
| | 445 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunssfsi.zig" |
| | 446 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunssfti.zig" |
| | 447 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunstfdi.zig" |
| | 448 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunstfsi.zig" |
| | 449 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixunstfti.zig" |
| | 450 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatXisf.zig" |
| | 451 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatdidf.zig" |
| | 452 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatditf.zig" |
| | 453 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatsiXf.zig" |
| | 454 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floattidf.zig" |
| | 455 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floattitf.zig" |
| | 456 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatundidf.zig" |
| | 457 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatundisf.zig" |
| | 458 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatunditf.zig" |
| | 459 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatunsidf.zig" |
| | 460 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatunsisf.zig" |
| | 461 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatunsitf.zig" |
| | 462 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatuntidf.zig" |
| | 463 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatuntisf.zig" |
| | 464 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatuntitf.zig" |
| | 465 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/int.zig" |
| | 466 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/modti3.zig" |
| | 467 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/mulXf3.zig" |
| | 468 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/muldi3.zig" |
| | 469 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/mulodi4.zig" |
| | 470 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/muloti4.zig" |
| | 471 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/multi3.zig" |
| | 472 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/negXf2.zig" |
| | 473 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/popcountdi2.zig" |
| | 474 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/shift.zig" |
| | 475 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/stack_probe.zig" |
| | 476 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/truncXfYf2.zig" |
| | 477 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/udivmod.zig" |
| | 478 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/udivmodti4.zig" |
| | 479 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/udivti3.zig" |
| | 480 | "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/umodti3.zig" |
| | 481 | "${CMAKE_SOURCE_DIR}/lib/std/spinlock.zig" |
| | 482 | "${CMAKE_SOURCE_DIR}/lib/std/start.zig" |
| | 483 | "${CMAKE_SOURCE_DIR}/lib/std/std.zig" |
| | 484 | "${CMAKE_SOURCE_DIR}/lib/std/target.zig" |
| | 485 | "${CMAKE_SOURCE_DIR}/lib/std/target/aarch64.zig" |
| | 486 | "${CMAKE_SOURCE_DIR}/lib/std/target/amdgpu.zig" |
| | 487 | "${CMAKE_SOURCE_DIR}/lib/std/target/arm.zig" |
| | 488 | "${CMAKE_SOURCE_DIR}/lib/std/target/avr.zig" |
| | 489 | "${CMAKE_SOURCE_DIR}/lib/std/target/bpf.zig" |
| | 490 | "${CMAKE_SOURCE_DIR}/lib/std/target/hexagon.zig" |
| | 491 | "${CMAKE_SOURCE_DIR}/lib/std/target/mips.zig" |
| | 492 | "${CMAKE_SOURCE_DIR}/lib/std/target/msp430.zig" |
| | 493 | "${CMAKE_SOURCE_DIR}/lib/std/target/nvptx.zig" |
| | 494 | "${CMAKE_SOURCE_DIR}/lib/std/target/powerpc.zig" |
| | 495 | "${CMAKE_SOURCE_DIR}/lib/std/target/riscv.zig" |
| | 496 | "${CMAKE_SOURCE_DIR}/lib/std/target/sparc.zig" |
| | 497 | "${CMAKE_SOURCE_DIR}/lib/std/target/systemz.zig" |
| | 498 | "${CMAKE_SOURCE_DIR}/lib/std/target/wasm.zig" |
| | 499 | "${CMAKE_SOURCE_DIR}/lib/std/target/x86.zig" |
| | 500 | "${CMAKE_SOURCE_DIR}/lib/std/thread.zig" |
| | 501 | "${CMAKE_SOURCE_DIR}/lib/std/time.zig" |
| | 502 | "${CMAKE_SOURCE_DIR}/lib/std/unicode.zig" |
| | 503 | "${CMAKE_SOURCE_DIR}/lib/std/zig.zig" |
| | 504 | "${CMAKE_SOURCE_DIR}/lib/std/zig/ast.zig" |
| | 505 | "${CMAKE_SOURCE_DIR}/lib/std/zig/cross_target.zig" |
| | 506 | "${CMAKE_SOURCE_DIR}/lib/std/zig/parse.zig" |
| | 507 | "${CMAKE_SOURCE_DIR}/lib/std/zig/render.zig" |
| | 508 | "${CMAKE_SOURCE_DIR}/lib/std/zig/string_literal.zig" |
| | 509 | "${CMAKE_SOURCE_DIR}/lib/std/zig/system.zig" |
| | 510 | "${CMAKE_SOURCE_DIR}/lib/std/zig/system/x86.zig" |
| | 511 | "${CMAKE_SOURCE_DIR}/lib/std/zig/tokenizer.zig" |
| | 512 | "${CMAKE_SOURCE_DIR}/src/Cache.zig" |
| | 513 | "${CMAKE_SOURCE_DIR}/src/Compilation.zig" |
| | 514 | "${CMAKE_SOURCE_DIR}/src/DepTokenizer.zig" |
| | 515 | "${CMAKE_SOURCE_DIR}/src/Module.zig" |
| | 516 | "${CMAKE_SOURCE_DIR}/src/Package.zig" |
| | 517 | "${CMAKE_SOURCE_DIR}/src/RangeSet.zig" |
| | 518 | "${CMAKE_SOURCE_DIR}/src/TypedValue.zig" |
| | 519 | "${CMAKE_SOURCE_DIR}/src/astgen.zig" |
| | 520 | "${CMAKE_SOURCE_DIR}/src/clang.zig" |
| | 521 | "${CMAKE_SOURCE_DIR}/src/clang_options.zig" |
| | 522 | "${CMAKE_SOURCE_DIR}/src/clang_options_data.zig" |
| | 523 | "${CMAKE_SOURCE_DIR}/src/codegen.zig" |
| | 524 | "${CMAKE_SOURCE_DIR}/src/codegen/aarch64.zig" |
| | 525 | "${CMAKE_SOURCE_DIR}/src/codegen/arm.zig" |
| | 526 | "${CMAKE_SOURCE_DIR}/src/codegen/c.zig" |
| | 527 | "${CMAKE_SOURCE_DIR}/src/codegen/llvm.zig" |
| | 528 | "${CMAKE_SOURCE_DIR}/src/codegen/riscv64.zig" |
| | 529 | "${CMAKE_SOURCE_DIR}/src/codegen/spu-mk2.zig" |
| | 530 | "${CMAKE_SOURCE_DIR}/src/codegen/wasm.zig" |
| | 531 | "${CMAKE_SOURCE_DIR}/src/codegen/x86_64.zig" |
| | 532 | "${CMAKE_SOURCE_DIR}/src/glibc.zig" |
| | 533 | "${CMAKE_SOURCE_DIR}/src/introspect.zig" |
| | 534 | "${CMAKE_SOURCE_DIR}/src/ir.zig" |
| | 535 | "${CMAKE_SOURCE_DIR}/src/libc_installation.zig" |
| | 536 | "${CMAKE_SOURCE_DIR}/src/libcxx.zig" |
| | 537 | "${CMAKE_SOURCE_DIR}/src/libunwind.zig" |
| | 538 | "${CMAKE_SOURCE_DIR}/src/link.zig" |
| | 539 | "${CMAKE_SOURCE_DIR}/src/link/C.zig" |
| | 540 | "${CMAKE_SOURCE_DIR}/src/link/Coff.zig" |
| | 541 | "${CMAKE_SOURCE_DIR}/src/link/Elf.zig" |
| | 542 | "${CMAKE_SOURCE_DIR}/src/link/MachO.zig" |
| | 543 | "${CMAKE_SOURCE_DIR}/src/link/MachO/Trie.zig" |
| | 544 | "${CMAKE_SOURCE_DIR}/src/link/Wasm.zig" |
| | 545 | "${CMAKE_SOURCE_DIR}/src/link/cbe.h" |
| | 546 | "${CMAKE_SOURCE_DIR}/src/link/msdos-stub.bin" |
| | 547 | "${CMAKE_SOURCE_DIR}/src/liveness.zig" |
| | 548 | "${CMAKE_SOURCE_DIR}/src/llvm.zig" |
| | 549 | "${CMAKE_SOURCE_DIR}/src/main.zig" |
| | 550 | "${CMAKE_SOURCE_DIR}/src/mingw.zig" |
| | 551 | "${CMAKE_SOURCE_DIR}/src/musl.zig" |
| | 552 | "${CMAKE_SOURCE_DIR}/src/print_env.zig" |
| | 553 | "${CMAKE_SOURCE_DIR}/src/print_targets.zig" |
| | 554 | "${CMAKE_SOURCE_DIR}/src/stage1.zig" |
| | 555 | "${CMAKE_SOURCE_DIR}/src/target.zig" |
| | 556 | "${CMAKE_SOURCE_DIR}/src/tracy.zig" |
| | 557 | "${CMAKE_SOURCE_DIR}/src/translate_c.zig" |
| | 558 | "${CMAKE_SOURCE_DIR}/src/type.zig" |
| | 559 | "${CMAKE_SOURCE_DIR}/src/value.zig" |
| | 560 | "${CMAKE_SOURCE_DIR}/src/windows_sdk.zig" |
| | 561 | "${CMAKE_SOURCE_DIR}/src/zir.zig" |
| | 562 | "${CMAKE_SOURCE_DIR}/src/zir_sema.zig" |
| | 563 | ) |
| 302 | | 564 | |
| 303 | if(MSVC) | 565 | if(MSVC) |
| 304 | set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK") | 566 | set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK") |
| ... | @@ -308,14 +570,6 @@ if(MSVC) | ... | @@ -308,14 +570,6 @@ if(MSVC) |
| 308 | endif() | 570 | endif() |
| 309 | endif() | 571 | endif() |
| 310 | | 572 | |
| 311 | set(ZIG_LIB_DIR "lib/zig") | | |
| 312 | set(C_HEADERS_DEST "${ZIG_LIB_DIR}/include") | | |
| 313 | set(LIBC_FILES_DEST "${ZIG_LIB_DIR}/libc") | | |
| 314 | set(LIBUNWIND_FILES_DEST "${ZIG_LIB_DIR}/libunwind") | | |
| 315 | set(LIBCXX_FILES_DEST "${ZIG_LIB_DIR}/libcxx") | | |
| 316 | set(ZIG_STD_DEST "${ZIG_LIB_DIR}/std") | | |
| 317 | set(ZIG_CONFIG_H_OUT "${CMAKE_BINARY_DIR}/config.h") | | |
| 318 | set(ZIG_CONFIG_ZIG_OUT "${CMAKE_BINARY_DIR}/config.zig") | | |
| 319 | configure_file ( | 573 | configure_file ( |
| 320 | "${CMAKE_SOURCE_DIR}/src/stage1/config.h.in" | 574 | "${CMAKE_SOURCE_DIR}/src/stage1/config.h.in" |
| 321 | "${ZIG_CONFIG_H_OUT}" | 575 | "${ZIG_CONFIG_H_OUT}" |
| ... | @@ -468,10 +722,10 @@ set(BUILD_ZIG1_ARGS | ... | @@ -468,10 +722,10 @@ set(BUILD_ZIG1_ARGS |
| 468 | ) | 722 | ) |
| 469 | | 723 | |
| 470 | if("${ZIG_EXECUTABLE}" STREQUAL "") | 724 | if("${ZIG_EXECUTABLE}" STREQUAL "") |
| 471 | add_custom_target(zig_build_zig1 ALL | 725 | add_custom_command( |
| | 726 | OUTPUT "${ZIG1_OBJECT}" |
| 472 | COMMAND zig0 ${BUILD_ZIG1_ARGS} | 727 | COMMAND zig0 ${BUILD_ZIG1_ARGS} |
| 473 | DEPENDS zig0 | 728 | DEPENDS zig0 "${ZIG_STAGE2_SOURCES}" |
| 474 | BYPRODUCTS "${ZIG1_OBJECT}" | | |
| 475 | COMMENT STATUS "Building self-hosted component ${ZIG1_OBJECT}" | 729 | COMMENT STATUS "Building self-hosted component ${ZIG1_OBJECT}" |
| 476 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | 730 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" |
| 477 | ) | 731 | ) |
| ... | @@ -480,28 +734,29 @@ if("${ZIG_EXECUTABLE}" STREQUAL "") | ... | @@ -480,28 +734,29 @@ if("${ZIG_EXECUTABLE}" STREQUAL "") |
| 480 | set(ZIG_EXECUTABLE "${ZIG_EXECUTABLE}.exe") | 734 | set(ZIG_EXECUTABLE "${ZIG_EXECUTABLE}.exe") |
| 481 | endif() | 735 | endif() |
| 482 | else() | 736 | else() |
| 483 | add_custom_target(zig_build_zig1 ALL | 737 | add_custom_command( |
| 484 | COMMAND "${ZIG_EXECUTABLE}" "build-obj" ${BUILD_ZIG1_ARGS} | 738 | OUTPUT "${ZIG1_OBJECT}" |
| 485 | BYPRODUCTS "${ZIG1_OBJECT}" | 739 | BYPRODUCTS "${ZIG1_OBJECT}" |
| | 740 | COMMAND "${ZIG_EXECUTABLE}" "build-obj" ${BUILD_ZIG1_ARGS} |
| | 741 | DEPENDS ${ZIG_STAGE2_SOURCES} |
| 486 | COMMENT STATUS "Building self-hosted component ${ZIG1_OBJECT}" | 742 | COMMENT STATUS "Building self-hosted component ${ZIG1_OBJECT}" |
| 487 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | 743 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" |
| 488 | ) | 744 | ) |
| 489 | endif() | 745 | endif() |
| 490 | | 746 | |
| 491 | # cmake won't let us configure an executable without C sources. | 747 | # cmake won't let us configure an executable without C sources. |
| 492 | add_executable(zig "${CMAKE_SOURCE_DIR}/src/stage1/empty.cpp") | 748 | add_executable(zig "${CMAKE_SOURCE_DIR}/src/stage1/empty.cpp" "${ZIG1_OBJECT}") |
| 493 | | 749 | |
| 494 | set_target_properties(zig PROPERTIES | 750 | set_target_properties(zig PROPERTIES |
| 495 | COMPILE_FLAGS ${EXE_CFLAGS} | 751 | COMPILE_FLAGS ${EXE_CFLAGS} |
| 496 | LINK_FLAGS ${EXE_LDFLAGS} | 752 | LINK_FLAGS ${EXE_LDFLAGS} |
| 497 | ) | 753 | ) |
| 498 | target_link_libraries(zig "${ZIG1_OBJECT}" zigstage1) | 754 | target_link_libraries(zig zigstage1) |
| 499 | if(MSVC) | 755 | if(MSVC) |
| 500 | target_link_libraries(zig ntdll.lib) | 756 | target_link_libraries(zig ntdll.lib) |
| 501 | elseif(MINGW) | 757 | elseif(MINGW) |
| 502 | target_link_libraries(zig ntdll) | 758 | target_link_libraries(zig ntdll) |
| 503 | endif() | 759 | endif() |
| 504 | add_dependencies(zig zig_build_zig1) | | |
| 505 | | 760 | |
| 506 | install(TARGETS zig DESTINATION bin) | 761 | install(TARGETS zig DESTINATION bin) |
| 507 | | 762 | |