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
133 lines
3.0 KiB
cmake_minimum_required(VERSION 3.13)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
include(zcmake/zcmake.cmake)
|
|
project(app)
|
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/)
|
|
# 设置ccache加速C++编译速度
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
# 设置通用编译选项
|
|
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -rdynamic")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-format-overflow")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-local-typedefs")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-but-set-variable")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-deprecated-declarations")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Werror=return-type")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Werror=parentheses")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wfatal-errors")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-unused-result")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-comment")
|
|
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -O1")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -g3")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -fPIC")
|
|
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wall")
|
|
|
|
# 设置C编译选项
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CPP_FLAGS}")
|
|
|
|
# 设置CPP编译选项
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_CPP_FLAGS}")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
|
|
|
message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
|
message("PROJECT_NAME: ${PROJECT_NAME}")
|
|
message("ARCH: ${ARCH}")
|
|
|
|
if(${ARCH} STREQUAL "amd64")
|
|
add_definitions(-DBUILD_ON_PC)
|
|
endif()
|
|
message("ARCH: ${ARCH}")
|
|
|
|
file(
|
|
GLOB_RECURSE
|
|
APP_SRC #
|
|
appsrc/*.cpp #
|
|
appsrc/*.c #
|
|
appsrc/*.hpp #
|
|
appsrc/*.h #
|
|
app_protocols/*.cpp #
|
|
app_protocols/*.c #
|
|
app_protocols/*.hpp #
|
|
app_protocols/*.h #
|
|
)
|
|
|
|
file(
|
|
GLOB_RECURSE
|
|
APP_DEP_SRC #
|
|
appdep/*.cpp #
|
|
appdep/*.c #
|
|
appdep/*.hpp #
|
|
appdep/*.h #
|
|
)
|
|
|
|
include_directories(
|
|
appdep/iflytop/core/spdlog/include #
|
|
appsrc/ #
|
|
appdep/ #
|
|
app_protocols/ #
|
|
./ #
|
|
appdep/libs/libixwebsocket/include #
|
|
appdep/libs/
|
|
appdep/libs/libhpdf/include)
|
|
|
|
link_directories(appdep/libs/libixwebsocket/${ARCH}/
|
|
appdep/libs/libhpdf/${ARCH}/)
|
|
|
|
link_libraries(
|
|
pthread
|
|
hpdf
|
|
ixwebsocket
|
|
z
|
|
crypto
|
|
ssl
|
|
dl
|
|
sqlite3)
|
|
|
|
# *******************************************************************************
|
|
# * APP *
|
|
# *******************************************************************************
|
|
|
|
zadd_executable(
|
|
TARGET
|
|
app.out
|
|
INSTALL
|
|
./app/
|
|
SRC
|
|
${APP_DEP_SRC}
|
|
${APP_SRC})
|
|
|
|
#
|
|
# testpdf
|
|
#
|
|
zadd_executable(
|
|
TARGET
|
|
testpdf.out #
|
|
INSTALL
|
|
./app/ #
|
|
SRC
|
|
${APP_DEP_SRC}
|
|
appsrc/appbase/utils/zsimplepdf.cpp
|
|
./test/testpdf.cpp)
|
|
|
|
#
|
|
# debugpage
|
|
#
|
|
zadd_executable(
|
|
TARGET
|
|
debugpage.out #
|
|
INSTALL
|
|
./app/ #
|
|
SRC
|
|
${APP_DEP_SRC}
|
|
appsrc/appbase/utils/zsimplepdf.cpp
|
|
./test/debugpage.cpp)
|