libraries + self building + work on extensions
This commit is contained in:
parent
b6ee9d0dc3
commit
3ddb2943bc
14 changed files with 97 additions and 39 deletions
|
@ -24,6 +24,10 @@ TargetInfo grbc_library(const LibraryConfig &library_config) {
|
|||
compiler_args += compiler_arg + " ";
|
||||
}
|
||||
|
||||
if (library_config.lib_type == LibraryType_Shared) {
|
||||
compiler_args += "-fPIC ";
|
||||
}
|
||||
|
||||
// Include directories
|
||||
|
||||
compiler_args += grbc_include_dirs_to_cflags(library_config.include_dirs);
|
||||
|
@ -44,21 +48,27 @@ TargetInfo grbc_library(const LibraryConfig &library_config) {
|
|||
target.compile_commands.push_back(compile_cmd);
|
||||
}
|
||||
|
||||
// Libraries which need to be built before us
|
||||
|
||||
std::vector<std::string> libraries;
|
||||
|
||||
for (auto &lib : library_config.requirements) {
|
||||
libraries.push_back(lib.file_name);
|
||||
}
|
||||
|
||||
// Generate package config
|
||||
PackageConfig pkg_cfg{};
|
||||
pkg_cfg.name = library_config.name;
|
||||
pkg_cfg.libraries = library_config.package_config.libraries;
|
||||
pkg_cfg.include_dirs = library_config.include_dirs;
|
||||
|
||||
if (library_config.lib_type == LibraryType_Static) {
|
||||
pkg_cfg.linker_flags.push_back(grbc_get_config().build_dir + "/" + lib_name);
|
||||
}
|
||||
|
||||
// FIXME: Shared library linker flags
|
||||
pkg_cfg.linker_flags.push_back(grbc_get_config().build_dir + "/" + lib_name);
|
||||
|
||||
if (!pkg_cfg.name.empty()) {
|
||||
GState::get().packages.insert(
|
||||
{pkg_cfg.name, grbc_bake_package_config(pkg_cfg)});
|
||||
Package pkg = grbc_bake_package_config(pkg_cfg);
|
||||
pkg.file_name = lib_name;
|
||||
|
||||
GState::get().packages.insert({pkg_cfg.name, pkg});
|
||||
}
|
||||
|
||||
GeneratorLinkTargetCommand link_target{};
|
||||
|
@ -72,6 +82,7 @@ TargetInfo grbc_library(const LibraryConfig &library_config) {
|
|||
link_target.object_files = object_files;
|
||||
link_target.linker_flags = linker_args;
|
||||
link_target.output_name = lib_name;
|
||||
link_target.libraries = libraries;
|
||||
|
||||
target.link_target_commands.push_back(link_target);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue