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.

133 lines
3.0 KiB

2 years ago
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} -rdynamic")
  16. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-format-overflow")
  17. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-local-typedefs")
  18. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-but-set-variable")
  19. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-deprecated-declarations")
  20. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Werror=return-type")
  21. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Werror=parentheses")
  22. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wfatal-errors")
  23. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-result")
  24. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-comment")
  25. set(C_CPP_FLAGS "${C_CPP_FLAGS} -O1")
  26. set(C_CPP_FLAGS "${C_CPP_FLAGS} -g3")
  27. set(C_CPP_FLAGS "${C_CPP_FLAGS} -fPIC")
  28. set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wall")
  29. # 设置C编译选项
  30. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CPP_FLAGS}")
  31. # 设置CPP编译选项
  32. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_CPP_FLAGS}")
  33. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move")
  34. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
  35. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
  36. message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
  37. message("PROJECT_NAME: ${PROJECT_NAME}")
  38. message("ARCH: ${ARCH}")
  39. if(${ARCH} STREQUAL "amd64")
  40. add_definitions(-DBUILD_ON_PC)
  41. endif()
  42. message("ARCH: ${ARCH}")
  43. file(
  44. GLOB_RECURSE
  45. APP_SRC #
  46. appsrc/*.cpp #
  47. appsrc/*.c #
  48. appsrc/*.hpp #
  49. appsrc/*.h #
  50. app_protocols/*.cpp #
  51. app_protocols/*.c #
  52. app_protocols/*.hpp #
  53. app_protocols/*.h #
  54. )
  55. file(
  56. GLOB_RECURSE
  57. APP_DEP_SRC #
  58. appdep/*.cpp #
  59. appdep/*.c #
  60. appdep/*.hpp #
  61. appdep/*.h #
  62. )
  63. include_directories(
  64. appdep/iflytop/core/spdlog/include #
  65. appsrc/ #
  66. appdep/ #
  67. app_protocols/ #
  68. ./ #
  69. appdep/libs/libixwebsocket/include #
  70. appdep/libs/
  71. appdep/libs/libhpdf/include)
  72. link_directories(appdep/libs/libixwebsocket/${ARCH}/
  73. appdep/libs/libhpdf/${ARCH}/)
  74. link_libraries(
  75. pthread
  76. hpdf
  77. ixwebsocket
  78. z
  79. crypto
  80. ssl
  81. dl
  82. sqlite3)
  83. # *******************************************************************************
  84. # * APP *
  85. # *******************************************************************************
  86. zadd_executable(
  87. TARGET
  88. app.out
  89. INSTALL
  90. ./app/
  91. SRC
  92. ${APP_DEP_SRC}
  93. ${APP_SRC})
  94. #
  95. # testpdf
  96. #
  97. zadd_executable(
  98. TARGET
  99. testpdf.out #
  100. INSTALL
  101. ./app/ #
  102. SRC
  103. ${APP_DEP_SRC}
  104. appsrc/appbase/utils/zsimplepdf.cpp
  105. ./test/testpdf.cpp)
  106. #
  107. # debugpage
  108. #
  109. zadd_executable(
  110. TARGET
  111. debugpage.out #
  112. INSTALL
  113. ./app/ #
  114. SRC
  115. ${APP_DEP_SRC}
  116. appsrc/appbase/utils/zsimplepdf.cpp
  117. ./test/debugpage.cpp)