25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 3.4 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. include_directories(${PNG_PNG_INCLUDE_DIR})
  16. include_directories(${LIBSNDFILE_INCLUDE_DIR})
  17. target_link_libraries(aptdec PRIVATE PNG::PNG)
  18. target_link_libraries(aptdec PRIVATE ${LIBSNDFILE_LIBRARY})
  19. target_link_libraries(aptdec PRIVATE libaptdec)
  20. if (MSVC)
  21. target_compile_options(aptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1)
  22. else()
  23. # Math
  24. target_link_libraries(aptdec PRIVATE m)
  25. # Throw errors on warnings on release builds
  26. if(CMAKE_BUILD_TYPE MATCHES "Release")
  27. target_compile_options(aptdec PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror)
  28. else()
  29. target_compile_options(aptdec PRIVATE -Wall -Wextra -pedantic)
  30. endif()
  31. endif()
  32. else()
  33. MESSAGE(STATUS "WARNING: Only building libaptdec, as not all of the required libraries were found.")
  34. endif()
  35. if (MSVC)
  36. target_compile_options(libaptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1)
  37. else()
  38. # Math
  39. target_link_libraries(libaptdec PRIVATE m)
  40. if(CMAKE_BUILD_TYPE MATCHES "Release")
  41. target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror)
  42. else()
  43. target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic)
  44. endif()
  45. endif()
  46. # TODO: get this from git
  47. set(PROJECT_VERSION "1.7.0")
  48. # CPack
  49. set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
  50. set(CPACK_PACKAGE_NAME "aptdec")
  51. set(CPACK_PACKAGE_CONTACT "Xerbo (xerbo@protonmail.com)")
  52. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NOAA APT satellite imagery decoder")
  53. 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.")
  54. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
  55. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
  56. IF(NOT WIN32)
  57. set(CPACK_GENERATOR "DEB;TGZ")
  58. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
  59. if (TARGET aptdec)
  60. install(TARGETS aptdec DESTINATION "bin/")
  61. install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "palettes/")
  62. endif()
  63. install(TARGETS libaptdec LIBRARY DESTINATION lib)
  64. install(FILES ${LIB_C_HEADER_FILES} DESTINATION include/apt )
  65. else()
  66. #set(CPACK_GENERATOR "ZIP;NSIS")
  67. set(CPACK_GENERATOR "ZIP")
  68. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
  69. if (TARGET aptdec)
  70. install(TARGETS aptdec DESTINATION "bin/")
  71. file(GLOB_RECURSE DLLS *.dll)
  72. install(FILES ${DLLS} DESTINATION "bin/")
  73. endif()
  74. install(TARGETS libaptdec DESTINATION "bin/")
  75. install(FILES ${LIB_C_HEADER_FILES} DESTINATION include/apt )
  76. install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "palettes/")
  77. endif()
  78. include(CPack)