Skip to content

Commit

Permalink
Merge pull request #141 from rafzi/build-fixes-for-emscripten
Browse files Browse the repository at this point in the history
Build fixes for Emscripten
  • Loading branch information
bfierz authored Oct 28, 2024
2 parents c1d5031 + a577503 commit 776bcf2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ endif()
# Global configurations for emscripten
if (EMSCRIPTEN)
# Make sure exception can be used
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -s DISABLE_EXCEPTION_CATCHING=0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
add_definitions(-DEIGEN_DONT_VECTORIZE)
endif(EMSCRIPTEN)

################################################################################
Expand Down
6 changes: 6 additions & 0 deletions src/cmake/VCLConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ function(vcl_configure tgt)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_compile_options(${tgt} PUBLIC "-mfloat-abi=hard" "-mfpu=neon")
endif()
else()
set(VCL_NOT_VECTORIZING ON)
endif()

if(EMSCRIPTEN AND NOT VCL_NOT_VECTORIZING)
target_compile_options(${tgt} PUBLIC "-msimd128")
endif()
endif(VCL_COMPILER_GNU OR VCL_COMPILER_CLANG OR VCL_COMPILER_ICC)

Expand Down
2 changes: 1 addition & 1 deletion src/libs/vcl.core/vcl/config/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
// Add missing definition for max_align_t for compatibility with older clang version (3.4, 3.5)
# if defined(VCL_COMPILER_CLANG) && !defined(_MSC_VER) && !defined(__APPLE_CC__)
# if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
# if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && !defined(__DEFINED_max_align_t)
# if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && !defined(__DEFINED_max_align_t) && !defined(__EMSCRIPTEN__)
typedef struct
{
long long __clang_max_align_nonce1 __attribute__((__aligned__(__alignof__(long long))));
Expand Down
2 changes: 2 additions & 0 deletions src/libs/vcl.core/vcl/config/eigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <vcl/config/global.h>

// Configure vectorisation
#ifndef __EMSCRIPTEN__
#if defined VCL_VECTORIZE_AVX
# define EIGEN_VECTORIZE_AVX
# define EIGEN_VECTORIZE_SSE4_2
Expand All @@ -51,6 +52,7 @@
# define EIGEN_VECTORIZE_SSE3
# endif
#endif
#endif

VCL_BEGIN_EXTERNAL_HEADERS
// Eigen library
Expand Down

0 comments on commit 776bcf2

Please sign in to comment.