This should make integrating the project easier. CMake also works on Windows now.pull/40/head
parent
fccf11915d
commit
3495a7cc84
@ -1,172 +1,250 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/project-meta-info.in")
|
include(CMakePrintHelpers)
|
||||||
|
|
||||||
set(disasm_version_file ${CMAKE_CURRENT_LIST_DIR}/inc/version.h)
|
set(BDD_VER_FILE ${CMAKE_CURRENT_LIST_DIR}/inc/version.h)
|
||||||
|
|
||||||
file(STRINGS ${disasm_version_file} disasm_ver_major REGEX "DISASM_VERSION_MAJOR")
|
file(STRINGS ${BDD_VER_FILE} disasm_ver_major REGEX "DISASM_VERSION_MAJOR")
|
||||||
file(STRINGS ${disasm_version_file} disasm_ver_minor REGEX "DISASM_VERSION_MINOR")
|
file(STRINGS ${BDD_VER_FILE} disasm_ver_minor REGEX "DISASM_VERSION_MINOR")
|
||||||
file(STRINGS ${disasm_version_file} disasm_ver_patch REGEX "DISASM_VERSION_REVISION")
|
file(STRINGS ${BDD_VER_FILE} disasm_ver_patch REGEX "DISASM_VERSION_REVISION")
|
||||||
|
|
||||||
string(REGEX REPLACE "#define DISASM_VERSION_MAJOR[ \t\r\n]*" "" disasm_ver_major ${disasm_ver_major})
|
string(REGEX REPLACE "#define DISASM_VERSION_MAJOR[ \t\r\n]*" "" disasm_ver_major ${disasm_ver_major})
|
||||||
string(REGEX REPLACE "#define DISASM_VERSION_MINOR[ \t\r\n]*" "" disasm_ver_minor ${disasm_ver_minor})
|
string(REGEX REPLACE "#define DISASM_VERSION_MINOR[ \t\r\n]*" "" disasm_ver_minor ${disasm_ver_minor})
|
||||||
string(REGEX REPLACE "#define DISASM_VERSION_REVISION[ \t\r\n]*" "" disasm_ver_patch ${disasm_ver_patch})
|
string(REGEX REPLACE "#define DISASM_VERSION_REVISION[ \t\r\n]*" "" disasm_ver_patch ${disasm_ver_patch})
|
||||||
|
|
||||||
message(STATUS "Extracted version from ${disasm_version_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 ${project_description}
|
DESCRIPTION "Bitdefender x86 instruction decoder and emulator"
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
)
|
HOMEPAGE_URL https://github.com/bitdefender/bddisasm
|
||||||
|
)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE)
|
# 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)
|
||||||
message(STATUS "No build type given. Will use 'Release'")
|
message(STATUS "No build type given. Will use 'Release'")
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
# Set the possible values of build type for cmake-gui.
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# These are shared by bddisasm and bdshemu.
|
||||||
|
if (NOT MSVC)
|
||||||
|
set(BDDISASM_COMMON_COMPILE_OPTIONS
|
||||||
|
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
||||||
|
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
||||||
|
-Wall
|
||||||
|
-Wno-unknown-pragmas
|
||||||
|
-Wextra
|
||||||
|
-Wshadow
|
||||||
|
-Wformat-security
|
||||||
|
-Wstrict-overflow=2
|
||||||
|
-Wstrict-prototypes
|
||||||
|
-Wwrite-strings
|
||||||
|
-Wshadow
|
||||||
|
-Winit-self
|
||||||
|
-Wno-unused-function
|
||||||
|
-Wno-multichar
|
||||||
|
-Wno-incompatible-pointer-types
|
||||||
|
-Wno-discarded-qualifiers
|
||||||
|
-Wnull-dereference
|
||||||
|
-Wduplicated-cond
|
||||||
|
-Werror=format-security
|
||||||
|
-Werror=implicit-function-declaration
|
||||||
|
-pipe
|
||||||
|
-fwrapv
|
||||||
|
-fno-strict-aliasing
|
||||||
|
-fstack-protector-strong
|
||||||
|
-fno-omit-frame-pointer
|
||||||
|
-ffunction-sections
|
||||||
|
-fdata-sections
|
||||||
|
-g3
|
||||||
|
-gdwarf-4
|
||||||
|
-grecord-gcc-switches
|
||||||
|
-march=westmere
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
set(BDDISASM_COMMON_COMPILE_OPTIONS /W4 /WX)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/x64/${CMAKE_BUILD_TYPE})
|
set(BDDISASM_PUBLIC_HEADERS
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/x64/${CMAKE_BUILD_TYPE})
|
"inc/bddisasm.h"
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/x64/${CMAKE_BUILD_TYPE})
|
"inc/constants.h"
|
||||||
|
"inc/cpuidflags.h"
|
||||||
|
"inc/disasmstatus.h"
|
||||||
|
"inc/disasmtypes.h"
|
||||||
|
"inc/registers.h"
|
||||||
|
"inc/version.h"
|
||||||
|
)
|
||||||
|
|
||||||
message(STATUS "Output directory set to: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
|
cmake_print_variables(BDDISASM_PUBLIC_HEADERS)
|
||||||
|
cmake_print_variables(CMAKE_INSTALL_PREFIX)
|
||||||
|
|
||||||
set(bddisasm_src
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
set(BDDISASM_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/bddisasm"
|
||||||
|
CACHE STRING "Path to bddisasm public include files."
|
||||||
|
)
|
||||||
|
|
||||||
|
# -- bddisasm --
|
||||||
|
|
||||||
|
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_library(bddisasm STATIC ${bddisasm_src})
|
bddisasm/include/instructions.h
|
||||||
|
bddisasm/include/mnemonics.h
|
||||||
|
bddisasm/include/nd_crt.h
|
||||||
|
bddisasm/include/prefixes.h
|
||||||
|
bddisasm/include/table_evex.h
|
||||||
|
bddisasm/include/table_root.h
|
||||||
|
bddisasm/include/table_vex.h
|
||||||
|
bddisasm/include/table_xop.h
|
||||||
|
bddisasm/include/tabledefs.h
|
||||||
|
"${BDDISASM_PUBLIC_HEADERS}"
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(bddisasm PROPERTIES
|
set_target_properties(bddisasm PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
C_STANDARD 11
|
C_STANDARD 11
|
||||||
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_include_directories(bddisasm PRIVATE bddisasm/include)
|
||||||
|
target_include_directories(bddisasm PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||||
|
$<INSTALL_INTERFACE:${BDDISASM_INSTALL_INCLUDE_DIR}>
|
||||||
|
)
|
||||||
|
|
||||||
set(bdshemu_src
|
target_compile_options(bddisasm PRIVATE ${BDDISASM_COMMON_COMPILE_OPTIONS})
|
||||||
|
|
||||||
|
set_target_properties(bddisasm PROPERTIES
|
||||||
|
PUBLIC_HEADER "${BDDISASM_PUBLIC_HEADERS}"
|
||||||
|
VERSION ${CMAKE_PROJECT_VERSION}
|
||||||
|
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(bddisasm::bddisasm ALIAS bddisasm)
|
||||||
|
|
||||||
|
# -- bdshemu --
|
||||||
|
|
||||||
|
add_library(bdshemu STATIC
|
||||||
bdshemu/bdshemu.c
|
bdshemu/bdshemu.c
|
||||||
)
|
# Add the headers so they will show up in IDEs.
|
||||||
add_library(bdshemu STATIC ${bdshemu_src})
|
inc/bdshemu.h
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(bdshemu PROPERTIES
|
set_target_properties(bdshemu PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
C_STANDARD 11
|
C_STANDARD 11
|
||||||
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
||||||
)
|
)
|
||||||
add_dependencies(bdshemu bddisasm)
|
|
||||||
|
|
||||||
include_directories(
|
|
||||||
inc
|
|
||||||
bddisasm/include
|
|
||||||
)
|
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE EQUAL "Release")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Ofast -DNDEBUG")
|
|
||||||
else ()
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -D_DEBUG -DDEBUG")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(BDDISASM_COMPILE_OPTIONS
|
|
||||||
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
|
|
||||||
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
|
|
||||||
-Wall
|
|
||||||
-Wno-unknown-pragmas
|
|
||||||
-Wextra
|
|
||||||
-Wshadow
|
|
||||||
-Wformat-security
|
|
||||||
-Wstrict-overflow=2
|
|
||||||
-Wstrict-prototypes
|
|
||||||
-Wwrite-strings
|
|
||||||
-Wshadow
|
|
||||||
-Winit-self
|
|
||||||
-Wno-unused-function
|
|
||||||
-Wno-multichar
|
|
||||||
-Wno-incompatible-pointer-types
|
|
||||||
-Wno-discarded-qualifiers
|
|
||||||
-Wnull-dereference
|
|
||||||
-Wduplicated-cond
|
|
||||||
-Werror=format-security
|
|
||||||
-Werror=implicit-function-declaration
|
|
||||||
-pipe
|
|
||||||
-fwrapv
|
|
||||||
-fno-strict-aliasing
|
|
||||||
-fstack-protector-strong
|
|
||||||
-fno-omit-frame-pointer
|
|
||||||
-ffunction-sections
|
|
||||||
-fdata-sections
|
|
||||||
-g3
|
|
||||||
-gdwarf-4
|
|
||||||
-grecord-gcc-switches
|
|
||||||
-march=westmere
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(bddisasm PRIVATE ${BDDISASM_COMPILE_OPTIONS})
|
target_include_directories(bdshemu PRIVATE bddisasm/include)
|
||||||
target_compile_options(bdshemu PRIVATE ${BDDISASM_COMPILE_OPTIONS} -maes)
|
target_include_directories(bddisasm PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||||
|
$<INSTALL_INTERFACE:${BDDISASM_INSTALL_INCLUDE_DIR}>
|
||||||
|
)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
target_link_libraries(bdshemu PUBLIC bddisasm)
|
||||||
|
|
||||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
target_compile_options(bdshemu PRIVATE ${BDDISASM_COMMON_COMPILE_OPTIONS})
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
if (NOT MSVC)
|
||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
target_compile_options(bdshemu PRIVATE -maes)
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
endif ()
|
||||||
|
|
||||||
get_filename_component(public_header_path "${PROJECT_SOURCE_DIR}/inc" REALPATH)
|
set_target_properties(bdshemu PROPERTIES
|
||||||
file(GLOB_RECURSE public_headers "${public_header_path}/*.h")
|
PUBLIC_HEADER "inc/bdshemu.h"
|
||||||
set_target_properties(bddisasm PROPERTIES PUBLIC_HEADER "${public_headers}")
|
VERSION ${CMAKE_PROJECT_VERSION}
|
||||||
|
SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(bddisasm::bdshemu ALIAS bdshemu)
|
||||||
|
|
||||||
|
# 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 (WIN32)
|
||||||
|
add_subdirectory(disasmtool)
|
||||||
|
else ()
|
||||||
|
add_subdirectory(disasmtool_lix)
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(DEST_DIR "${CMAKE_INSTALL_PREFIX}")
|
# If this is the master project add install and package targets.
|
||||||
set(LIB_DIR "${CMAKE_INSTALL_LIBDIR}")
|
if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
|
||||||
set(INC_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
set(BDDISASM_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/bddisasm"
|
||||||
set(PRIVATE_LIBS "-lbdshemu -lbddisasm")
|
CACHE STRING "Path to bddisasm cmake files."
|
||||||
set(DATA_DIR "${CMAKE_INSTALL_DATADIR}")
|
)
|
||||||
|
|
||||||
CONFIGURE_FILE("${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc.in"
|
set(BDDISASM_INSTALL_PCDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
||||||
"${PROJECT_SOURCE_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc"
|
CACHE STRING "Path to bddisasm pkgconfig files."
|
||||||
@ONLY
|
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(TARGETS bddisasm bdshemu
|
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||||
EXPORT bddisasmTargets
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/bddisasm"
|
|
||||||
|
install(TARGETS bddisasm bdshemu disasmtool
|
||||||
|
EXPORT bddisasmTargets
|
||||||
|
INCLUDES
|
||||||
|
DESTINATION ${BDDISASM_INSTALL_INCLUDE_DIR}
|
||||||
|
PUBLIC_HEADER
|
||||||
|
DESTINATION ${BDDISASM_INSTALL_INCLUDE_DIR}
|
||||||
|
COMPONENT bddisasm_Development
|
||||||
|
RUNTIME
|
||||||
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
COMPONENT bddisasm_Runtime
|
||||||
|
LIBRARY
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
COMPONENT bddisasm_Runtime
|
||||||
|
NAMELINK_COMPONENT bddisasm_Development
|
||||||
|
ARCHIVE
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
COMPONENT bddisasm_Development
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/bddisasm)
|
install(EXPORT bddisasmTargets
|
||||||
install(EXPORT bddisasmTargets
|
DESTINATION ${BDDISASM_INSTALL_CMAKEDIR}
|
||||||
DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
|
NAMESPACE bddisasm::
|
||||||
|
FILE bddisasmTargets.cmake
|
||||||
|
COMPONENT bddisasm_Development
|
||||||
)
|
)
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
configure_package_config_file(${PROJECT_SOURCE_DIR}/bddisasmConfig.cmake.in ${PROJECT_BINARY_DIR}/bddisasmConfig.cmake
|
write_basic_package_version_file("bddisasmConfigVersion.cmake"
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
|
VERSION ${CMAKE_PROJECT_VERSION}
|
||||||
PATH_VARS CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR
|
COMPATIBILITY SameMajorVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
write_basic_package_version_file(${PROJECT_BINARY_DIR}/bddisasmConfigVersion.cmake
|
install(FILES bddisasmConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/bddisasmConfigVersion.cmake
|
||||||
VERSION ${PROJECT_VERSION}
|
DESTINATION ${BDDISASM_INSTALL_CMAKEDIR}
|
||||||
COMPATIBILITY SameMajorVersion
|
COMPONENT bddisasm_Development
|
||||||
)
|
)
|
||||||
|
|
||||||
install(FILES ${PROJECT_BINARY_DIR}/bddisasmConfig.cmake ${PROJECT_BINARY_DIR}/bddisasmConfigVersion.cmake
|
CONFIGURE_FILE("bddisasm.pc.in" "${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc" @ONLY)
|
||||||
DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
INSTALL(FILES "${PROJECT_SOURCE_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc"
|
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}bddisasm.pc"
|
||||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
DESTINATION "${BDDISASM_INSTALL_PCDIR}"
|
||||||
|
COMPONENT bddisasm_Development
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT CPACK_GENERATOR)
|
set(CPACK_PACKAGE_VENDOR "Bitdefender")
|
||||||
set(CPACK_GENERATOR "DEB")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bitdefender HVI Team <hvmi-oss@bitdefender.com>")
|
if (NOT CPACK_GENERATOR)
|
||||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
|
if (NOT WIN32)
|
||||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
|
set(CPACK_GENERATOR "DEB")
|
||||||
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
else ()
|
||||||
|
set(CPACK_GENERATOR "ZIP")
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
|
||||||
if (INCLUDE_TOOL)
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bitdefender HVI Team <hvmi-oss@bitdefender.com>")
|
||||||
add_subdirectory("disasmtool_lix")
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
|
||||||
add_dependencies(disasmtool bdshemu)
|
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
|
||||||
endif()
|
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
endif ()
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/bddisasmTargets.cmake)
|
@ -0,0 +1,59 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
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 .
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
message(STATUS "No build type given. Will use 'Release'")
|
||||||
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
# Set the possible values of build type for cmake-gui.
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(disasmtool disasmtool.c)
|
||||||
|
target_link_libraries(disasmtool PRIVATE bddisasm::bddisasm bddisasm::bdshemu)
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
target_compile_options(disasmtool PRIVATE
|
||||||
|
-Wall
|
||||||
|
-Wno-unknown-pragmas
|
||||||
|
-Wextra
|
||||||
|
-Wshadow
|
||||||
|
-Wformat-security
|
||||||
|
-Wstrict-overflow=2
|
||||||
|
-Wstrict-prototypes
|
||||||
|
-Wwrite-strings
|
||||||
|
-Wshadow
|
||||||
|
-Winit-self
|
||||||
|
-Wno-unused-function
|
||||||
|
-Wno-multichar
|
||||||
|
-Wno-incompatible-pointer-types
|
||||||
|
-Wno-discarded-qualifiers
|
||||||
|
-Wnull-dereference
|
||||||
|
-Wduplicated-cond
|
||||||
|
-Werror=format-security
|
||||||
|
-Werror=implicit-function-declaration
|
||||||
|
-pipe
|
||||||
|
-fwrapv
|
||||||
|
-fno-strict-aliasing
|
||||||
|
-fstack-protector-strong
|
||||||
|
-fno-omit-frame-pointer
|
||||||
|
-ffunction-sections
|
||||||
|
-fdata-sections
|
||||||
|
-g3
|
||||||
|
-gdwarf-4
|
||||||
|
-grecord-gcc-switches
|
||||||
|
-march=westmere
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
target_compile_options(disasmtool PRIVATE
|
||||||
|
/W4 /WX)
|
||||||
|
endif ()
|
@ -1,3 +0,0 @@
|
|||||||
# project-meta-info.in
|
|
||||||
|
|
||||||
set(project_description "Bitdefender x86 instruction decoder and emulator")
|
|
Loading…
Reference in new issue