I see.

This should do it. (updated patch attached)

On Sat, Sep 27, 2014 at 8:04 PM, Kornel Benko <[email protected]>
wrote:

> Am Samstag, 27. September 2014 um 16:44:34, schrieb Roman Lebedev <
> [email protected]>
> > >I had no problems with your patch. If nobody complains, I will soon
> commit.
> > Ok.
> >
> > >The inclusion 'include(CheckCXXCompilerFlag)' inside the macro:
> > Makes sense.
> > Should it rather be included in HuginMacros.cmake, or in CMakeLists.txt?
>
> I like it to be near the place, where it is needed. (1 line before macro
> creation in HuginMacros.cmake)
> Alternatively at the prominent place (e.g. first lines in
> HuginMacros.cmake should include everything
> needed by the following macros)
>
> OTOH, ConfigureChecks.cmake already has some includes, so maybe everything
> should go there.
> But as it is not used there, I still prefer HuginMacros.cmake.
>
> > On Sat, Sep 27, 2014 at 4:35 PM, Kornel Benko <[email protected]>
> > wrote:
> >
> > > Am Donnerstag, 25. September 2014 um 10:10:55, schrieb Roman Lebedev <
> > > [email protected]>
> > > > Hi.
> > > >
> > > > Sure, if this is how it is preferred. (updated patch attached)
> > > >
> > > > Any chance to see it being merged into enblend hg repo? (preferably
> > > keeping
> > > > User line)
> > > > Or this is the wrong place to submit patches?
> > > >
> > >
> > > I had no problems with your patch. If nobody complains, I will
> > > soon commit.
> > >
> > > The inclusion 'include(CheckCXXCompilerFlag)' inside the macro:
> > > Sure, the macro is called exactly once, so there is no overhead.
> > > And using it outside of the macro will execute the include it even if
> not
> > > needed.
> > > But for the sake of possible later check for another compiles flags, I
> > > prefer to
> > > have the assignment be outside.
>
>         Kornel
>

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/CADoyv_5pi0YSp1V7mVgyCmDpYWD-hJT%3D1pk1g287syGVkPuNZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# User Roman Lebedev <[email protected]>
# Date 1411505016 -14400
#      Wed Sep 24 00:43:36 2014 +0400
# Node ID 3bdedebd39349d1f67ba3d0a39c210cd7f6a99de
# Parent  fd5bc9fbf0962833e8a0bf834d19893cf766ac00
CMake: replace hardcoded -mtune=pentium4 with -march=native or -mtune=native or 
-mtune=generic (v3)

This fixes enblend build for me (on Debian GNU/Linux sid), after running cmake 
with -DENABLE_SSE2:BOOL=ON

diff -r fd5bc9fbf096 -r 3bdedebd3934 CMakeLists.txt
--- a/CMakeLists.txt    Mon Sep 22 19:14:06 2014 +0200
+++ b/CMakeLists.txt    Wed Sep 24 00:43:36 2014 +0400
@@ -315,11 +315,7 @@
 ENDIF(ENABLE_OPENCL)
 
 IF(ENABLE_SSE2)
-  IF(CMAKE_COMPILER_IS_GNUCXX)
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2 
-mtune=pentium4")
-  ELSEIF(MSVC)
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE2")
-  ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+  set_sse_cxx_flags()
 ENDIF(ENABLE_SSE2)
 
 IF(ENABLE_DMALLOC)
diff -r fd5bc9fbf096 -r 3bdedebd3934 CMakeModules/HuginMacros.cmake
--- a/CMakeModules/HuginMacros.cmake    Mon Sep 22 19:14:06 2014 +0200
+++ b/CMakeModules/HuginMacros.cmake    Wed Sep 24 00:43:36 2014 +0400
@@ -36,3 +36,26 @@
   ENDFOREACH(arg)
   SET(${prefix}_${current_arg_name} ${current_arg_list})
 ENDMACRO(PARSE_ARGUMENTS)
+
+include(CheckCXXCompilerFlag)
+MACRO(set_sse_cxx_flags)
+  IF(CMAKE_COMPILER_IS_GNUCXX)
+    MESSAGE("-- Checking for -march=native support")
+    CHECK_CXX_COMPILER_FLAG("-march=native" MARCHNATIVE)
+    if (MARCHNATIVE)
+      set(MARCH "-march=native")
+    else()
+      MESSAGE("-- Checking for -mtune=native support")
+      CHECK_CXX_COMPILER_FLAG("-mtune=native" MTUNENATIVE)
+      if (MTUNENATIVE)
+        set(MARCH "-mtune=native")
+      else()
+        set(MARCH "-mtune=generic")
+      endif()
+    endif()
+
+    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2 ${MARCH}")
+  ELSEIF(MSVC)
+    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE2")
+  ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+ENDMACRO(set_sse_cxx_flags)

Reply via email to