retdec/deps/capstone/CMakeLists.txt

143 lines
4.3 KiB
CMake
Raw Normal View History

2020-07-27 13:25:51 +00:00
set(CAPSTONE_INSTALL_DIR ${CMAKE_BINARY_DIR}/deps/install/capstone)
set(CAPSTONE_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}capstone${CMAKE_STATIC_LIBRARY_SUFFIX})
set(CAPSTONE_LIB_PNAME ${CMAKE_STATIC_LIBRARY_PREFIX}retdec-capstone${CMAKE_STATIC_LIBRARY_SUFFIX})
set(CAPSTONE_LIB ${CAPSTONE_INSTALL_DIR}/lib/${CAPSTONE_LIB_NAME})
2020-07-27 13:25:51 +00:00
if(CAPSTONE_LOCAL_DIR)
message(STATUS "Capstone: using local Capstone directory.")
2020-07-27 13:25:51 +00:00
set(CAPSTONE_SOURCE_DIR "${CAPSTONE_LOCAL_DIR}")
set(_CAPSTONE_URL "")
else()
message(STATUS "Capstone: using remote Capstone revision.")
2020-07-27 13:25:51 +00:00
set(CAPSTONE_SOURCE_DIR "")
set(_CAPSTONE_URL "${CAPSTONE_URL}")
endif()
2020-07-27 13:25:51 +00:00
ExternalProject_Add(capstone-project
SOURCE_DIR ${CAPSTONE_SOURCE_DIR}
URL ${_CAPSTONE_URL}
URL_HASH SHA256=${CAPSTONE_ARCHIVE_SHA256}
DOWNLOAD_NAME capstone.zip
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CAPSTONE_INSTALL_DIR}
# This does not work on MSVC, but may be useful on Linux.
-DCMAKE_BUILD_TYPE=Release
-DCAPSTONE_BUILD_STATIC=ON
-DCAPSTONE_BUILD_SHARED=OFF
-DCAPSTONE_BUILD_STATIC_RUNTIME=${RETDEC_MSVC_STATIC_RUNTIME}
-DCAPSTONE_BUILD_TESTS=OFF
-DCAPSTONE_X86_ATT_DISABLE=OFF
# Enabled architectures.
-DCAPSTONE_ARM_SUPPORT=ON
-DCAPSTONE_MIPS_SUPPORT=ON
-DCAPSTONE_PPC_SUPPORT=ON
-DCAPSTONE_X86_SUPPORT=ON
-DCAPSTONE_ARM64_SUPPORT=ON
# Disabled architectures.
-DCAPSTONE_M68K_SUPPORT=OFF
-DCAPSTONE_SPARC_SUPPORT=OFF
-DCAPSTONE_SYSZ_SUPPORT=OFF
-DCAPSTONE_XCORE_SUPPORT=OFF
-DCAPSTONE_TMS320C64X_SUPPORT=OFF
-DCAPSTONE_M680X_SUPPORT=OFF
# Force the use of the same compiler as used to build the top-level
# project. Otherwise, the external project may pick up a different
# compiler, which may result in link errors.
"${CMAKE_C_COMPILER_OPTION}"
"${CMAKE_CXX_COMPILER_OPTION}"
-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
# Patch the Capstone sources.
PATCH_COMMAND
${CMAKE_COMMAND} -Dcapstone_path=<SOURCE_DIR> -P ${CMAKE_CURRENT_SOURCE_DIR}/patch.cmake
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
BUILD_BYPRODUCTS
${CAPSTONE_LIB}
)
if(CAPSTONE_LOCAL_DIR)
force_configure_step(capstone-project)
endif()
ExternalProject_Add_Step(capstone-project movelib64
WORKING_DIRECTORY ${CAPSTONE_INSTALL_DIR}
DEPENDEES install
# We cannot copy non-existing directory - it fails.
# So we try to create it, if it already does exist, nothing happens.
COMMAND ${CMAKE_COMMAND} -E make_directory lib64
# If lib was created by Capstone install, and lib64 by us, lib64 is empty
# and this should not replace lib content (i.e. capstone lib).
COMMAND ${CMAKE_COMMAND} -E copy_directory lib64 lib
)
check_if_variable_changed(CAPSTONE_LOCAL_DIR CHANGED)
if(CHANGED)
ExternalProject_Get_Property(capstone-project binary_dir)
message(STATUS "Capstone: path to Capstone directory changed -> cleaning CMake files in ${binary_dir}.")
clean_cmake_files(${binary_dir})
endif()
ExternalProject_Get_Property(capstone-project source_dir)
New build system (#730) * something working * progress * progress * progress * cmake: fix common and add ctypes * src/serdes: new build system * new build system for pdbparser * new build system for yaracpp * new build system for crypto component * new build system for config * refactor cmake for retdec-configtool * new build system for idr2pat * new build system for ar-extractor and its LLVM dependency * refactor the new build system * new build for ar-extractortool * new build system for macho-extractor and macho-extractortool * new build for ctypesparser, demangler, and demanglertool * new build for llvm-support and llvmir-emul * new build for capstone2llvmir and capstone2llvmirtool * new build for fileformat, loader, cpdetect, fileinfo * new build for most remaining modules * cmake/options.cmake: fix debugformat enable settings * some build system fixes * cmake/options.cmake: make RETDEC_ENABLE_ALL into option this allows us to set it to ODD and build only documentation * tests: new build system for unit tests * pelib: fix doxygen comment * retdec/retdec: remove unused include of llvm-support/diagnostics.h * fileformat: do not include openssl in headers * cmake: make install paths relative. When they are absolute, then all the paths in instaled cmake scripts are absolute - install dir could not be moved. * deps/yara: refactor cmake to properly install libs * deps/yara: small cosmetic changes * deps/llvm: refactor cmake to properly install libs * deps/capstone: refactor cmake to properly install libs * deps: refactor cmake files * deps: refactor cmake files * deps/yaramod: refactor cmake to properly install libs * CMakeLists.txt: fix files installation * config/retdec-config-config.cmake: fix required component order Looks like this may matter (on some machines or cmake version). * deps/llvm: fix include installation * fileformat/cmake: do not use openssl-crypto For some reasons, this can cause linking problems on some machines. * deps/yaramod: fix link library order * deps/googletests: fix target link library order * rtti-finder: make deps PUBLIC. I have no idea why it doesn't work with PRIVATE. * deps/yaramod: fix formatting * cmake: more refactorization... 1. Protect against including the same target file multiple times. It looks like this was not a problem, but who knows. 2. Use find_package() instead of find_dependency(). It looks like the later does not work correctly for components on some CMake versions. * cmake: do not create version files for all components Only the main RetDec version file is needed. * cmake: propagate current project version to package config files It is used to find the same version retdec components. * CMakeLists.txt: replace AnyNewerVersion -> ExactVersion in compatibility settings Since we probably will make breaking changes, make retdec installation compatible only with the same version. * cmake: remove all COMPONENT options, these are not really needed * cmake: move dependency finders inside double target protection conditions * cmake: prefix all deps targets with retdec::deps:: * fileinfo: add openssl-crypto dep * Revert "fileinfo: add openssl-crypto dep" This reverts commit e1645d7fd5e81d1606c96752da3ac633c38a63e1. * remove RETDEC_FORCE_OPENSSL_BUILD option, always build OpenSSL * cmake: refactorization * deps/whereami: fix include paths * deps/tinyxml+whereami: fix included dirs * deps/yaramod: fix pog_fmt lib installation * deps/whereami: properly install target, not as part of utils. Previous version should work, but there is a CMake bug in older versions which screws it up on Windows and macOS. * crypto: link retdec::deps::openssl-crypto as PUBLIC * bin2llvmir/providers/debugformat: fix segfault Co-authored-by: Peter Matula <imatula@fit.vutbr.cz>
2020-04-05 14:50:56 +00:00
# Create target.
add_library(capstone INTERFACE)
New build system (#730) * something working * progress * progress * progress * cmake: fix common and add ctypes * src/serdes: new build system * new build system for pdbparser * new build system for yaracpp * new build system for crypto component * new build system for config * refactor cmake for retdec-configtool * new build system for idr2pat * new build system for ar-extractor and its LLVM dependency * refactor the new build system * new build for ar-extractortool * new build system for macho-extractor and macho-extractortool * new build for ctypesparser, demangler, and demanglertool * new build for llvm-support and llvmir-emul * new build for capstone2llvmir and capstone2llvmirtool * new build for fileformat, loader, cpdetect, fileinfo * new build for most remaining modules * cmake/options.cmake: fix debugformat enable settings * some build system fixes * cmake/options.cmake: make RETDEC_ENABLE_ALL into option this allows us to set it to ODD and build only documentation * tests: new build system for unit tests * pelib: fix doxygen comment * retdec/retdec: remove unused include of llvm-support/diagnostics.h * fileformat: do not include openssl in headers * cmake: make install paths relative. When they are absolute, then all the paths in instaled cmake scripts are absolute - install dir could not be moved. * deps/yara: refactor cmake to properly install libs * deps/yara: small cosmetic changes * deps/llvm: refactor cmake to properly install libs * deps/capstone: refactor cmake to properly install libs * deps: refactor cmake files * deps: refactor cmake files * deps/yaramod: refactor cmake to properly install libs * CMakeLists.txt: fix files installation * config/retdec-config-config.cmake: fix required component order Looks like this may matter (on some machines or cmake version). * deps/llvm: fix include installation * fileformat/cmake: do not use openssl-crypto For some reasons, this can cause linking problems on some machines. * deps/yaramod: fix link library order * deps/googletests: fix target link library order * rtti-finder: make deps PUBLIC. I have no idea why it doesn't work with PRIVATE. * deps/yaramod: fix formatting * cmake: more refactorization... 1. Protect against including the same target file multiple times. It looks like this was not a problem, but who knows. 2. Use find_package() instead of find_dependency(). It looks like the later does not work correctly for components on some CMake versions. * cmake: do not create version files for all components Only the main RetDec version file is needed. * cmake: propagate current project version to package config files It is used to find the same version retdec components. * CMakeLists.txt: replace AnyNewerVersion -> ExactVersion in compatibility settings Since we probably will make breaking changes, make retdec installation compatible only with the same version. * cmake: remove all COMPONENT options, these are not really needed * cmake: move dependency finders inside double target protection conditions * cmake: prefix all deps targets with retdec::deps:: * fileinfo: add openssl-crypto dep * Revert "fileinfo: add openssl-crypto dep" This reverts commit e1645d7fd5e81d1606c96752da3ac633c38a63e1. * remove RETDEC_FORCE_OPENSSL_BUILD option, always build OpenSSL * cmake: refactorization * deps/whereami: fix include paths * deps/tinyxml+whereami: fix included dirs * deps/yaramod: fix pog_fmt lib installation * deps/whereami: properly install target, not as part of utils. Previous version should work, but there is a CMake bug in older versions which screws it up on Windows and macOS. * crypto: link retdec::deps::openssl-crypto as PUBLIC * bin2llvmir/providers/debugformat: fix segfault Co-authored-by: Peter Matula <imatula@fit.vutbr.cz>
2020-04-05 14:50:56 +00:00
add_library(retdec::deps::capstone ALIAS capstone)
add_dependencies(capstone capstone-project)
New build system (#730) * something working * progress * progress * progress * cmake: fix common and add ctypes * src/serdes: new build system * new build system for pdbparser * new build system for yaracpp * new build system for crypto component * new build system for config * refactor cmake for retdec-configtool * new build system for idr2pat * new build system for ar-extractor and its LLVM dependency * refactor the new build system * new build for ar-extractortool * new build system for macho-extractor and macho-extractortool * new build for ctypesparser, demangler, and demanglertool * new build for llvm-support and llvmir-emul * new build for capstone2llvmir and capstone2llvmirtool * new build for fileformat, loader, cpdetect, fileinfo * new build for most remaining modules * cmake/options.cmake: fix debugformat enable settings * some build system fixes * cmake/options.cmake: make RETDEC_ENABLE_ALL into option this allows us to set it to ODD and build only documentation * tests: new build system for unit tests * pelib: fix doxygen comment * retdec/retdec: remove unused include of llvm-support/diagnostics.h * fileformat: do not include openssl in headers * cmake: make install paths relative. When they are absolute, then all the paths in instaled cmake scripts are absolute - install dir could not be moved. * deps/yara: refactor cmake to properly install libs * deps/yara: small cosmetic changes * deps/llvm: refactor cmake to properly install libs * deps/capstone: refactor cmake to properly install libs * deps: refactor cmake files * deps: refactor cmake files * deps/yaramod: refactor cmake to properly install libs * CMakeLists.txt: fix files installation * config/retdec-config-config.cmake: fix required component order Looks like this may matter (on some machines or cmake version). * deps/llvm: fix include installation * fileformat/cmake: do not use openssl-crypto For some reasons, this can cause linking problems on some machines. * deps/yaramod: fix link library order * deps/googletests: fix target link library order * rtti-finder: make deps PUBLIC. I have no idea why it doesn't work with PRIVATE. * deps/yaramod: fix formatting * cmake: more refactorization... 1. Protect against including the same target file multiple times. It looks like this was not a problem, but who knows. 2. Use find_package() instead of find_dependency(). It looks like the later does not work correctly for components on some CMake versions. * cmake: do not create version files for all components Only the main RetDec version file is needed. * cmake: propagate current project version to package config files It is used to find the same version retdec components. * CMakeLists.txt: replace AnyNewerVersion -> ExactVersion in compatibility settings Since we probably will make breaking changes, make retdec installation compatible only with the same version. * cmake: remove all COMPONENT options, these are not really needed * cmake: move dependency finders inside double target protection conditions * cmake: prefix all deps targets with retdec::deps:: * fileinfo: add openssl-crypto dep * Revert "fileinfo: add openssl-crypto dep" This reverts commit e1645d7fd5e81d1606c96752da3ac633c38a63e1. * remove RETDEC_FORCE_OPENSSL_BUILD option, always build OpenSSL * cmake: refactorization * deps/whereami: fix include paths * deps/tinyxml+whereami: fix included dirs * deps/yaramod: fix pog_fmt lib installation * deps/whereami: properly install target, not as part of utils. Previous version should work, but there is a CMake bug in older versions which screws it up on Windows and macOS. * crypto: link retdec::deps::openssl-crypto as PUBLIC * bin2llvmir/providers/debugformat: fix segfault Co-authored-by: Peter Matula <imatula@fit.vutbr.cz>
2020-04-05 14:50:56 +00:00
target_include_directories(capstone
SYSTEM INTERFACE
$<BUILD_INTERFACE:${source_dir}/arch>
2020-07-27 13:25:51 +00:00
$<BUILD_INTERFACE:${CAPSTONE_INSTALL_DIR}/include>
New build system (#730) * something working * progress * progress * progress * cmake: fix common and add ctypes * src/serdes: new build system * new build system for pdbparser * new build system for yaracpp * new build system for crypto component * new build system for config * refactor cmake for retdec-configtool * new build system for idr2pat * new build system for ar-extractor and its LLVM dependency * refactor the new build system * new build for ar-extractortool * new build system for macho-extractor and macho-extractortool * new build for ctypesparser, demangler, and demanglertool * new build for llvm-support and llvmir-emul * new build for capstone2llvmir and capstone2llvmirtool * new build for fileformat, loader, cpdetect, fileinfo * new build for most remaining modules * cmake/options.cmake: fix debugformat enable settings * some build system fixes * cmake/options.cmake: make RETDEC_ENABLE_ALL into option this allows us to set it to ODD and build only documentation * tests: new build system for unit tests * pelib: fix doxygen comment * retdec/retdec: remove unused include of llvm-support/diagnostics.h * fileformat: do not include openssl in headers * cmake: make install paths relative. When they are absolute, then all the paths in instaled cmake scripts are absolute - install dir could not be moved. * deps/yara: refactor cmake to properly install libs * deps/yara: small cosmetic changes * deps/llvm: refactor cmake to properly install libs * deps/capstone: refactor cmake to properly install libs * deps: refactor cmake files * deps: refactor cmake files * deps/yaramod: refactor cmake to properly install libs * CMakeLists.txt: fix files installation * config/retdec-config-config.cmake: fix required component order Looks like this may matter (on some machines or cmake version). * deps/llvm: fix include installation * fileformat/cmake: do not use openssl-crypto For some reasons, this can cause linking problems on some machines. * deps/yaramod: fix link library order * deps/googletests: fix target link library order * rtti-finder: make deps PUBLIC. I have no idea why it doesn't work with PRIVATE. * deps/yaramod: fix formatting * cmake: more refactorization... 1. Protect against including the same target file multiple times. It looks like this was not a problem, but who knows. 2. Use find_package() instead of find_dependency(). It looks like the later does not work correctly for components on some CMake versions. * cmake: do not create version files for all components Only the main RetDec version file is needed. * cmake: propagate current project version to package config files It is used to find the same version retdec components. * CMakeLists.txt: replace AnyNewerVersion -> ExactVersion in compatibility settings Since we probably will make breaking changes, make retdec installation compatible only with the same version. * cmake: remove all COMPONENT options, these are not really needed * cmake: move dependency finders inside double target protection conditions * cmake: prefix all deps targets with retdec::deps:: * fileinfo: add openssl-crypto dep * Revert "fileinfo: add openssl-crypto dep" This reverts commit e1645d7fd5e81d1606c96752da3ac633c38a63e1. * remove RETDEC_FORCE_OPENSSL_BUILD option, always build OpenSSL * cmake: refactorization * deps/whereami: fix include paths * deps/tinyxml+whereami: fix included dirs * deps/yaramod: fix pog_fmt lib installation * deps/whereami: properly install target, not as part of utils. Previous version should work, but there is a CMake bug in older versions which screws it up on Windows and macOS. * crypto: link retdec::deps::openssl-crypto as PUBLIC * bin2llvmir/providers/debugformat: fix segfault Co-authored-by: Peter Matula <imatula@fit.vutbr.cz>
2020-04-05 14:50:56 +00:00
$<INSTALL_INTERFACE:${RETDEC_INSTALL_DEPS_INCLUDE_DIR}>
)
target_link_libraries(capstone INTERFACE
$<BUILD_INTERFACE:${CAPSTONE_LIB}>
New build system (#730) * something working * progress * progress * progress * cmake: fix common and add ctypes * src/serdes: new build system * new build system for pdbparser * new build system for yaracpp * new build system for crypto component * new build system for config * refactor cmake for retdec-configtool * new build system for idr2pat * new build system for ar-extractor and its LLVM dependency * refactor the new build system * new build for ar-extractortool * new build system for macho-extractor and macho-extractortool * new build for ctypesparser, demangler, and demanglertool * new build for llvm-support and llvmir-emul * new build for capstone2llvmir and capstone2llvmirtool * new build for fileformat, loader, cpdetect, fileinfo * new build for most remaining modules * cmake/options.cmake: fix debugformat enable settings * some build system fixes * cmake/options.cmake: make RETDEC_ENABLE_ALL into option this allows us to set it to ODD and build only documentation * tests: new build system for unit tests * pelib: fix doxygen comment * retdec/retdec: remove unused include of llvm-support/diagnostics.h * fileformat: do not include openssl in headers * cmake: make install paths relative. When they are absolute, then all the paths in instaled cmake scripts are absolute - install dir could not be moved. * deps/yara: refactor cmake to properly install libs * deps/yara: small cosmetic changes * deps/llvm: refactor cmake to properly install libs * deps/capstone: refactor cmake to properly install libs * deps: refactor cmake files * deps: refactor cmake files * deps/yaramod: refactor cmake to properly install libs * CMakeLists.txt: fix files installation * config/retdec-config-config.cmake: fix required component order Looks like this may matter (on some machines or cmake version). * deps/llvm: fix include installation * fileformat/cmake: do not use openssl-crypto For some reasons, this can cause linking problems on some machines. * deps/yaramod: fix link library order * deps/googletests: fix target link library order * rtti-finder: make deps PUBLIC. I have no idea why it doesn't work with PRIVATE. * deps/yaramod: fix formatting * cmake: more refactorization... 1. Protect against including the same target file multiple times. It looks like this was not a problem, but who knows. 2. Use find_package() instead of find_dependency(). It looks like the later does not work correctly for components on some CMake versions. * cmake: do not create version files for all components Only the main RetDec version file is needed. * cmake: propagate current project version to package config files It is used to find the same version retdec components. * CMakeLists.txt: replace AnyNewerVersion -> ExactVersion in compatibility settings Since we probably will make breaking changes, make retdec installation compatible only with the same version. * cmake: remove all COMPONENT options, these are not really needed * cmake: move dependency finders inside double target protection conditions * cmake: prefix all deps targets with retdec::deps:: * fileinfo: add openssl-crypto dep * Revert "fileinfo: add openssl-crypto dep" This reverts commit e1645d7fd5e81d1606c96752da3ac633c38a63e1. * remove RETDEC_FORCE_OPENSSL_BUILD option, always build OpenSSL * cmake: refactorization * deps/whereami: fix include paths * deps/tinyxml+whereami: fix included dirs * deps/yaramod: fix pog_fmt lib installation * deps/whereami: properly install target, not as part of utils. Previous version should work, but there is a CMake bug in older versions which screws it up on Windows and macOS. * crypto: link retdec::deps::openssl-crypto as PUBLIC * bin2llvmir/providers/debugformat: fix segfault Co-authored-by: Peter Matula <imatula@fit.vutbr.cz>
2020-04-05 14:50:56 +00:00
$<INSTALL_INTERFACE:retdec::deps::capstone-libs>
)
# Install includes.
install(
2020-07-27 13:25:51 +00:00
DIRECTORY ${CAPSTONE_INSTALL_DIR}/include/
DESTINATION ${RETDEC_INSTALL_DEPS_INCLUDE_DIR}
New build system (#730) * something working * progress * progress * progress * cmake: fix common and add ctypes * src/serdes: new build system * new build system for pdbparser * new build system for yaracpp * new build system for crypto component * new build system for config * refactor cmake for retdec-configtool * new build system for idr2pat * new build system for ar-extractor and its LLVM dependency * refactor the new build system * new build for ar-extractortool * new build system for macho-extractor and macho-extractortool * new build for ctypesparser, demangler, and demanglertool * new build for llvm-support and llvmir-emul * new build for capstone2llvmir and capstone2llvmirtool * new build for fileformat, loader, cpdetect, fileinfo * new build for most remaining modules * cmake/options.cmake: fix debugformat enable settings * some build system fixes * cmake/options.cmake: make RETDEC_ENABLE_ALL into option this allows us to set it to ODD and build only documentation * tests: new build system for unit tests * pelib: fix doxygen comment * retdec/retdec: remove unused include of llvm-support/diagnostics.h * fileformat: do not include openssl in headers * cmake: make install paths relative. When they are absolute, then all the paths in instaled cmake scripts are absolute - install dir could not be moved. * deps/yara: refactor cmake to properly install libs * deps/yara: small cosmetic changes * deps/llvm: refactor cmake to properly install libs * deps/capstone: refactor cmake to properly install libs * deps: refactor cmake files * deps: refactor cmake files * deps/yaramod: refactor cmake to properly install libs * CMakeLists.txt: fix files installation * config/retdec-config-config.cmake: fix required component order Looks like this may matter (on some machines or cmake version). * deps/llvm: fix include installation * fileformat/cmake: do not use openssl-crypto For some reasons, this can cause linking problems on some machines. * deps/yaramod: fix link library order * deps/googletests: fix target link library order * rtti-finder: make deps PUBLIC. I have no idea why it doesn't work with PRIVATE. * deps/yaramod: fix formatting * cmake: more refactorization... 1. Protect against including the same target file multiple times. It looks like this was not a problem, but who knows. 2. Use find_package() instead of find_dependency(). It looks like the later does not work correctly for components on some CMake versions. * cmake: do not create version files for all components Only the main RetDec version file is needed. * cmake: propagate current project version to package config files It is used to find the same version retdec components. * CMakeLists.txt: replace AnyNewerVersion -> ExactVersion in compatibility settings Since we probably will make breaking changes, make retdec installation compatible only with the same version. * cmake: remove all COMPONENT options, these are not really needed * cmake: move dependency finders inside double target protection conditions * cmake: prefix all deps targets with retdec::deps:: * fileinfo: add openssl-crypto dep * Revert "fileinfo: add openssl-crypto dep" This reverts commit e1645d7fd5e81d1606c96752da3ac633c38a63e1. * remove RETDEC_FORCE_OPENSSL_BUILD option, always build OpenSSL * cmake: refactorization * deps/whereami: fix include paths * deps/tinyxml+whereami: fix included dirs * deps/yaramod: fix pog_fmt lib installation * deps/whereami: properly install target, not as part of utils. Previous version should work, but there is a CMake bug in older versions which screws it up on Windows and macOS. * crypto: link retdec::deps::openssl-crypto as PUBLIC * bin2llvmir/providers/debugformat: fix segfault Co-authored-by: Peter Matula <imatula@fit.vutbr.cz>
2020-04-05 14:50:56 +00:00
)
# Install libs.
install(
FILES ${CAPSTONE_LIB}
DESTINATION ${RETDEC_INSTALL_LIB_DIR}
RENAME ${CAPSTONE_LIB_PNAME}
New build system (#730) * something working * progress * progress * progress * cmake: fix common and add ctypes * src/serdes: new build system * new build system for pdbparser * new build system for yaracpp * new build system for crypto component * new build system for config * refactor cmake for retdec-configtool * new build system for idr2pat * new build system for ar-extractor and its LLVM dependency * refactor the new build system * new build for ar-extractortool * new build system for macho-extractor and macho-extractortool * new build for ctypesparser, demangler, and demanglertool * new build for llvm-support and llvmir-emul * new build for capstone2llvmir and capstone2llvmirtool * new build for fileformat, loader, cpdetect, fileinfo * new build for most remaining modules * cmake/options.cmake: fix debugformat enable settings * some build system fixes * cmake/options.cmake: make RETDEC_ENABLE_ALL into option this allows us to set it to ODD and build only documentation * tests: new build system for unit tests * pelib: fix doxygen comment * retdec/retdec: remove unused include of llvm-support/diagnostics.h * fileformat: do not include openssl in headers * cmake: make install paths relative. When they are absolute, then all the paths in instaled cmake scripts are absolute - install dir could not be moved. * deps/yara: refactor cmake to properly install libs * deps/yara: small cosmetic changes * deps/llvm: refactor cmake to properly install libs * deps/capstone: refactor cmake to properly install libs * deps: refactor cmake files * deps: refactor cmake files * deps/yaramod: refactor cmake to properly install libs * CMakeLists.txt: fix files installation * config/retdec-config-config.cmake: fix required component order Looks like this may matter (on some machines or cmake version). * deps/llvm: fix include installation * fileformat/cmake: do not use openssl-crypto For some reasons, this can cause linking problems on some machines. * deps/yaramod: fix link library order * deps/googletests: fix target link library order * rtti-finder: make deps PUBLIC. I have no idea why it doesn't work with PRIVATE. * deps/yaramod: fix formatting * cmake: more refactorization... 1. Protect against including the same target file multiple times. It looks like this was not a problem, but who knows. 2. Use find_package() instead of find_dependency(). It looks like the later does not work correctly for components on some CMake versions. * cmake: do not create version files for all components Only the main RetDec version file is needed. * cmake: propagate current project version to package config files It is used to find the same version retdec components. * CMakeLists.txt: replace AnyNewerVersion -> ExactVersion in compatibility settings Since we probably will make breaking changes, make retdec installation compatible only with the same version. * cmake: remove all COMPONENT options, these are not really needed * cmake: move dependency finders inside double target protection conditions * cmake: prefix all deps targets with retdec::deps:: * fileinfo: add openssl-crypto dep * Revert "fileinfo: add openssl-crypto dep" This reverts commit e1645d7fd5e81d1606c96752da3ac633c38a63e1. * remove RETDEC_FORCE_OPENSSL_BUILD option, always build OpenSSL * cmake: refactorization * deps/whereami: fix include paths * deps/tinyxml+whereami: fix included dirs * deps/yaramod: fix pog_fmt lib installation * deps/whereami: properly install target, not as part of utils. Previous version should work, but there is a CMake bug in older versions which screws it up on Windows and macOS. * crypto: link retdec::deps::openssl-crypto as PUBLIC * bin2llvmir/providers/debugformat: fix segfault Co-authored-by: Peter Matula <imatula@fit.vutbr.cz>
2020-04-05 14:50:56 +00:00
OPTIONAL
)
# Install targets.
install(TARGETS capstone
EXPORT capstone-targets
)
# Export targets.
install(EXPORT capstone-targets
FILE "retdec-capstone-targets.cmake"
NAMESPACE retdec::deps::
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
)
# Configure config file.
set(CAPSTONE_LIB_INSTALLED "${RETDEC_INSTALL_LIB_DIR_ABS}/${CAPSTONE_LIB_PNAME}")
New build system (#730) * something working * progress * progress * progress * cmake: fix common and add ctypes * src/serdes: new build system * new build system for pdbparser * new build system for yaracpp * new build system for crypto component * new build system for config * refactor cmake for retdec-configtool * new build system for idr2pat * new build system for ar-extractor and its LLVM dependency * refactor the new build system * new build for ar-extractortool * new build system for macho-extractor and macho-extractortool * new build for ctypesparser, demangler, and demanglertool * new build for llvm-support and llvmir-emul * new build for capstone2llvmir and capstone2llvmirtool * new build for fileformat, loader, cpdetect, fileinfo * new build for most remaining modules * cmake/options.cmake: fix debugformat enable settings * some build system fixes * cmake/options.cmake: make RETDEC_ENABLE_ALL into option this allows us to set it to ODD and build only documentation * tests: new build system for unit tests * pelib: fix doxygen comment * retdec/retdec: remove unused include of llvm-support/diagnostics.h * fileformat: do not include openssl in headers * cmake: make install paths relative. When they are absolute, then all the paths in instaled cmake scripts are absolute - install dir could not be moved. * deps/yara: refactor cmake to properly install libs * deps/yara: small cosmetic changes * deps/llvm: refactor cmake to properly install libs * deps/capstone: refactor cmake to properly install libs * deps: refactor cmake files * deps: refactor cmake files * deps/yaramod: refactor cmake to properly install libs * CMakeLists.txt: fix files installation * config/retdec-config-config.cmake: fix required component order Looks like this may matter (on some machines or cmake version). * deps/llvm: fix include installation * fileformat/cmake: do not use openssl-crypto For some reasons, this can cause linking problems on some machines. * deps/yaramod: fix link library order * deps/googletests: fix target link library order * rtti-finder: make deps PUBLIC. I have no idea why it doesn't work with PRIVATE. * deps/yaramod: fix formatting * cmake: more refactorization... 1. Protect against including the same target file multiple times. It looks like this was not a problem, but who knows. 2. Use find_package() instead of find_dependency(). It looks like the later does not work correctly for components on some CMake versions. * cmake: do not create version files for all components Only the main RetDec version file is needed. * cmake: propagate current project version to package config files It is used to find the same version retdec components. * CMakeLists.txt: replace AnyNewerVersion -> ExactVersion in compatibility settings Since we probably will make breaking changes, make retdec installation compatible only with the same version. * cmake: remove all COMPONENT options, these are not really needed * cmake: move dependency finders inside double target protection conditions * cmake: prefix all deps targets with retdec::deps:: * fileinfo: add openssl-crypto dep * Revert "fileinfo: add openssl-crypto dep" This reverts commit e1645d7fd5e81d1606c96752da3ac633c38a63e1. * remove RETDEC_FORCE_OPENSSL_BUILD option, always build OpenSSL * cmake: refactorization * deps/whereami: fix include paths * deps/tinyxml+whereami: fix included dirs * deps/yaramod: fix pog_fmt lib installation * deps/whereami: properly install target, not as part of utils. Previous version should work, but there is a CMake bug in older versions which screws it up on Windows and macOS. * crypto: link retdec::deps::openssl-crypto as PUBLIC * bin2llvmir/providers/debugformat: fix segfault Co-authored-by: Peter Matula <imatula@fit.vutbr.cz>
2020-04-05 14:50:56 +00:00
configure_package_config_file(
"retdec-capstone-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/retdec-capstone-config.cmake"
INSTALL_DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
PATH_VARS
CAPSTONE_LIB_INSTALLED
)
# Install CMake files.
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/retdec-capstone-config.cmake"
DESTINATION
"${RETDEC_INSTALL_CMAKE_DIR}"
)