Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

CMakeLists.txt 2.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. cmake_minimum_required (VERSION 3.0.0)
  2. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
  3. project(aptdec)
  4. file(GLOB_RECURSE C_SOURCE_FILES src/*.c)
  5. add_executable(aptdec ${C_SOURCE_FILES})
  6. add_compile_definitions(PALETTE_DIR="${CMAKE_SOURCE_DIR}/palettes")
  7. # Math
  8. target_link_libraries(aptdec PRIVATE m)
  9. # Throw errors on warnings on release builds
  10. if(CMAKE_BUILD_TYPE MATCHES "Release")
  11. target_compile_options(aptdec PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror)
  12. else()
  13. target_compile_options(aptdec PRIVATE -Wall -Wextra -pedantic)
  14. endif()
  15. # libpng
  16. target_link_libraries(aptdec PRIVATE PNG::PNG)
  17. if(WIN32 AND NOT MINGW)
  18. find_package(PNG CONFIG REQUIRED)
  19. else()
  20. find_package(PNG REQUIRED)
  21. endif()
  22. # libsndfile
  23. find_package(LibSndFile REQUIRED)
  24. target_link_libraries(aptdec PRIVATE ${LIBSNDFILE_LIBRARY})
  25. # TODO: get this from git
  26. set(PROJECT_VERSION "1.7.0")
  27. # CPack
  28. set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
  29. set(CPACK_PACKAGE_NAME "aptdec")
  30. set(CPACK_PACKAGE_CONTACT "Xerbo (xerbo@protonmail.com)")
  31. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NOAA APT satellite imagery decoder")
  32. 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.")
  33. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
  34. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
  35. IF(NOT WIN32)
  36. set(CPACK_GENERATOR "DEB")
  37. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
  38. install(TARGETS aptdec DESTINATION "bin/")
  39. install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "lib/aptdec/palettes")
  40. else()
  41. #set(CPACK_GENERATOR "ZIP;NSIS")
  42. set(CPACK_GENERATOR "ZIP")
  43. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
  44. install(TARGETS aptdec DESTINATION "bin/")
  45. install(FILES libpng16.dll libsndfile-1.dll libzlib.dll DESTINATION "bin/")
  46. install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "palettes/")
  47. endif()
  48. include(CPack)