BUILD: Refactor libpng submodule (#10238)

* relocate libpng files

* fix cmake build

* fix MSVC build
This commit is contained in:
polar 2021-05-07 09:07:42 +01:00 committed by GitHub
parent 7b6482c01d
commit ce94a4ecea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 45 additions and 44 deletions

2
.gitmodules vendored
View File

@ -49,7 +49,7 @@
url = https://github.com/RPCS3/yaml-cpp.git url = https://github.com/RPCS3/yaml-cpp.git
ignore = dirty ignore = dirty
[submodule "3rdparty/libpng"] [submodule "3rdparty/libpng"]
path = 3rdparty/libpng path = 3rdparty/libpng/libpng
url = https://github.com/glennrp/libpng.git url = https://github.com/glennrp/libpng.git
ignore = dirty ignore = dirty
[submodule "3rdparty/libusb"] [submodule "3rdparty/libusb"]

View File

@ -29,28 +29,7 @@ add_library(3rdparty_flatbuffers INTERFACE)
target_include_directories(3rdparty_flatbuffers INTERFACE flatbuffers/include) target_include_directories(3rdparty_flatbuffers INTERFACE flatbuffers/include)
# libPNG # libPNG
# Select the version of libpng to use, default is builtin add_subdirectory(libpng EXCLUDE_FROM_ALL)
if (NOT USE_SYSTEM_LIBPNG)
# We use libpng's static library and don't need to build the shared library and run the tests
set(PNG_SHARED OFF CACHE BOOL "Build shared lib" FORCE)
set(PNG_TESTS OFF CACHE BOOL "Build libpng tests" FORCE)
set(PNG_BUILD_ZLIB ON CACHE BOOL "ZLIB is already build or package is found" FORCE)
set(SKIP_INSTALL_ALL ON)
add_subdirectory(libpng EXCLUDE_FROM_ALL)
set(LIBPNG_TARGET png_static)
target_include_directories(png_static INTERFACE "${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}")
else()
find_package(PNG REQUIRED)
add_library(3rdparty_system_libpng INTERFACE)
target_include_directories(3rdparty_system_libpng INTERFACE ${PNG_INCLUDE_DIR})
target_link_libraries(3rdparty_system_libpng INTERFACE ${PNG_LIBRARY})
target_compile_definitions(3rdparty_system_libpng INTERFACE ${PNG_DEFINITIONS})
set(LIBPNG_TARGET 3rdparty_system_libpng)
endif()
# pugixml # pugixml

22
3rdparty/libpng/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,22 @@
# libPNG
# Select the version of libpng to use, default is builtin
if (NOT USE_SYSTEM_LIBPNG)
# We use libpng's static library and don't need to build the shared library and run the tests
set(PNG_SHARED OFF CACHE BOOL "Build shared lib" FORCE)
set(PNG_TESTS OFF CACHE BOOL "Build libpng tests" FORCE)
set(PNG_BUILD_ZLIB ON CACHE BOOL "ZLIB is already build or package is found" FORCE)
set(SKIP_INSTALL_ALL ON)
add_subdirectory(libpng EXCLUDE_FROM_ALL)
target_include_directories(png_static INTERFACE "${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}")
set(LIBPNG_TARGET png_static PARENT_SCOPE)
else()
find_package(PNG REQUIRED)
add_library(3rdparty_system_libpng INTERFACE)
target_include_directories(3rdparty_system_libpng INTERFACE ${PNG_INCLUDE_DIR})
target_link_libraries(3rdparty_system_libpng INTERFACE ${PNG_LIBRARY})
target_compile_definitions(3rdparty_system_libpng INTERFACE ${PNG_DEFINITIONS})
set(LIBPNG_TARGET 3rdparty_system_libpng PARENT_SCOPE)
endif()

View File

@ -114,27 +114,27 @@
</Lib> </Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include=".\libpng\png.c"> <ClCompile Include="libpng\png.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Library|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Library|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Library|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Library|x64'">Create</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include=".\libpng\pngerror.c" /> <ClCompile Include="libpng\pngerror.c" />
<ClCompile Include=".\libpng\pngget.c" /> <ClCompile Include="libpng\pngget.c" />
<ClCompile Include=".\libpng\pngmem.c" /> <ClCompile Include="libpng\pngmem.c" />
<ClCompile Include=".\libpng\pngpread.c" /> <ClCompile Include="libpng\pngpread.c" />
<ClCompile Include=".\libpng\pngread.c" /> <ClCompile Include="libpng\pngread.c" />
<ClCompile Include=".\libpng\pngrio.c" /> <ClCompile Include="libpng\pngrio.c" />
<ClCompile Include=".\libpng\pngrtran.c" /> <ClCompile Include="libpng\pngrtran.c" />
<ClCompile Include=".\libpng\pngrutil.c" /> <ClCompile Include="libpng\pngrutil.c" />
<ClCompile Include=".\libpng\pngset.c" /> <ClCompile Include="libpng\pngset.c" />
<ClCompile Include=".\libpng\pngtrans.c" /> <ClCompile Include="libpng\pngtrans.c" />
<ClCompile Include=".\libpng\pngwio.c" /> <ClCompile Include="libpng\pngwio.c" />
<ClCompile Include=".\libpng\pngwrite.c" /> <ClCompile Include="libpng\pngwrite.c" />
<ClCompile Include=".\libpng\pngwtran.c" /> <ClCompile Include="libpng\pngwtran.c" />
<ClCompile Include=".\libpng\pngwutil.c" /> <ClCompile Include="libpng\pngwutil.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include=".\libpng\scripts\pngwin.rc"> <ResourceCompile Include="libpng\scripts\pngwin.rc">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Library|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Library|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Library|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Library|x64'">true</ExcludedFromBuild>
</ResourceCompile> </ResourceCompile>

View File

@ -19,9 +19,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XAudio", "rpcs3\XAudio.vcxp
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenAL", "rpcs3\OpenAL.vcxproj", "{30A05C4D-F5FD-421C-A864-17A64BDEAA75}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenAL", "rpcs3\OpenAL.vcxproj", "{30A05C4D-F5FD-421C-A864-17A64BDEAA75}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pnglibconf", "3rdparty\pnglibconf.vcxproj", "{EB33566E-DA7F-4D28-9077-88C0B7C77E35}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pnglibconf", "3rdparty\libpng\pnglibconf.vcxproj", "{EB33566E-DA7F-4D28-9077-88C0B7C77E35}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "3rdparty\libpng.vcxproj", "{D6973076-9317-4EF2-A0B8-B7A18AC0713E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "3rdparty\libpng\libpng.vcxproj", "{D6973076-9317-4EF2-A0B8-B7A18AC0713E}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{60F89955-91C6-3A36-8000-13C592FEC2DF} = {60F89955-91C6-3A36-8000-13C592FEC2DF} {60F89955-91C6-3A36-8000-13C592FEC2DF} = {60F89955-91C6-3A36-8000-13C592FEC2DF}
{EB33566E-DA7F-4D28-9077-88C0B7C77E35} = {EB33566E-DA7F-4D28-9077-88C0B7C77E35} {EB33566E-DA7F-4D28-9077-88C0B7C77E35} = {EB33566E-DA7F-4D28-9077-88C0B7C77E35}

View File

@ -62,12 +62,12 @@
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</IgnoreImportLibrary> <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</IgnoreImportLibrary>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>..\3rdparty\7z\src;..\3rdparty\hidapi\hidapi;.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\XAudio2Redist\include;..\3rdparty\span\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib</IncludePath> <IncludePath>..\3rdparty\7z\src;..\3rdparty\hidapi\hidapi;.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\XAudio2Redist\include;..\3rdparty\span\include;..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib</IncludePath>
<LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath> <LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath> <LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<IncludePath>..\3rdparty\7z\src;..\3rdparty\hidapi\hidapi;.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\XAudio2Redist\include;..\3rdparty\span\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib</IncludePath> <IncludePath>..\3rdparty\7z\src;..\3rdparty\hidapi\hidapi;.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\XAudio2Redist\include;..\3rdparty\span\include;..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib</IncludePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>

View File

@ -3,7 +3,7 @@
<ImportGroup Label="PropertySheets" /> <ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
<IncludePath>.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\span\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\hidapi\hidapi;..\3rdparty\Optional;..\3rdparty\xxhash</IncludePath> <IncludePath>.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\span\include;..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\hidapi\hidapi;..\3rdparty\Optional;..\3rdparty\xxhash</IncludePath>
<OutDir>$(SolutionDir)lib\$(Configuration)-$(Platform)\</OutDir> <OutDir>$(SolutionDir)lib\$(Configuration)-$(Platform)\</OutDir>
<LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath> <LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<IntDir>$(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)\</IntDir> <IntDir>$(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)\</IntDir>