1
0
mirror of https://github.com/bitdefender/bddisasm.git synced 2024-12-22 22:18:09 +00:00

Merge remote-tracking branch 'bitdefender-public/master'

This commit is contained in:
Ionel-Cristinel ANICHITEI 2020-11-20 15:59:52 +02:00
commit b93bb94e16
2 changed files with 42 additions and 24 deletions

View File

@ -55,7 +55,6 @@ add_dependencies(bdshemu bddisasm)
include_directories(
inc
inc/bdshemu
bddisasm/include
)
@ -65,7 +64,7 @@ else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -D_DEBUG -DDEBUG")
endif ()
add_compile_options(
set(BDDISASM_COMPILE_OPTIONS
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
-Wall
@ -78,14 +77,10 @@ add_compile_options(
-Wwrite-strings
-Wshadow
-Winit-self
-Wswitch-default
-Wmissing-variable-declarations
-Wused-but-marked-unused
-Wswitch-enum
-Wno-unused-function
-Wno-multichar
-Wno-incompatible-pointer-types
-Wcast-qual
-Wno-discarded-qualifiers
-Wnull-dereference
-Wduplicated-cond
-Werror=format-security
@ -103,6 +98,9 @@ add_compile_options(
-march=nehalem
)
target_compile_options(bddisasm PRIVATE ${BDDISASM_COMPILE_OPTIONS})
target_compile_options(bdshemu PRIVATE ${BDDISASM_COMPILE_OPTIONS})
include(GNUInstallDirs)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
@ -156,3 +154,19 @@ install(FILES ${PROJECT_BINARY_DIR}/bddisasmConfig.cmake ${PROJECT_BINARY_DIR}/b
INSTALL(FILES "${PROJECT_SOURCE_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
if (NOT CPACK_GENERATOR)
set(CPACK_GENERATOR "DEB")
endif()
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bitdefender HVI Team <hvmi-oss@bitdefender.com>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
if (INCLUDE_TOOL)
add_subdirectory("disasmtool_lix")
add_dependencies(disasmtool bdshemu)
endif()
include(CPack)

View File

@ -27,9 +27,6 @@ set(disasmtool_src_files
dumpers.cpp
)
find_library(DISASM_LIB bddisasm PATHS "${DISASM_DIRECTORY}/${DISASM_BUILD_PREFIX}/${CMAKE_BUILD_TYPE}" NO_DEFAULT_PATH)
message(STATUS "Disasm lib used: ${DISASM_LIB}")
find_package(RapidJSON)
if (RapidJSON_FOUND)
@ -41,7 +38,11 @@ else()
message(FATAL_ERROR "Dependency: rapidjson not found")
endif()
add_compile_options(
add_executable(${PROJECT_NAME} ${disasmtool_src_files})
target_compile_options(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
-Wall
@ -81,7 +82,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,
if (CMAKE_COMPILER_IS_GNUCXX)
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0))
add_compile_options(
target_compile_options(${PROJECT_NAME} PRIVATE
-Wshift-overflow=2
-Wnull-dereference
-Wduplicated-cond
@ -91,7 +92,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 7.0))
add_compile_options(
target_compile_options(${PROJECT_NAME} PRIVATE
-Wdangling-else
-Wshadow=global
-Walloc-zero
@ -99,7 +100,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 8.0))
add_compile_options(
target_compile_options(${PROJECT_NAME} PRIVATE
-Wmultistatement-macros
-Warray-bounds=2
-Wformat-overflow=2
@ -127,7 +128,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 9.0))
add_compile_options(
target_compile_options(${PROJECT_NAME} PRIVATE
-Wcatch-value=2
-Wduplicated-branches
-Wextra-semi
@ -140,12 +141,12 @@ if (CMAKE_COMPILER_IS_GNUCXX)
)
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(
target_compile_options(${PROJECT_NAME} PRIVATE
-Wno-missing-braces
)
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0))
add_compile_options(
target_compile_options(${PROJECT_NAME} PRIVATE
-Wshift-overflow
-Wnull-dereference
-Wvla
@ -157,7 +158,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 10.0))
add_compile_options(
target_compile_options(${PROJECT_NAME} PRIVATE
-Warray-bounds-pointer-arithmetic
-Wassign-enum
-Watomic-implicit-seq-cst
@ -251,20 +252,18 @@ else()
message(FATAL_ERROR "Unsupported compiler!")
endif()
include_directories(
target_include_directories(${PROJECT_NAME} PRIVATE
${DISASM_DIRECTORY}/inc
${DISASM_DIRECTORY}/bddisasm/include
)
add_executable(${CMAKE_PROJECT_NAME} ${disasmtool_src_files})
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
include(CheckIPOSupported)
check_ipo_supported(RESULT USE_IPO)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
set_target_properties(${PROJECT_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
endif()
set_target_properties(${CMAKE_PROJECT_NAME}
set_target_properties(${PROJECT_NAME}
PROPERTIES
POSITION_INDEPENDENT_CODE ON
CXX_STANDARD 17
@ -272,6 +271,11 @@ set_target_properties(${CMAKE_PROJECT_NAME}
CXX_EXTENSIONS ON
)
target_link_libraries(${CMAKE_PROJECT_NAME} ${DISASM_LIB})
target_link_directories(${PROJECT_NAME} PRIVATE "${DISASM_DIRECTORY}/bin/x64/${CMAKE_BUILD_TYPE}")
target_link_libraries(${PROJECT_NAME} PRIVATE bddisasm bdshemu)
INSTALL(TARGETS disasmtool
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}"
)
unset(DISASM_LIB CACHE)