aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
AgeCommit message (Collapse)Author
2018-04-01Add run compiler commandMarc Tiehuis
'zig run file.zig' builds a file and stores the artifacts in the global cache. On successful compilation the binary is executed. 'zig run file.zig -- a b c' does the same, but passes the arguments a, b and c as runtime arguments to the program. Everything after an '--' are treated as runtime arguments. On a posix system, a shebang can be used to run a zig file directly. An example shebang would be '#!/usr/bin/zig run'. You may not be able pass extra compile arguments currently as part of the shebang. Linux for example treats all arguments after the first as a single argument which will result in an 'invalid command'. Currently there is no customisability for the cache path as a compile argument. For a posix system you can use `TMPDIR=. zig run file.zig` to override, in this case using the current directory for the run cache. The input file is always recompiled, even if it has changed. This is intended to be cached but further discussion/thought needs to go into this. Closes #466.
2018-03-30find libc and zig std lib at runtimeAndrew Kelley
this removes the following configure options: * ZIG_LIBC_LIB_DIR * ZIG_LIBC_STATIC_LIB_DIR * ZIG_LIBC_INCLUDE_DIR * ZIG_DYNAMIC_LINKER * ZIG_EACH_LIB_RPATH * zig's reliance on CMAKE_INSTALL_PREFIX these options are still available as command line options, however, the default will attempt to execute the system's C compiler to collect system defaults for these values. closes #870
2018-03-28non-zero exit when build.zig cannot be createdBen Noordhuis
Make the stage 1 compiler exit with a non-zero status code when `zig build --init` cannot create a new build.zig file.
2018-02-08Merge remote-tracking branch 'origin/master' into error-setsAndrew Kelley
2018-02-07improve behavior of `zig build` (#754)Jeff Fowler
See #748
2018-02-04add --forbid-libraryAndrew Kelley
to help track down accidentally linking against a library
2018-01-19all doc code examples are now testedAndrew Kelley
improve color scheme of docs make docs depend on no external files fix broken example code in docs closes #465
2018-01-06Darwin -> MacOSX, added Zen. See #438Andrea Orru
2018-01-04update windows build to llvm 5.0.1Andrew Kelley
llvm-config.exe does not handle diaguids.lib for us so we have to duplicate the work.
2018-01-03self-hosted build: use llvm-config from stage1Andrew Kelley
2018-01-03build: std files and c header files are only specified onceAndrew Kelley
In the CMakeLists.txt file. And then we communicate the list to the zig build.
2018-01-03fix self hosted compiler on windowsAndrew Kelley
2017-12-26self-hosted: build against zig_llvm and embedded LLDAndrew Kelley
Now the self-hosted compiler re-uses the same C++ code for interfacing with LLVM as the C++ code. It also links against the same LLD library files.
2017-11-24rename "parsec" to "translate-c"Andrew Kelley
2017-11-07std.io: introduce buffered I/O and change APIAndrew Kelley
I started working on #465 and made some corresponding std.io API changes. New structs: * std.io.FileInStream * std.io.FileOutStream * std.io.BufferedOutStream * std.io.BufferedInStream Removed: * std.io.File.in_stream * std.io.File.out_stream Now instead of &file.out_stream or &file.in_stream to get access to the stream API for a file, you get it like this: var file_in_stream = io.FileInStream.init(&file); const in_stream = &file_in_stream.stream; var file_out_stream = io.FileOutStream.init(&file); const out_stream = &file_out_stream.stream; This is evidence that we might not need any OOP features - See #130.
2017-11-03Add emit command-line option (#580)Marc Tiehuis
Add emit command-line option
2017-11-01windows: use the same libc search within a compilation unitAndrew Kelley
2017-11-01WIN32: Linking with the CRT at runtime. (#570)Dimenus
Disclaimer: Forgive me if my format sucks, I've never submitted a PR before! Fixes: #517 I added a few things to allow zig to link with the CRT properly both statically and dynamically. In Visual Studio 2017, Microsoft changed how the c-runtime is factored again. With this change, they also added a COM interface to allow you to query the respective Visual Studio instance for two of them. This does that and also falls back on a registry query for 2015 support. If you're using a Visual Studio instance older than 2015, you'll have to use the existing options available with the zig compiler. Changes are listed below along with a general description of the changes. all_types.cpp: The separate variables for msvc/kern32 have been removed and all win32 libc directory paths have been combined into a ZigList since we're querying more than two directories and differentiating one from another doesn't matter to lld. analyze.cpp: The existing functions were extended to support querying libc libs & libc headers at runtime. codegen.cpp/hpp: Microsoft uses the new 'Universal C Runtime' name now. Doesn't matter from a functionality standpoint. I left the compiler switches as is to not introduce any breaking changes. link.cpp: We're linking 4 libs and generating another in order to support the UCRT. Dynamic: msvcrt/d, vcruntime/d, ucrt/d, legacy_stdio_definitions.lib Static: libcmt/d, libvcruntime/d libucrt/d, legacy_stdio_definitions.lib main.cpp: Update function call names. os.cpp/hpp: COM/Registry interface for querying Windows UCRT/SDK. Sources: [Windows CRT](https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features) [VS 2015 Breaking Changes](https://msdn.microsoft.com/en-us/library/bb531344.aspx)
2017-10-27Merge branch 'master' into self-hostedAndrew Kelley
2017-10-25cleaner verbose flags and zig build prints failed commandAndrew Kelley
2017-10-24wip self hosted codeAndrew Kelley
2017-10-16look for libc at runtime on windowsAndrew Kelley
See #539 before we close the issue we should also detect MSVC 2017 but this gets us started with supporting MSVC 2015
2017-10-15clean up some resourcesAndrew Kelley
2017-10-01fix regression from previous commitAndrew Kelley
2017-10-01implement standard library path searchAndrew Kelley
closes #463 See #302
2017-10-01fix implementation of --zig-std-dirAndrew Kelley
see #463
2017-09-30better divTrunc codegenAndrew Kelley
branch and phi instead of select instruction fixes division test for windows. See #302
2017-09-30zig test on 64-bit windows runs 32-bit testsAndrew Kelley
2017-09-30better output for cross platform zig test on windowsAndrew Kelley
2017-09-18add --verbose-link optionAndrew Kelley
only prints the link line
2017-09-17add -mllvm supportAndrew Kelley
useful for debugging crashes in llvm optimizer
2017-09-17add option to run tests in LLDB and turn it on for macos travisAndrew Kelley
2017-09-17Add dash arguments for cliMarc Tiehuis
2017-09-05rename parseh to parsecAndrew Kelley
2017-09-02rewrite parseh to use AST instead of direct typesAndrew Kelley
some tests still failing
2017-08-31add windows to test targetsAndrew Kelley
cross-compiling hello world with no libc for windows is working
2017-08-30test suite cross-compile builds tests for other targetsAndrew Kelley
2017-08-28remove remnants of depending on darwin system linkerAndrew Kelley
2017-08-20move docs to websiteAndrew Kelley
2017-08-20more zenAndrew Kelley
2017-08-20move zen of zig to a sub commandAndrew Kelley
2017-06-14progress toward windows hello world workingAndrew Kelley
2017-05-02add safe release build modeAndrew Kelley
closes #288
2017-05-01basic support for specifying packages at the command lineAndrew Kelley
See #226
2017-05-01`@import("builtin")` instead of `@compileVar`Andrew Kelley
See #226 Closes #220
2017-04-30zig build: organize build artifactsAndrew Kelley
closes #328
2017-04-28zig puts temporary object files in zig-cache folderAndrew Kelley
See #298
2017-04-27zig test no longer requires a separate test_runner.o fileAndrew Kelley
See #298
2017-04-26build system: consolidate duplicate code and moreAndrew Kelley
* add ability to add assembly files when building an exe, obj, or lib * add implicit cast from `[N]T` to `?[]const T` (closes #343) * remove link_exe and link_lib in favor of allowing build_exe and build_lib support no root zig source file
2017-04-25add some timing diagnosticsAndrew Kelley
pass --enable-timing-info to print a nice table like this: ``` Name Start End Duration Percent Initialize 0.0000 0.0000 0.0000 0.0001 Semantic Analysis 0.0000 0.0421 0.0420 0.2109 Code Generation 0.0421 0.0620 0.0200 0.1003 LLVM Emit Object 0.0620 0.1852 0.1231 0.6180 Build Dependencies 0.1852 0.1974 0.0122 0.0615 LLVM Link 0.1974 0.1993 0.0018 0.0093 Generate .h 0.1993 0.1993 0.0000 0.0000 Total 0.0000 0.1993 0.1993 1.0000 ```