mirror of
https://github.com/bitdefender/bddisasm.git
synced 2025-01-03 11:50:55 +00:00
cmake: Format the cmake scripts
This commit is contained in:
parent
3495a7cc84
commit
283c00b4c7
179
CMakeLists.txt
179
CMakeLists.txt
@ -14,23 +14,25 @@ string(REGEX REPLACE "#define DISASM_VERSION_REVISION[ \t\r\n]*" "" disasm_ver_p
|
|||||||
|
|
||||||
message(STATUS "Extracted version from ${BDD_VER_FILE}: ${disasm_ver_major}.${disasm_ver_minor}.${disasm_ver_patch}")
|
message(STATUS "Extracted version from ${BDD_VER_FILE}: ${disasm_ver_major}.${disasm_ver_minor}.${disasm_ver_patch}")
|
||||||
|
|
||||||
project(bddisasm
|
project(
|
||||||
|
bddisasm
|
||||||
VERSION ${disasm_ver_major}.${disasm_ver_minor}.${disasm_ver_patch}
|
VERSION ${disasm_ver_major}.${disasm_ver_minor}.${disasm_ver_patch}
|
||||||
DESCRIPTION "Bitdefender x86 instruction decoder and emulator"
|
DESCRIPTION "Bitdefender x86 instruction decoder and emulator"
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
HOMEPAGE_URL https://github.com/bitdefender/bddisasm
|
HOMEPAGE_URL https://github.com/bitdefender/bddisasm)
|
||||||
)
|
|
||||||
|
|
||||||
# Use Release as the build type if no build type was specified and we're not using a multi-config generator .
|
# Use Release as the build type if no build type was specified and we're not using a multi-config generator .
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
message(STATUS "No build type given. Will use 'Release'")
|
message(STATUS "No build type given. Will use 'Release'")
|
||||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
set(CMAKE_BUILD_TYPE
|
||||||
|
"Release"
|
||||||
|
CACHE STRING "Choose the type of build." FORCE)
|
||||||
# Set the possible values of build type for cmake-gui.
|
# Set the possible values of build type for cmake-gui.
|
||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# These are shared by bddisasm and bdshemu.
|
# These are shared by bddisasm and bdshemu.
|
||||||
if (NOT MSVC)
|
if(NOT MSVC)
|
||||||
set(BDDISASM_COMMON_COMPILE_OPTIONS
|
set(BDDISASM_COMMON_COMPILE_OPTIONS
|
||||||
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
||||||
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
||||||
@ -62,11 +64,10 @@ if (NOT MSVC)
|
|||||||
-g3
|
-g3
|
||||||
-gdwarf-4
|
-gdwarf-4
|
||||||
-grecord-gcc-switches
|
-grecord-gcc-switches
|
||||||
-march=westmere
|
-march=westmere)
|
||||||
)
|
else()
|
||||||
else ()
|
|
||||||
set(BDDISASM_COMMON_COMPILE_OPTIONS /W4 /WX)
|
set(BDDISASM_COMMON_COMPILE_OPTIONS /W4 /WX)
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
set(BDDISASM_PUBLIC_HEADERS
|
set(BDDISASM_PUBLIC_HEADERS
|
||||||
"inc/bddisasm.h"
|
"inc/bddisasm.h"
|
||||||
@ -75,21 +76,21 @@ set(BDDISASM_PUBLIC_HEADERS
|
|||||||
"inc/disasmstatus.h"
|
"inc/disasmstatus.h"
|
||||||
"inc/disasmtypes.h"
|
"inc/disasmtypes.h"
|
||||||
"inc/registers.h"
|
"inc/registers.h"
|
||||||
"inc/version.h"
|
"inc/version.h")
|
||||||
)
|
|
||||||
|
|
||||||
cmake_print_variables(BDDISASM_PUBLIC_HEADERS)
|
cmake_print_variables(BDDISASM_PUBLIC_HEADERS)
|
||||||
cmake_print_variables(CMAKE_INSTALL_PREFIX)
|
cmake_print_variables(CMAKE_INSTALL_PREFIX)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
set(BDDISASM_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/bddisasm"
|
set(BDDISASM_INSTALL_INCLUDE_DIR
|
||||||
CACHE STRING "Path to bddisasm public include files."
|
"${CMAKE_INSTALL_INCLUDEDIR}/bddisasm"
|
||||||
)
|
CACHE STRING "Path to bddisasm public include files.")
|
||||||
|
|
||||||
# -- bddisasm --
|
# -- bddisasm --
|
||||||
|
|
||||||
add_library(bddisasm STATIC
|
add_library(
|
||||||
|
bddisasm STATIC
|
||||||
bddisasm/crt.c
|
bddisasm/crt.c
|
||||||
bddisasm/bddisasm.c
|
bddisasm/bddisasm.c
|
||||||
# Add the headers so they will show up in IDEs.
|
# Add the headers so they will show up in IDEs.
|
||||||
@ -102,143 +103,131 @@ add_library(bddisasm STATIC
|
|||||||
bddisasm/include/table_vex.h
|
bddisasm/include/table_vex.h
|
||||||
bddisasm/include/table_xop.h
|
bddisasm/include/table_xop.h
|
||||||
bddisasm/include/tabledefs.h
|
bddisasm/include/tabledefs.h
|
||||||
"${BDDISASM_PUBLIC_HEADERS}"
|
"${BDDISASM_PUBLIC_HEADERS}")
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(bddisasm PROPERTIES
|
set_target_properties(
|
||||||
POSITION_INDEPENDENT_CODE ON
|
bddisasm
|
||||||
C_STANDARD 11
|
PROPERTIES POSITION_INDEPENDENT_CODE ON
|
||||||
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
C_STANDARD 11
|
||||||
)
|
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
target_include_directories(bddisasm PRIVATE bddisasm/include)
|
target_include_directories(bddisasm PRIVATE bddisasm/include)
|
||||||
target_include_directories(bddisasm PUBLIC
|
target_include_directories(bddisasm PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
$<INSTALL_INTERFACE:${BDDISASM_INSTALL_INCLUDE_DIR}>)
|
||||||
$<INSTALL_INTERFACE:${BDDISASM_INSTALL_INCLUDE_DIR}>
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(bddisasm PRIVATE ${BDDISASM_COMMON_COMPILE_OPTIONS})
|
target_compile_options(bddisasm PRIVATE ${BDDISASM_COMMON_COMPILE_OPTIONS})
|
||||||
|
|
||||||
set_target_properties(bddisasm PROPERTIES
|
set_target_properties(
|
||||||
PUBLIC_HEADER "${BDDISASM_PUBLIC_HEADERS}"
|
bddisasm
|
||||||
VERSION ${CMAKE_PROJECT_VERSION}
|
PROPERTIES PUBLIC_HEADER "${BDDISASM_PUBLIC_HEADERS}"
|
||||||
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
|
VERSION ${CMAKE_PROJECT_VERSION}
|
||||||
)
|
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR})
|
||||||
|
|
||||||
add_library(bddisasm::bddisasm ALIAS bddisasm)
|
add_library(bddisasm::bddisasm ALIAS bddisasm)
|
||||||
|
|
||||||
# -- bdshemu --
|
# -- bdshemu --
|
||||||
|
|
||||||
add_library(bdshemu STATIC
|
add_library(
|
||||||
|
bdshemu STATIC
|
||||||
bdshemu/bdshemu.c
|
bdshemu/bdshemu.c
|
||||||
# Add the headers so they will show up in IDEs.
|
# Add the headers so they will show up in IDEs.
|
||||||
inc/bdshemu.h
|
inc/bdshemu.h)
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(bdshemu PROPERTIES
|
set_target_properties(
|
||||||
POSITION_INDEPENDENT_CODE ON
|
bdshemu
|
||||||
C_STANDARD 11
|
PROPERTIES POSITION_INDEPENDENT_CODE ON
|
||||||
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
C_STANDARD 11
|
||||||
)
|
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
target_include_directories(bdshemu PRIVATE bddisasm/include)
|
target_include_directories(bdshemu PRIVATE bddisasm/include)
|
||||||
target_include_directories(bddisasm PUBLIC
|
target_include_directories(bddisasm PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
$<INSTALL_INTERFACE:${BDDISASM_INSTALL_INCLUDE_DIR}>)
|
||||||
$<INSTALL_INTERFACE:${BDDISASM_INSTALL_INCLUDE_DIR}>
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(bdshemu PUBLIC bddisasm)
|
target_link_libraries(bdshemu PUBLIC bddisasm)
|
||||||
|
|
||||||
target_compile_options(bdshemu PRIVATE ${BDDISASM_COMMON_COMPILE_OPTIONS})
|
target_compile_options(bdshemu PRIVATE ${BDDISASM_COMMON_COMPILE_OPTIONS})
|
||||||
if (NOT MSVC)
|
if(NOT MSVC)
|
||||||
target_compile_options(bdshemu PRIVATE -maes)
|
target_compile_options(bdshemu PRIVATE -maes)
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
set_target_properties(bdshemu PROPERTIES
|
set_target_properties(
|
||||||
PUBLIC_HEADER "inc/bdshemu.h"
|
bdshemu
|
||||||
VERSION ${CMAKE_PROJECT_VERSION}
|
PROPERTIES PUBLIC_HEADER "inc/bdshemu.h"
|
||||||
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
|
VERSION ${CMAKE_PROJECT_VERSION}
|
||||||
)
|
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR})
|
||||||
|
|
||||||
add_library(bddisasm::bdshemu ALIAS bdshemu)
|
add_library(bddisasm::bdshemu ALIAS bdshemu)
|
||||||
|
|
||||||
# If this is the master project (or if the user requested it) add disasmtool.
|
# If this is the master project (or if the user requested it) add disasmtool.
|
||||||
if ((${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) OR BDD_INCLUDE_TOOL)
|
if((${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) OR BDD_INCLUDE_TOOL)
|
||||||
if (WIN32)
|
if(WIN32)
|
||||||
add_subdirectory(disasmtool)
|
add_subdirectory(disasmtool)
|
||||||
else ()
|
else()
|
||||||
add_subdirectory(disasmtool_lix)
|
add_subdirectory(disasmtool_lix)
|
||||||
endif ()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If this is the master project add install and package targets.
|
# If this is the master project add install and package targets.
|
||||||
if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
|
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
|
||||||
set(BDDISASM_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/bddisasm"
|
set(BDDISASM_INSTALL_CMAKEDIR
|
||||||
CACHE STRING "Path to bddisasm cmake files."
|
"${CMAKE_INSTALL_LIBDIR}/cmake/bddisasm"
|
||||||
)
|
CACHE STRING "Path to bddisasm cmake files.")
|
||||||
|
|
||||||
set(BDDISASM_INSTALL_PCDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
set(BDDISASM_INSTALL_PCDIR
|
||||||
CACHE STRING "Path to bddisasm pkgconfig files."
|
"${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
||||||
)
|
CACHE STRING "Path to bddisasm pkgconfig files.")
|
||||||
|
|
||||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
install(TARGETS bddisasm bdshemu disasmtool
|
install(
|
||||||
|
TARGETS bddisasm bdshemu disasmtool
|
||||||
EXPORT bddisasmTargets
|
EXPORT bddisasmTargets
|
||||||
INCLUDES
|
INCLUDES
|
||||||
DESTINATION ${BDDISASM_INSTALL_INCLUDE_DIR}
|
DESTINATION ${BDDISASM_INSTALL_INCLUDE_DIR}
|
||||||
PUBLIC_HEADER
|
PUBLIC_HEADER DESTINATION ${BDDISASM_INSTALL_INCLUDE_DIR} COMPONENT bddisasm_Development
|
||||||
DESTINATION ${BDDISASM_INSTALL_INCLUDE_DIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT bddisasm_Runtime
|
||||||
COMPONENT bddisasm_Development
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
RUNTIME
|
COMPONENT bddisasm_Runtime
|
||||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
NAMELINK_COMPONENT bddisasm_Development
|
||||||
COMPONENT bddisasm_Runtime
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bddisasm_Development)
|
||||||
LIBRARY
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
COMPONENT bddisasm_Runtime
|
|
||||||
NAMELINK_COMPONENT bddisasm_Development
|
|
||||||
ARCHIVE
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
COMPONENT bddisasm_Development
|
|
||||||
)
|
|
||||||
|
|
||||||
install(EXPORT bddisasmTargets
|
install(
|
||||||
|
EXPORT bddisasmTargets
|
||||||
DESTINATION ${BDDISASM_INSTALL_CMAKEDIR}
|
DESTINATION ${BDDISASM_INSTALL_CMAKEDIR}
|
||||||
NAMESPACE bddisasm::
|
NAMESPACE bddisasm::
|
||||||
FILE bddisasmTargets.cmake
|
FILE bddisasmTargets.cmake
|
||||||
COMPONENT bddisasm_Development
|
COMPONENT bddisasm_Development)
|
||||||
)
|
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
write_basic_package_version_file("bddisasmConfigVersion.cmake"
|
write_basic_package_version_file(
|
||||||
|
"bddisasmConfigVersion.cmake"
|
||||||
VERSION ${CMAKE_PROJECT_VERSION}
|
VERSION ${CMAKE_PROJECT_VERSION}
|
||||||
COMPATIBILITY SameMajorVersion
|
COMPATIBILITY SameMajorVersion)
|
||||||
)
|
|
||||||
|
|
||||||
install(FILES bddisasmConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/bddisasmConfigVersion.cmake
|
install(
|
||||||
|
FILES bddisasmConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/bddisasmConfigVersion.cmake
|
||||||
DESTINATION ${BDDISASM_INSTALL_CMAKEDIR}
|
DESTINATION ${BDDISASM_INSTALL_CMAKEDIR}
|
||||||
COMPONENT bddisasm_Development
|
COMPONENT bddisasm_Development)
|
||||||
)
|
|
||||||
|
|
||||||
CONFIGURE_FILE("bddisasm.pc.in" "${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc" @ONLY)
|
configure_file("bddisasm.pc.in" "${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc" @ONLY)
|
||||||
|
|
||||||
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc"
|
install(
|
||||||
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc"
|
||||||
DESTINATION "${BDDISASM_INSTALL_PCDIR}"
|
DESTINATION "${BDDISASM_INSTALL_PCDIR}"
|
||||||
COMPONENT bddisasm_Development
|
COMPONENT bddisasm_Development)
|
||||||
)
|
|
||||||
|
|
||||||
set(CPACK_PACKAGE_VENDOR "Bitdefender")
|
set(CPACK_PACKAGE_VENDOR "Bitdefender")
|
||||||
|
|
||||||
if (NOT CPACK_GENERATOR)
|
if(NOT CPACK_GENERATOR)
|
||||||
if (NOT WIN32)
|
if(NOT WIN32)
|
||||||
set(CPACK_GENERATOR "DEB")
|
set(CPACK_GENERATOR "DEB")
|
||||||
else ()
|
else()
|
||||||
set(CPACK_GENERATOR "ZIP")
|
set(CPACK_GENERATOR "ZIP")
|
||||||
endif ()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bitdefender HVI Team <hvmi-oss@bitdefender.com>")
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bitdefender HVI Team <hvmi-oss@bitdefender.com>")
|
||||||
@ -247,4 +236,4 @@ if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
|
|||||||
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
endif ()
|
endif()
|
||||||
|
@ -5,7 +5,9 @@ project(disasmtool LANGUAGES C)
|
|||||||
# Use Release as the build type if no build type was specified and we're not using a multi-config generator .
|
# Use Release as the build type if no build type was specified and we're not using a multi-config generator .
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
message(STATUS "No build type given. Will use 'Release'")
|
message(STATUS "No build type given. Will use 'Release'")
|
||||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
set(CMAKE_BUILD_TYPE
|
||||||
|
"Release"
|
||||||
|
CACHE STRING "Choose the type of build." FORCE)
|
||||||
# Set the possible values of build type for cmake-gui.
|
# Set the possible values of build type for cmake-gui.
|
||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||||
endif()
|
endif()
|
||||||
@ -13,47 +15,46 @@ endif()
|
|||||||
add_executable(disasmtool disasmtool.c)
|
add_executable(disasmtool disasmtool.c)
|
||||||
target_link_libraries(disasmtool PRIVATE bddisasm::bddisasm bddisasm::bdshemu)
|
target_link_libraries(disasmtool PRIVATE bddisasm::bddisasm bddisasm::bdshemu)
|
||||||
|
|
||||||
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)
|
||||||
if (USE_IPO)
|
if(USE_IPO)
|
||||||
set_target_properties(bddisasm PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
set_target_properties(bddisasm PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
||||||
endif ()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT MSVC)
|
if(NOT MSVC)
|
||||||
target_compile_options(disasmtool PRIVATE
|
target_compile_options(
|
||||||
-Wall
|
disasmtool
|
||||||
-Wno-unknown-pragmas
|
PRIVATE -Wall
|
||||||
-Wextra
|
-Wno-unknown-pragmas
|
||||||
-Wshadow
|
-Wextra
|
||||||
-Wformat-security
|
-Wshadow
|
||||||
-Wstrict-overflow=2
|
-Wformat-security
|
||||||
-Wstrict-prototypes
|
-Wstrict-overflow=2
|
||||||
-Wwrite-strings
|
-Wstrict-prototypes
|
||||||
-Wshadow
|
-Wwrite-strings
|
||||||
-Winit-self
|
-Wshadow
|
||||||
-Wno-unused-function
|
-Winit-self
|
||||||
-Wno-multichar
|
-Wno-unused-function
|
||||||
-Wno-incompatible-pointer-types
|
-Wno-multichar
|
||||||
-Wno-discarded-qualifiers
|
-Wno-incompatible-pointer-types
|
||||||
-Wnull-dereference
|
-Wno-discarded-qualifiers
|
||||||
-Wduplicated-cond
|
-Wnull-dereference
|
||||||
-Werror=format-security
|
-Wduplicated-cond
|
||||||
-Werror=implicit-function-declaration
|
-Werror=format-security
|
||||||
-pipe
|
-Werror=implicit-function-declaration
|
||||||
-fwrapv
|
-pipe
|
||||||
-fno-strict-aliasing
|
-fwrapv
|
||||||
-fstack-protector-strong
|
-fno-strict-aliasing
|
||||||
-fno-omit-frame-pointer
|
-fstack-protector-strong
|
||||||
-ffunction-sections
|
-fno-omit-frame-pointer
|
||||||
-fdata-sections
|
-ffunction-sections
|
||||||
-g3
|
-fdata-sections
|
||||||
-gdwarf-4
|
-g3
|
||||||
-grecord-gcc-switches
|
-gdwarf-4
|
||||||
-march=westmere
|
-grecord-gcc-switches
|
||||||
)
|
-march=westmere)
|
||||||
else ()
|
else()
|
||||||
target_compile_options(disasmtool PRIVATE
|
target_compile_options(disasmtool PRIVATE /W4 /WX)
|
||||||
/W4 /WX)
|
endif()
|
||||||
endif ()
|
|
||||||
|
@ -1,65 +1,66 @@
|
|||||||
cmake_minimum_required (VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project(disasmtool LANGUAGES CXX)
|
project(disasmtool LANGUAGES CXX)
|
||||||
|
|
||||||
# Use Release as the build type if no build type was specified and we're not using a multi-config generator .
|
# Use Release as the build type if no build type was specified and we're not using a multi-config generator .
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
message(STATUS "No build type given. Will use 'Release'")
|
message(STATUS "No build type given. Will use 'Release'")
|
||||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
set(CMAKE_BUILD_TYPE
|
||||||
|
"Release"
|
||||||
|
CACHE STRING "Choose the type of build." FORCE)
|
||||||
# Set the possible values of build type for cmake-gui.
|
# Set the possible values of build type for cmake-gui.
|
||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(disasmtool disasmtool.cpp dumpers.cpp)
|
add_executable(disasmtool disasmtool.cpp dumpers.cpp)
|
||||||
|
|
||||||
target_compile_options(disasmtool PRIVATE
|
target_compile_options(
|
||||||
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
disasmtool
|
||||||
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
PRIVATE "$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
||||||
-Wall
|
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
||||||
-Wextra
|
-Wall
|
||||||
-Wshadow
|
-Wextra
|
||||||
-Wformat-security
|
-Wshadow
|
||||||
-Wstrict-overflow=2
|
-Wformat-security
|
||||||
-Wno-unused-function
|
-Wstrict-overflow=2
|
||||||
-Wno-multichar
|
-Wno-unused-function
|
||||||
-Werror=format-security
|
-Wno-multichar
|
||||||
-pipe
|
-Werror=format-security
|
||||||
-fpie
|
-pipe
|
||||||
-fwrapv
|
-fpie
|
||||||
-fno-strict-aliasing
|
-fwrapv
|
||||||
-fstack-protector-strong
|
-fno-strict-aliasing
|
||||||
-ffunction-sections
|
-fstack-protector-strong
|
||||||
-fdata-sections
|
-ffunction-sections
|
||||||
-g3
|
-fdata-sections
|
||||||
-gdwarf-4
|
-g3
|
||||||
-grecord-gcc-switches
|
-gdwarf-4
|
||||||
-march=nehalem
|
-grecord-gcc-switches
|
||||||
-fno-omit-frame-pointer
|
-march=nehalem
|
||||||
)
|
-fno-omit-frame-pointer)
|
||||||
|
|
||||||
# find_package(bddisasm REQUIRED)
|
# find_package(bddisasm REQUIRED)
|
||||||
find_package(RapidJSON QUIET)
|
find_package(RapidJSON QUIET)
|
||||||
|
|
||||||
target_link_libraries(disasmtool PRIVATE bddisasm::bddisasm bddisasm::bdshemu)
|
target_link_libraries(disasmtool PRIVATE bddisasm::bddisasm bddisasm::bdshemu)
|
||||||
if (RapidJSON_FOUND)
|
if(RapidJSON_FOUND)
|
||||||
# :( https://github.com/satishbabariya/modern-cmake#good-boys-export-their-targets
|
# :( https://github.com/satishbabariya/modern-cmake#good-boys-export-their-targets
|
||||||
target_include_directories(disasmtool PRIVATE ${RapidJSON_INCLUDE_DIRS})
|
target_include_directories(disasmtool PRIVATE ${RapidJSON_INCLUDE_DIRS})
|
||||||
target_sources(disasmtool PRIVATE rapidjson.cpp)
|
target_sources(disasmtool PRIVATE rapidjson.cpp)
|
||||||
target_compile_definitions(disasmtool PRIVATE HAS_RAPIDJSON)
|
target_compile_definitions(disasmtool PRIVATE HAS_RAPIDJSON)
|
||||||
endif ()
|
|
||||||
|
|
||||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
|
||||||
include(CheckIPOSupported)
|
|
||||||
check_ipo_supported(RESULT USE_IPO)
|
|
||||||
if (USE_IPO)
|
|
||||||
set_target_properties(bddisasm PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
|
||||||
endif ()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(disasmtool
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||||
PROPERTIES
|
include(CheckIPOSupported)
|
||||||
POSITION_INDEPENDENT_CODE ON
|
check_ipo_supported(RESULT USE_IPO)
|
||||||
CXX_STANDARD 17
|
if(USE_IPO)
|
||||||
CXX_STANDARD_REQUIRED ON
|
set_target_properties(bddisasm PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
||||||
CXX_EXTENSIONS ON
|
endif()
|
||||||
)
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(
|
||||||
|
disasmtool
|
||||||
|
PROPERTIES POSITION_INDEPENDENT_CODE ON
|
||||||
|
CXX_STANDARD 17
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
|
CXX_EXTENSIONS ON)
|
||||||
|
Loading…
Reference in New Issue
Block a user