add ZIG_STATIC cmake option
it's not compatible with glibc but it works with muslmaster
parent
edca173997
commit
f586acabdc
|
@ -35,6 +35,7 @@ set(ZIG_LIBC_STATIC_LIB_DIR "" CACHE STRING "Default native target libc director
|
||||||
set(ZIG_LIBC_INCLUDE_DIR "/usr/include" CACHE STRING "Default native target libc include directory")
|
set(ZIG_LIBC_INCLUDE_DIR "/usr/include" CACHE STRING "Default native target libc include directory")
|
||||||
set(ZIG_DYNAMIC_LINKER "" CACHE STRING "Override dynamic linker for native target")
|
set(ZIG_DYNAMIC_LINKER "" CACHE STRING "Override dynamic linker for native target")
|
||||||
set(ZIG_EACH_LIB_RPATH off CACHE BOOL "Add each dynamic library to rpath for native target")
|
set(ZIG_EACH_LIB_RPATH off CACHE BOOL "Add each dynamic library to rpath for native target")
|
||||||
|
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
|
||||||
|
|
||||||
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_LIB_DIR_ESCAPED "${ZIG_LIBC_LIB_DIR}")
|
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_LIB_DIR_ESCAPED "${ZIG_LIBC_LIB_DIR}")
|
||||||
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_STATIC_LIB_DIR_ESCAPED "${ZIG_LIBC_STATIC_LIB_DIR}")
|
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_STATIC_LIB_DIR_ESCAPED "${ZIG_LIBC_STATIC_LIB_DIR}")
|
||||||
|
@ -698,6 +699,8 @@ if(MINGW)
|
||||||
set(EXE_LDFLAGS "-static -static-libgcc -static-libstdc++")
|
set(EXE_LDFLAGS "-static -static-libgcc -static-libstdc++")
|
||||||
elseif(MSVC)
|
elseif(MSVC)
|
||||||
set(EXE_LDFLAGS "/STACK:16777216")
|
set(EXE_LDFLAGS "/STACK:16777216")
|
||||||
|
elseif(ZIG_STATIC)
|
||||||
|
set(EXE_LDFLAGS "-static")
|
||||||
else()
|
else()
|
||||||
set(EXE_LDFLAGS " ")
|
set(EXE_LDFLAGS " ")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -15,7 +15,7 @@ find_program(LLVM_CONFIG_EXE
|
||||||
"c:/msys64/mingw64/bin"
|
"c:/msys64/mingw64/bin"
|
||||||
"C:/Libraries/llvm-6.0.0/bin")
|
"C:/Libraries/llvm-6.0.0/bin")
|
||||||
|
|
||||||
if(NOT(CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
if(NOT(CMAKE_BUILD_TYPE STREQUAL "Debug") OR ZIG_STATIC)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${LLVM_CONFIG_EXE} --libfiles --link-static
|
COMMAND ${LLVM_CONFIG_EXE} --libfiles --link-static
|
||||||
OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
|
OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
|
||||||
|
|
Loading…
Reference in New Issue