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.

131 lines
3.0 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
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. message("ARCH: ${ARCH}")
  42. file(
  43. GLOB_RECURSE
  44. APP_SRC #
  45. appsrc/*.cpp #
  46. appsrc/*.c #
  47. appsrc/*.hpp #
  48. appsrc/*.h #
  49. app_protocols/*.cpp #
  50. app_protocols/*.c #
  51. app_protocols/*.hpp #
  52. app_protocols/*.h #
  53. )
  54. file(
  55. GLOB_RECURSE
  56. APP_DEP_SRC #
  57. appdep/*.cpp #
  58. appdep/*.c #
  59. appdep/*.hpp #
  60. appdep/*.h #
  61. )
  62. include_directories(
  63. appdep/iflytop/core/spdlog/include #
  64. appsrc/ #
  65. appdep/ #
  66. app_protocols/ #
  67. ./ #
  68. appdep/libs/libixwebsocket/include #
  69. appdep/libs/
  70. appdep/libs/libhpdf/include)
  71. link_directories(appdep/libs/libixwebsocket/${ARCH}/
  72. appdep/libs/libhpdf/${ARCH}/)
  73. link_libraries(
  74. pthread
  75. hpdf
  76. ixwebsocket
  77. z
  78. crypto
  79. ssl
  80. dl
  81. sqlite3)
  82. # *******************************************************************************
  83. # * APP *
  84. # *******************************************************************************
  85. zadd_executable(
  86. TARGET
  87. app.out
  88. INSTALL
  89. ./app/
  90. SRC
  91. ${APP_DEP_SRC}
  92. ${APP_SRC})
  93. #
  94. # testpdf
  95. #
  96. zadd_executable(
  97. TARGET
  98. testpdf.out #
  99. INSTALL
  100. ./app/ #
  101. SRC
  102. ${APP_DEP_SRC}
  103. appsrc/appbase/utils/zsimplepdf.cpp
  104. ./test/testpdf.cpp)
  105. #
  106. # debugpage
  107. #
  108. zadd_executable(
  109. TARGET
  110. debugpage.out #
  111. INSTALL
  112. ./app/ #
  113. SRC
  114. ${APP_DEP_SRC}
  115. appsrc/appbase/utils/zsimplepdf.cpp
  116. ./test/debugpage.cpp)