[Debian-med-packaging] Bug#793344: How to inject options only for intel architectures with cmake (Was: Bug#793344: hyphy: FTBFS on non-x86: unrecognized command line option '-msse3')
Gert Wollny
gw.fossdev at gmail.com
Thu Jul 23 13:25:00 UTC 2015
On Thu, 2015-07-23 at 14:36 +0200, Andreas Tille wrote:
> Hi,
>
> considering the fact that SSE3 optimisation is really wanted on intel
> architectures how could the option be added only for those architectures
> that understand -msse3 option?
You can do this:
###
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-msee3" HAS_GNU_MSSE3_FLAG)
IF(HAS_GNU_MSSE3_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3")
ENDIF(HAS_GNU_MSSE3_FLAG)
###
You could also add to the d/rules that certain flags are only set on
certain architectures:
I think it would be done like this:
ifeq ($(DEB_BUIL_ARCH), amd64)
CXXFLAGS += -msse3
endif
Note however, that even on Intel arch -msse3 is not supported across all
processor types that are supported by Debian.
* amd64 is only guaranteed to support SSE2 (and this is enabled by
default), but some early processors, like the single core Opteron don't
support sse3.
* on i386 the situation is even worse.
The clean solution would be to make a run-time decision about different
code path using different instruction sets based on the processor. The
non-free Intel compiler can provide this automatically with certain
compiler flags, but AFAIK with gcc one has to do this manually.
More information about the Debian-med-packaging
mailing list