// 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 override; virtual recipe apply (action, target&) const override; target_state perform_update (action, target&) const; target_state perform_clean (action, target&) const; private: friend class install; // Shared library paths. // struct libs_paths { // If any (except real) is empty, then it is the same as the next // one. Except for intermediate, for which empty indicates that it is // not used. // // The libs{} path is always the real path. On Windows the link path // is the import library. // // @@ TODO: change real to reference, make other const once cache the // object. // path link; // What we link: libfoo.so path soname; // SONAME: libfoo-1.so, libfoo.so.1 path interm; // Intermediate: libfoo.so.1.2 const path* real; // Real: libfoo.so.1.2.3 inline const path& effect_link () const {return link.empty () ? effect_soname () : link;} inline const path& effect_soname () const {return soname.empty () ? *real : soname;} }; libs_paths derive_libs_paths (file&) const; // Library handling. // void append_libraries (strings&, file&, bool, scope&, lorder) const; void hash_libraries (sha256&, file&, bool, scope&, lorder) const; void rpath_libraries (strings&, target&, scope&, lorder, bool) const; // Windows rpath emulation (windows-rpath.cxx). // struct windows_dll { const string& dll; const string* pdb; // NULL if none. string pdb_storage; bool operator< (const windows_dll& y) const {return dll < y.dll;} }; using windows_dlls = std::set; timestamp windows_rpath_timestamp (file&, scope&, lorder) const; windows_dlls windows_rpath_dlls (file&, scope&, lorder) const; void windows_rpath_assembly (file&, scope&, lorder, const string&, timestamp, bool) const; // Windows-specific (windows-manifest.cxx). // path windows_manifest (file&, bool rpath_assembly) const; private: const string rule_id; }; } } #endif // BUILD2_CC_LINK