mirror of
https://github.com/bitdefender/bddisasm.git
synced 2024-12-31 18:30:54 +00:00
Merge remote-tracking branch 'bitdefender-public/master'
This commit is contained in:
commit
b93bb94e16
@ -55,7 +55,6 @@ add_dependencies(bdshemu bddisasm)
|
|||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
inc
|
inc
|
||||||
inc/bdshemu
|
|
||||||
bddisasm/include
|
bddisasm/include
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -65,7 +64,7 @@ else ()
|
|||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -D_DEBUG -DDEBUG")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -D_DEBUG -DDEBUG")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_compile_options(
|
set(BDDISASM_COMPILE_OPTIONS
|
||||||
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
||||||
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
||||||
-Wall
|
-Wall
|
||||||
@ -78,14 +77,10 @@ add_compile_options(
|
|||||||
-Wwrite-strings
|
-Wwrite-strings
|
||||||
-Wshadow
|
-Wshadow
|
||||||
-Winit-self
|
-Winit-self
|
||||||
-Wswitch-default
|
|
||||||
-Wmissing-variable-declarations
|
|
||||||
-Wused-but-marked-unused
|
|
||||||
-Wswitch-enum
|
|
||||||
-Wno-unused-function
|
-Wno-unused-function
|
||||||
-Wno-multichar
|
-Wno-multichar
|
||||||
-Wno-incompatible-pointer-types
|
-Wno-incompatible-pointer-types
|
||||||
-Wcast-qual
|
-Wno-discarded-qualifiers
|
||||||
-Wnull-dereference
|
-Wnull-dereference
|
||||||
-Wduplicated-cond
|
-Wduplicated-cond
|
||||||
-Werror=format-security
|
-Werror=format-security
|
||||||
@ -103,6 +98,9 @@ add_compile_options(
|
|||||||
-march=nehalem
|
-march=nehalem
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_options(bddisasm PRIVATE ${BDDISASM_COMPILE_OPTIONS})
|
||||||
|
target_compile_options(bdshemu PRIVATE ${BDDISASM_COMPILE_OPTIONS})
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
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"
|
INSTALL(FILES "${PROJECT_SOURCE_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc"
|
||||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
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)
|
||||||
|
@ -27,9 +27,6 @@ set(disasmtool_src_files
|
|||||||
dumpers.cpp
|
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)
|
find_package(RapidJSON)
|
||||||
|
|
||||||
if (RapidJSON_FOUND)
|
if (RapidJSON_FOUND)
|
||||||
@ -41,7 +38,11 @@ else()
|
|||||||
message(FATAL_ERROR "Dependency: rapidjson not found")
|
message(FATAL_ERROR "Dependency: rapidjson not found")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_compile_options(
|
|
||||||
|
add_executable(${PROJECT_NAME} ${disasmtool_src_files})
|
||||||
|
|
||||||
|
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
||||||
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
||||||
-Wall
|
-Wall
|
||||||
@ -81,7 +82,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,
|
|||||||
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0))
|
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0))
|
||||||
add_compile_options(
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
-Wshift-overflow=2
|
-Wshift-overflow=2
|
||||||
-Wnull-dereference
|
-Wnull-dereference
|
||||||
-Wduplicated-cond
|
-Wduplicated-cond
|
||||||
@ -91,7 +92,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 7.0))
|
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 7.0))
|
||||||
add_compile_options(
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
-Wdangling-else
|
-Wdangling-else
|
||||||
-Wshadow=global
|
-Wshadow=global
|
||||||
-Walloc-zero
|
-Walloc-zero
|
||||||
@ -99,7 +100,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 8.0))
|
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 8.0))
|
||||||
add_compile_options(
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
-Wmultistatement-macros
|
-Wmultistatement-macros
|
||||||
-Warray-bounds=2
|
-Warray-bounds=2
|
||||||
-Wformat-overflow=2
|
-Wformat-overflow=2
|
||||||
@ -127,7 +128,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 9.0))
|
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 9.0))
|
||||||
add_compile_options(
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
-Wcatch-value=2
|
-Wcatch-value=2
|
||||||
-Wduplicated-branches
|
-Wduplicated-branches
|
||||||
-Wextra-semi
|
-Wextra-semi
|
||||||
@ -140,12 +141,12 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
add_compile_options(
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
-Wno-missing-braces
|
-Wno-missing-braces
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0))
|
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0))
|
||||||
add_compile_options(
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
-Wshift-overflow
|
-Wshift-overflow
|
||||||
-Wnull-dereference
|
-Wnull-dereference
|
||||||
-Wvla
|
-Wvla
|
||||||
@ -157,7 +158,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 10.0))
|
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 10.0))
|
||||||
add_compile_options(
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
-Warray-bounds-pointer-arithmetic
|
-Warray-bounds-pointer-arithmetic
|
||||||
-Wassign-enum
|
-Wassign-enum
|
||||||
-Watomic-implicit-seq-cst
|
-Watomic-implicit-seq-cst
|
||||||
@ -251,20 +252,18 @@ else()
|
|||||||
message(FATAL_ERROR "Unsupported compiler!")
|
message(FATAL_ERROR "Unsupported compiler!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
${DISASM_DIRECTORY}/inc
|
${DISASM_DIRECTORY}/inc
|
||||||
${DISASM_DIRECTORY}/bddisasm/include
|
${DISASM_DIRECTORY}/bddisasm/include
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(${CMAKE_PROJECT_NAME} ${disasmtool_src_files})
|
|
||||||
|
|
||||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported(RESULT USE_IPO)
|
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()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${CMAKE_PROJECT_NAME}
|
set_target_properties(${PROJECT_NAME}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
CXX_STANDARD 17
|
CXX_STANDARD 17
|
||||||
@ -272,6 +271,11 @@ set_target_properties(${CMAKE_PROJECT_NAME}
|
|||||||
CXX_EXTENSIONS ON
|
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)
|
unset(DISASM_LIB CACHE)
|
||||||
|
Loading…
Reference in New Issue
Block a user