retdec/deps/capstone/CMakeLists.txt

165 lines
5.0 KiB
CMake
Raw Normal View History

if(CAPSTONE_LOCAL_DIR)
message(STATUS "Capstone: using local Capstone directory.")
ExternalProject_Add(capstone-project
DOWNLOAD_COMMAND ""
SOURCE_DIR "${CAPSTONE_LOCAL_DIR}"
CMAKE_ARGS
# 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
# Disabled architectures.
-DCAPSTONE_ARM64_SUPPORT=OFF
-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}"
Retdec is a library now (#779) * llvmir-emul: do not include llvm/Support/PluginLoader.h This must not be included in a library. * bin2llvmirtool: simplify * llvmir2hlltool: do not include llvm/Support/PluginLoader.h It is not needed and it is dangerous because it contains "load" option which can be included only once. * bin2llvmir/providers/config: use params output file to generate config * config/parameters: add more params * bin2llvmir: add config-generator pass * retdec/retdec: add super ugly decompilation API * stacofin: stricter signature filtering This is still very shitty. A better solution would be using some metadata in signature files - not the current signature-file-path-based filtering. * progress: all test from "integration.ack" work * progress * progress * do not manually create passes in code, use just the pass list * create LlvmIr2Hll pass in llvmir2hll lib * progress * add decompiler-config.json * aggregate LLVM passes * add -k option * bin2llvmir/config: fix Config::empty() * bin2llvmir/unreahable_funcs: use params to disable opt * retdec-decompiler: add more command line options * progress * all regression tests pass * src/configtool: remove, not needed anymore * config: remove isFromIda flag * config: remove unused exceptions * configL fix exceptions * config: remove frontend version entry * config: remove some duplicate values * config: refactor * config: refactor * bin2llvmir: fix #301, fix #750, proper removal of artificial undef functions * deps/llvm: update ref to fix gcc 10 compilation error * deps/llvm: enable exeptions and RTTI * progress * remove debug msgs * tests/debugformat_tests: fix compilation * replace retdec-decompiler.py with retdec-decompiler * retdec-decompiler: return decompilation error code * tests/bin2llvmir/unreachable_funcs: fix JSON configs * progress * llvmir2hll: remove code specific for Python output HLL * llvmir2hll: fix JSON output generation * progress * progress * progress * remove bin2llvmirtool and llvmir2hlltool * refactor * tests/bin2llvmir/x87_fpu: fix compilation * unpackertool: do not build unpaker plugins separatelly * scripts: return retdec-fileinfo.py back, some reg tests need it * bin2llvmir: fix doxygen warnings * set CMAKE_POSITION_INDEPENDENT_CODE and propagate it to deps * Win: macOS: link llvmir2hll to decompiler target * bin2llvmir/lti: fix pat filtering on windows * retdec-decompiler: increase windows stack size Co-authored-by: Peter Kubov <peter.kubov@avast.com>
2020-06-05 05:42:46 +00:00
-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
# Disable the update step.
UPDATE_COMMAND ""
# Disable the install step.
INSTALL_COMMAND ""
)
force_configure_step(capstone-project)
else()
message(STATUS "Capstone: using remote Capstone revision.")
ExternalProject_Add(capstone-project
URL ${CAPSTONE_URL}
URL_HASH SHA256=${CAPSTONE_ARCHIVE_SHA256}
DOWNLOAD_NAME capstone.zip
CMAKE_ARGS
# 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}"
Retdec is a library now (#779) * llvmir-emul: do not include llvm/Support/PluginLoader.h This must not be included in a library. * bin2llvmirtool: simplify * llvmir2hlltool: do not include llvm/Support/PluginLoader.h It is not needed and it is dangerous because it contains "load" option which can be included only once. * bin2llvmir/providers/config: use params output file to generate config * config/parameters: add more params * bin2llvmir: add config-generator pass * retdec/retdec: add super ugly decompilation API * stacofin: stricter signature filtering This is still very shitty. A better solution would be using some metadata in signature files - not the current signature-file-path-based filtering. * progress: all test from "integration.ack" work * progress * progress * do not manually create passes in code, use just the pass list * create LlvmIr2Hll pass in llvmir2hll lib * progress * add decompiler-config.json * aggregate LLVM passes * add -k option * bin2llvmir/config: fix Config::empty() * bin2llvmir/unreahable_funcs: use params to disable opt * retdec-decompiler: add more command line options * progress * all regression tests pass * src/configtool: remove, not needed anymore * config: remove isFromIda flag * config: remove unused exceptions * configL fix exceptions * config: remove frontend version entry * config: remove some duplicate values * config: refactor * config: refactor * bin2llvmir: fix #301, fix #750, proper removal of artificial undef functions * deps/llvm: update ref to fix gcc 10 compilation error * deps/llvm: enable exeptions and RTTI * progress * remove debug msgs * tests/debugformat_tests: fix compilation * replace retdec-decompiler.py with retdec-decompiler * retdec-decompiler: return decompilation error code * tests/bin2llvmir/unreachable_funcs: fix JSON configs * progress * llvmir2hll: remove code specific for Python output HLL * llvmir2hll: fix JSON output generation * progress * progress * progress * remove bin2llvmirtool and llvmir2hlltool * refactor * tests/bin2llvmir/x87_fpu: fix compilation * unpackertool: do not build unpaker plugins separatelly * scripts: return retdec-fileinfo.py back, some reg tests need it * bin2llvmir: fix doxygen warnings * set CMAKE_POSITION_INDEPENDENT_CODE and propagate it to deps * Win: macOS: link llvmir2hll to decompiler target * bin2llvmir/lti: fix pat filtering on windows * retdec-decompiler: increase windows stack size Co-authored-by: Peter Kubov <peter.kubov@avast.com>
2020-06-05 05:42:46 +00:00
-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
# Disable the update step.
UPDATE_COMMAND ""
# Disable the install step.
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
)
endif()
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)
ExternalProject_Get_Property(capstone-project binary_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
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 ${binary_dir}/${MSVC_CONFIG}${CAPSTONE_LIB_NAME})
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}/include>
$<BUILD_INTERFACE:${source_dir}/arch>
$<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(
DIRECTORY ${source_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}"
)