@@ -13,7 +13,8 @@ SET(PROJECT_STATIC_RUNTIME FALSE CACHE BOOL "Use statically linked standard/runt
1313
1414SET (USE_RTTI TRUE CACHE BOOL "Use run time type information?" )
1515
16- SET (USE_EXTLIBS FALSE CACHE BOOL "Use external zlib and pugixml libraries instead of the included source?" )
16+ SET (USE_EXTLIBS FALSE CACHE BOOL "Use external zlib, zstd and pugixml libraries instead of the included source?" )
17+ SET (USE_ZSTD FALSE CACHE BOOL "Enable zstd compression? (Already set to true if USE_EXTLIBS is true)" )
1718
1819if (USE_RTTI)
1920 if (CMAKE_COMPILER_IS_GNUCXX OR APPLE )
@@ -62,17 +63,28 @@ include(${PROJECT_DIR}/CMakeLists.txt)
6263#if we want external zip and xml libs find them and tell the compiler
6364if (USE_EXTLIBS)
6465 add_definitions (-DUSE_EXTLIBS )
66+ add_definitions (-DUSE_ZSTD )
6567
6668 SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH } "${CMAKE_SOURCE_DIR } /cmake/modules/" )
6769
6870 find_package (ZLIB REQUIRED )
6971 find_package (PUGIXML REQUIRED )
72+ find_package (Zstd REQUIRED )
7073
71- include_directories (${ZLIB_INCLUDE_DIRS} ${PUGIXML_INCLUDE_DIR} )
74+ include_directories (${ZLIB_INCLUDE_DIRS} ${PUGIXML_INCLUDE_DIR} ${ZSTD_INCLUDE_DIR} )
7275
7376else ()
7477 #add miniz and pugixml from source
7578 SET (PROJECT_SRC ${PROJECT_SRC} ${LIB_SRC} )
79+
80+ if (USE_ZSTD)
81+ add_definitions (-DUSE_ZSTD )
82+
83+ SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH } "${CMAKE_SOURCE_DIR } /cmake/modules/" )
84+ find_package (Zstd REQUIRED )
85+ include_directories (${ZSTD_INCLUDE_DIR} )
86+ endif ()
87+
7688endif ()
7789
7890if (WIN32 )
@@ -90,7 +102,11 @@ else()
90102endif ()
91103
92104if (USE_EXTLIBS)
93- target_link_libraries (${PROJECT_NAME } ${ZLIB_LIBRARIES} ${PUGIXML_LIBRARY} )
105+ target_link_libraries (${PROJECT_NAME } ${ZLIB_LIBRARIES} ${PUGIXML_LIBRARY} ${ZSTD_LIBRARY} )
106+ else ()
107+ if (USE_ZSTD)
108+ target_link_libraries (${PROJECT_NAME } ${ZSTD_LIBRARY} )
109+ endif ()
94110endif ()
95111
96112configure_file (${CMAKE_CURRENT_SOURCE_DIR } /tmxlite.pc.in ${CMAKE_CURRENT_BINARY_DIR } /tmxlite.pc
0 commit comments