comparison CMakeLists.txt @ 15:e05c257c6a23

*: huge refactor, add many new x86 intrinsics and the like ALSO!! now intrinsics are enabled at runtime, depending on what is detected. altivec *should* still work but I only tested compiling it. the major version has been updated to 2.0 for this...
author Paper <paper@tflc.us>
date Wed, 20 Nov 2024 04:10:37 -0500
parents 6e0eb3aa12ab
children 41dd962abdd1
comparison
equal deleted inserted replaced
14:981cf0bc7f3a 15:e05c257c6a23
1 cmake_minimum_required(VERSION 3.5) 1 cmake_minimum_required(VERSION 3.5)
2 2
3 project(vec VERSION 1.0.0 DESCRIPTION "a tiny C99 SIMD vector library") 3 project(vec VERSION 2.0.0 DESCRIPTION "a tiny C99 SIMD vector library")
4 4
5 add_library(vec SHARED src/vec.c) 5 add_library(vec SHARED src/vec.c)
6 6
7 set_target_properties(vec PROPERTIES PUBLIC_HEADER include/vec/vec.h) 7 include(CheckCCompilerFlag)
8
9 if(MSVC)
10 # TODO ?
11 else()
12 check_c_compiler_flag("-maltivec" COMPILER_HAS_ALTIVEC)
13 if(COMPILER_HAS_ALTIVEC)
14 target_compile_options(vec PRIVATE "-maltivec")
15 endif()
16 check_c_compiler_flag("-mmmx" COMPILER_HAS_MMX)
17 if(COMPILER_HAS_MMX)
18 target_compile_options(vec PRIVATE "-mmmx")
19 endif()
20 check_c_compiler_flag("-msse2" COMPILER_HAS_SSE2)
21 if(COMPILER_HAS_SSE2)
22 target_compile_options(vec PRIVATE "-msse2")
23 endif()
24 check_c_compiler_flag("-msse4.1" COMPILER_HAS_SSE41)
25 if(COMPILER_HAS_SSE41)
26 target_compile_options(vec PRIVATE "-msse4.1")
27 endif()
28 check_c_compiler_flag("-mavx2" COMPILER_HAS_AVX2)
29 if(COMPILER_HAS_AVX2)
30 target_compile_options(vec PRIVATE "-mavx2")
31 endif()
32 check_c_compiler_flag("-mavx512f" COMPILER_HAS_AVX512F)
33 if(COMPILER_HAS_AVX512F)
34 target_compile_options(vec PRIVATE "-mavx512f")
35 endif()
36 endif()
37
38
39 set_target_properties(vec PROPERTIES PUBLIC_HEADER include/vec/vec.h C_STANDARD 99)
8 40
9 target_include_directories(vec PRIVATE include) 41 target_include_directories(vec PRIVATE include)
10 42
11 # Installing 43 # Installing
12 44
13 include(GNUInstallDirs) 45 include(GNUInstallDirs)
14 46
15 install(TARGETS vec 47 install(TARGETS vec
16 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 48 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
17 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 49 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
18 50
19 # pkg-config 51 # pkg-config
20 configure_file(vec.pc.in vec.pc @ONLY) 52 configure_file(vec.pc.in vec.pc @ONLY)
21 install(FILES ${CMAKE_BINARY_DIR}/vec.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) 53 install(FILES ${CMAKE_BINARY_DIR}/vec.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)