mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-12 02:30:29 +09:00
This reverts commit f5c9a5e8f5
.
This commit is contained in:
parent
2a72651144
commit
5b86dca8e7
33 changed files with 183 additions and 267 deletions
|
@ -324,7 +324,6 @@
|
|||
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
|
||||
|
||||
<NativeBuildPartitionPropertiesToRemove>ClrFullNativeBuild;ClrRuntimeSubset;ClrJitSubset;ClrPalTestsSubset;ClrAllJitsSubset;ClrILToolsSubset;ClrNativeAotSubset;ClrSpmiSubset;ClrCrossComponentsSubset;ClrDebugSubset;HostArchitecture;PgoInstrument;NativeOptimizationDataSupported;CMakeArgs;CxxStandardLibrary;CxxStandardLibraryStatic;CxxAbiLibrary</NativeBuildPartitionPropertiesToRemove>
|
||||
<UseSystemZlib Condition="'$(TargetsAppleMobile)' == 'true' or '$(TargetOS)' == 'android' or '$(TargetArchitecture)' == 'armv6'">true</UseSystemZlib>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- RepositoryEngineeringDir isn't set when Installer tests import this file. -->
|
||||
|
|
|
@ -12,11 +12,6 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
|
|||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# We need to set this to Release as there's no way to intercept configuration-specific linker flags
|
||||
# for try_compile-style tests (like check_c_source_compiles) and some of the default Debug flags
|
||||
# (ie. /INCREMENTAL) conflict with our own flags.
|
||||
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckLinkerFlag)
|
||||
|
@ -63,7 +58,6 @@ if (MSVC)
|
|||
define_property(TARGET PROPERTY CLR_CONTROL_FLOW_GUARD INHERITED BRIEF_DOCS "Controls the /guard:cf flag presence" FULL_DOCS "Set this property to ON or OFF to indicate if the /guard:cf compiler and linker flag should be present")
|
||||
define_property(TARGET PROPERTY CLR_EH_CONTINUATION INHERITED BRIEF_DOCS "Controls the /guard:ehcont flag presence" FULL_DOCS "Set this property to ON or OFF to indicate if the /guard:ehcont compiler flag should be present")
|
||||
define_property(TARGET PROPERTY CLR_EH_OPTION INHERITED BRIEF_DOCS "Defines the value of the /EH option" FULL_DOCS "Set this property to one of the valid /EHxx options (/EHa, /EHsc, /EHa-, ...)")
|
||||
define_property(TARGET PROPERTY MSVC_WARNING_LEVEL INHERITED BRIEF_DOCS "Define the warning level for the /Wn option" FULL_DOCS "Set this property to one of the valid /Wn options (/W0, /W1, /W2, /W3, /W4)")
|
||||
|
||||
set_property(GLOBAL PROPERTY CLR_CONTROL_FLOW_GUARD ON)
|
||||
|
||||
|
@ -785,8 +779,7 @@ if (MSVC)
|
|||
|
||||
# [[! Microsoft.Security.SystemsADM.10086 !]] - SDL required warnings
|
||||
# set default warning level to 4 but allow targets to override it.
|
||||
set_property(GLOBAL PROPERTY MSVC_WARNING_LEVEL 4)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>>)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W$<GENEX_EVAL:$<IF:$<BOOL:$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>>,$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>,4>>>)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/WX>) # treat warnings as errors
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oi>) # enable intrinsics
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oy->) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls
|
||||
|
|
|
@ -500,9 +500,3 @@ if(LOWERCASE_CMAKE_BUILD_TYPE STREQUAL debug)
|
|||
string(REPLACE "-D_FORTIFY_SOURCE=2 " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "-D_FORTIFY_SOURCE=2 " "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
|
||||
if (CLR_CMAKE_TARGET_ANDROID OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_HOST_ARCH_ARMV6)
|
||||
# Our zlib-ng copy should only be used in non-mobile platforms only.
|
||||
# In mobile platforms we should use the zlib package provided by the system.
|
||||
set(CLR_CMAKE_USE_SYSTEM_ZLIB 1)
|
||||
endif()
|
||||
|
|
|
@ -508,7 +508,7 @@ function(install_static_library targetName destination component)
|
|||
if (WIN32)
|
||||
set_target_properties(${targetName} PROPERTIES
|
||||
COMPILE_PDB_NAME "${targetName}"
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:${targetName}>"
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
|
||||
)
|
||||
install (FILES "$<TARGET_FILE_DIR:${targetName}>/${targetName}.pdb" DESTINATION ${destination} COMPONENT ${component})
|
||||
endif()
|
||||
|
|
|
@ -24,7 +24,6 @@ The .NET Foundation licenses this file to you under the MIT license.
|
|||
<LinkerFlavor Condition="'$(LinkerFlavor)' == '' and '$(_linuxLibcFlavor)' == 'bionic'">lld</LinkerFlavor>
|
||||
<LinkerFlavor Condition="'$(LinkerFlavor)' == '' and '$(_targetOS)' == 'linux'">bfd</LinkerFlavor>
|
||||
<IlcDefaultStackSize Condition="'$(IlcDefaultStackSize)' == '' and '$(_linuxLibcFlavor)' == 'musl'">1572864</IlcDefaultStackSize>
|
||||
<UseSystemZlib Condition="!Exists('$(IlcSdkPath)libz.a')">true</UseSystemZlib>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="SetupOSSpecificProps" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
|
||||
|
@ -130,7 +129,6 @@ The .NET Foundation licenses this file to you under the MIT license.
|
|||
<NativeLibrary Condition="'$(_targetArchitecture)' == 'x64'" Include="$(IlcSdkPath)$(VxSortSupportName)$(LibFileExt)" />
|
||||
<NativeLibrary Include="$(IlcSdkPath)$(StandaloneGCSupportName)$(LibFileExt)" />
|
||||
<NativeLibrary Condition="'$(LinkStandardCPlusPlusLibrary)' != 'true' and '$(StaticICULinking)' != 'true'" Include="$(IlcSdkPath)libstdc++compat.a" />
|
||||
<NativeLibrary Condition="'$(UseSystemZlib)' != 'true'" Include="$(IlcSdkPath)libz.a" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -190,7 +188,7 @@ The .NET Foundation licenses this file to you under the MIT license.
|
|||
<NativeSystemLibrary Include="objc" Condition="'$(_IsApplePlatform)' == 'true'" />
|
||||
<NativeSystemLibrary Include="swiftCore" Condition="'$(_targetOS)' == 'osx'" />
|
||||
<NativeSystemLibrary Include="swiftFoundation" Condition="'$(_targetOS)' == 'osx'" />
|
||||
<NativeSystemLibrary Include="z" Condition="'$(UseSystemZlib)' == 'true'" />
|
||||
<NativeSystemLibrary Include="z" />
|
||||
<NativeSystemLibrary Include="rt" Condition="'$(_IsApplePlatform)' != 'true' and '$(_linuxLibcFlavor)' != 'bionic'" />
|
||||
<NativeSystemLibrary Include="log" Condition="'$(_linuxLibcFlavor)' == 'bionic'" />
|
||||
<NativeSystemLibrary Include="icucore" Condition="'$(_IsApplePlatform)' == 'true'" />
|
||||
|
|
|
@ -46,7 +46,6 @@ The .NET Foundation licenses this file to you under the MIT license.
|
|||
<NativeLibrary Condition="'$(_targetArchitecture)' == 'x64'" Include="$(IlcSdkPath)$(VxSortSupportName)$(LibrarySuffix)" />
|
||||
<NativeLibrary Condition="'$(IlcMultiModule)' == 'true'" Include="$(SharedLibrary)" />
|
||||
<NativeLibrary Include="$(IlcSdkPath)$(StandaloneGCSupportName)$(LibrarySuffix)" />
|
||||
<NativeLibrary Include="$(IlcSdkPath)zlibstatic$(LibFileExt)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -277,8 +277,6 @@
|
|||
<PlatformManifestFileEntry Include="libicudata.a" IsNative="true" />
|
||||
<PlatformManifestFileEntry Include="libicui18n.a" IsNative="true" />
|
||||
<PlatformManifestFileEntry Include="libicuuc.a" IsNative="true" />
|
||||
<!-- zlib-specific files -->
|
||||
<PlatformManifestFileEntry Include="libz.a" IsNative="true" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -249,6 +249,7 @@ elseif(CLR_CMAKE_HOST_OS STREQUAL "emscripten")
|
|||
set(DISABLE_SHARED_LIBS 1)
|
||||
# sys/random.h exists, but its not found
|
||||
set(HAVE_SYS_RANDOM_H 1)
|
||||
set(INTERNAL_ZLIB 1)
|
||||
elseif(CLR_CMAKE_HOST_OS STREQUAL "wasi")
|
||||
set(HOST_WASI 1)
|
||||
add_definitions(-D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -DHOST_WASI)
|
||||
|
@ -260,6 +261,7 @@ elseif(CLR_CMAKE_HOST_OS STREQUAL "wasi")
|
|||
add_compile_options(-Wno-unused-but-set-variable)
|
||||
set(ENABLE_PERFTRACING 0)
|
||||
set(DISABLE_SHARED_LIBS 1)
|
||||
set(INTERNAL_ZLIB 1)
|
||||
set(DISABLE_EXECUTABLES 1)
|
||||
set(STATIC_COMPONENTS 1)
|
||||
elseif(CLR_CMAKE_HOST_OS STREQUAL "windows")
|
||||
|
@ -268,6 +270,7 @@ elseif(CLR_CMAKE_HOST_OS STREQUAL "windows")
|
|||
set(HOST_NO_SYMLINKS 1)
|
||||
set(MONO_KEYWORD_THREAD "__declspec (thread)")
|
||||
set(MONO_ZERO_LEN_ARRAY 1)
|
||||
set(INTERNAL_ZLIB 1)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") # statically link VC runtime library
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W4>) # set warning level 4
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/WX>) # treat warnings as errors
|
||||
|
@ -508,15 +511,16 @@ if ((HOST_MACCAT AND HOST_ARM64) OR (TARGET_MACCAT AND TARGET_ARM64))
|
|||
set(TARGET_APPLE_MOBILE 1)
|
||||
endif()
|
||||
|
||||
# Decide if we need zlib-ng.
|
||||
# Decide if we need zlib, and if so whether we want the system zlib or the in-tree copy.
|
||||
if(NOT DISABLE_EMBEDDED_PDB OR NOT DISABLE_LOG_PROFILER_GZ)
|
||||
if (CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
# if we're not on a platform where we use the in-tree zlib-ng, require system zlib
|
||||
if(INTERNAL_ZLIB)
|
||||
# defines ZLIB_SOURCES
|
||||
include(${CLR_SRC_NATIVE_DIR}/external/zlib.cmake)
|
||||
else()
|
||||
# if we're not on a platform where we use the in-tree zlib, require system zlib
|
||||
include(${CLR_SRC_NATIVE_DIR}/libs/System.IO.Compression.Native/extra_libs.cmake)
|
||||
set(Z_LIBS)
|
||||
append_extra_compression_libs(Z_LIBS)
|
||||
else()
|
||||
include(${CLR_SRC_NATIVE_DIR}/external/zlib-ng.cmake)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -660,17 +664,12 @@ if(LLVM_PREFIX)
|
|||
endif()
|
||||
set(llvm_includedir "${LLVM_PREFIX}/include")
|
||||
|
||||
set(llvm_system_libs "")
|
||||
if(HOST_LINUX)
|
||||
# llvm-config --system-libs
|
||||
list(APPEND llvm_system_libs ${MONO_cxx_lib} "-lrt" "-ldl" "-lpthread" "-lm")
|
||||
set(llvm_system_libs ${MONO_cxx_lib} "-lz" "-lrt" "-ldl" "-lpthread" "-lm")
|
||||
elseif(HOST_OSX)
|
||||
# llvm-config --system-libs
|
||||
list(APPEND llvm_system_libs "-lm")
|
||||
endif()
|
||||
|
||||
if (CLR_CMAKE_USE_SYSTEM_ZLIB AND (HOST_LINUX OR HOST_OSX))
|
||||
list(APPEND llvm_system_libs "-lz")
|
||||
set(llvm_system_libs "-lz" "-lm")
|
||||
endif()
|
||||
|
||||
# llvm-config --libs analysis core bitwriter mcjit orcjit
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
<WasmPInvokeModule Include="libSystem.Native" />
|
||||
<WasmPInvokeModule Include="libSystem.IO.Compression.Native" />
|
||||
<WasmPInvokeModule Include="libSystem.Globalization.Native" />
|
||||
<WasmPInvokeModule Include="libz" />
|
||||
<WasmPInvokeAssembly Include="@(LibrariesRuntimeFiles)" Condition="'%(Extension)' == '.dll' and '%(IsNative)' != 'true'" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ target_link_libraries(dotnet.native
|
|||
${MONO_ARTIFACTS_DIR}/libmono-wasm-${CONFIGURATION_INTERPSIMDTABLES_LIB}.a
|
||||
${MONO_ARTIFACTS_DIR}/libmono-profiler-aot.a
|
||||
${MONO_ARTIFACTS_DIR}/libmono-profiler-browser.a
|
||||
${MONO_ARTIFACTS_DIR}/libz.a
|
||||
${NATIVE_BIN_DIR}/wasm-bundled-timezones.a
|
||||
${NATIVE_BIN_DIR}/libSystem.Native.a
|
||||
${NATIVE_BIN_DIR}/libSystem.Globalization.Native.a
|
||||
|
|
|
@ -168,6 +168,9 @@
|
|||
/* Define to 1 if you have the <unwind.h> header file. */
|
||||
#cmakedefine HAVE_UNWIND_H 1
|
||||
|
||||
/* Use in-tree zlib */
|
||||
#cmakedefine INTERNAL_ZLIB 1
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#cmakedefine HAVE_POLL_H 1
|
||||
|
||||
|
|
|
@ -1189,9 +1189,6 @@ JS_ENGINES = [NODE_JS]
|
|||
<_MonoRuntimeArtifacts Condition="('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true') and '$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(MonoObjDir)out\lib\libmono-wasm-nosimd.a">
|
||||
<Destination>$(RuntimeBinDir)libmono-wasm-nosimd.a</Destination>
|
||||
</_MonoRuntimeArtifacts>
|
||||
<_MonoRuntimeArtifacts Condition="('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true') and '$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(MonoObjDir)_deps\fetchzlibng-build\libz.a">
|
||||
<Destination>$(RuntimeBinDir)libz.a</Destination>
|
||||
</_MonoRuntimeArtifacts>
|
||||
<_MonoICorDebugArtifacts Condition="'$(MonoMsCorDbi)' == 'true'" Include="$(MonoObjDir)out\lib\$(LibPrefix)mscordbi$(LibSuffix)">
|
||||
<Destination>$(RuntimeBinDir)$(LibPrefix)mscordbi$(LibSuffix)</Destination>
|
||||
</_MonoICorDebugArtifacts>
|
||||
|
|
|
@ -39,16 +39,7 @@ if(ENABLE_PERFTRACING)
|
|||
set(CMAKE_SKIP_RPATH 1)
|
||||
add_executable(ep-test ${EVENTPIPE_TEST_SOURCES} ${EVENTPIPE_TEST_HEADERS})
|
||||
target_sources(ep-test PRIVATE "${mono-components-objects}")
|
||||
|
||||
set(EPTEST_LINKABLE_LIBS "")
|
||||
list(APPEND EPTEST_LINKABLE_LIBS eglib_api monosgen-static ${OS_LIBS} ${LLVM_LIBS} monoapi)
|
||||
if (CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND EPTEST_LINKABLE_LIBS ${EPTEST_LINKABLE_LIBS} ${Z_LIBS})
|
||||
else()
|
||||
list(APPEND EPTEST_LINKABLE_LIBS ${EPTEST_LINKABLE_LIBS} zlib)
|
||||
endif()
|
||||
target_link_libraries(ep-test PRIVATE ${EPTEST_LINKABLE_LIBS})
|
||||
|
||||
target_link_libraries(ep-test PRIVATE eglib_api monosgen-static ${OS_LIBS} ${LLVM_LIBS} ${Z_LIBS} monoapi)
|
||||
install_with_stripped_symbols(ep-test TARGETS bin)
|
||||
else(ENABLE_EVENTPIPE_TEST AND STATIC_COMPONENTS AND (NOT DISABLE_COMPONENTS) AND (NOT DISABLE_LIBS) AND (NOT DISABLE_EXECUTABLES))
|
||||
message(VERBOSE "Skip building native EventPipe library test runner.")
|
||||
|
|
|
@ -200,14 +200,7 @@ set(metadata_sources "${metadata_platform_sources};${metadata_common_sources};${
|
|||
if(HOST_WIN32 AND NOT DISABLE_SHARED_LIBS)
|
||||
add_library(metadata_objects_shared OBJECT ${metadata_sources})
|
||||
target_compile_definitions(metadata_objects_shared PRIVATE ${metadata_compile_definitions})
|
||||
|
||||
set(METADATAOBJECTSSHARED_LINKABLE_LIBS "")
|
||||
list(APPEND METADATAOBJECTSSHARED_LINKABLE_LIBS monoapi eglib_api utils_objects_shared)
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND METADATAOBJECTSSHARED_LINKABLE_LIBS zlib)
|
||||
endif()
|
||||
target_link_libraries(metadata_objects_shared PRIVATE ${METADATAOBJECTSSHARED_LINKABLE_LIBS})
|
||||
|
||||
target_link_libraries(metadata_objects_shared PRIVATE monoapi eglib_api utils_objects_shared)
|
||||
# note: metadata_objects is an object library, so this doesn't force linking with sgen,
|
||||
# it just adds the relevant include directories - which we need even with Boehm
|
||||
target_link_libraries(metadata_objects_shared PRIVATE sgen_objects_shared)
|
||||
|
@ -219,14 +212,7 @@ endif()
|
|||
|
||||
add_library(metadata_objects OBJECT ${metadata_sources})
|
||||
target_compile_definitions(metadata_objects PRIVATE ${metadata_compile_definitions})
|
||||
|
||||
set(METADATAOBJECTS_LINKABLE_LIBS "")
|
||||
list(APPEND METADATAOBJECTS_LINKABLE_LIBS monoapi eglib_api utils_objects)
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND METADATAOBJECTS_LINKABLE_LIBS zlib)
|
||||
endif()
|
||||
target_link_libraries(metadata_objects PRIVATE ${METADATAOBJECTS_LINKABLE_LIBS})
|
||||
|
||||
target_link_libraries(metadata_objects PRIVATE monoapi eglib_api utils_objects)
|
||||
# note: metadata_objects is an object library, so this doesn't force linking with sgen,
|
||||
# it just adds the relevant include directories - which we need even with Boehm
|
||||
target_link_libraries(metadata_objects PRIVATE sgen_objects)
|
||||
|
|
|
@ -30,8 +30,12 @@
|
|||
#include <mono/utils/mono-logger-internals.h>
|
||||
|
||||
#ifndef DISABLE_EMBEDDED_PDB
|
||||
#ifdef INTERNAL_ZLIB
|
||||
#include <external/zlib/zlib.h>
|
||||
#else
|
||||
#include <zlib.h>
|
||||
#endif // DISABLE_EMBEDDED_PDB
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "debug-mono-ppdb.h"
|
||||
|
||||
|
|
|
@ -314,7 +314,10 @@ elseif(NOT HOST_BROWSER AND NOT HOST_WASI)
|
|||
set(mini_sources "${mini_sources};${VERSION_FILE_PATH}") # this is generated by GenerateNativeVersionFile in Arcade
|
||||
endif()
|
||||
|
||||
set(monosgen-sources "${mini_sources}")
|
||||
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_DEFINITIONS "${ZLIB_COMPILE_DEFINITIONS}")
|
||||
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_OPTIONS "${ZLIB_COMPILE_OPTIONS}")
|
||||
|
||||
set(monosgen-sources "${mini_sources};${ZLIB_SOURCES}")
|
||||
|
||||
if(HOST_WIN32 AND NOT DISABLE_SHARED_LIBS)
|
||||
add_library(monosgen-objects_shared OBJECT "${monosgen-sources}")
|
||||
|
@ -323,14 +326,7 @@ if(HOST_WIN32 AND NOT DISABLE_SHARED_LIBS)
|
|||
endif()
|
||||
|
||||
add_library(monosgen-objects OBJECT "${monosgen-sources}")
|
||||
|
||||
set(MONOSGEN_OBJECTS_LINKABLE_LIBS "")
|
||||
list(APPEND MONOSGEN_OBJECTS_LINKABLE_LIBS monoapi eglib_api utils_objects sgen_objects metadata_objects)
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND MONOSGEN_OBJECTS_LINKABLE_LIBS zlib)
|
||||
endif()
|
||||
target_link_libraries (monosgen-objects PRIVATE ${MONOSGEN_OBJECTS_LINKABLE_LIBS})
|
||||
|
||||
target_link_libraries (monosgen-objects PRIVATE monoapi eglib_api utils_objects sgen_objects metadata_objects)
|
||||
if(NOT HOST_WIN32)
|
||||
target_compile_definitions(monosgen-objects PRIVATE -DMONO_DLL_EXPORT)
|
||||
endif()
|
||||
|
@ -357,23 +353,15 @@ if(NOT DISABLE_SHARED_LIBS)
|
|||
# musl-libc implements ucontext in a different library on s390x
|
||||
if(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
|
||||
target_link_libraries(monosgen-shared PRIVATE ucontext)
|
||||
endif()
|
||||
endif(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
|
||||
set_target_properties(monosgen-shared PROPERTIES OUTPUT_NAME ${MONO_SHARED_LIB_NAME})
|
||||
if(MONO_SET_RPATH_ORIGIN)
|
||||
set_target_properties(monosgen-shared PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
|
||||
set(MONOSGENSHARED_LINKABLE_LIBS "")
|
||||
list(APPEND MONOSGENSHARED_LINKABLE_LIBS monoapi eglib_objects dn-containers)
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND MONOSGENSHARED_LINKABLE_LIBS zlib)
|
||||
endif()
|
||||
if(HOST_WIN32)
|
||||
list(APPEND MONOSGENSHARED_LINKABLE_LIBS utils_objects_shared sgen_objects_shared metadata_objects_shared)
|
||||
target_link_libraries(monosgen-shared PRIVATE ${MONOSGENSHARED_LINKABLE_LIBS})
|
||||
target_link_libraries(monosgen-shared PRIVATE monoapi eglib_objects utils_objects_shared sgen_objects_shared metadata_objects_shared dn-containers)
|
||||
else()
|
||||
list(APPEND MONOSGENSHARED_LINKABLE_LIBS utils_objects sgen_objects metadata_objects)
|
||||
target_link_libraries(monosgen-shared PRIVATE ${MONOSGENSHARED_LINKABLE_LIBS})
|
||||
target_link_libraries(monosgen-shared PRIVATE monoapi eglib_objects utils_objects sgen_objects metadata_objects dn-containers)
|
||||
endif()
|
||||
target_include_directories (monosgen-shared PRIVATE monoapi)
|
||||
if(TARGET_WIN32)
|
||||
|
@ -381,16 +369,11 @@ if(NOT DISABLE_SHARED_LIBS)
|
|||
# to avoid a conflict we rename the import library with the .import.lib suffix
|
||||
set_target_properties(monosgen-shared PROPERTIES IMPORT_SUFFIX ".import.lib")
|
||||
endif()
|
||||
|
||||
set(MONOSGENSHARED_LINKABLE_EXTRALIBS "")
|
||||
list(APPEND MONOSGENSHARED_LINKABLE_EXTRALIBS ${OS_LIBS} ${LLVM_LIBS})
|
||||
if (CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND MONOSGENSHARED_LINKABLE_EXTRALIBS ${Z_LIBS})
|
||||
if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
|
||||
target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${Z_LIBS})
|
||||
else()
|
||||
list(APPEND MONOSGENSHARED_LINKABLE_EXTRALIBS zlib)
|
||||
target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${Z_LIBS})
|
||||
endif()
|
||||
target_link_libraries(monosgen-shared PRIVATE ${MONOSGENSHARED_LINKABLE_EXTRALIBS})
|
||||
|
||||
if(TARGET_DARWIN)
|
||||
set_property(TARGET monosgen-shared APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-compatibility_version -Wl,2.0 -Wl,-current_version -Wl,2.0")
|
||||
endif()
|
||||
|
@ -434,22 +417,8 @@ if(NOT DISABLE_SHARED_LIBS)
|
|||
endif()
|
||||
add_library(${frameworkconfig} SHARED $<TARGET_OBJECTS:monosgen-objects>)
|
||||
target_compile_definitions(${frameworkconfig} PRIVATE -DMONO_DLL_EXPORT)
|
||||
|
||||
set(FRAMEWORKCONFIG_LINKABLE_LIBS "")
|
||||
list(APPEND FRAMEWORKCONFIG_LINKABLE_LIBS monoapi eglib_objects utils_objects sgen_objects metadata_objects dn-containers)
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND FRAMEWORKCONFIG_LINKABLE_LIBS zlib)
|
||||
endif()
|
||||
target_link_libraries(${frameworkconfig} PRIVATE ${FRAMEWORKCONFIG_LINKABLE_LIBS})
|
||||
|
||||
set(FRAMEWORKCONFIG_LINKABLE_EXTRALIBS "")
|
||||
list(APPEND FRAMEWORKCONFIG_LINKABLE_EXTRALIBS ${OS_LIBS} ${LLVM_LIBS})
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND FRAMEWORKCONFIG_LINKABLE_EXTRALIBS zlib)
|
||||
else()
|
||||
list(APPEND FRAMEWORKCONFIG_LINKABLE_EXTRALIBS ${Z_LIBS})
|
||||
endif()
|
||||
target_link_libraries(${frameworkconfig} PRIVATE ${FRAMEWORKCONFIG_LINKABLE_EXTRALIBS})
|
||||
target_link_libraries(${frameworkconfig} PRIVATE monoapi eglib_objects utils_objects sgen_objects metadata_objects dn-containers)
|
||||
target_link_libraries(${frameworkconfig} PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${Z_LIBS})
|
||||
|
||||
set_property(TARGET ${frameworkconfig} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-compatibility_version -Wl,2.0 -Wl,-current_version -Wl,2.0")
|
||||
string(REPLACE "*" ";" componentsobjects-whitespace "${componentsobjects}")
|
||||
|
@ -565,27 +534,11 @@ if(NOT DISABLE_EXECUTABLES)
|
|||
set_target_properties(mono-sgen PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(MONOSGEN_LINKABLE_LIBS "")
|
||||
list(APPEND MONOSGEN_LINKABLE_LIBS monoapi eglib_api monosgen-static dn-containers)
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND MONOSGEN_LINKABLE_LIBS zlib)
|
||||
endif()
|
||||
target_link_libraries(mono-sgen PRIVATE ${MONOSGEN_LINKABLE_LIBS})
|
||||
|
||||
target_link_libraries(mono-sgen PRIVATE monoapi eglib_api monosgen-static dn-containers)
|
||||
if (HOST_WASM)
|
||||
target_link_libraries(mono-sgen PRIVATE mono-wasm-nosimd)
|
||||
endif()
|
||||
|
||||
set(MONOSGEN_LINKABLE_EXTRALIBS "")
|
||||
list(APPEND MONOSGEN_LINKABLE_EXTRALIBS ${OS_LIBS} ${LLVM_LIBS})
|
||||
if (CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
list(APPEND MONOSGEN_LINKABLE_EXTRALIBS ${Z_LIBS})
|
||||
else()
|
||||
list(APPEND MONOSGEN_LINKABLE_EXTRALIBS zlib)
|
||||
endif()
|
||||
target_link_libraries(mono-sgen PRIVATE ${MONOSGEN_LINKABLE_EXTRALIBS})
|
||||
|
||||
target_link_libraries(mono-sgen PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${Z_LIBS})
|
||||
# musl-libc implements ucontext in a different library on s390x
|
||||
if(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
|
||||
target_link_libraries(mono-sgen PRIVATE ucontext)
|
||||
|
|
|
@ -12,7 +12,9 @@ include_directories(
|
|||
if(NOT DISABLE_LIBS)
|
||||
if(HOST_ANDROID OR HOST_IOS OR HOST_TVOS OR HOST_S390X)
|
||||
# Build the logging profiler only for certain platforms
|
||||
add_library(mono-profiler-log SHARED helper.c log.c log-args.c)
|
||||
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_DEFINITIONS "${ZLIB_COMPILE_DEFINITIONS}")
|
||||
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_OPTIONS "${ZLIB_COMPILE_OPTIONS}")
|
||||
add_library(mono-profiler-log SHARED helper.c log.c log-args.c ${ZLIB_SOURCES})
|
||||
target_compile_definitions(mono-profiler-log PRIVATE -DMONO_DLL_EXPORT)
|
||||
target_link_libraries(mono-profiler-log PRIVATE monosgen-shared monoapi eglib_objects)
|
||||
if(HOST_ANDROID)
|
||||
|
@ -26,11 +28,7 @@ if(NOT DISABLE_LIBS)
|
|||
install(TARGETS mono-profiler-log-static LIBRARY)
|
||||
|
||||
if(NOT DISABLE_LOG_PROFILER_GZ)
|
||||
if (CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries(mono-profiler-log PRIVATE ${Z_LIBS})
|
||||
else()
|
||||
target_link_libraries(mono-profiler-log PRIVATE zlib)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -72,8 +72,12 @@
|
|||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifndef DISABLE_LOG_PROFILER_GZ
|
||||
#ifdef INTERNAL_ZLIB
|
||||
#include <external/zlib/zlib.h>
|
||||
#else
|
||||
#include <zlib.h>
|
||||
#endif // DISABLE_LOG_PROFILER_GZ
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HOST_WIN32
|
||||
#include <winsock2.h>
|
||||
|
|
|
@ -23,8 +23,12 @@
|
|||
#endif
|
||||
#include <stdlib.h>
|
||||
#ifndef DISABLE_LOG_PROFILER_GZ
|
||||
#ifdef INTERNAL_ZLIB
|
||||
#include <external/zlib/zlib.h>
|
||||
#else
|
||||
#include <zlib.h>
|
||||
#endif // DISABLE_LOG_PROFILER_GZ
|
||||
#endif
|
||||
#endif
|
||||
#include <glib.h>
|
||||
#include <mono/metadata/profiler.h>
|
||||
#include <mono/metadata/object.h>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<AppleGenerateAppBundle Condition="'$(_IsLibraryMode)' == 'true' and '$(ForceLibraryModeGenerateAppBundle)' != 'true' and '$(UseNativeAOTRuntime)' != 'true'">false</AppleGenerateAppBundle>
|
||||
<_ProcessRuntimeComponentsForLibraryMode Condition="'$(_IsLibraryMode)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">_ProcessRuntimeComponentsForLibraryMode</_ProcessRuntimeComponentsForLibraryMode>
|
||||
<EnableDefaultAssembliesToBundle Condition="'$(EnableDefaultAssembliesToBundle)' == ''">false</EnableDefaultAssembliesToBundle>
|
||||
<UseSystemZlib Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'android' or '$(TargetArchitecture)' == 'armv6'">true</UseSystemZlib>
|
||||
</PropertyGroup>
|
||||
|
||||
<UsingTask Condition="'$(AppleGenerateAppBundle)' == 'true'"
|
||||
|
@ -71,7 +70,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(_IsLibraryMode)' == 'true'">
|
||||
<_CommonLinkerArgs Include="-lz" Condition="'$(UseSystemZlib)' == 'true'" />
|
||||
<_CommonLinkerArgs Include="-lz" />
|
||||
<_CommonLinkerArgs Include="-lc++" />
|
||||
<_CommonLinkerArgs Include="-liconv" />
|
||||
<_CommonLinkerArgs Include="-licucore" />
|
||||
|
|
|
@ -27,7 +27,6 @@ target_link_libraries(dotnet
|
|||
${MONO_ARTIFACTS_DIR}/libmonosgen-2.0.a
|
||||
${MONO_ARTIFACTS_DIR}/libmono-icall-table.a
|
||||
${MONO_ARTIFACTS_DIR}/libmono-wasm-${CONFIGURATION_INTERPSIMDTABLES_LIB}.a
|
||||
${MONO_ARTIFACTS_DIR}/libz.a
|
||||
${NATIVE_BIN_DIR}/wasm-bundled-timezones.a
|
||||
${NATIVE_BIN_DIR}/libSystem.Native.a
|
||||
${NATIVE_BIN_DIR}/libSystem.Globalization.Native.a
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
<WasmPInvokeModule Include="libSystem.Native" />
|
||||
<WasmPInvokeModule Include="libSystem.IO.Compression.Native" />
|
||||
<WasmPInvokeModule Include="libSystem.Globalization.Native" />
|
||||
<WasmPInvokeModule Include="libz" />
|
||||
<WasmPInvokeAssembly Include="@(LibrariesRuntimeFiles)" Condition="'%(Extension)' == '.dll' and '%(IsNative)' != 'true'" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
29
src/native/external/zlib-intel.cmake
vendored
Normal file
29
src/native/external/zlib-intel.cmake
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
# IMPORTANT: do not use add_compile_options(), add_definitions() or similar functions here since it will leak to the including projects
|
||||
|
||||
set(ZLIB_SOURCES_BASE
|
||||
adler32.c
|
||||
compress.c
|
||||
crc_folding.c
|
||||
crc32.c
|
||||
deflate_medium.c
|
||||
deflate_quick.c
|
||||
deflate.c
|
||||
inffast.c
|
||||
inflate.c
|
||||
inftrees.c
|
||||
match.c
|
||||
slide_sse.c
|
||||
trees.c
|
||||
x86.c
|
||||
zutil.c
|
||||
../../libs/System.IO.Compression.Native/zlib_allocator_win.c
|
||||
)
|
||||
|
||||
addprefix(ZLIB_SOURCES "${CMAKE_CURRENT_LIST_DIR}/zlib-intel" "${ZLIB_SOURCES_BASE}")
|
||||
|
||||
# enable custom zlib allocator
|
||||
set(ZLIB_COMPILE_DEFINITIONS "MY_ZCALLOC")
|
||||
|
||||
if(HOST_WIN32 OR CLR_CMAKE_TARGET_WIN32)
|
||||
set(ZLIB_COMPILE_OPTIONS "/wd4127;/wd4131")
|
||||
endif()
|
33
src/native/external/zlib-ng.cmake
vendored
33
src/native/external/zlib-ng.cmake
vendored
|
@ -1,33 +0,0 @@
|
|||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
fetchzlibng
|
||||
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib-ng")
|
||||
|
||||
set(ZLIB_COMPAT ON)
|
||||
set(ZLIB_ENABLE_TESTS OFF)
|
||||
set(ZLIBNG_ENABLE_TESTS OFF)
|
||||
set(Z_PREFIX ON)
|
||||
|
||||
add_compile_options($<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:-Wno-unused-command-line-argument>) # clang : error : argument unused during compilation: '-fno-semantic-interposition'
|
||||
add_compile_options($<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:-Wno-logical-op-parentheses>) # place parentheses around the '&&' expression to silence this warning
|
||||
add_compile_options($<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4127>) # warning C4127: conditional expression is constant
|
||||
add_compile_options($<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4242>) # 'function': conversion from 'unsigned int' to 'Pos', possible loss of data, in various deflate_*.c files
|
||||
add_compile_options($<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4244>) # 'function': conversion from 'unsigned int' to 'Pos', possible loss of data, in various deflate_*.c files
|
||||
|
||||
# 'aligned_alloc' is not available in browser/wasi, yet it is set by zlib-ng/CMakeLists.txt.
|
||||
if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
|
||||
set(HAVE_ALIGNED_ALLOC FALSE CACHE BOOL "have aligned_alloc" FORCE)
|
||||
endif()
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF) # Shared libraries aren't supported in wasm
|
||||
set(SKIP_INSTALL_ALL ON)
|
||||
FetchContent_MakeAvailable(fetchzlibng)
|
||||
set(SKIP_INSTALL_ALL OFF)
|
||||
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/zlib-ng PROPERTY MSVC_WARNING_LEVEL 3) # Set the MSVC warning level for all zlib-ng targets to 3.
|
||||
target_compile_options(zlib PRIVATE $<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:-Wno-unused-command-line-argument>) # Make sure MacOS respects ignoring unused CLI arguments
|
||||
target_compile_options(zlib PRIVATE $<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:-Wno-logical-op-parentheses>) # place parentheses around the '&&' expression to silence this warning
|
||||
target_compile_options(zlib PRIVATE $<$<COMPILE_LANG_AND_ID:C,MSVC>:/guard:cf>) # Enable CFG always for zlib-ng so we don't need to build two flavors.
|
||||
|
||||
set_target_properties(zlib PROPERTIES DEBUG_POSTFIX "") # Workaround: zlib's debug lib name is zlibd.lib
|
41
src/native/external/zlib.cmake
vendored
Normal file
41
src/native/external/zlib.cmake
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
# IMPORTANT: do not use add_compile_options(), add_definitions() or similar functions here since it will leak to the including projects
|
||||
|
||||
set(ZLIB_SOURCES_BASE
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
uncompr.c
|
||||
deflate.c
|
||||
gzguts.h
|
||||
trees.c
|
||||
zutil.c
|
||||
inflate.c
|
||||
infback.c
|
||||
inftrees.c
|
||||
inffast.c
|
||||
crc32.h
|
||||
deflate.h
|
||||
inffast.h
|
||||
inffixed.h
|
||||
inflate.h
|
||||
inftrees.h
|
||||
trees.h
|
||||
zconf.h
|
||||
zlib.h
|
||||
zutil.h
|
||||
)
|
||||
|
||||
if(HOST_WIN32 OR CLR_CMAKE_TARGET_WIN32)
|
||||
set(ZLIB_SOURCES_BASE ${ZLIB_SOURCES_BASE} ../../libs/System.IO.Compression.Native/zlib_allocator_win.c)
|
||||
else()
|
||||
set(ZLIB_SOURCES_BASE ${ZLIB_SOURCES_BASE} ../../libs/System.IO.Compression.Native/zlib_allocator_unix.c)
|
||||
endif()
|
||||
|
||||
addprefix(ZLIB_SOURCES "${CMAKE_CURRENT_LIST_DIR}/zlib" "${ZLIB_SOURCES_BASE}")
|
||||
|
||||
# enable custom zlib allocator
|
||||
set(ZLIB_COMPILE_DEFINITIONS "MY_ZCALLOC")
|
||||
|
||||
if(HOST_WIN32 OR CLR_CMAKE_TARGET_WIN32)
|
||||
set(ZLIB_COMPILE_OPTIONS "/wd4127;/wd4131")
|
||||
endif()
|
|
@ -12,9 +12,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <minipal/utils.h>
|
||||
|
@ -71,7 +69,6 @@ inline static int ToFileDescriptorUnchecked(intptr_t fd)
|
|||
return (int)fd;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
/**
|
||||
* Converts an intptr_t to a file descriptor.
|
||||
* intptr_t is the type used to marshal file descriptors so we can use SafeHandles effectively.
|
||||
|
@ -89,7 +86,6 @@ static inline bool CheckInterrupted(ssize_t result)
|
|||
{
|
||||
return result < 0 && errno == EINTR;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline static uint32_t Int32ToUint32(int32_t value)
|
||||
{
|
||||
|
|
|
@ -2,24 +2,10 @@ project(System.IO.Compression.Native C)
|
|||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake)
|
||||
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
include(${CLR_SRC_NATIVE_DIR}/external/zlib-ng.cmake)
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../Common/pal_config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pal_config.h)
|
||||
|
||||
set(NATIVECOMPRESSION_SOURCES
|
||||
pal_zlib.c
|
||||
)
|
||||
|
||||
if (HOST_WIN32 OR CLR_CMAKE_TARGET_WIN32)
|
||||
list(APPEND NATIVECOMPRESSION_SOURCES "zlib_allocator_win.c")
|
||||
else()
|
||||
list(APPEND NATIVECOMPRESSION_SOURCES "zlib_allocator_unix.c")
|
||||
endif()
|
||||
|
||||
if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
|
||||
|
||||
if (CLR_CMAKE_USE_SYSTEM_BROTLI)
|
||||
|
@ -43,6 +29,14 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
|
|||
set(NATIVE_LIBS_EXTRA)
|
||||
append_extra_compression_libs(NATIVE_LIBS_EXTRA)
|
||||
|
||||
if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
|
||||
include(${CLR_SRC_NATIVE_DIR}/external/zlib.cmake)
|
||||
add_definitions(-DINTERNAL_ZLIB)
|
||||
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_DEFINITIONS "${ZLIB_COMPILE_DEFINITIONS}")
|
||||
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_OPTIONS "${ZLIB_COMPILE_OPTIONS}")
|
||||
set(NATIVECOMPRESSION_SOURCES ${ZLIB_SOURCES} ${NATIVECOMPRESSION_SOURCES})
|
||||
endif()
|
||||
|
||||
# Disable implicit fallthrough warning for Zlib and Brotli
|
||||
set(FLAGS -Wno-implicit-fallthrough)
|
||||
|
||||
|
@ -102,16 +96,24 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
|
|||
${NATIVECOMPRESSION_SOURCES}
|
||||
)
|
||||
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries(System.IO.Compression.Native-Static PRIVATE zlibstatic)
|
||||
endif()
|
||||
|
||||
set_target_properties(System.IO.Compression.Native-Static PROPERTIES OUTPUT_NAME System.IO.Compression.Native CLEAN_DIRECT_OUTPUT 1)
|
||||
else ()
|
||||
if (GEN_SHARED_LIB)
|
||||
include (GenerateExportHeader)
|
||||
endif ()
|
||||
|
||||
if (CLR_CMAKE_HOST_ARCH_I386 OR CLR_CMAKE_HOST_ARCH_AMD64)
|
||||
include(${CLR_SRC_NATIVE_DIR}/external/zlib-intel.cmake)
|
||||
add_definitions(-DINTERNAL_ZLIB_INTEL)
|
||||
else ()
|
||||
include(${CLR_SRC_NATIVE_DIR}/external/zlib.cmake)
|
||||
endif ()
|
||||
|
||||
add_definitions(-DINTERNAL_ZLIB)
|
||||
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_DEFINITIONS "${ZLIB_COMPILE_DEFINITIONS}")
|
||||
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_OPTIONS "${ZLIB_COMPILE_OPTIONS}")
|
||||
set(NATIVECOMPRESSION_SOURCES ${ZLIB_SOURCES} ${NATIVECOMPRESSION_SOURCES})
|
||||
|
||||
if (GEN_SHARED_LIB)
|
||||
add_definitions(-DVER_FILEDESCRIPTION_STR="System.IO.Compression.Native")
|
||||
add_library(System.IO.Compression.Native
|
||||
|
@ -120,10 +122,6 @@ else ()
|
|||
System.IO.Compression.Native.def
|
||||
${VERSION_FILE_RC_PATH}
|
||||
)
|
||||
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries(System.IO.Compression.Native PRIVATE zlib)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
|
||||
|
@ -135,20 +133,11 @@ else ()
|
|||
${NATIVECOMPRESSION_SOURCES}
|
||||
)
|
||||
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries(System.IO.Compression.Native-Static PRIVATE zlibstatic)
|
||||
endif()
|
||||
|
||||
if(STATIC_LIBS_ONLY)
|
||||
add_library(System.IO.Compression.Native.Aot
|
||||
STATIC
|
||||
${NATIVECOMPRESSION_SOURCES}
|
||||
)
|
||||
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries(System.IO.Compression.Native.Aot PRIVATE zlibstatic)
|
||||
endif()
|
||||
|
||||
set_target_properties(System.IO.Compression.Native.Aot PROPERTIES CLR_CONTROL_FLOW_GUARD OFF)
|
||||
set_target_properties(System.IO.Compression.Native.Aot PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
|
||||
|
@ -156,11 +145,6 @@ else ()
|
|||
STATIC
|
||||
${NATIVECOMPRESSION_SOURCES}
|
||||
)
|
||||
|
||||
if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries(System.IO.Compression.Native.Aot.GuardCF PRIVATE zlibstatic)
|
||||
endif()
|
||||
|
||||
set_target_properties(System.IO.Compression.Native.Aot.GuardCF PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
endif()
|
||||
|
||||
|
@ -183,8 +167,4 @@ else ()
|
|||
|
||||
endif ()
|
||||
|
||||
if((NOT CLR_CMAKE_USE_SYSTEM_ZLIB) AND STATIC_LIBS_ONLY)
|
||||
install_static_library(zlib aotsdk nativeaot)
|
||||
endif()
|
||||
|
||||
install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs)
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
|
||||
macro(append_extra_compression_libs NativeLibsExtra)
|
||||
set(ZLIB_LIBRARIES "")
|
||||
# TODO: remove the mono-style HOST_ variable checks once Mono is using eng/native/configureplatform.cmake to define the CLR_CMAKE_TARGET_ defines
|
||||
if (CLR_CMAKE_TARGET_BROWSER OR HOST_BROWSER OR CLR_CMAKE_TARGET_WASI OR HOST_WASI)
|
||||
# nothing special to link
|
||||
elseif (CLR_CMAKE_TARGET_ANDROID OR HOST_ANDROID)
|
||||
# need special case here since we want to link against libz.so but find_package() would resolve libz.a
|
||||
list(APPEND ZLIB_LIBRARIES z)
|
||||
elseif (CLR_CMAKE_HOST_ARCH_ARMV6)
|
||||
set(ZLIB_LIBRARIES z)
|
||||
elseif (CLR_CMAKE_TARGET_SUNOS OR HOST_SOLARIS)
|
||||
set(ZLIB_LIBRARIES z m)
|
||||
else ()
|
||||
find_package(ZLIB REQUIRED)
|
||||
list(APPEND ZLIB_LIBRARIES z)
|
||||
elseif (CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
|
||||
find_package(ZLIB REQUIRED)
|
||||
list(APPEND ZLIB_LIBRARIES m)
|
||||
else()
|
||||
list(APPEND ZLIB_LIBRARIES zlib)
|
||||
set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} m)
|
||||
endif ()
|
||||
list(APPEND ${NativeLibsExtra} ${ZLIB_LIBRARIES})
|
||||
|
||||
|
|
|
@ -5,14 +5,19 @@
|
|||
#include <stdlib.h>
|
||||
#include "pal_zlib.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef INTERNAL_ZLIB
|
||||
#ifdef _WIN32
|
||||
#define c_static_assert(e) static_assert((e),"")
|
||||
#include "../Common/pal_utilities.h"
|
||||
#endif
|
||||
#ifdef INTERNAL_ZLIB_INTEL
|
||||
#include <external/zlib-intel/zlib.h>
|
||||
#else
|
||||
#include <external/zlib/zlib.h>
|
||||
#endif
|
||||
#else
|
||||
#include "pal_utilities.h"
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
#include <zlib_allocator.h>
|
||||
#include <zlib.h>
|
||||
|
||||
c_static_assert(PAL_Z_NOFLUSH == Z_NO_FLUSH);
|
||||
c_static_assert(PAL_Z_FINISH == Z_FINISH);
|
||||
|
@ -39,10 +44,6 @@ Initializes the PAL_ZStream by creating and setting its underlying z_stream.
|
|||
static int32_t Init(PAL_ZStream* stream)
|
||||
{
|
||||
z_stream* zStream = (z_stream*)calloc(1, sizeof(z_stream));
|
||||
|
||||
zStream->zalloc = z_custom_calloc;
|
||||
zStream->zfree = z_custom_cfree;
|
||||
|
||||
stream->internalState = zStream;
|
||||
|
||||
if (zStream != NULL)
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
#include <stdint.h>
|
||||
#include <windows.h>
|
||||
#define FUNCTIONEXPORT
|
||||
#define FUNCTIONCALLINGCONVENTION WINAPI
|
||||
#define FUNCTIONCALLINGCONVENCTION WINAPI
|
||||
#else
|
||||
#include "pal_types.h"
|
||||
#include "pal_compiler.h"
|
||||
#define FUNCTIONEXPORT PALEXPORT
|
||||
#define FUNCTIONCALLINGCONVENTION
|
||||
#define FUNCTIONCALLINGCONVENCTION
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -84,7 +84,7 @@ Initializes the PAL_ZStream so the Deflate function can be invoked on it.
|
|||
|
||||
Returns a PAL_ErrorCode indicating success or an error number on failure.
|
||||
*/
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENTION CompressionNative_DeflateInit2_(
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENCTION CompressionNative_DeflateInit2_(
|
||||
PAL_ZStream* stream, int32_t level, int32_t method, int32_t windowBits, int32_t memLevel, int32_t strategy);
|
||||
|
||||
/*
|
||||
|
@ -93,21 +93,21 @@ compressed bytes in nextOut.
|
|||
|
||||
Returns a PAL_ErrorCode indicating success or an error number on failure.
|
||||
*/
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENTION CompressionNative_Deflate(PAL_ZStream* stream, int32_t flush);
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENCTION CompressionNative_Deflate(PAL_ZStream* stream, int32_t flush);
|
||||
|
||||
/*
|
||||
All dynamically allocated data structures for this stream are freed.
|
||||
|
||||
Returns a PAL_ErrorCode indicating success or an error number on failure.
|
||||
*/
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENTION CompressionNative_DeflateEnd(PAL_ZStream* stream);
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENCTION CompressionNative_DeflateEnd(PAL_ZStream* stream);
|
||||
|
||||
/*
|
||||
Initializes the PAL_ZStream so the Inflate function can be invoked on it.
|
||||
|
||||
Returns a PAL_ErrorCode indicating success or an error number on failure.
|
||||
*/
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENTION CompressionNative_InflateInit2_(PAL_ZStream* stream, int32_t windowBits);
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENCTION CompressionNative_InflateInit2_(PAL_ZStream* stream, int32_t windowBits);
|
||||
|
||||
/*
|
||||
Inflates (uncompresses) the bytes in the PAL_ZStream's nextIn buffer and puts the
|
||||
|
@ -115,14 +115,14 @@ uncompressed bytes in nextOut.
|
|||
|
||||
Returns a PAL_ErrorCode indicating success or an error number on failure.
|
||||
*/
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENTION CompressionNative_Inflate(PAL_ZStream* stream, int32_t flush);
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENCTION CompressionNative_Inflate(PAL_ZStream* stream, int32_t flush);
|
||||
|
||||
/*
|
||||
All dynamically allocated data structures for this stream are freed.
|
||||
|
||||
Returns a PAL_ErrorCode indicating success or an error number on failure.
|
||||
*/
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENTION CompressionNative_InflateEnd(PAL_ZStream* stream);
|
||||
FUNCTIONEXPORT int32_t FUNCTIONCALLINGCONVENCTION CompressionNative_InflateEnd(PAL_ZStream* stream);
|
||||
|
||||
/*
|
||||
Update a running CRC-32 with the bytes buffer[0..len-1] and return the
|
||||
|
@ -130,4 +130,4 @@ updated CRC-32.
|
|||
|
||||
Returns the updated CRC-32.
|
||||
*/
|
||||
FUNCTIONEXPORT uint32_t FUNCTIONCALLINGCONVENTION CompressionNative_Crc32(uint32_t crc, uint8_t* buffer, int32_t len);
|
||||
FUNCTIONEXPORT uint32_t FUNCTIONCALLINGCONVENCTION CompressionNative_Crc32(uint32_t crc, uint8_t* buffer, int32_t len);
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
#include <zconf.h> // voidpf
|
||||
|
||||
voidpf z_custom_calloc(voidpf opaque, unsigned items, unsigned size);
|
||||
|
||||
void z_custom_cfree(voidpf opaque, voidpf ptr);
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <zconf.h>
|
||||
#include <zlib_allocator.h>
|
||||
#include <external/zlib/zutil.h>
|
||||
|
||||
/* A custom allocator for zlib that provides some defense-in-depth over standard malloc / free.
|
||||
* (non-Windows version)
|
||||
|
@ -73,7 +70,7 @@ static void WriteAllocCookieUnaligned(void* pDest, DOTNET_ALLOC_COOKIE vCookie)
|
|||
const size_t DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING = (sizeof(DOTNET_ALLOC_COOKIE) + MEMORY_ALLOCATION_ALIGNMENT - 1) & ~((size_t)MEMORY_ALLOCATION_ALIGNMENT - 1);
|
||||
const size_t DOTNET_ALLOC_TRAILER_COOKIE_SIZE = sizeof(DOTNET_ALLOC_COOKIE);
|
||||
|
||||
voidpf z_custom_calloc(opaque, items, size)
|
||||
voidpf ZLIB_INTERNAL zcalloc(opaque, items, size)
|
||||
voidpf opaque;
|
||||
unsigned items;
|
||||
unsigned size;
|
||||
|
@ -122,7 +119,7 @@ static void zcfree_trash_cookie(void* pCookie)
|
|||
memset(pCookie, 0, sizeof(DOTNET_ALLOC_COOKIE));
|
||||
}
|
||||
|
||||
void z_custom_cfree(opaque, ptr)
|
||||
void ZLIB_INTERNAL zcfree(opaque, ptr)
|
||||
voidpf opaque;
|
||||
voidpf ptr;
|
||||
{
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
#include <winnt.h>
|
||||
#include <crtdbg.h> /* _ASSERTE */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <zconf.h>
|
||||
#include <zlib_allocator.h>
|
||||
#ifdef INTERNAL_ZLIB_INTEL
|
||||
#include <external/zlib-intel/zutil.h>
|
||||
#else
|
||||
#include <external/zlib/zutil.h>
|
||||
#endif
|
||||
|
||||
/* A custom allocator for zlib that provides some defense-in-depth over standard malloc / free.
|
||||
* (Windows-specific version)
|
||||
|
@ -91,7 +92,7 @@ typedef struct _DOTNET_ALLOC_COOKIE
|
|||
const SIZE_T DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING = (sizeof(DOTNET_ALLOC_COOKIE) + MEMORY_ALLOCATION_ALIGNMENT - 1) & ~((SIZE_T)MEMORY_ALLOCATION_ALIGNMENT - 1);
|
||||
const SIZE_T DOTNET_ALLOC_TRAILER_COOKIE_SIZE = sizeof(DOTNET_ALLOC_COOKIE);
|
||||
|
||||
voidpf z_custom_calloc(opaque, items, size)
|
||||
voidpf ZLIB_INTERNAL zcalloc(opaque, items, size)
|
||||
voidpf opaque;
|
||||
unsigned items;
|
||||
unsigned size;
|
||||
|
@ -149,7 +150,7 @@ void zcfree_cookie_check_failed()
|
|||
__fastfail(FAST_FAIL_HEAP_METADATA_CORRUPTION);
|
||||
}
|
||||
|
||||
void z_custom_cfree(opaque, ptr)
|
||||
void ZLIB_INTERNAL zcfree(opaque, ptr)
|
||||
voidpf opaque;
|
||||
voidpf ptr;
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue