Merge branch 'master' into detections-improv

This commit is contained in:
Michal Bandzi 2018-02-05 16:19:40 +01:00
commit a20d6f666f
8 changed files with 48 additions and 49 deletions

View File

@ -2,6 +2,7 @@
# dev
* Enhancement: Build with `-std=c++14` instead of `-std=gnu++14` with GCC on Linux ([#76](https://github.com/avast-tl/retdec/issues/76)).
* Enhancement: Speeded up build by skipping compilation of unnecessary dependencies (e.g. unused LLVM libraries, tools, and examples).
* Enhancement: OpenSSL is now automatically built only if it is not found in your system.
* Enhancement: Added support for a system-wide installation ([#94](https://github.com/avast-tl/retdec/issues/94)).

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.6)
project(retdec C CXX)
# Set the default build type to 'Release'.
if (NOT CMAKE_BUILD_TYPE)
if(NOT CMAKE_BUILD_TYPE)
set(default_build_type "Release")
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
@ -13,6 +13,8 @@ option(RETDEC_TESTS "Build tests." OFF)
option(RETDEC_DEV_TOOLS "Build dev tools." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# On Linux and macOS, set RPATH relative to the origin of the installed
# executables (i.e. relative to the bin directory). This allows us to move the

View File

@ -1,7 +1,7 @@
# RetDec
[![Travis CI build status](https://travis-ci.org/avast-tl/retdec.svg?branch=master)](https://travis-ci.org/avast-tl/retdec)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/avast-tl/retdec?branch=master&svg=true)](https://ci.appveyor.com/project/avast-tl/retdec)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/avast-tl/retdec?branch=master&svg=true)](https://ci.appveyor.com/project/avast-tl/retdec?branch=master)
[RetDec](https://retdec.com/) is a retargetable machine-code decompiler based on [LLVM](https://llvm.org/).

View File

@ -11,7 +11,7 @@ if(CMAKE_CXX_COMPILER)
endif()
# Set the default build type to 'Release'
if (NOT CMAKE_BUILD_TYPE)
if(NOT CMAKE_BUILD_TYPE)
set(default_build_type "Release")
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
@ -155,7 +155,7 @@ if(UNIX)
target_link_libraries(llvm INTERFACE debug ${ZLIB_LIBRARIES} dl)
target_link_libraries(llvm INTERFACE optimized ${ZLIB_LIBRARIES} dl)
if (NOT APPLE)
if(NOT APPLE)
target_link_libraries(llvm INTERFACE debug rt tinfo)
target_link_libraries(llvm INTERFACE optimized rt tinfo)
else()

View File

@ -100,48 +100,44 @@ set(OPENSSL_CONFIGURE_OPTIONS
--openssldir=${OPENSSL_INSTALL_DIR}
)
if (NOT TARGET openssl)
ExternalProject_Add(openssl
PREFIX ${OPENSSL_PREFIX}
URL ${OPENSSL_URL}
URL_HASH SHA256=${OPENSSL_ARCHIVE_SHA256}
DOWNLOAD_NAME ${OPENSSL_DOWNLOAD_NAME}
CONFIGURE_COMMAND
${PERL_EXECUTABLE}
${OPENSSL_SRC_DIR}/Configure
${OPENSSL_CONFIGURE_OPTIONS}
${OPENSSL_CONFIGURE_ARCH}
BUILD_IN_SOURCE 1
BUILD_COMMAND
${OPENSSL_MAKE}
INSTALL_COMMAND
# Install only the software parts (libraries and includes), not
# e.g. documentation and manual pages.
${OPENSSL_MAKE} install_sw
LOG_DOWNLOAD 1
LOG_BUILD 1
LOG_CONFIGURE 1
LOG_INSTALL 1
)
ExternalProject_Add(openssl
PREFIX ${OPENSSL_PREFIX}
URL ${OPENSSL_URL}
URL_HASH SHA256=${OPENSSL_ARCHIVE_SHA256}
DOWNLOAD_NAME ${OPENSSL_DOWNLOAD_NAME}
CONFIGURE_COMMAND
${PERL_EXECUTABLE}
${OPENSSL_SRC_DIR}/Configure
${OPENSSL_CONFIGURE_OPTIONS}
${OPENSSL_CONFIGURE_ARCH}
BUILD_IN_SOURCE 1
BUILD_COMMAND
${OPENSSL_MAKE}
INSTALL_COMMAND
# Install only the software parts (libraries and includes), not
# e.g. documentation and manual pages.
${OPENSSL_MAKE} install_sw
LOG_DOWNLOAD 1
LOG_BUILD 1
LOG_CONFIGURE 1
LOG_INSTALL 1
)
set(OPENSSL_INCLUDES
"${OPENSSL_INSTALL_DIR}/include"
PARENT_SCOPE
)
set(OPENSSL_INCLUDES
"${OPENSSL_INSTALL_DIR}/include"
PARENT_SCOPE
)
set(OPENSSL_LIBRARIES
"${OPENSSL_INSTALL_DIR}/lib/libssl${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${OPENSSL_INSTALL_DIR}/lib/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}"
PARENT_SCOPE
)
add_library(openssl-crypto INTERFACE)
target_include_directories(openssl-crypto SYSTEM INTERFACE "${OPENSSL_INSTALL_DIR}/include")
target_link_libraries(openssl-crypto INTERFACE "${OPENSSL_INSTALL_DIR}/lib/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(MSVC)
target_link_libraries(openssl-crypto INTERFACE ws2_32 gdi32 advapi32 crypt32 user32)
endif()
add_dependencies(openssl-crypto openssl)
set(OPENSSL_LIBRARIES
"${OPENSSL_INSTALL_DIR}/lib/libssl${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${OPENSSL_INSTALL_DIR}/lib/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}"
PARENT_SCOPE
)
add_library(openssl-crypto INTERFACE)
target_include_directories(openssl-crypto SYSTEM INTERFACE "${OPENSSL_INSTALL_DIR}/include")
target_link_libraries(openssl-crypto INTERFACE "${OPENSSL_INSTALL_DIR}/lib/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(MSVC)
target_link_libraries(openssl-crypto INTERFACE ws2_32 gdi32 advapi32 crypt32 user32)
endif()
add_dependencies(openssl-crypto openssl)

View File

@ -1,7 +1,7 @@
find_package(Doxygen REQUIRED)
# Variables.
set(DOXYGEN_CFG_IN "doxygen.in")
set(DOXYGEN_CFG_IN "doxygen.cfg.in")
set(DOXYGEN_CFG "${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg")
set(DOXYGEN_LOG "${CMAKE_CURRENT_BINARY_DIR}/doxygen.log")
# The trailing '/' after html is significant.

View File

@ -2,7 +2,7 @@
## The following variables are use from CMake automatically:
## PROJECT_NAME = "@CMAKE_PROJECT_NAME@"
## OUTPUT_DIRECTORY = "@CMAKE_CURRENT_BINARY_DIR@"
##
##
## The following variables may be set via CMake configuration:
## WARNINGS = @DOXYGEN_WARNINGS@
## EXTRACT_PRIVATE = @DOXYGEN_EXTRACT_PRIVATE@

View File

@ -258,7 +258,7 @@ while true; do
shift 2;;
-f|--format) # Executable file format.
[ "$FORMAT" ] && print_error_and_die "Duplicate option: -f|--format"
[ "$2" != "elf" -a "$2" != "pe" -a "$2" != "ihex" -a "$2" != "macho" ] && print_error_and_die "Unsupported target format '$2'. Supported formats: ELF, PE, Intel HEX, Mach-O."
[ "$2" != "elf" -a "$2" != "pe" -a "$2" != "ihex" -a "$2" != "macho" ] && print_error_and_die "Unsupported target format '$2'. Supported formats: elf, pe, ihex, macho."
FORMAT="$2"
shift 2;;
-h|--help) # Help.
@ -759,7 +759,7 @@ if [ "$MODE" = "bin" ] || [ "$MODE" = "raw" ]; then
FILECLASS=$("$CONFIGTOOL" "$CONFIG" --read --file-class)
if [ "$FILECLASS" != "16" ] && [ "$FILECLASS" != "32" ]; then
cleanup
print_error_and_die "Unsupported target format '${FORMAT^^}$FILECLASS'. Supported formats: ELF32, PE32, Intel HEX 32."
print_error_and_die "Unsupported target format '${FORMAT^^}$FILECLASS'. Supported formats: ELF32, PE32, Intel HEX 32, Mach-O 32."
fi
# Set path to statically linked code signatures.