Skip to content

Commit 066940a

Browse files
committed
build: Add ms rc file to put extra metatdata on dll
Change-Id: Idf687c6b2f8d1dea203f01bf57c5158d19ed519e Signed-off-by: Ranjit Menon <[email protected]> Signed-off-by: Greg Tucker <[email protected]>
1 parent 908726e commit 066940a

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

Makefile.nmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,20 @@ isa-l_static.lib: $(objs)
185185
$?
186186
<<
187187

188+
!IF [rc] == 0
189+
isa-l.dll: isa-l.res
190+
!ELSE
191+
!MESSAGE Optionally install rc to set file version info
192+
!ENDIF
193+
188194
isa-l.dll: $(objs)
189195
link -out:$@ -dll -def:isa-l.def $(LINKFLAGS) @<<
190196
$?
191197
<<
192198

199+
isa-l.res: isa-l.h
200+
rc /fo $@ isa-l.rc
201+
193202
{erasure_code}.c.obj:
194203
$(CC) $(CFLAGS) /c -Fo$@ $?
195204
{erasure_code}.asm.obj:
@@ -321,13 +330,15 @@ isa-l.h:
321330
@echo #define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $@
322331
@echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $@
323332
@echo.>> $@
333+
@echo #ifndef RC_INVOKED>> $@
324334
@echo #include ^<isa-l/crc.h^>>> $@
325335
@echo #include ^<isa-l/crc64.h^>>> $@
326336
@echo #include ^<isa-l/erasure_code.h^>>> $@
327337
@echo #include ^<isa-l/gf_vect_mul.h^>>> $@
328338
@echo #include ^<isa-l/igzip_lib.h^>>> $@
329339
@echo #include ^<isa-l/mem_routines.h^>>> $@
330340
@echo #include ^<isa-l/raid.h^>>> $@
341+
@echo #endif // RC_INVOKED>> $@
331342
@echo #endif //_ISAL_H_>> $@
332343

333344
clean:
@@ -339,6 +350,7 @@ clean:
339350
-if exist isa-l.lib del isa-l.lib
340351
-if exist isa-l.dll del isa-l.dll
341352
-if exist isa-l.exp del isa-l.exp
353+
-if exist isa-l.res del isa-l.res
342354

343355
zlib.lib:
344356
igzip_perf.exe: zlib.lib

isa-l.rc

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**********************************************************************
2+
Copyright(c) 2021 Intel Corporation All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions
6+
are met:
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in
11+
the documentation and/or other materials provided with the
12+
distribution.
13+
* Neither the name of Intel Corporation nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
**********************************************************************/
29+
30+
#include <windows.h>
31+
#include "isa-l.h"
32+
33+
#define _MAKE_VER_STRING(major, minor, patch, buildnum) \
34+
#major "." \
35+
#minor "." \
36+
#patch "." \
37+
#buildnum
38+
#define MAKE_VER_STRING(major, minor, patch, buildnum) _MAKE_VER_STRING(major, minor, patch, buildnum)
39+
40+
#define VER_FILEVERSION ISAL_MAJOR_VERSION,ISAL_MINOR_VERSION,ISAL_PATCH_VERSION,0
41+
#define VER_FILEVERSION_STR MAKE_VER_STRING(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION, 0)
42+
43+
#define VER_PRODUCTVERSION VER_FILEVERSION
44+
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
45+
46+
#define VER_COMPANYNAME_STR "Intel Corporation"
47+
#define VER_FILEDESCRIPTION_STR "Intel(R) Intelligent Storage Acceleration Library"
48+
#define VER_INTERNALNAME_STR "Intel(R) Intelligent Storage Acceleration Library"
49+
#define VER_LEGALCOPYRIGHT_STR "Copyright (C) Intel Corporation 2021"
50+
#define VER_LEGALTRADEMARKS1_STR "All Rights Reserved"
51+
#define VER_ORIGINALFILENAME_STR "isa-l.dll"
52+
#define VER_PRODUCTNAME_STR VER_FILEDESCRIPTION_STR
53+
54+
VS_VERSION_INFO VERSIONINFO
55+
FILEVERSION VER_FILEVERSION
56+
PRODUCTVERSION VER_PRODUCTVERSION
57+
BEGIN
58+
BLOCK "StringFileInfo"
59+
BEGIN
60+
BLOCK "040904B0"
61+
BEGIN
62+
VALUE "CompanyName", VER_COMPANYNAME_STR
63+
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
64+
VALUE "FileVersion", VER_FILEVERSION_STR
65+
VALUE "InternalName", VER_INTERNALNAME_STR
66+
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
67+
VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
68+
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
69+
VALUE "ProductName", VER_PRODUCTNAME_STR
70+
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
71+
END
72+
END
73+
74+
BLOCK "VarFileInfo"
75+
BEGIN
76+
VALUE "Translation", 0x409, 0x04B0
77+
END
78+
END

tools/gen_nmake.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,20 @@ Makefile.nmake tst.nmake: FORCE
4141
@echo '$$?' >> $@
4242
@echo '<<' >> $@
4343
@echo '' >> $@
44+
@echo '!IF [rc] == 0' >> $@
45+
@echo 'isa-l.dll: isa-l.res' >> $@
46+
@echo '!ELSE' >> $@
47+
@echo '!MESSAGE Optionally install rc to set file version info' >> $@
48+
@echo '!ENDIF' >> $@
49+
@echo '' >> $@
4450
@echo 'isa-l.dll: $$(objs)' >> $@
4551
@echo ' link -out:$$@ -dll -def:isa-l.def $$(LINKFLAGS) @<<' >> $@
4652
@echo '$$?' >> $@
4753
@echo '<<' >> $@
4854
@echo '' >> $@
55+
@echo 'isa-l.res: isa-l.h' >> $@
56+
@echo ' rc /fo $$@ isa-l.rc' >> $@
57+
@echo '' >> $@
4958
@$(foreach b, $(units), \
5059
printf "{%s}.c.obj:\n\t\$$(CC) \$$(CFLAGS) /c -Fo\$$@ \$$?\n{%s}.asm.obj:\n\t\$$(AS) \$$(AFLAGS) -o \$$@ \$$?\n\n" $(b) $(b) >> $@; )
5160
@echo '' >> $@
@@ -114,7 +123,9 @@ endif
114123
@echo ' @echo #define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $$@' >> $@
115124
@echo ' @echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $$@' >> $@
116125
@echo ' @echo.>> $$@' >> $@
126+
@echo ' @echo #ifndef RC_INVOKED>> $$@' >> $@
117127
@for unit in $(sort $(extern_hdrs)); do echo " @echo #include ^<isa-l/$$unit^>>> \$$@" | sed -e 's;include/;;' >> $@; done
128+
@echo ' @echo #endif // RC_INVOKED>> $$@' >> $@
118129
@echo ' @echo #endif //_ISAL_H_>> $$@' >> $@
119130
@echo '' >> $@
120131
@echo 'clean:' >> $@
@@ -126,6 +137,7 @@ endif
126137
@echo ' -if exist isa-l.lib del isa-l.lib' >> $@
127138
@echo ' -if exist isa-l.dll del isa-l.dll' >> $@
128139
@echo ' -if exist isa-l.exp del isa-l.exp' >> $@
140+
@echo ' -if exist isa-l.res del isa-l.res' >> $@
129141
@echo '' >> $@
130142
$(if $(findstring igzip,$(units)),@echo 'zlib.lib:' >> $@ )
131143
@cat $(foreach unit,$(units), $(unit)/Makefile.am) | sed \

0 commit comments

Comments
 (0)