Skip to content

Commit

Permalink
add CMake check for extended vector type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Daniel committed Nov 23, 2024
1 parent e06f777 commit 3381f06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ check_c_source_compiles("
"
HAVE__DIV64
)
check_c_source_compiles("
typedef float vec __attribute__((ext_vector_type(4)));
int main()
{
vec a = (vec){0, 1, 2, 3};
return 0;
}
"
HAVE_EXT_VECTOR_TYPE
)

option(CMAKE_FIND_PACKAGE_PREFER_CONFIG
"Lookup package config files before using find modules" ON)
Expand Down
5 changes: 3 additions & 2 deletions src/m_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@

#include <math.h>

#include "config.h"
#include "doomtype.h"

#if defined(__has_attribute) && defined(__clang__) && __has_attribute(ext_vector_type)
#if defined(HAVE_EXT_VECTOR_TYPE)
typedef float vec __attribute__((ext_vector_type(3)));
#else
typedef struct
Expand All @@ -33,7 +34,7 @@ typedef struct
} vec;
#endif

#if defined(__has_attribute) && defined(__clang__) && __has_attribute(ext_vector_type)
#if defined(HAVE_EXT_VECTOR_TYPE)
typedef float quat __attribute__((ext_vector_type(4)));
#else
typedef struct
Expand Down

0 comments on commit 3381f06

Please sign in to comment.