From 9fa5f73d00905568e8979d0c93ec4a8f645c81d5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 9 Aug 2016 11:31:53 +0200 Subject: Implement support for C compilation We now have two new modules: cc (c-common) and c. --- build2/cc/link | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 build2/cc/link (limited to 'build2/cc/link') diff --git a/build2/cc/link b/build2/cc/link new file mode 100644 index 0000000..8be386f --- /dev/null +++ b/build2/cc/link @@ -0,0 +1,78 @@ +// file : build2/cc/link -*- C++ -*- +// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BUILD2_CC_LINK +#define BUILD2_CC_LINK + +#include +#include + +#include + +#include + +#include +#include + +namespace build2 +{ + namespace cc + { + class link: public rule, virtual common + { + public: + link (data&&); + + virtual match_result + match (action, target&, const string& hint) const; + + virtual recipe + apply (action, target&, const match_result&) const; + + target_state + perform_update (action, target&) const; + + target_state + perform_clean (action, target&) const; + + private: + friend class compile; + + // Extract system library search paths from GCC or compatible (Clang, + // Intel) using the -print-search-dirs option. + // + void + gcc_library_search_paths (scope&, dir_paths&) const; + + // Extract system library search paths from VC (msvc.cxx). + // + void + msvc_library_search_paths (scope&, dir_paths&) const; + + dir_paths + extract_library_paths (scope&) const; + + // Alternative search logic for VC (msvc.cxx). + // + bin::liba* + msvc_search_static (const path&, const dir_path&, prerequisite&) const; + + bin::libs* + msvc_search_shared (const path&, const dir_path&, prerequisite&) const; + + target* + search_library (optional&, prerequisite&) const; + + // Windows-specific (windows-manifest.cxx). + // + path + windows_manifest (file&, bool rpath_assembly) const; + + private: + const string rule_id; + }; + } +} + +#endif // BUILD2_CC_LINK -- cgit v1.1