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.

116 lines
2.8 KiB

2 years ago
2 years ago
2 years ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
2 years ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
  1. cmake_minimum_required(VERSION 3.13)
  2. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  3. set(CMAKE_SYSTEM_NAME Linux)
  4. set(CMAKE_BUILD_TYPE Debug)
  5. set(CMAKE_SKIP_BUILD_RPATH FALSE)
  6. set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  7. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  8. include(zcmake/zcmake.cmake)
  9. project(app)
  10. set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/)
  11. # 设置ccache加速C++编译速度
  12. set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
  13. set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
  14. # 设置通用编译选项
  15. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-format-overflow")
  16. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-local-typedefs")
  17. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-but-set-variable")
  18. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-deprecated-declarations")
  19. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Werror=return-type")
  20. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Werror=parentheses")
  21. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wfatal-errors")
  22. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-result")
  23. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-comment")
  24. set(C_CPP_FLAGS "${C_CPP_FLAGS} -O1")
  25. set(C_CPP_FLAGS "${C_CPP_FLAGS} -g3")
  26. set(C_CPP_FLAGS "${C_CPP_FLAGS} -fPIC")
  27. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wall")
  28. # 设置C编译选项
  29. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CPP_FLAGS}")
  30. # 设置CPP编译选项
  31. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_CPP_FLAGS}")
  32. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move")
  33. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
  34. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
  35. message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
  36. message("PROJECT_NAME: ${PROJECT_NAME}")
  37. message("ARCH: ${ARCH}")
  38. if(${ARCH} STREQUAL "amd64")
  39. add_definitions(-DBUILD_ON_PC)
  40. endif()
  41. file(
  42. GLOB_RECURSE
  43. APP_SRC #
  44. appsrc/*.cpp #
  45. appsrc/*.c #
  46. appsrc/*.hpp #
  47. appsrc/*.h #
  48. app_protocols/*.cpp #
  49. app_protocols/*.c #
  50. app_protocols/*.hpp #
  51. app_protocols/*.h #
  52. )
  53. file(
  54. GLOB_RECURSE
  55. APP_DEP_SRC #
  56. appdep/*.cpp #
  57. appdep/*.c #
  58. appdep/*.hpp #
  59. appdep/*.h #
  60. )
  61. include_directories(
  62. appdep/iflytop/core/spdlog/include #
  63. appsrc/ #
  64. appdep/ #
  65. app_protocols/ #
  66. ./ #
  67. appdep/libs/libixwebsocket/include #
  68. appdep/libs/libhpdf/include)
  69. link_directories(appdep/libs/libixwebsocket/${ARCH}/
  70. appdep/libs/libhpdf/${ARCH}/)
  71. link_libraries(
  72. pthread
  73. hpdf
  74. ixwebsocket
  75. z
  76. crypto
  77. ssl
  78. dl
  79. sqlite3)
  80. # *******************************************************************************
  81. # * APP *
  82. # *******************************************************************************
  83. zadd_executable(
  84. TARGET
  85. app.out
  86. INSTALL
  87. ./app/
  88. SRC
  89. ${APP_DEP_SRC}
  90. ${APP_SRC})
  91. #
  92. # testpdf
  93. #
  94. zadd_executable(
  95. TARGET
  96. testpdf.out #
  97. INSTALL
  98. ./app/ #
  99. SRC
  100. ${APP_DEP_SRC}
  101. appsrc/appbase/utils/zsimplepdf.cpp
  102. ./test/testpdf.cpp)