windows: Add .rc (#415)

- Add resource file for DLL;
This commit is contained in:
Ihor Dutchak 2022-05-11 17:47:38 +03:00 committed by GitHub
parent 52fa87300b
commit 93285f5246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 3 deletions

View File

@ -1,13 +1,21 @@
list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_winapi.h") list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_winapi.h")
add_library(hidapi_winapi set(SOURCES
${HIDAPI_PUBLIC_HEADERS}
hid.c hid.c
hidapi_cfgmgr32.h hidapi_cfgmgr32.h
hidapi_hidclass.h hidapi_hidclass.h
hidapi_hidpi.h hidapi_hidpi.h
hidapi_hidsdi.h hidapi_hidsdi.h
) )
if(BUILD_SHARED_LIBS)
list(APPEND SOURCES hidapi.rc)
endif()
add_library(hidapi_winapi
${HIDAPI_PUBLIC_HEADERS}
${SOURCES}
)
target_link_libraries(hidapi_winapi target_link_libraries(hidapi_winapi
PUBLIC hidapi_include PUBLIC hidapi_include
) )

35
windows/hidapi.rc Normal file
View File

@ -0,0 +1,35 @@
#include "winresrc.h"
#include "hidapi.h"
// English
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
VS_VERSION_INFO VERSIONINFO
FILEVERSION HID_API_VERSION_MAJOR,HID_API_VERSION_MINOR,HID_API_VERSION_PATCH,0
PRODUCTVERSION HID_API_VERSION_MAJOR,HID_API_VERSION_MINOR,HID_API_VERSION_PATCH,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
#ifdef _DEBUG
| VS_FF_DEBUG
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "04090000"
BEGIN
VALUE "CompanyName", "libusb/hidapi Team"
VALUE "FileDescription", "A multi-platform library to interface with HID devices (USB, Bluetooth, etc.)"
VALUE "FileVersion", HID_API_VERSION_STR
VALUE "ProductName", "HIDAPI"
VALUE "ProductVersion", HID_API_VERSION_STR
VALUE "Licence", "https://github.com/libusb/hidapi/blob/master/LICENSE.txt"
VALUE "Comments", "https://github.com/libusb/hidapi"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0
END
END

View File

@ -107,6 +107,10 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\hidapi</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
@ -125,6 +129,10 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
</Link> </Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\hidapi</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
@ -146,6 +154,10 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\hidapi</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
@ -167,14 +179,22 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link> </Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\hidapi</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="hid.c" /> <ClCompile Include="hid.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\hidapi\hidapi.h" /> <ClInclude Include="..\hidapi\hidapi.h" />
<ClInclude Include="hidapi_winapi.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="hidapi.rc" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -23,5 +23,13 @@
<ClInclude Include="..\hidapi\hidapi.h"> <ClInclude Include="..\hidapi\hidapi.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="hidapi_winapi.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="hidapi.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>