mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
build: obtain zigcpp library prefix/suffix from cmake
This commit is contained in:
parent
eb4337fe83
commit
9627018d0c
2 changed files with 23 additions and 5 deletions
18
build.zig
18
build.zig
|
|
@ -537,7 +537,11 @@ fn addCmakeCfgOptionsToExe(
|
||||||
exe.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{
|
exe.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{
|
||||||
cfg.cmake_binary_dir,
|
cfg.cmake_binary_dir,
|
||||||
"zigcpp",
|
"zigcpp",
|
||||||
b.fmt("{s}{s}{s}", .{ exe.target.libPrefix(), "zigcpp", exe.target.staticLibSuffix() }),
|
b.fmt("{s}{s}{s}", .{
|
||||||
|
cfg.cmake_static_library_prefix,
|
||||||
|
"zigcpp",
|
||||||
|
cfg.cmake_static_library_suffix,
|
||||||
|
}),
|
||||||
}) catch unreachable);
|
}) catch unreachable);
|
||||||
assert(cfg.lld_include_dir.len != 0);
|
assert(cfg.lld_include_dir.len != 0);
|
||||||
exe.addIncludePath(cfg.lld_include_dir);
|
exe.addIncludePath(cfg.lld_include_dir);
|
||||||
|
|
@ -669,6 +673,8 @@ const CMakeConfig = struct {
|
||||||
llvm_linkage: std.build.LibExeObjStep.Linkage,
|
llvm_linkage: std.build.LibExeObjStep.Linkage,
|
||||||
cmake_binary_dir: []const u8,
|
cmake_binary_dir: []const u8,
|
||||||
cmake_prefix_path: []const u8,
|
cmake_prefix_path: []const u8,
|
||||||
|
cmake_static_library_prefix: []const u8,
|
||||||
|
cmake_static_library_suffix: []const u8,
|
||||||
cxx_compiler: []const u8,
|
cxx_compiler: []const u8,
|
||||||
lld_include_dir: []const u8,
|
lld_include_dir: []const u8,
|
||||||
lld_libraries: []const u8,
|
lld_libraries: []const u8,
|
||||||
|
|
@ -732,6 +738,8 @@ fn parseConfigH(b: *Builder, config_h_text: []const u8) ?CMakeConfig {
|
||||||
.llvm_linkage = undefined,
|
.llvm_linkage = undefined,
|
||||||
.cmake_binary_dir = undefined,
|
.cmake_binary_dir = undefined,
|
||||||
.cmake_prefix_path = undefined,
|
.cmake_prefix_path = undefined,
|
||||||
|
.cmake_static_library_prefix = undefined,
|
||||||
|
.cmake_static_library_suffix = undefined,
|
||||||
.cxx_compiler = undefined,
|
.cxx_compiler = undefined,
|
||||||
.lld_include_dir = undefined,
|
.lld_include_dir = undefined,
|
||||||
.lld_libraries = undefined,
|
.lld_libraries = undefined,
|
||||||
|
|
@ -751,6 +759,14 @@ fn parseConfigH(b: *Builder, config_h_text: []const u8) ?CMakeConfig {
|
||||||
.prefix = "#define ZIG_CMAKE_PREFIX_PATH ",
|
.prefix = "#define ZIG_CMAKE_PREFIX_PATH ",
|
||||||
.field = "cmake_prefix_path",
|
.field = "cmake_prefix_path",
|
||||||
},
|
},
|
||||||
|
.{
|
||||||
|
.prefix = "#define ZIG_CMAKE_STATIC_LIBRARY_PREFIX ",
|
||||||
|
.field = "cmake_static_library_prefix",
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.prefix = "#define ZIG_CMAKE_STATIC_LIBRARY_SUFFIX ",
|
||||||
|
.field = "cmake_static_library_suffix",
|
||||||
|
},
|
||||||
.{
|
.{
|
||||||
.prefix = "#define ZIG_CXX_COMPILER ",
|
.prefix = "#define ZIG_CXX_COMPILER ",
|
||||||
.field = "cxx_compiler",
|
.field = "cxx_compiler",
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,18 @@
|
||||||
#define ZIG_VERSION_STRING "@ZIG_VERSION@"
|
#define ZIG_VERSION_STRING "@ZIG_VERSION@"
|
||||||
|
|
||||||
// Used by build.zig for communicating build information to self hosted build.
|
// Used by build.zig for communicating build information to self hosted build.
|
||||||
|
#define ZIG_CLANG_LIBRARIES "@CLANG_LIBRARIES@"
|
||||||
#define ZIG_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@"
|
#define ZIG_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@"
|
||||||
#define ZIG_LLVM_LINK_MODE "@LLVM_LINK_MODE@"
|
|
||||||
#define ZIG_CMAKE_PREFIX_PATH "@ZIG_CMAKE_PREFIX_PATH@"
|
#define ZIG_CMAKE_PREFIX_PATH "@ZIG_CMAKE_PREFIX_PATH@"
|
||||||
|
#define ZIG_CMAKE_STATIC_LIBRARY_PREFIX "@CMAKE_STATIC_LIBRARY_PREFIX@"
|
||||||
|
#define ZIG_CMAKE_STATIC_LIBRARY_SUFFIX "@CMAKE_STATIC_LIBRARY_SUFFIX@"
|
||||||
#define ZIG_CXX_COMPILER "@CMAKE_CXX_COMPILER@"
|
#define ZIG_CXX_COMPILER "@CMAKE_CXX_COMPILER@"
|
||||||
|
#define ZIG_DIA_GUIDS_LIB "@ZIG_DIA_GUIDS_LIB_ESCAPED@"
|
||||||
#define ZIG_LLD_INCLUDE_PATH "@LLD_INCLUDE_DIRS@"
|
#define ZIG_LLD_INCLUDE_PATH "@LLD_INCLUDE_DIRS@"
|
||||||
#define ZIG_LLD_LIBRARIES "@LLD_LIBRARIES@"
|
#define ZIG_LLD_LIBRARIES "@LLD_LIBRARIES@"
|
||||||
#define ZIG_CLANG_LIBRARIES "@CLANG_LIBRARIES@"
|
|
||||||
#define ZIG_LLVM_INCLUDE_PATH "@LLVM_INCLUDE_DIRS@"
|
#define ZIG_LLVM_INCLUDE_PATH "@LLVM_INCLUDE_DIRS@"
|
||||||
#define ZIG_LLVM_LIB_PATH "@LLVM_LIBDIRS@"
|
|
||||||
#define ZIG_LLVM_LIBRARIES "@LLVM_LIBRARIES@"
|
#define ZIG_LLVM_LIBRARIES "@LLVM_LIBRARIES@"
|
||||||
#define ZIG_DIA_GUIDS_LIB "@ZIG_DIA_GUIDS_LIB_ESCAPED@"
|
#define ZIG_LLVM_LIB_PATH "@LLVM_LIBDIRS@"
|
||||||
|
#define ZIG_LLVM_LINK_MODE "@LLVM_LINK_MODE@"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue