Mercurial > vec
view CMakeLists.txt @ 16:9da2aba90c87
pkgconfig: -DVEC_EXTERN is no longer required
author | Paper <paper@tflc.us> |
---|---|
date | Wed, 20 Nov 2024 04:16:56 -0500 |
parents | e05c257c6a23 |
children | 41dd962abdd1 |
line wrap: on
line source
cmake_minimum_required(VERSION 3.5) project(vec VERSION 2.0.0 DESCRIPTION "a tiny C99 SIMD vector library") add_library(vec SHARED src/vec.c) include(CheckCCompilerFlag) if(MSVC) # TODO ? else() check_c_compiler_flag("-maltivec" COMPILER_HAS_ALTIVEC) if(COMPILER_HAS_ALTIVEC) target_compile_options(vec PRIVATE "-maltivec") endif() check_c_compiler_flag("-mmmx" COMPILER_HAS_MMX) if(COMPILER_HAS_MMX) target_compile_options(vec PRIVATE "-mmmx") endif() check_c_compiler_flag("-msse2" COMPILER_HAS_SSE2) if(COMPILER_HAS_SSE2) target_compile_options(vec PRIVATE "-msse2") endif() check_c_compiler_flag("-msse4.1" COMPILER_HAS_SSE41) if(COMPILER_HAS_SSE41) target_compile_options(vec PRIVATE "-msse4.1") endif() check_c_compiler_flag("-mavx2" COMPILER_HAS_AVX2) if(COMPILER_HAS_AVX2) target_compile_options(vec PRIVATE "-mavx2") endif() check_c_compiler_flag("-mavx512f" COMPILER_HAS_AVX512F) if(COMPILER_HAS_AVX512F) target_compile_options(vec PRIVATE "-mavx512f") endif() endif() set_target_properties(vec PROPERTIES PUBLIC_HEADER include/vec/vec.h C_STANDARD 99) target_include_directories(vec PRIVATE include) # Installing include(GNUInstallDirs) install(TARGETS vec LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # pkg-config configure_file(vec.pc.in vec.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/vec.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)