You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

51 line
1.5 KiB

  1. cmake_minimum_required (VERSION 3.0.0)
  2. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
  3. set(PROJECT_VERSION "1.7.0")
  4. project(aptdec)
  5. file(GLOB_RECURSE C_SOURCE_FILES src/*.c)
  6. add_executable(aptdec ${C_SOURCE_FILES})
  7. add_compile_definitions(PALETTE_DIR="${CMAKE_SOURCE_DIR}/palettes")
  8. # math
  9. target_link_libraries(aptdec PRIVATE m)
  10. # libpng
  11. target_link_libraries(aptdec PRIVATE PNG::PNG)
  12. if(WIN32 AND NOT MINGW)
  13. find_package(PNG CONFIG REQUIRED)
  14. else()
  15. find_package(PNG REQUIRED)
  16. endif()
  17. # libsndfile
  18. find_package(LibSndFile REQUIRED)
  19. target_link_libraries(aptdec PRIVATE ${LIBSNDFILE_LIBRARY})
  20. # CPack
  21. set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
  22. set(CPACK_PACKAGE_NAME "aptdec")
  23. set(CPACK_PACKAGE_CONTACT "Xerbo (xerbo@protonmail.com)")
  24. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NOAA APT satellite imagery decoder")
  25. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
  26. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
  27. IF(NOT WIN32)
  28. set(CPACK_GENERATOR "DEB")
  29. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
  30. install(TARGETS aptdec DESTINATION "bin/")
  31. install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "lib/aptdec/palettes")
  32. else()
  33. set(CPACK_GENERATOR "ZIP;NSIS")
  34. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
  35. install(TARGETS aptdec DESTINATION "bin/")
  36. install(FILES libpng16.dll libsndfile-1.dll libzlib.dll DESTINATION "bin/")
  37. install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "palettes/")
  38. endif()
  39. include(CPack)