From 08cb6951ae0c4d9eedf74e696426e86a19019668 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Sun, 17 May 2020 13:33:20 +0200 Subject: [PATCH] Fix compilation using default options on Emscripten By default, fcl compiles with the `FCL_USE_X64_SSE` option enabled, that compiles the library with SSE flags enabled. This creates problems in any compiler that do not targets x86 or x86_64 . While the problem can be easily solved by user by setting the FCL_USE_X64_SSE to OFF (as done for example in Debian packaging scripts, see https://salsa.debian.org/science-team/fcl/-/blob/61641fb7a12d19806c799503fc90fcd64b20c5ad/debian/rules#L10) it is nice to provide a working build out of the box. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e90e56b2a..8987691c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,8 +86,13 @@ else() endif() # Whether to enable SSE +if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + set(FCL_TARGET_SUPPORT_X64_SSE OFF) +else() + set(FCL_TARGET_SUPPORT_X64_SSE ON) +endif() set(SSE_FLAGS "") -option(FCL_USE_X64_SSE "Whether FCL should x64 SSE instructions" ON) +option(FCL_USE_X64_SSE "Whether FCL should x64 SSE instructions" ${FCL_TARGET_SUPPORT_X64_SSE}) if(FCL_USE_X64_SSE) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(SSE_FLAGS -mfpmath=sse -msse -msse2 -msse3 -mssse3)