Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b90ac02d..b0d6b13f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,11 @@ if( APPLE )
set(make_env ${CMAKE_COMMAND} -E env SDKROOT=${CMAKE_OSX_SYSROOT})
endif()
+option(ABC_USE_SYSTEM_ZLIB "Use system shared ZLIB" OFF)
+if(ABC_USE_SYSTEM_ZLIB)
+ set(ABC_USE_SYSTEM_ZLIB_FLAGS "ABC_USE_SYSTEM_ZLIB=${ABC_USE_SYSTEM_ZLIB}")
+endif()
+
# run make to extract compiler options, linker options and list of source files
execute_process(
COMMAND
@@ -69,6 +74,7 @@ execute_process(
${ABC_READLINE_FLAGS}
${ABC_USE_NAMESPACE_FLAGS}
${ABC_USE_STDINT_H_FLAGS}
+ ${ABC_USE_SYSTEM_ZLIB_FLAGS}
ARCHFLAGS_EXE=${CMAKE_CURRENT_BINARY_DIR}/abc_arch_flags_program.exe
ABC_MAKE_NO_DEPS=1
CC=${CMAKE_C_COMPILER}
@@ -98,10 +104,16 @@ if(ABC_USE_NAMESPACE)
set_source_files_properties(${ABC_SRC} PROPERTIES LANGUAGE CXX)
endif()
+
+find_package(ZLIB)
+
function(abc_properties target visibility)
target_include_directories(${target} ${visibility} ${CMAKE_CURRENT_SOURCE_DIR}/src )
target_compile_options_filtered(${target} ${visibility} ${ABC_CFLAGS} ${ABC_CXXFLAGS} -Wno-unused-but-set-variable )
target_link_libraries(${target} ${visibility} ${ABC_LIBS})
+ if(ABC_USE_SYSTEM_ZLIB)
+ target_link_libraries(${target} ${visibility} ZLIB::ZLIB)
+ endif()
endfunction()
set(ABC_MAIN_SRC src/base/main/main.c)
diff --git a/Makefile b/Makefile
index e94591b2..89e2500b 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ MODULES := \
src/map/mapper src/map/mio src/map/super src/map/if src/map/if/acd \
src/map/amap src/map/cov src/map/scl src/map/mpm \
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/nm \
- src/misc/vec src/misc/hash src/misc/tim src/misc/bzlib src/misc/zlib \
+ src/misc/vec src/misc/hash src/misc/tim src/misc/bzlib \
src/misc/mem src/misc/bar src/misc/bbl src/misc/parse \
src/opt/cut src/opt/fxu src/opt/fxch src/opt/rwr src/opt/mfs src/opt/sim \
src/opt/ret src/opt/fret src/opt/res src/opt/lpk src/opt/nwk src/opt/rwt \
@@ -45,6 +45,12 @@ $(ARCHFLAGS_EXE) : arch_flags.c
INCLUDES += -I$(ABCSRC)/src
+ifdef ABC_USE_SYSTEM_ZLIB
+ CFLAGS += -DUSE_SYSTEM_ZLIB
+else
+ MODULES += src/misc/zlib
+endif
+
# Use C99 stdint.h header for platform-dependent types
ifdef ABC_USE_STDINT_H
ARCHFLAGS ?= -DABC_USE_STDINT_H=1
diff --git a/src/misc/zlib/zlib.h b/src/misc/zlib/zlib.h
index 46c1a1ae..1667a8cf 100644
--- a/src/misc/zlib/zlib.h
+++ b/src/misc/zlib/zlib.h
@@ -28,6 +28,10 @@
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
*/
+#ifdef USE_SYSTEM_ZLIB
+#include "misc/util/abc_global.h"
+#include <zlib.h>
+#else
#ifndef ZLIB_H
#define ZLIB_H
@@ -1617,3 +1621,4 @@ ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
ABC_NAMESPACE_HEADER_END
#endif /* ZLIB_H */
+#endif /* USE_SYSTEM_ZLIB */
f3aa9354aThis file is pinned to the selected release. Download the original to open it in your design tool.