CMakeLists.txt 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. project(lzma C)
  2. include(CheckTypeSize)
  3. include(CheckFunctionExists)
  4. include(CheckIncludeFile)
  5. include(CheckCSourceCompiles)
  6. check_include_file(sys/types.h HAVE_SYS_TYPES_H)
  7. check_include_file(stdint.h HAVE_STDINT_H)
  8. check_include_file(stddef.h HAVE_STDDEF_H)
  9. # Check to see if we have large file support
  10. set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
  11. # We add these other definitions here because CheckTypeSize.cmake
  12. # in CMake 2.4.x does not automatically do so and we want
  13. # compatibility with CMake 2.4.x.
  14. if(HAVE_SYS_TYPES_H)
  15. list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
  16. endif()
  17. if(HAVE_STDINT_H)
  18. list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
  19. endif()
  20. if(HAVE_STDDEF_H)
  21. list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
  22. endif()
  23. check_type_size(off64_t OFF64_T)
  24. if(HAVE_OFF64_T)
  25. add_definitions(-D_LARGEFILE64_SOURCE=1)
  26. endif()
  27. set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
  28. # Check for fseeko
  29. check_function_exists(fseeko HAVE_FSEEKO)
  30. if(NOT HAVE_FSEEKO)
  31. add_definitions(-DNO_FSEEKO)
  32. endif()
  33. #
  34. # Check for unistd.h
  35. #
  36. check_include_file(unistd.h HAVE_UNISTD_H)
  37. if(HAVE_UNISTD_H)
  38. add_definitions(-DHAVE_UNISTD_H)
  39. endif()
  40. if(MSVC)
  41. add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
  42. add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
  43. endif()
  44. add_definitions(-DHAVE_CONFIG_H)
  45. add_definitions(-DLZMA_API_STATIC)
  46. #============================================================================
  47. # lzma
  48. #============================================================================
  49. set(LZMA_PUBLIC_HDRS
  50. api/lzma.h
  51. api/lzma/base.h
  52. api/lzma/bcj.h
  53. api/lzma/block.h
  54. api/lzma/check.h
  55. api/lzma/container.h
  56. api/lzma/delta.h
  57. api/lzma/filter.h
  58. api/lzma/hardware.h
  59. api/lzma/index.h
  60. api/lzma/index_hash.h
  61. api/lzma/lzma12.h
  62. api/lzma/stream_flags.h
  63. api/lzma/version.h
  64. api/lzma/vli.h
  65. )
  66. set(LZMA_SRCS
  67. check/check.c
  68. check/check.h
  69. check/crc32_fast.c
  70. check/crc32_table_be.h
  71. check/crc32_table.c
  72. check/crc32_table_le.h
  73. check/crc64_fast.c
  74. check/crc64_table_be.h
  75. check/crc64_table.c
  76. check/crc64_table_le.h
  77. check/crc_macros.h
  78. check/sha256.c
  79. common/alone_decoder.c
  80. common/alone_decoder.h
  81. common/alone_encoder.c
  82. common/auto_decoder.c
  83. common/block_buffer_decoder.c
  84. common/block_buffer_encoder.c
  85. common/block_buffer_encoder.h
  86. common/block_decoder.c
  87. common/block_decoder.h
  88. common/block_encoder.c
  89. common/block_encoder.h
  90. common/block_header_decoder.c
  91. common/block_header_encoder.c
  92. common/block_util.c
  93. common/common.c
  94. common/common.h
  95. common/easy_buffer_encoder.c
  96. common/easy_decoder_memusage.c
  97. common/easy_encoder.c
  98. common/easy_encoder_memusage.c
  99. common/easy_preset.c
  100. common/easy_preset.h
  101. common/filter_buffer_decoder.c
  102. common/filter_buffer_encoder.c
  103. common/filter_common.c
  104. common/filter_common.h
  105. common/filter_decoder.c
  106. common/filter_decoder.h
  107. common/filter_encoder.c
  108. common/filter_encoder.h
  109. common/filter_flags_decoder.c
  110. common/filter_flags_encoder.c
  111. common/hardware_cputhreads.c
  112. common/hardware_physmem.c
  113. common/index.c
  114. common/index_decoder.c
  115. common/index_encoder.c
  116. common/index_encoder.h
  117. common/index.h
  118. common/index_hash.c
  119. common/memcmplen.h
  120. common/outqueue.c
  121. common/outqueue.h
  122. common/stream_buffer_decoder.c
  123. common/stream_buffer_encoder.c
  124. common/stream_decoder.c
  125. common/stream_decoder.h
  126. common/stream_encoder.c
  127. common/stream_encoder_mt.c
  128. common/stream_flags_common.c
  129. common/stream_flags_common.h
  130. common/stream_flags_decoder.c
  131. common/stream_flags_encoder.c
  132. common/vli_decoder.c
  133. common/vli_encoder.c
  134. common/vli_size.c
  135. delta/delta_common.c
  136. delta/delta_common.h
  137. delta/delta_decoder.c
  138. delta/delta_decoder.h
  139. delta/delta_encoder.c
  140. delta/delta_encoder.h
  141. delta/delta_private.h
  142. lz/lz_decoder.c
  143. lz/lz_decoder.h
  144. lz/lz_encoder.c
  145. lz/lz_encoder.h
  146. lz/lz_encoder_hash.h
  147. lz/lz_encoder_hash_table.h
  148. lz/lz_encoder_mf.c
  149. lzma/fastpos.h
  150. lzma/fastpos_table.c
  151. lzma/lzma2_decoder.c
  152. lzma/lzma2_decoder.h
  153. lzma/lzma2_encoder.c
  154. lzma/lzma2_encoder.h
  155. lzma/lzma_common.h
  156. lzma/lzma_decoder.c
  157. lzma/lzma_decoder.h
  158. lzma/lzma_encoder.c
  159. lzma/lzma_encoder.h
  160. lzma/lzma_encoder_optimum_fast.c
  161. lzma/lzma_encoder_optimum_normal.c
  162. lzma/lzma_encoder_presets.c
  163. lzma/lzma_encoder_private.h
  164. rangecoder/price.h
  165. rangecoder/price_table.c
  166. rangecoder/range_common.h
  167. rangecoder/range_decoder.h
  168. rangecoder/range_encoder.h
  169. simple/simple_coder.c
  170. simple/simple_coder.h
  171. simple/simple_decoder.c
  172. simple/simple_decoder.h
  173. simple/simple_encoder.c
  174. simple/simple_encoder.h
  175. simple/simple_private.h
  176. tuklib/mythread.h
  177. tuklib/sysdefs.h
  178. tuklib/tuklib_common.h
  179. tuklib/tuklib_config.h
  180. tuklib/tuklib_cpucores.c
  181. tuklib/tuklib_cpucores.h
  182. tuklib/tuklib_exit.c
  183. tuklib/tuklib_exit.h
  184. tuklib/tuklib_gettext.h
  185. tuklib/tuklib_integer.h
  186. tuklib/tuklib_mbstr_fw.c
  187. tuklib/tuklib_mbstr.h
  188. tuklib/tuklib_mbstr_width.c
  189. tuklib/tuklib_open_stdxxx.c
  190. tuklib/tuklib_open_stdxxx.h
  191. tuklib/tuklib_physmem.c
  192. tuklib/tuklib_physmem.h
  193. tuklib/tuklib_progname.c
  194. tuklib/tuklib_progname.h
  195. )
  196. add_library(lzma STATIC ${LZMA_SRCS} ${LZMA_PUBLIC_HDRS})
  197. add_library(LibLZMA::LibLZMA ALIAS lzma)
  198. dolphin_disable_warnings(lzma)
  199. target_compile_definitions(lzma PUBLIC LZMA_API_STATIC)
  200. target_include_directories(lzma
  201. PUBLIC
  202. ${CMAKE_CURRENT_SOURCE_DIR}/api
  203. PRIVATE
  204. ${CMAKE_CURRENT_SOURCE_DIR}/
  205. ${CMAKE_CURRENT_SOURCE_DIR}/check
  206. ${CMAKE_CURRENT_SOURCE_DIR}/common
  207. ${CMAKE_CURRENT_SOURCE_DIR}/delta
  208. ${CMAKE_CURRENT_SOURCE_DIR}/lz
  209. ${CMAKE_CURRENT_SOURCE_DIR}/lzma
  210. ${CMAKE_CURRENT_SOURCE_DIR}/rangecoder
  211. ${CMAKE_CURRENT_SOURCE_DIR}/simple
  212. ${CMAKE_CURRENT_SOURCE_DIR}/tuklib
  213. )