Patch #2937 2010-02-24 12:14

thedmd

Added ability to specify .def and import library filenames
Download
2937-Added_ability.patch (40.4 KB)
Category
Application::FeatureAdd
Status
Accepted
Close date
2011-06-24 18:52
Assigned to
mortenmacfly
Index: src/include/compiletargetbase.h
===================================================================
--- src/include/compiletargetbase.h    (revision 6178)
+++ src/include/compiletargetbase.h    (working copy)
@@ -114,6 +114,8 @@
         virtual const wxString& GetTitle() const; ///< Read the target's title
         virtual void SetTitle(const wxString& title); ///< Set the target's title
         virtual void SetOutputFilename(const wxString& filename); ///< Set the target's output filename
+        virtual void SetImportLibraryFilename(const wxString& filename); ///< Set the target's import library filename
+        virtual void SetDefinitionFileFilename(const wxString& filename); ///< Set the target's definition file filename
         virtual void SetWorkingDir(const wxString& dirname); ///< Set the target's working dir on execution (valid only for executable targets)
         virtual void SetObjectOutput(const wxString& dirname); ///< Set the target's objects output dir
         virtual void SetDepsOutput(const wxString& dirname); ///< Set the target's dependencies output dir
@@ -126,6 +128,7 @@
         virtual wxString SuggestOutputFilename(); ///< Suggest a filename based on the target's type
         virtual wxString GetExecutableFilename() const; ///< Read the target's executable filename (produced if target type is ttExecutable)
         virtual wxString GetDynamicLibFilename(); ///< Read the target's dynamic library filename (produced if target type is ttDynamicLib)
+        virtual wxString GetDynamicLibImportFilename(); ///< Read the target's dynamic library import filename (produced if target type is ttDynamicLib)
         virtual wxString GetDynamicLibDefFilename(); ///< Read the target's dynamic library definition file filename (produced if target type is ttDynamicLib)
         virtual wxString GetStaticLibFilename(); ///< Read the target's static library filename (produced if target type is ttStaticLib)
         virtual wxString GetNativeFilename(); ///< Read the target's native filename (produced if target type is ttNative)
@@ -147,6 +150,8 @@
         wxString m_Filename;
         wxString m_Title;
         wxString m_OutputFilename;
+        wxString m_ImportLibraryFilename;
+        wxString m_DefinitionFileFilename;
         wxString m_WorkingDir;
         wxString m_ObjectOutput;
         wxString m_DepsOutput;
Index: src/include/macrosmanager.h
===================================================================
--- src/include/macrosmanager.h    (revision 6178)
+++ src/include/macrosmanager.h    (working copy)
@@ -58,6 +58,7 @@
     wxString            m_TargetOutputDir;
     wxString            m_TargetName;
     wxString            m_TargetOutputBaseName;
+    wxString            m_TargetOutputFilename;
     wxString            m_TargetFilename;

     MacrosMap           m_Macros;
Index: src/include/projectoptionsdlg.h
===================================================================
--- src/include/projectoptionsdlg.h    (revision 6178)
+++ src/include/projectoptionsdlg.h    (working copy)
@@ -35,6 +35,8 @@
         void OnCopyBuildTargetClick(wxCommandEvent& event);
         void OnRemoveBuildTargetClick(wxCommandEvent& event);
         void OnBrowseOutputFilenameClick(wxCommandEvent& event);
+        void OnBrowseImportLibraryFilenameClick(wxCommandEvent& event);
+        void OnBrowseDefinitionFileFilenameClick(wxCommandEvent& event);
         void OnBrowseDirClick(wxCommandEvent& event);
         void OnVirtualTargets(wxCommandEvent& event);
         void OnEditDepsClick(wxCommandEvent& event);
@@ -46,6 +48,8 @@
         void OnPlatform(wxCommandEvent& event);
         void OnUpdateUI(wxUpdateUIEvent& event);
         void OnOK(wxCommandEvent& event);
