feat: Optimize compilation parameters

Log: Optimize compilation parameters
This commit is contained in:
rewine 2022-09-26 11:33:51 +08:00 committed by deepin-bot[bot]
parent 1b4b0c229a
commit 8ce7d3e3c7
3 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.10) cmake_minimum_required (VERSION 3.10)
set (DVERSION "5.6.0.2" CACHE STRING "define project version") set (DVERSION "5.6.2" CACHE STRING "define project version")
project (DtkCore project (DtkCore
VERSION ${DVERSION} VERSION ${DVERSION}
@ -33,14 +33,20 @@ endif()
set (BUILD_DOCS ON CACHE BOOL "Generate doxygen-based documentation") set (BUILD_DOCS ON CACHE BOOL "Generate doxygen-based documentation")
# CXX FILAGS # CXX FILAGS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wextra") set(CMAKE_CXX_STANDARD 11)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed") if (NOT CMAKE_BUILD_TYPE)
if (CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -fsanitize=address -fno-omit-frame-pointer") endif()
set(BUILD_TESTING ON)
else () if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wextra")
endif () set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(BUILD_TESTING ON)
endif ()
string(REPLACE "-O3" "-Ofast" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
endif()
if (BUILD_DOCS) if (BUILD_DOCS)
add_subdirectory(docs) add_subdirectory(docs)

1
debian/rules vendored
View File

@ -2,6 +2,7 @@
DPKG_EXPORT_BUILDFLAGS = 1 DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk include /usr/share/dpkg/default.mk
export QT_SELECT = qt5 export QT_SELECT = qt5
export DEB_CXXFLAGS_MAINT_APPEND = -Ofast
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

View File

@ -1,6 +1,5 @@
set(BIN_NAME qdbusxml2cpp-fix) set(BIN_NAME qdbusxml2cpp-fix)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(Qt5 REQUIRED COMPONENTS Core) find_package(Qt5 REQUIRED COMPONENTS Core)
find_package(Qt5 REQUIRED COMPONENTS DBus) find_package(Qt5 REQUIRED COMPONENTS DBus)