commit 5e976f4c9200700b2c4b63859a49af65198ef198 parent a1a97e0106437db2a2da12c726fdfd23c1e7fc8f Author: d.levin256@gmail.com <d.levin256@gmail.com> Date: Wed, 5 Jun 2019 09:05:07 +0300 Set ABI for multi arch dft Diffstat:
M | dft/CMakeLists.txt | | | 36 | ++++++++++++++++++++++++++++++++---- |
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/dft/CMakeLists.txt b/dft/CMakeLists.txt @@ -17,11 +17,39 @@ cmake_minimum_required(VERSION 3.1) +if (MSVC) + set(LIBABI "vc${MSVC_TOOLSET_VERSION}") +elseif (WIN32) + set(LIBABI "mingw") +elseif (APPLE) + set(LIBABI "apple") +elseif ("${CMAKE_SYSTEM}" MATCHES "Linux") + set(LIBABI "linux") +else () + set(LIBABI "unknown") + message(WARNING "KFR DFT: Unknown ABI") +endif () + +if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(LIBABI "${LIBABI}-x64") +else () + set(LIBABI "${LIBABI}-x32") +endif () + +if (CMAKE_BUILD_TYPE STREQUAL Debug) + set(LIBABI "${LIBABI}-d") +endif () + +message(STATUS "LIBABI = ${LIBABI}") + +add_custom_target(kfr_multiarch_dft) + function(add_dft_library ARCH) - add_library(kfr_dft_${ARCH} STATIC ${KFR_DFT_SRC}) - target_link_libraries(kfr_dft_${ARCH} kfr) - target_set_arch(kfr_dft_${ARCH} INTERFACE ${ARCH}) - target_compile_options(kfr_dft_${ARCH} PRIVATE -Xclang -ffast-math) + add_library(kfr_dft_${LIBABI}_${ARCH} STATIC ${KFR_DFT_SRC}) + target_link_libraries(kfr_dft_${LIBABI}_${ARCH} kfr) + target_set_arch(kfr_dft_${LIBABI}_${ARCH} PUBLIC ${ARCH}) + target_compile_options(kfr_dft_${LIBABI}_${ARCH} PRIVATE -Xclang -ffast-math) + add_dependencies(kfr_multiarch_dft kfr_dft_${LIBABI}_${ARCH}) endfunction() add_dft_library(sse2)