aboutsummaryrefslogtreecommitdiff
path: root/src/os.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-31implement os_self_exe_path in the c++ compiler for darwinAndrew Kelley
ported from the zig std lib this fixes looking for zig std lib at runtime on darwin
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-01-20remove unused function, fixes mingw buildAndrew Kelley
2018-01-19fix docgen on windowsAndrew Kelley
2018-01-19os_rename uses MoveFileEx on windowsAndrew Kelley
2018-01-19windows-compatible os_rename functionAndrew Kelley
windows libc rename() requires destination file path to not exist
2018-01-05workaround for microsoft releasing windows SDK with wrong versionAndrew Kelley
2017-12-04Fix the color of compiler messages for light-themed terminal.MIURA Masahiro
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-15fix windows argument parsingAndrew Kelley
2017-10-15set stdout and stderr to binary mode on windowsAndrew Kelley
2017-10-15mingw build: delete unused variableAndrew Kelley
2017-10-15only SetConsoleTextAttribute to do console colors on windowsAndrew Kelley
2017-10-14try harder to emit console colorsAndrew Kelley
2017-10-03fix mingw buildAndrew Kelley
2017-10-02support terminal colors for cmd.exe and msys ptyAndrew Kelley
See #302
2017-10-01implement standard library path searchAndrew Kelley
closes #463 See #302
2017-09-30better implementation of os_spawn_process for windowsAndrew Kelley
See #302
2017-09-11Add support for MSVCJonathan Marler
2017-08-27progress toward tests passing on MacOSAndrew Kelley
2017-05-23building with mingw for windowsAndrew Kelley
2017-04-28zig puts temporary object files in zig-cache folderAndrew 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 ```
2017-04-19convert assemble and link tests to zig build systemAndrew Kelley
2017-04-11zig build system writes template build.zig file when none existsAndrew Kelley
see #204
2017-04-10fix some -Wconversion errorsAndrew Kelley
2017-03-31first pass at zig build systemAndrew Kelley
* `zig build --export [obj|lib|exe]` changed to `zig build_obj`, `zig build_lib` and `zig build_exe` respectively. * `--name` parameter is optional when it can be inferred from the root source filename. closes #207 * `zig build` now looks for `build.zig` which interacts with `std.build.Builder` to describe the targets, and then the zig build system prints TODO: build these targets. See #204 * add `@bitcast` which is mainly used for pointer reinterpret casting and make explicit casting not do pointer reinterpretation. Closes #290 * fix debug info for byval parameters * sort command line help options * `std.debug.panic` supports format string printing * add `std.mem.IncrementingAllocator` * fix const ptr to a variable with data changing at runtime. closes #289
2017-03-13add --each-lib-rpath option and corresponding config optionAndrew Kelley
This adds an rpath entry for each used dynamic library directory. This is necessary on some systems such as NixOS.
2016-09-22os: fix file descriptor leak in os_execAndrew Kelley
See #182
2016-09-19use size_t for indexesAndrew Kelley
protect against incorrect copies in debug mode
2016-05-07add debug safety for divisionAndrew Kelley
See #149
2016-04-18add @embed_file builtin functionAndrew Kelley
2016-02-19fix build error with signed/unsignedAndrew Kelley
2016-02-17os: implement windows os layerAndrew Kelley
2016-02-16os: fix ability to compile for windowsAndrew Kelley
2016-02-16add windows os codeAndrew Kelley
2016-02-03basic support for building a test targetAndrew Kelley
2016-01-28fix incorrect loading of files over 8192 bytesAndrew Kelley
2016-01-27upgrade to the libclang C++ APIAndrew Kelley
c_import creates a tmp .h file and parses it with libclang, reporting any errors found. See #88
2015-12-15use realpath to avoid duplicate importsAndrew Kelley
2015-12-15when linking with libc use the C runtime libraryAndrew Kelley
2015-12-04fix reading source from stdinAndrew Kelley
2015-12-01add test for bad importAndrew Kelley
2015-12-01colored error messages that tell the source fileAndrew Kelley
2015-11-30refactor code to prepare for multiple filesAndrew Kelley
verbose compiler output is now behind --verbose flag
2015-11-26more readable integer constantJosh Wolfe
2015-11-26add testsAndrew Kelley