annotate CMakeLists.txt @ 29:e59c91d050c0

*: add aligned malloc stuff :)
author Paper <paper@tflc.us>
date Thu, 24 Apr 2025 17:12:05 -0400
parents c6c99ab1088a
children 641d8c79b1da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
1 cmake_minimum_required(VERSION 3.23)
8
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
2
25
92156fe32755 impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents: 23
diff changeset
3 project(vec VERSION 3.0.0 DESCRIPTION "a tiny C99 SIMD vector library" LANGUAGES C)
8
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
4
28
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
5 add_library(vec "src/vec.c")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
6
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
7 target_sources(vec PRIVATE
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
8 "src/cpu.c"
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
9 "src/impl/generic.c"
29
e59c91d050c0 *: add aligned malloc stuff :)
Paper <paper@tflc.us>
parents: 28
diff changeset
10 "src/mem.c"
28
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
11 # "src/impl/fallback.c" -- deadcode
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
12 )
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
13
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
14 include(CheckCCompilerFlag)
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
16 if(MSVC)
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
17 # Untested!
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
18
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
19 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
20 set(COMPILER_HAS_MMX OFF)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
21 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
22 set(COMPILER_HAS_MMX ON)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
23 set(COMPILER_MMX_FLAGS "") # none?
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
24 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
25 check_c_compiler_flag("/arch:SSE2" COMPILER_HAS_SSE2)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
26 if(COMPILER_HAS_SSE2)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
27 set(COMPILER_SSE2_FLAGS "/arch:SSE2")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
28 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
29 check_c_compiler_flag("/arch:SSE4.2" COMPILER_HAS_SSE41)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
30 if(COMPILER_HAS_SSE41)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
31 set(COMPILER_SSE41_FLAGS "/arch:SSE4.2")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
32 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
33 check_c_compiler_flag("/arch:AVX2" COMPILER_HAS_AVX2)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
34 if(COMPILER_HAS_AVX2)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
35 set(COMPILER_AVX2_FLAGS "/arch:AVX2")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
36 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
37 check_c_compiler_flag("/arch:AVX512" COMPILER_HAS_AVX512F)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
38 if(COMPILER_HAS_AVX512F)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
39 set(COMPILER_AVX512F_FLAGS "/arch:AVX512")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
40 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
41 # TODO we have to try_compile to detect NEON
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
42 else()
25
92156fe32755 impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents: 23
diff changeset
43 check_c_compiler_flag("-maltivec" COMPILER_HAS_ALTIVEC)
92156fe32755 impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents: 23
diff changeset
44 if(COMPILER_HAS_ALTIVEC)
92156fe32755 impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents: 23
diff changeset
45 set(COMPILER_ALTIVEC_FLAGS "-maltivec")
92156fe32755 impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents: 23
diff changeset
46 endif()
27
d00b95f95dd1 impl/arm/neon: it compiles again, but is untested
Paper <paper@tflc.us>
parents: 25
diff changeset
47 check_c_compiler_flag("-mfpu=neon" COMPILER_HAS_NEON)
d00b95f95dd1 impl/arm/neon: it compiles again, but is untested
Paper <paper@tflc.us>
parents: 25
diff changeset
48 if(COMPILER_HAS_NEON)
d00b95f95dd1 impl/arm/neon: it compiles again, but is untested
Paper <paper@tflc.us>
parents: 25
diff changeset
49 set(COMPILER_NEON_FLAGS "-mfpu=neon")
d00b95f95dd1 impl/arm/neon: it compiles again, but is untested
Paper <paper@tflc.us>
parents: 25
diff changeset
50 endif()
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
51 check_c_compiler_flag("-mmmx" COMPILER_HAS_MMX)
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
52 if(COMPILER_HAS_MMX)
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
53 set(COMPILER_MMX_FLAGS "-mmmx")
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
54 endif()
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
55 check_c_compiler_flag("-msse2" COMPILER_HAS_SSE2)
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
56 if(COMPILER_HAS_SSE2)
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
57 set(COMPILER_SSE2_FLAGS "-msse2")
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
58 endif()
28
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
59 check_c_compiler_flag("-msse3" COMPILER_HAS_SSE3)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
60 if(COMPILER_HAS_SSE3)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
61 set(COMPILER_SSE3_FLAGS "-msse3")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
62 endif()
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
63 check_c_compiler_flag("-msse4.1" COMPILER_HAS_SSE41)
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
64 if(COMPILER_HAS_SSE41)
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
65 set(COMPILER_SSE41_FLAGS "-msse4.1")
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
66 endif()
28
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
67 check_c_compiler_flag("-msse4.2" COMPILER_HAS_SSE42)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
68 if(COMPILER_HAS_SSE42)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
69 set(COMPILER_SSE42_FLAGS "-msse4.2")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
70 endif()
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
71 check_c_compiler_flag("-mavx2" COMPILER_HAS_AVX2)
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
72 if(COMPILER_HAS_AVX2)
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
73 set(COMPILER_AVX2_FLAGS "-mavx2")
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
74 endif()
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
75 check_c_compiler_flag("-mavx512f" COMPILER_HAS_AVX512F)
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
76 if(COMPILER_HAS_AVX512F)
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
77 set(COMPILER_AVX512F_FLAGS "-mavx512f")
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
78 endif()
28
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
79 check_c_compiler_flag("-mavx512bw" COMPILER_HAS_AVX512BW)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
80 if(COMPILER_HAS_AVX512BW)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
81 set(COMPILER_AVX512BW_FLAGS "-mavx512bw")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
82 endif()
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
83 check_c_compiler_flag("-mavx512dq" COMPILER_HAS_AVX512DQ)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
84 if(COMPILER_HAS_AVX512DQ)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
85 set(COMPILER_AVX512DQ_FLAGS "-mavx512dq")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
86 endif()
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
87 endif()
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
88
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
89 if(COMPILER_HAS_ALTIVEC)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
90 target_sources(vec PRIVATE "src/impl/ppc/altivec.c")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
91 set_source_files_properties("src/impl/ppc/altivec.c" PROPERTIES COMPILE_FLAGS "${COMPILER_ALTIVEC_FLAGS}")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
92 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_ALTIVEC")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
93 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
94
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
95 if(COMPILER_HAS_NEON)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
96 target_sources(vec PRIVATE "src/impl/arm/neon.c")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
97 set_source_files_properties("src/impl/arm/neon.c" PROPERTIES COMPILE_FLAGS "${COMPILER_NEON_FLAGS}")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
98 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_NEON")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
99 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
100
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
101 if(COMPILER_HAS_MMX)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
102 target_sources(vec PRIVATE "src/impl/x86/mmx.c")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
103 set_source_files_properties("src/impl/x86/mmx.c" PROPERTIES COMPILE_FLAGS "${COMPILER_MMX_FLAGS}")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
104 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_MMX")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
105 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
106
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
107 if(COMPILER_HAS_SSE2)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
108 target_sources(vec PRIVATE "src/impl/x86/sse2.c")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
109 set_source_files_properties("src/impl/x86/sse2.c" PROPERTIES COMPILE_FLAGS "${COMPILER_SSE2_FLAGS}")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
110 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_SSE2")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
111 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
112
28
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
113 if(COMPILER_HAS_SSE3)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
114 target_sources(vec PRIVATE "src/impl/x86/sse3.c")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
115 set_source_files_properties("src/impl/x86/sse3.c" PROPERTIES COMPILE_FLAGS "${COMPILER_SSE3_FLAGS}")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
116 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_SSE3")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
117 endif()
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
118
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
119 if(COMPILER_HAS_SSE41)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
120 target_sources(vec PRIVATE "src/impl/x86/sse41.c")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
121 set_source_files_properties("src/impl/x86/sse41.c" PROPERTIES COMPILE_FLAGS "${COMPILER_SSE41_FLAGS}")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
122 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_SSE41")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
123 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
124
28
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
125 if(COMPILER_HAS_SSE42)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
126 target_sources(vec PRIVATE "src/impl/x86/sse42.c")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
127 set_source_files_properties("src/impl/x86/sse42.c" PROPERTIES COMPILE_FLAGS "${COMPILER_SSE42_FLAGS}")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
128 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_SSE42")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
129 endif()
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
130
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
131 if(COMPILER_HAS_AVX2)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
132 target_sources(vec PRIVATE "src/impl/x86/avx2.c")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
133 set_source_files_properties("src/impl/x86/avx2.c" PROPERTIES COMPILE_FLAGS "${COMPILER_AVX2_FLAGS}")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
134 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_AVX2")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
135 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
136
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
137 if(COMPILER_HAS_AVX512F)
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
138 target_sources(vec PRIVATE "src/impl/x86/avx512f.c")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
139 set_source_files_properties("src/impl/x86/avx512f.c" PROPERTIES COMPILE_FLAGS "${COMPILER_AVX512F_FLAGS}")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
140 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_AVX512F")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
141 endif()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
142
28
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
143 if(COMPILER_HAS_AVX512BW)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
144 target_sources(vec PRIVATE "src/impl/x86/avx512bw.c")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
145 set_source_files_properties("src/impl/x86/avx512bw.c" PROPERTIES COMPILE_FLAGS "${COMPILER_AVX512BW_FLAGS}")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
146 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_AVX512BW")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
147 endif()
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
148
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
149 if(COMPILER_HAS_AVX512DQ)
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
150 target_sources(vec PRIVATE "src/impl/x86/avx512dq.c")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
151 set_source_files_properties("src/impl/x86/avx512dq.c" PROPERTIES COMPILE_FLAGS "${COMPILER_AVX512DQ_FLAGS}")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
152 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_AVX512DQ")
c6c99ab1088a *: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents: 27
diff changeset
153 endif()
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
154
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
155 #########################################################################
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
156 # integer types; it's nice to accommodate for older broken systems that
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
157 # may not have stdint.h.
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
158
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
159 include(CheckTypeSize)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
160
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
161 check_type_size("int16_t" INT16_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
162 check_type_size("uint16_t" UINT16_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
163 check_type_size("u_int16_t" U_INT16_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
164 check_type_size("int32_t" INT32_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
165 check_type_size("uint32_t" UINT32_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
166 check_type_size("u_int32_t" U_INT32_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
167 check_type_size("int64_t" INT64_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
168 check_type_size("uint64_t" UINT64_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
169 check_type_size("u_int64_t" U_INT64_T_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
170 check_type_size("short" SHORT_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
171 check_type_size("int" INT_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
172 check_type_size("long" LONG_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
173 check_type_size("long long" LONG_LONG_SIZE LANGUAGE C)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
174 check_type_size("uintptr_t" UINTPTR_T_SIZE LANGUAGE C)
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
175 check_type_size("size_t" SIZE_T_SIZE LANGUAGE C)
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
176
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
177 if(INT16_T_SIZE EQUAL 2)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
178 set(SIZE16 "int16_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
179 elseif(SHORT_SIZE EQUAL 2)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
180 set(SIZE16 "short")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
181 elseif(INT_SIZE EQUAL 2)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
182 set(SIZE16 "int")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
183 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
184 message(FATAL_ERROR "Failed to find a signed 16-bit integer type.")
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
185 endif()
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
186
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
187 if(UINT16_T_SIZE EQUAL 2)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
188 set(USIZE16 "uint16_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
189 elseif(U_INT16_T_SIZE EQUAL 2)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
190 set(USIZE16 "u_int16_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
191 elseif(SHORT_SIZE EQUAL 2)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
192 set(USIZE16 "unsigned short")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
193 elseif(INT_SIZE EQUAL 2)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
194 set(USIZE16 "unsigned int")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
195 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
196 message(FATAL_ERROR "Failed to find an unsigned 16-bit integer type.")
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
197 endif()
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
198
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
199 if(INT32_T_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
200 set(SIZE32 "int32_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
201 elseif(SHORT_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
202 set(SIZE32 "short")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
203 elseif(INT_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
204 set(SIZE32 "int")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
205 elseif(LONG_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
206 set(SIZE32 "long")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
207 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
208 message(FATAL_ERROR "Failed to find a signed 32-bit integer type.")
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
209 endif()
8
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
210
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
211 if(UINT32_T_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
212 set(USIZE32 "uint32_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
213 elseif(U_INT32_T_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
214 set(USIZE32 "u_int32_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
215 elseif(SHORT_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
216 set(USIZE32 "unsigned short")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
217 elseif(INT_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
218 set(USIZE32 "unsigned int")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
219 elseif(LONG_SIZE EQUAL 4)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
220 set(USIZE32 "unsigned long")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
221 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
222 message(FATAL_ERROR "Failed to find an unsigned 32-bit integer type.")
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
223 endif()
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
224
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
225 if(INT64_T_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
226 set(SIZE64 "int64_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
227 elseif(SHORT_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
228 set(SIZE64 "short")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
229 elseif(INT_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
230 set(SIZE64 "int")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
231 elseif(LONG_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
232 set(SIZE64 "long")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
233 elseif(LONG_LONG_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
234 set(SIZE64 "long long")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
235 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
236 message(FATAL_ERROR "Failed to find a signed 64-bit integer type.")
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
237 endif()
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
238
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
239 if(UINT64_T_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
240 set(USIZE64 "uint64_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
241 elseif(U_INT64_T_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
242 set(USIZE64 "u_int64_t")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
243 elseif(SHORT_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
244 set(USIZE64 "unsigned short")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
245 elseif(INT_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
246 set(USIZE64 "unsigned int")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
247 elseif(LONG_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
248 set(USIZE64 "unsigned long")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
249 elseif(LONG_LONG_SIZE EQUAL 8)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
250 set(USIZE64 "unsigned long long")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
251 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
252 message(FATAL_ERROR "Failed to find an unsigned 64-bit integer type.")
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
253 endif()
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
254
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
255 if(CMAKE_SIZEOF_VOID_P EQUAL UINTPTR_T_SIZE)
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
256 set(USIZEPTR "uintptr_t")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
257 elseif(CMAKE_SIZEOF_VOID_P LESS_EQUAL 1)
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
258 set(USIZEPTR "unsigned char")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
259 elseif(CMAKE_SIZEOF_VOID_P LESS_EQUAL 2)
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
260 set(USIZEPTR "${USIZE16}")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
261 elseif(CMAKE_SIZEOF_VOID_P LESS_EQUAL 4)
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
262 set(USIZEPTR "${USIZE32}")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
263 elseif(CMAKE_SIZEOF_VOID_P LESS_EQUAL 8)
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
264 set(USIZEPTR "${USIZE64}")
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
265 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
266 message(FATAL_ERROR "Failed to find an integer type that can fit a pointer.")
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
267 endif()
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
268
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
269 if(NOT SIZE_T_SIZE EQUAL 0 AND NOT SIZE_T_SIZE EQUAL "")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
270 set(USIZESIZE "size_t")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
271 else()
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
272 # should be close enough I guess
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
273 set(USIZESIZE "${USIZEPTR}")
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
274 endif()
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
275
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
276 configure_file(include/vec/types.h.in include/vec/types.h @ONLY)
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
277
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
278 #########################################################################
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
279
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
280 target_sources(vec PUBLIC
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
281 $<INSTALL_INTERFACE:vec/vec.h>
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
282 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/vec/vec.h>
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
283 $<INSTALL_INTERFACE:vec/types.h>
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
284 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include/vec/types.h>
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
285 $<INSTALL_INTERFACE:vec/cpu.h>
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
286 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/vec/cpu.h>
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
287 )
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
288
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
289 target_compile_features(vec PRIVATE $<IF:$<COMPILE_FEATURES:c_std_11>,c_std_11,c_std_99>)
23
e26874655738 *: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents: 17
diff changeset
290 target_include_directories(vec PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_CURRENT_BINARY_DIR}/include")
8
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
291
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
292 # Installing
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
293
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
294 include(GNUInstallDirs)
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
295
17
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
296 install(TARGETS vec LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
297
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
298 install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/vec/vec.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/vec")
41dd962abdd1 *: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents: 15
diff changeset
299 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/vec/impl/integer.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/vec/impl")
8
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
300
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
301 # pkg-config
6e0eb3aa12ab build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff changeset
302 configure_file(vec.pc.in vec.pc @ONLY)
15
e05c257c6a23 *: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents: 8
diff changeset
303 install(FILES ${CMAKE_BINARY_DIR}/vec.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)