build: rename the "skip lib files" option

* Old cmake option: `-DZIG_SKIP_INSTALL_LIB_FILES=ON`
 * New cmake option: `-DZIG_NO_LIB=ON`
 * Old build.zig option: `-Dskip-install-lib-files`
 * New build.zig option: `-Dno-lib`

Motivation is making build commands easier to type.
This commit is contained in:
Andrew Kelley 2022-10-27 15:16:14 -07:00
parent f4f4e33885
commit 0b99e5e4c4
3 changed files with 17 additions and 7 deletions

View File

@ -68,7 +68,7 @@ test and debug from a git working tree.
- `make` is typically sufficient to build zig during development iterations. - `make` is typically sufficient to build zig during development iterations.
- `make install` performs a build __and__ install. - `make install` performs a build __and__ install.
- `msbuild -p:Configuration=Release INSTALL.vcxproj` on Windows performs a - `msbuild -p:Configuration=Release INSTALL.vcxproj` on Windows performs a
build and install. To avoid install, pass cmake option `-DZIG_SKIP_INSTALL_LIB_FILES=ON`. build and install. To avoid install, pass cmake option `-DZIG_NO_LIB=ON`.
To test changes, do the following from the build directory: To test changes, do the following from the build directory:

View File

@ -81,9 +81,15 @@ if("${ZIG_VERSION}" STREQUAL "")
endif() endif()
message(STATUS "Configuring zig version ${ZIG_VERSION}") message(STATUS "Configuring zig version ${ZIG_VERSION}")
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL set(ZIG_NO_LIB off CACHE BOOL
"Disable copying lib/ files to install prefix during the build phase") "Disable copying lib/ files to install prefix during the build phase")
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL "Deprecated. Use ZIG_NO_LIB")
if(ZIG_SKIP_INSTALL_LIB_FILES)
message(WARNING "ZIG_SKIP_INSTALL_LIB_FILES is deprecated. Use ZIG_NO_LIB instead.")
set(ZIG_NO_LIB ON)
endif()
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)") set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries") set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries")
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries") set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
@ -1004,10 +1010,10 @@ elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
else() else()
set(ZIG_RELEASE_ARG -Drelease -Dstrip) set(ZIG_RELEASE_ARG -Drelease -Dstrip)
endif() endif()
if(ZIG_SKIP_INSTALL_LIB_FILES) if(ZIG_NO_LIB)
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files") set(ZIG_NO_LIB_ARG "-Dno-lib")
else() else()
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files=false") set(ZIG_NO_LIB_ARG "")
endif() endif()
if(ZIG_SINGLE_THREADED) if(ZIG_SINGLE_THREADED)
set(ZIG_SINGLE_THREADED_ARG "-fsingle-threaded") set(ZIG_SINGLE_THREADED_ARG "-fsingle-threaded")
@ -1080,7 +1086,7 @@ set(ZIG_BUILD_ARGS
"-Denable-stage1" "-Denable-stage1"
${ZIG_RELEASE_ARG} ${ZIG_RELEASE_ARG}
${ZIG_STATIC_ARG} ${ZIG_STATIC_ARG}
${ZIG_SKIP_INSTALL_LIB_FILES_ARG} ${ZIG_NO_LIB_ARG}
${ZIG_SINGLE_THREADED_ARG} ${ZIG_SINGLE_THREADED_ARG}
"-Dtarget=${ZIG_TARGET_TRIPLE}" "-Dtarget=${ZIG_TARGET_TRIPLE}"
"-Dcpu=${ZIG_TARGET_MCPU}" "-Dcpu=${ZIG_TARGET_MCPU}"

View File

@ -61,7 +61,11 @@ pub fn build(b: *Builder) !void {
const skip_stage1 = b.option(bool, "skip-stage1", "Main test suite skips stage1 compile error tests") orelse false; const skip_stage1 = b.option(bool, "skip-stage1", "Main test suite skips stage1 compile error tests") orelse false;
const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false; const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;
const skip_stage2_tests = b.option(bool, "skip-stage2-tests", "Main test suite skips self-hosted compiler tests") orelse false; const skip_stage2_tests = b.option(bool, "skip-stage2-tests", "Main test suite skips self-hosted compiler tests") orelse false;
const skip_install_lib_files = b.option(bool, "skip-install-lib-files", "Do not copy lib/ files to installation prefix") orelse false; const deprecated_skip_install_lib_files = b.option(bool, "skip-install-lib-files", "deprecated. see no-lib") orelse false;
if (deprecated_skip_install_lib_files) {
std.log.warn("-Dskip-install-lib-files is deprecated in favor of -Dno-lib", .{});
}
const skip_install_lib_files = b.option(bool, "no-lib", "skip copying of lib/ files to installation prefix. Useful for development") orelse deprecated_skip_install_lib_files;
const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;