← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-c/trunk] Rev 26: auto-fill the resource file

 

------------------------------------------------------------
revno: 26
committer: poy <poy@xxxxxxxxxx>
branch nick: dcpp-plugin-sdk-c
timestamp: Sun 2013-06-16 20:40:48 +0200
message:
  auto-fill the resource file
modified:
  packaging/packager/packager.cpp
  projects/make/Makefile
  projects/vs2012/Plugin.vcxproj
  src/resource.h
  src/resource.rc
  src/stdafx.h
  src/version.h


--
lp:dcpp-plugin-sdk-c
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcpp-plugin-sdk-c.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/trunk/+edit-subscription
=== modified file 'packaging/packager/packager.cpp'
--- packaging/packager/packager.cpp	2013-06-03 16:32:50 +0000
+++ packaging/packager/packager.cpp	2013-06-16 18:40:48 +0000
@@ -1,12 +1,11 @@
 // Generate an info.xml template from the version.h file.
 
+#include <src/stdafx.h>
+
 #include <fstream>
 #include <iostream>
 #include <string>
 
-#include <pluginsdk/PluginDefs.h>
-#include <src/version.h>
-
 using namespace std;
 
 string escape(string str) {

=== modified file 'projects/make/Makefile'
--- projects/make/Makefile	2013-06-03 16:32:50 +0000
+++ projects/make/Makefile	2013-06-16 18:40:48 +0000
@@ -35,6 +35,8 @@
 	LIBEXT = .dll
 	OBJS += src/resource.o
 	OUTPUT_DIR := $(OUTPUT_DIR)-mingw
+	RCFLAGS := -DPLUGIN_FILE_NAME="\\\"$(TARGET)\\\"" \
+		-DPLUGIN_FILE_NAME_EXT="\\\"$(TARGET)$(LIBEXT)\\\""
 endif
 
 ifeq ($(findstring x86_64, $(COMPILER_SPEC)),)
@@ -91,8 +93,10 @@
 $(OUTPUT_DIR)/%.o: %.cpp
 	$(COMPILE.cpp) $< $(OUTPUT_OPTION)
 
+ifneq ($(findstring mingw, $(COMPILER_SPEC)),)
 $(OUTPUT_DIR)/%.o: %.rc
-	windres $< $(OUTPUT_OPTION)
+	windres $< $(RCFLAGS) $(OUTPUT_OPTION)
+endif
 
 $(OBJS): | $(OUTPUT_DIR)
 

=== modified file 'projects/vs2012/Plugin.vcxproj'
--- projects/vs2012/Plugin.vcxproj	2013-05-23 16:17:12 +0000
+++ projects/vs2012/Plugin.vcxproj	2013-06-16 18:40:48 +0000
@@ -95,6 +95,9 @@
       <SubSystem>Windows</SubSystem>
       <AdditionalOptions>/EXPORT:pluginInit %(AdditionalOptions)</AdditionalOptions>
     </Link>
+    <ResourceCompile>
+      <PreprocessorDefinitions>PLUGIN_FILE_NAME="\"$(TargetName)\"";PLUGIN_FILE_NAME_EXT="\"$(TargetFileName)\"";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
@@ -111,6 +114,9 @@
       <SubSystem>Windows</SubSystem>
       <AdditionalOptions>/EXPORT:pluginInit %(AdditionalOptions)</AdditionalOptions>
     </Link>
+    <ResourceCompile>
+      <PreprocessorDefinitions>PLUGIN_FILE_NAME="\"$(TargetName)\"";PLUGIN_FILE_NAME_EXT="\"$(TargetFileName)\"";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
@@ -129,6 +135,9 @@
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalOptions>/EXPORT:pluginInit %(AdditionalOptions)</AdditionalOptions>
     </Link>
+    <ResourceCompile>
+      <PreprocessorDefinitions>PLUGIN_FILE_NAME="\"$(TargetName)\"";PLUGIN_FILE_NAME_EXT="\"$(TargetFileName)\"";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
@@ -146,6 +155,9 @@
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalOptions>/EXPORT:pluginInit %(AdditionalOptions)</AdditionalOptions>
     </Link>
+    <ResourceCompile>
+      <PreprocessorDefinitions>PLUGIN_FILE_NAME="\"$(TargetName)\"";PLUGIN_FILE_NAME_EXT="\"$(TargetFileName)\"";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\..\pluginsdk\Config.c" />

=== modified file 'src/resource.h'
--- src/resource.h	2012-12-27 14:49:19 +0000
+++ src/resource.h	2013-06-16 18:40:48 +0000
@@ -2,7 +2,6 @@
 // Microsoft Visual C++ generated include file.
 // Used by resource.rc
 //
-#define VERSION_INFO                    1
 
 // Next default values for new objects
 // 

=== modified file 'src/resource.rc'
--- src/resource.rc	2012-12-27 14:49:19 +0000
+++ src/resource.rc	2013-06-16 18:40:48 +0000
@@ -8,6 +8,7 @@
 // Generated from the TEXTINCLUDE 2 resource.
 //
 #include "afxres.h"
+#include "version.h"
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
@@ -33,26 +34,68 @@
 2 TEXTINCLUDE 
 BEGIN
     "#include ""afxres.h""\r\n"
+    "#include ""version.h""\r\n"
     "\0"
 END
 
 3 TEXTINCLUDE 
 BEGIN
+    "#define str_(x) #x\r\n"
+    "#define str(x) str_(x)\r\n"
     "\r\n"
+    "1 VERSIONINFO\r\n"
+    " FILEVERSION PLUGIN_VERSION_MAJOR,PLUGIN_VERSION_MINOR,0,0\r\n"
+    " PRODUCTVERSION PLUGIN_VERSION_MAJOR,PLUGIN_VERSION_MINOR,0,0\r\n"
+    " FILEFLAGSMASK 0x17L\r\n"
+    "#ifdef _DEBUG\r\n"
+    " FILEFLAGS 0x1L\r\n"
+    "#else\r\n"
+    " FILEFLAGS 0x0L\r\n"
+    "#endif\r\n"
+    " FILEOS 0x4L\r\n"
+    " FILETYPE 0x2L\r\n"
+    " FILESUBTYPE 0x0L\r\n"
+    "BEGIN\r\n"
+    "    BLOCK ""StringFileInfo""\r\n"
+    "    BEGIN\r\n"
+    "        BLOCK ""080004b0""\r\n"
+    "        BEGIN\r\n"
+    "            VALUE ""Comments"", PLUGIN_WEB\r\n"
+    "            VALUE ""FileDescription"", PLUGIN_NAME\r\n"
+    "            VALUE ""FileVersion"", str(PLUGIN_VERSION_MAJOR) "", "" str(PLUGIN_VERSION_MINOR) "", 0, 0""\r\n"
+    "            VALUE ""InternalName"", PLUGIN_FILE_NAME\r\n"
+    "            VALUE ""LegalCopyright"", PLUGIN_AUTHOR\r\n"
+    "            VALUE ""OriginalFilename"", PLUGIN_FILE_NAME_EXT\r\n"
+    "            VALUE ""ProductName"", PLUGIN_NAME\r\n"
+    "            VALUE ""ProductVersion"", str(PLUGIN_VERSION_MAJOR) "", "" str(PLUGIN_VERSION_MINOR) "", 0, 0""\r\n"
+    "        END\r\n"
+    "    END\r\n"
+    "    BLOCK ""VarFileInfo""\r\n"
+    "    BEGIN\r\n"
+    "        VALUE ""Translation"", 0x800, 1200\r\n"
+    "    END\r\n"
+    "END\r\n"
     "\0"
 END
 
 #endif    // APSTUDIO_INVOKED
 
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,0
- PRODUCTVERSION 1,0,0,0
+#endif    // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define str_(x) #x
+#define str(x) str_(x)
+
+1 VERSIONINFO
+ FILEVERSION PLUGIN_VERSION_MAJOR,PLUGIN_VERSION_MINOR,0,0
+ PRODUCTVERSION PLUGIN_VERSION_MAJOR,PLUGIN_VERSION_MINOR,0,0
  FILEFLAGSMASK 0x17L
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -67,14 +110,14 @@
     BEGIN
         BLOCK "080004b0"
         BEGIN
-            VALUE "Comments", "..."
-            VALUE "FileDescription", "..."
-            VALUE "FileVersion", "1, 0, 0, 0"
-            VALUE "InternalName", "..."
-            VALUE "LegalCopyright", "..."
-            VALUE "OriginalFilename", "..."
-            VALUE "ProductName", "..."
-            VALUE "ProductVersion", "1, 0, 0, 0"
+            VALUE "Comments", PLUGIN_WEB
+            VALUE "FileDescription", PLUGIN_NAME
+            VALUE "FileVersion", str(PLUGIN_VERSION_MAJOR) ", " str(PLUGIN_VERSION_MINOR) ", 0, 0"
+            VALUE "InternalName", PLUGIN_FILE_NAME
+            VALUE "LegalCopyright", PLUGIN_AUTHOR
+            VALUE "OriginalFilename", PLUGIN_FILE_NAME_EXT
+            VALUE "ProductName", PLUGIN_NAME
+            VALUE "ProductVersion", str(PLUGIN_VERSION_MAJOR) ", " str(PLUGIN_VERSION_MINOR) ", 0, 0"
         END
     END
     BLOCK "VarFileInfo"
@@ -83,18 +126,6 @@
     END
 END
 
-#endif    // English (United States) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
 /////////////////////////////////////////////////////////////////////////////
 #endif    // not APSTUDIO_INVOKED
 

=== modified file 'src/stdafx.h'
--- src/stdafx.h	2013-01-18 21:37:28 +0000
+++ src/stdafx.h	2013-06-16 18:40:48 +0000
@@ -34,4 +34,7 @@
 
 #include "version.h"
 
+#define PLUGIN_VERSION (PLUGIN_VERSION_MAJOR + (PLUGIN_VERSION_MINOR >= 10 ? PLUGIN_VERSION_MINOR >= 100 ? \
+	PLUGIN_VERSION_MINOR / 1000. : PLUGIN_VERSION_MINOR / 100. : PLUGIN_VERSION_MINOR / 10.))
+
 #endif

=== modified file 'src/version.h'
--- src/version.h	2013-01-18 21:37:28 +0000
+++ src/version.h	2013-06-16 18:40:48 +0000
@@ -16,9 +16,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-/* Information about the plugin - fill this out! Don't forget to edit the resource file as well. */
+/* Information about the plugin - fill this out! */
 
-#error Version information not set! Remove this error once you have filled version.h and the resource file.
+#error Version information not set! Remove this error once you have filled the version.h file.
 
 #ifndef PLUGIN_VERSION_H
 #define PLUGIN_VERSION_H
@@ -36,7 +36,8 @@
 #define PLUGIN_DESC "..."
 
 /* Version of the plugin (note: not API version) */
-#define PLUGIN_VERSION 1.0
+#define PLUGIN_VERSION_MAJOR 1
+#define PLUGIN_VERSION_MINOR 0
 
 /* Plugin website, set to "N/A" if none */
 #define PLUGIN_WEB "N/A"