+        void OnCreateDefFileClick(wxCommandEvent& event);
+        void OnCreateImportFileClick(wxCommandEvent& event);

         void OnScriptsOverviewSelChanged(wxTreeEvent& event);
         void OnCheckScripts(wxCommandEvent& event);
Index: src/sdk/compilercommandgenerator.cpp
===================================================================
--- src/sdk/compilercommandgenerator.cpp    (revision 6178)
+++ src/sdk/compilercommandgenerator.cpp    (working copy)
@@ -447,47 +447,106 @@
     FixPathSeparators(compiler, result);
     m_Output[target] = result;

-    // Replace Variables FIRST to address the $(VARIABLE)libfoo.a problem
-    // if $(VARIABLE) expands to /bar/ then wxFileName will still consider $(VARIABLE)libfoo.a a filename,
-    // not a fully qualified path, so we will prepend lib to /bar/libfoo.a incorrectly
-    // NOTE (thomas#1#): A better solution might be to use a regex, but finding an universal regex might not be easy...
-    wxString fnameString(target->GetOutputFilename());
-    Manager::Get()->GetMacrosManager()->ReplaceMacros(fnameString, target);
-    wxFileName fname(fnameString);
+    // static/import library name
+    switch (target->GetTargetType())
+    {
+        case ttDynamicLib:
+
download for full patch...
mortenmacfly 2010-02-26 17:01

Here is an issue:

If I compile a dynamic library and want to automatically create the prefix and extension and have enabled "create import library" and "create def file" and my output file does look like: "MyLib" the def file will overwrite the include library without any warning. You'll notice a linker error that "the format could be recognised" when you try to link against the import lib.

thedmd 2010-02-26 21:30

It may sounds strange, but it is correct behavior. This is just invalid configuration. I do not wish to introduce artificial limits. In all regular scenarios users setup reasonable configurations. Probably some warning may be produced.

mortenmacfly 2010-02-27 19:53

Please allow me an objection hereby:

I doubt that this will be considered as "correct".

If I want to have C::B take care about prefix and suffix and provide just the (middle) name compilation should really work. Otherwise the checkboxes simply don't do what a users intention is.

BTW: We had discussed these issues already a long time in the past. This must be bullet (and fool) proof.

thedmd 2010-02-28 12:25

I misunderstand you. I thought you were taking about case when both checkboxes are unchecked. Try it now, I fixed that error.

thedmd 2010-02-28 12:26

Ups, forgotten to check "upload" box.

thedmd 2010-03-06 13:02

Do you have the opportunity to review this patch?

mortenmacfly 2010-03-08 11:54

I cannot compile C::B anymore after applying the new version. Compilation failes here:

wxString requested_ext = "def";

thedmd 2010-03-08 12:04

My bad. "def" should be enclosed in _T(). Not it is fixed.

thedmd 2010-04-02 17:54

May I ask you for review this patch again?

mortenmacfly 2010-04-06 19:08

What do you mean by "review"? I don't see the patch has updated since March. If you mean to review your last update - don't worry, I did. I still have it applied in my local copy and use it in daily environment for testing. So far I have no complaints, otherwise I'll post here, of course.

I tried to reproduce the issue you said you've fixed and indeed it seems not to happen anymore.

However, Linux/Mac testing is missing which is a must! Hence I don't have time for this atm. As you are surely aware we are in feature freeze, so this won't make it into the release. But after that I am open for public testing/discussion through nightlies (if needed).

thedmd 2010-04-07 06:24

Yes, patch was not update because it should be complete in the way it is now. I had asked to clarify the status of this patch.

I was not aware about feature freeze. I was also not aware about the fact that you are using this path on daily basis. I'm pleased that it works for you.

I will be happy to see it in nightlies after release. Since I have no daily access to Mac nor Linux.

Thanks for response.

mortenmacfly 2011-06-24 18:52

Applied in trunk meanwhile.