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.

130 lines
2.9 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
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/
  69. appdep/libs/libhpdf/include)
  70. link_directories(appdep/libs/libixwebsocket/${ARCH}/
  71. appdep/libs/libhpdf/${ARCH}/)
  72. link_libraries(
  73. pthread
  74. hpdf
  75. ixwebsocket
  76. z
  77. crypto
  78. ssl
  79. dl
  80. sqlite3)
  81. # *******************************************************************************
  82. # * APP *
  83. # *******************************************************************************
  84. zadd_executable(
  85. TARGET
  86. app.out
  87. INSTALL
  88. ./app/
  89. SRC
  90. ${APP_DEP_SRC}
  91. ${APP_SRC})
  92. #
  93. # testpdf
  94. #
  95. zadd_executable(
  96. TARGET
  97. testpdf.out #
  98. INSTALL
  99. ./app/ #
  100. SRC
  101. ${APP_DEP_SRC}
  102. appsrc/appbase/utils/zsimplepdf.cpp
  103. ./test/testpdf.cpp)
  104. #
  105. # debugpage
  106. #
  107. zadd_executable(
  108. TARGET
  109. debugpage.out #
  110. INSTALL
  111. ./app/ #
  112. SRC
  113. ${APP_DEP_SRC}
  114. appsrc/appbase/utils/zsimplepdf.cpp
  115. ./test/debugpage.cpp)