Mercurial > vec
annotate CMakeLists.txt @ 28:c6c99ab1088a
*: add min/max functions and a big big refactor (again)
agh, this time I added a few more implementations (and generally
made the code just a little faster...)
author | Paper <paper@tflc.us> |
---|---|
date | Thu, 24 Apr 2025 00:54:02 -0400 |
parents | d00b95f95dd1 |
children | e59c91d050c0 |
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" |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
10 # "src/impl/fallback.c" -- deadcode |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
11 ) |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
12 |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
13 include(CheckCCompilerFlag) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
14 |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
15 if(MSVC) |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
16 # Untested! |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
17 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
18 if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
19 set(COMPILER_HAS_MMX OFF) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
20 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
21 set(COMPILER_HAS_MMX ON) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
22 set(COMPILER_MMX_FLAGS "") # none? |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
23 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
24 check_c_compiler_flag("/arch:SSE2" COMPILER_HAS_SSE2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
25 if(COMPILER_HAS_SSE2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
26 set(COMPILER_SSE2_FLAGS "/arch:SSE2") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
27 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
28 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
|
29 if(COMPILER_HAS_SSE41) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
30 set(COMPILER_SSE41_FLAGS "/arch:SSE4.2") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
31 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
32 check_c_compiler_flag("/arch:AVX2" COMPILER_HAS_AVX2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
33 if(COMPILER_HAS_AVX2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
34 set(COMPILER_AVX2_FLAGS "/arch:AVX2") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
35 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
36 check_c_compiler_flag("/arch:AVX512" COMPILER_HAS_AVX512F) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
37 if(COMPILER_HAS_AVX512F) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
38 set(COMPILER_AVX512F_FLAGS "/arch:AVX512") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
39 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
40 # 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
|
41 else() |
25
92156fe32755
impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents:
23
diff
changeset
|
42 check_c_compiler_flag("-maltivec" COMPILER_HAS_ALTIVEC) |
92156fe32755
impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents:
23
diff
changeset
|
43 if(COMPILER_HAS_ALTIVEC) |
92156fe32755
impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents:
23
diff
changeset
|
44 set(COMPILER_ALTIVEC_FLAGS "-maltivec") |
92156fe32755
impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents:
23
diff
changeset
|
45 endif() |
27
d00b95f95dd1
impl/arm/neon: it compiles again, but is untested
Paper <paper@tflc.us>
parents:
25
diff
changeset
|
46 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
|
47 if(COMPILER_HAS_NEON) |
d00b95f95dd1
impl/arm/neon: it compiles again, but is untested
Paper <paper@tflc.us>
parents:
25
diff
changeset
|
48 set(COMPILER_NEON_FLAGS "-mfpu=neon") |
d00b95f95dd1
impl/arm/neon: it compiles again, but is untested
Paper <paper@tflc.us>
parents:
25
diff
changeset
|
49 endif() |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
50 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
|
51 if(COMPILER_HAS_MMX) |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
52 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
|
53 endif() |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
54 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
|
55 if(COMPILER_HAS_SSE2) |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
56 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
|
57 endif() |
28
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
58 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
|
59 if(COMPILER_HAS_SSE3) |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
60 set(COMPILER_SSE3_FLAGS "-msse3") |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
61 endif() |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
62 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
|
63 if(COMPILER_HAS_SSE41) |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
64 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
|
65 endif() |
28
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
66 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
|
67 if(COMPILER_HAS_SSE42) |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
68 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
|
69 endif() |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
70 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
|
71 if(COMPILER_HAS_AVX2) |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
72 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
|
73 endif() |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
74 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
|
75 if(COMPILER_HAS_AVX512F) |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
76 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
|
77 endif() |
28
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
78 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
|
79 if(COMPILER_HAS_AVX512BW) |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
80 set(COMPILER_AVX512BW_FLAGS "-mavx512bw") |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
81 endif() |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
82 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
|
83 if(COMPILER_HAS_AVX512DQ) |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
84 set(COMPILER_AVX512DQ_FLAGS "-mavx512dq") |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
85 endif() |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
86 endif() |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
8
diff
changeset
|
87 |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
88 if(COMPILER_HAS_ALTIVEC) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
89 target_sources(vec PRIVATE "src/impl/ppc/altivec.c") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
90 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
|
91 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_ALTIVEC") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
92 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
93 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
94 if(COMPILER_HAS_NEON) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
95 target_sources(vec PRIVATE "src/impl/arm/neon.c") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
96 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
|
97 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_NEON") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
98 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
99 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
100 if(COMPILER_HAS_MMX) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
101 target_sources(vec PRIVATE "src/impl/x86/mmx.c") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
102 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
|
103 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_MMX") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
104 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
105 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
106 if(COMPILER_HAS_SSE2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
107 target_sources(vec PRIVATE "src/impl/x86/sse2.c") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
108 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
|
109 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_SSE2") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
110 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
111 |
28
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
112 if(COMPILER_HAS_SSE3) |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
113 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
|
114 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
|
115 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
|
116 endif() |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
117 |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
118 if(COMPILER_HAS_SSE41) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
119 target_sources(vec PRIVATE "src/impl/x86/sse41.c") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
120 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
|
121 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_SSE41") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
122 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
123 |
28
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
124 if(COMPILER_HAS_SSE42) |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
125 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
|
126 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
|
127 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
|
128 endif() |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
129 |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
130 if(COMPILER_HAS_AVX2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
131 target_sources(vec PRIVATE "src/impl/x86/avx2.c") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
132 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
|
133 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_AVX2") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
134 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
135 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
136 if(COMPILER_HAS_AVX512F) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
137 target_sources(vec PRIVATE "src/impl/x86/avx512f.c") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
138 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
|
139 target_compile_definitions(vec PRIVATE "-DVEC_COMPILER_HAS_AVX512F") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
140 endif() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
141 |
28
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
142 if(COMPILER_HAS_AVX512BW) |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
143 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
|
144 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
|
145 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
|
146 endif() |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
147 |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
148 if(COMPILER_HAS_AVX512DQ) |
c6c99ab1088a
*: add min/max functions and a big big refactor (again)
Paper <paper@tflc.us>
parents:
27
diff
changeset
|
149 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
|
150 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
|
151 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
|
152 endif() |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
153 |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
154 ######################################################################### |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
155 # 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
|
156 # 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
|
157 |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
158 include(CheckTypeSize) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
159 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
176 if(INT16_T_SIZE EQUAL 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
177 set(SIZE16 "int16_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
178 elseif(SHORT_SIZE EQUAL 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
179 set(SIZE16 "short") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
180 elseif(INT_SIZE EQUAL 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
181 set(SIZE16 "int") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
182 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
183 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
|
184 endif() |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
185 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
186 if(UINT16_T_SIZE EQUAL 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
187 set(USIZE16 "uint16_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
188 elseif(U_INT16_T_SIZE EQUAL 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
189 set(USIZE16 "u_int16_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
190 elseif(SHORT_SIZE EQUAL 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
191 set(USIZE16 "unsigned short") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
192 elseif(INT_SIZE EQUAL 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
193 set(USIZE16 "unsigned int") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
194 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
195 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
|
196 endif() |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
197 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
198 if(INT32_T_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
199 set(SIZE32 "int32_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
200 elseif(SHORT_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
201 set(SIZE32 "short") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
202 elseif(INT_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
203 set(SIZE32 "int") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
204 elseif(LONG_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
205 set(SIZE32 "long") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
206 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
207 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
|
208 endif() |
8
6e0eb3aa12ab
build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff
changeset
|
209 |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
210 if(UINT32_T_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
211 set(USIZE32 "uint32_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
212 elseif(U_INT32_T_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
213 set(USIZE32 "u_int32_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
214 elseif(SHORT_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
215 set(USIZE32 "unsigned short") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
216 elseif(INT_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
217 set(USIZE32 "unsigned int") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
218 elseif(LONG_SIZE EQUAL 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
219 set(USIZE32 "unsigned long") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
220 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
221 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
|
222 endif() |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
223 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
224 if(INT64_T_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
225 set(SIZE64 "int64_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
226 elseif(SHORT_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
227 set(SIZE64 "short") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
228 elseif(INT_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
229 set(SIZE64 "int") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
230 elseif(LONG_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
231 set(SIZE64 "long") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
232 elseif(LONG_LONG_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
233 set(SIZE64 "long long") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
234 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
235 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
|
236 endif() |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
237 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
238 if(UINT64_T_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
239 set(USIZE64 "uint64_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
240 elseif(U_INT64_T_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
241 set(USIZE64 "u_int64_t") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
242 elseif(SHORT_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
243 set(USIZE64 "unsigned short") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
244 elseif(INT_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
245 set(USIZE64 "unsigned int") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
246 elseif(LONG_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
247 set(USIZE64 "unsigned long") |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
248 elseif(LONG_LONG_SIZE EQUAL 8) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
249 set(USIZE64 "unsigned long long") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
250 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
251 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
|
252 endif() |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
253 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
254 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
|
255 set(USIZEPTR "uintptr_t") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
256 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
|
257 set(USIZEPTR "unsigned char") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
258 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
|
259 set(USIZEPTR "${USIZE16}") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
260 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
|
261 set(USIZEPTR "${USIZE32}") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
262 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
|
263 set(USIZEPTR "${USIZE64}") |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
264 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
265 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
|
266 endif() |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
267 |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
268 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
|
269 set(USIZESIZE "size_t") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
270 else() |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
271 # should be close enough I guess |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
272 set(USIZESIZE "${USIZEPTR}") |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
273 endif() |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
274 |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
275 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
|
276 |
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 |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
279 target_sources(vec PUBLIC |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
280 $<INSTALL_INTERFACE:vec/vec.h> |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
281 $<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
|
282 $<INSTALL_INTERFACE:vec/types.h> |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
283 $<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
|
284 $<INSTALL_INTERFACE:vec/cpu.h> |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
285 $<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
|
286 ) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
287 |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
288 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
|
289 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
|
290 |
6e0eb3aa12ab
build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff
changeset
|
291 # Installing |
6e0eb3aa12ab
build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff
changeset
|
292 |
6e0eb3aa12ab
build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff
changeset
|
293 include(GNUInstallDirs) |
6e0eb3aa12ab
build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff
changeset
|
294 |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
295 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
|
296 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
297 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
|
298 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
|
299 |
6e0eb3aa12ab
build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff
changeset
|
300 # pkg-config |
6e0eb3aa12ab
build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff
changeset
|
301 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
|
302 install(FILES ${CMAKE_BINARY_DIR}/vec.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) |