[llvm] r238740 - In MSVC builds embed a VERSIONINFO resource in our exe and DLL files.
Greg Bedwell
gregbedwell at gmail.com
Tue Jun 2 08:45:11 PDT 2015
Hi Sean,
The discussion all ended up happening on the lists rather than in the
review. E.g.
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150525/thread.html#278895
FWIW, I reverted this commit in r238744 as it failed on some clang-cl
self-host bots. I've been updating the thread above with my findings on
why. If I'm lucky I'll have a patch for clang-cl that fixes the issue up
for review relatively soon.
-Greg
On 2 June 2015 at 02:40, Sean Silva <chisophugis at gmail.com> wrote:
> Did this ever get discussed? http://reviews.llvm.org/D7828
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D7828&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=x7204Rz3acR6e5YRnrBhSkpTmUe07Ro1RVEQ3nSkfXI&s=6YN9Y49-z-LZoIDBjhQhHpKAsrFID6psYRqWpMu-Dug&e=> seems
> empty.
>
> -- Sean Silva
>
> On Mon, Jun 1, 2015 at 5:41 AM, Greg Bedwell <greg_bedwell at sn.scee.net>
> wrote:
>
>> Author: gbedwell
>> Date: Mon Jun 1 07:41:55 2015
>> New Revision: 238740
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=238740&view=rev
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D238740-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=x7204Rz3acR6e5YRnrBhSkpTmUe07Ro1RVEQ3nSkfXI&s=NPOOhqt5dzBIz2iPE8FKA3Ru6Y9_gw37Omhnz8yxglc&e=>
>> Log:
>> In MSVC builds embed a VERSIONINFO resource in our exe and DLL files.
>>
>> This embeds Windows version information into our executables and DLLs.
>> The most visible place to view this data is in the details tab of the file
>> properties window in Windows explorer.
>>
>> Differential Revision: http://reviews.llvm.org/D7828
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D7828&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=x7204Rz3acR6e5YRnrBhSkpTmUe07Ro1RVEQ3nSkfXI&s=6YN9Y49-z-LZoIDBjhQhHpKAsrFID6psYRqWpMu-Dug&e=>
>>
>> Added:
>> llvm/trunk/resources/
>> llvm/trunk/resources/windows_version_resource.rc
>> Modified:
>> llvm/trunk/cmake/modules/AddLLVM.cmake
>>
>> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=238740&r1=238739&r2=238740&view=diff
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_cmake_modules_AddLLVM.cmake-3Frev-3D238740-26r1-3D238739-26r2-3D238740-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=x7204Rz3acR6e5YRnrBhSkpTmUe07Ro1RVEQ3nSkfXI&s=hg5kANbD97TRZwlckSuJPY97CTXGj9hNquEFzpniU-E&e=>
>>
>> ==============================================================================
>> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
>> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Mon Jun 1 07:41:55 2015
>> @@ -228,6 +228,78 @@ function(set_output_directory target bin
>> endif()
>> endfunction()
>>
>> +# If on Windows and building with MSVC, add the resource script
>> containing the
>> +# VERSIONINFO data to the project. This embeds version resource
>> information
>> +# into the output .exe or .dll.
>> +# TODO: Enable for MinGW Windows builds too.
>> +#
>> +function(add_windows_version_resource_file OUT_VAR)
>> + set(sources ${ARGN})
>> + if (MSVC)
>> + set(resource_file
>> ${LLVM_SOURCE_DIR}/resources/windows_version_resource.rc)
>> + set(sources ${sources} ${resource_file})
>> + source_group("Resource Files" ${resource_file})
>> + set(windows_resource_file ${resource_file} PARENT_SCOPE)
>> + endif(MSVC)
>> +
>> + set(${OUT_VAR} ${sources} PARENT_SCOPE)
>> +endfunction(add_windows_version_resource_file)
>> +
>> +# set_windows_version_resource_properties(name resource_file...
>> +# VERSION_MAJOR int
>> +# Optional major version number (defaults to LLVM_VERSION_MAJOR)
>> +# VERSION_MINOR int
>> +# Optional minor version number (defaults to LLVM_VERSION_MINOR)
>> +# VERSION_PATCHLEVEL int
>> +# Optional patchlevel version number (defaults to LLVM_VERSION_PATCH)
>> +# VERSION_STRING
>> +# Optional version string (defaults to PACKAGE_VERSION)
>> +# PRODUCT_NAME
>> +# Optional product name string (defaults to "LLVM")
>> +# )
>> +function(set_windows_version_resource_properties name resource_file)
>> + cmake_parse_arguments(ARG
>> + ""
>> +
>> "VERSION_MAJOR;VERSION_MINOR;VERSION_PATCHLEVEL;VERSION_STRING;PRODUCT_NAME"
>> + ""
>> + ${ARGN})
>> +
>> + if (NOT DEFINED ARG_VERSION_MAJOR)
>> + set(ARG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
>> + endif()
>> +
>> + if (NOT DEFINED ARG_VERSION_MINOR)
>> + set(ARG_VERSION_MINOR ${LLVM_VERSION_MINOR})
>> + endif()
>> +
>> + if (NOT DEFINED ARG_VERSION_PATCHLEVEL)
>> + set(ARG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
>> + endif()
>> +
>> + if (NOT DEFINED ARG_VERSION_STRING)
>> + set(ARG_VERSION_STRING ${PACKAGE_VERSION})
>> + endif()
>> +
>> + if (NOT DEFINED ARG_PRODUCT_NAME)
>> + set(ARG_PRODUCT_NAME "LLVM")
>> + endif()
>> +
>> + get_target_property(target_location ${name} LOCATION)
>> + get_filename_component(target_filename ${target_location} NAME)
>> +
>> + set_property(SOURCE ${resource_file}
>> + PROPERTY COMPILE_DEFINITIONS
>> + "RC_VERSION_FIELD_1=${ARG_VERSION_MAJOR}"
>> + "RC_VERSION_FIELD_2=${ARG_VERSION_MINOR}"
>> + "RC_VERSION_FIELD_3=${ARG_VERSION_PATCHLEVEL}"
>> + "RC_VERSION_FIELD_4=0"
>> + "RC_FILE_VERSION=\"${ARG_VERSION_STRING}\""
>> + "RC_INTERNAL_NAME=\"${name}\""
>> + "RC_ORIGINAL_FILENAME=\"${target_filename}\""
>> + "RC_PRODUCT_NAME=\"${ARG_PRODUCT_NAME}\""
>> + "RC_PRODUCT_VERSION=\"${ARG_VERSION_STRING}\"")
>> +endfunction(set_windows_version_resource_properties)
>> +
>> # llvm_add_library(name sources...
>> # SHARED;STATIC
>> # STATIC by default w/o BUILD_SHARED_LIBS.
>> @@ -316,10 +388,17 @@ function(llvm_add_library name)
>> if(ARG_MODULE)
>> add_library(${name} MODULE ${ALL_FILES})
>> elseif(ARG_SHARED)
>> + add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
>> add_library(${name} SHARED ${ALL_FILES})
>> else()
>> add_library(${name} STATIC ${ALL_FILES})
>> endif()
>> +
>> + if(DEFINED windows_resource_file)
>> + set_windows_version_resource_properties(${name}
>> ${windows_resource_file})
>> + set(windows_resource_file ${windows_resource_file} PARENT_SCOPE)
>> + endif()
>> +
>> set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR}
>> ${LLVM_LIBRARY_OUTPUT_INTDIR})
>> llvm_update_compile_flags(${name})
>> add_link_opts( ${name} )
>> @@ -482,11 +561,18 @@ endmacro(add_llvm_loadable_module name)
>>
>> macro(add_llvm_executable name)
>> llvm_process_sources( ALL_FILES ${ARGN} )
>> + add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
>> +
>> if( EXCLUDE_FROM_ALL )
>> add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
>> else()
>> add_executable(${name} ${ALL_FILES})
>> endif()
>> +
>> + if(DEFINED windows_resource_file)
>> + set_windows_version_resource_properties(${name}
>> ${windows_resource_file})
>> + endif()
>> +
>> llvm_update_compile_flags(${name})
>> add_link_opts( ${name} )
>>
>>
>> Added: llvm/trunk/resources/windows_version_resource.rc
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/resources/windows_version_resource.rc?rev=238740&view=auto
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_resources_windows-5Fversion-5Fresource.rc-3Frev-3D238740-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=x7204Rz3acR6e5YRnrBhSkpTmUe07Ro1RVEQ3nSkfXI&s=ENxMYDbAqAXkq_ob0KEyoHHsB9lxTF7jyD0rPiDrHs0&e=>
>>
>> ==============================================================================
>> --- llvm/trunk/resources/windows_version_resource.rc (added)
>> +++ llvm/trunk/resources/windows_version_resource.rc Mon Jun 1 07:41:55
>> 2015
>> @@ -0,0 +1,89 @@
>> +// Microsoft Visual C++ resource script for embedding version
>> information.
>> +// The format is described at:
>> +//
>> http://msdn.microsoft.com/en-gb/library/windows/desktop/aa380599(v=vs.85).aspx
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__msdn.microsoft.com_en-2Dgb_library_windows_desktop_aa380599-28v-3Dvs.85-29.aspx&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=x7204Rz3acR6e5YRnrBhSkpTmUe07Ro1RVEQ3nSkfXI&s=PKcPSBAtppeWOfjX7cT4Zvcb5WXJvd5jV10rvjDEkdA&e=>
>> +// The VERSIONINFO resource is described at:
>> +//
>> https://msdn.microsoft.com/en-gb/library/windows/desktop/aa381058(v=vs.85).aspx
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__msdn.microsoft.com_en-2Dgb_library_windows_desktop_aa381058-28v-3Dvs.85-29.aspx&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=x7204Rz3acR6e5YRnrBhSkpTmUe07Ro1RVEQ3nSkfXI&s=jSbttDSJSR_6vWcsYUU2VEZQyh6eSBGAbKSmnI_7VSk&e=>
>> +
>> +
>> +// Default values for required fields.
>> +
>> +#ifndef RC_VERSION_FIELD_1
>> +#define RC_VERSION_FIELD_1 0
>> +#endif
>> +
>> +#ifndef RC_VERSION_FIELD_2
>> +#define RC_VERSION_FIELD_2 0
>> +#endif
>> +
>> +#ifndef RC_VERSION_FIELD_3
>> +#define RC_VERSION_FIELD_3 0
>> +#endif
>> +
>> +#ifndef RC_VERSION_FIELD_4
>> +#define RC_VERSION_FIELD_4 0
>> +#endif
>> +
>> +#ifndef RC_COMPANY_NAME
>> +#define RC_COMPANY_NAME ""
>> +#endif
>> +
>> +#ifndef RC_FILE_DESCRIPTION
>> +#define RC_FILE_DESCRIPTION ""
>> +#endif
>> +
>> +#ifndef RC_FILE_VERSION
>> +#define RC_FILE_VERSION ""
>> +#endif
>> +
>> +#ifndef RC_INTERNAL_NAME
>> +#define RC_INTERNAL_NAME ""
>> +#endif
>> +
>> +#ifndef RC_ORIGINAL_FILENAME
>> +#define RC_ORIGINAL_FILENAME ""
>> +#endif
>> +
>> +#ifndef RC_PRODUCT_NAME
>> +#define RC_PRODUCT_NAME ""
>> +#endif
>> +
>> +#ifndef RC_PRODUCT_VERSION
>> +#define RC_PRODUCT_VERSION ""
>> +#endif
>> +
>> +
>> +1 VERSIONINFO
>> +FILEVERSION
>> RC_VERSION_FIELD_1,RC_VERSION_FIELD_2,RC_VERSION_FIELD_3,RC_VERSION_FIELD_4
>> +BEGIN
>> + BLOCK "StringFileInfo"
>> + BEGIN
>> + BLOCK "040904B0"
>> + BEGIN
>> + // Required strings
>> + VALUE "CompanyName", RC_COMPANY_NAME
>> + VALUE "FileDescription", RC_FILE_DESCRIPTION
>> + VALUE "FileVersion", RC_FILE_VERSION
>> + VALUE "InternalName", RC_INTERNAL_NAME
>> + VALUE "OriginalFilename", RC_ORIGINAL_FILENAME
>> + VALUE "ProductName", RC_PRODUCT_NAME
>> + VALUE "ProductVersion", RC_PRODUCT_VERSION
>> +
>> + // Optional strings
>> +#ifdef RC_COMMENTS
>> + VALUE "Comments", RC_COMMENTS
>> +#endif
>> +
>> +#ifdef RC_COPYRIGHT
>> + VALUE "LegalCopyright", RC_COPYRIGHT
>> +#endif
>> + END
>> + END
>> +
>> + BLOCK "VarFileInfo"
>> + BEGIN
>> + // The translation must correspond to the above BLOCK inside
>> StringFileInfo
>> + // langID 0x0409 U.S. English
>> + // charsetID 0x04B0 Unicode
>> + VALUE "Translation", 0x0409, 0x04B0
>> + END
>> +END
>> \ No newline at end of file
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150602/a7f55537/attachment.html>
More information about the llvm-commits
mailing list