No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

91 líneas
3.3 KiB

  1. cmake_minimum_required (VERSION 3.0.0)
  2. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
  3. project(aptdec)
  4. # libpng
  5. find_package(PNG)
  6. # libsndfile
  7. find_package(LibSndFile)
  8. set(LIB_C_SOURCE_FILES src/color.c src/dsp.c src/filter.c src/image.c src/libs/reg.c src/libs/median.c)
  9. set(EXE_C_SOURCE_FILES src/main.c src/pngio.c src/libs/argparse.c)
  10. set(LIB_C_HEADER_FILES src/apt.h)
  11. add_library(libaptdec SHARED ${LIB_C_SOURCE_FILES})
  12. add_compile_definitions(PALETTE_DIR="../palettes")
  13. if (PNG_FOUND AND LIBSNDFILE_FOUND)
  14. add_executable(aptdec ${EXE_C_SOURCE_FILES})
  15. target_link_libraries(aptdec PRIVATE libaptdec)
  16. target_link_libraries(aptdec PRIVATE PNG::PNG)
  17. target_link_libraries(aptdec PRIVATE ${LIBSNDFILE_LIBRARY})
  18. if (CLANG OR GCC)
  19. # Math
  20. target_link_libraries(aptdec PRIVATE m)
  21. # Throw errors on warnings on release builds
  22. if(CMAKE_BUILD_TYPE MATCHES "Release")
  23. target_compile_options(aptdec PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror)
  24. else()
  25. target_compile_options(aptdec PRIVATE -Wall -Wextra -pedantic)
  26. endif()
  27. elseif (MSVC)
  28. target_compile_options(aptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1)
  29. endif()
  30. else()
  31. MESSAGE(STATUS "WARNING: Only building libaptdec, as not all of the required libraries were found.")
  32. endif()
  33. if (CLANG OR CGCC)
  34. if(CMAKE_BUILD_TYPE MATCHES "Release")
  35. target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror)
  36. else()
  37. target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic)
  38. endif()
  39. elseif (MSVC)
  40. target_compile_options(libaptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1)
  41. endif()
  42. # TODO: get this from git
  43. set(PROJECT_VERSION "1.7.0")
  44. # CPack
  45. set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
  46. set(CPACK_PACKAGE_NAME "aptdec")
  47. set(CPACK_PACKAGE_CONTACT "Xerbo (xerbo@protonmail.com)")
  48. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NOAA APT satellite imagery decoder")
  49. set(CPACK_PACKAGE_DESCRIPTION "Aptdec is a FOSS program that decodes images transmitted by NOAA weather satellites. These satellites transmit constantly (among other things) medium resolution (4km/px) images of the earth over a analog mode called APT.")
  50. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
  51. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
  52. IF(NOT WIN32)
  53. set(CPACK_GENERATOR "DEB;TGZ")
  54. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
  55. if (TARGET aptdec)
  56. install(TARGETS aptdec DESTINATION "bin/")
  57. install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "palettes/")
  58. endif()
  59. install(TARGETS libaptdec LIBRARY DESTINATION lib)
  60. install(FILES ${LIB_C_HEADER_FILES} DESTINATION include/apt )
  61. else()
  62. #set(CPACK_GENERATOR "ZIP;NSIS")
  63. set(CPACK_GENERATOR "ZIP")
  64. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
  65. if (TARGET aptdec)
  66. install(TARGETS aptdec DESTINATION "bin/")
  67. file(GLOB_RECURSE DLLS *.dll)
  68. install(FILES ${DLLS} DESTINATION "bin/")
  69. endif()
  70. install(TARGETS libaptdec DESTINATION "bin/")
  71. install(FILES ${LIB_C_HEADER_FILES} DESTINATION include/apt )
  72. install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "palettes/")
  73. endif()
  74. include(CPack)