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?

On Wednesday, September 24, 2014 2:56:21 PM UTC+4, kornel wrote:
>
> Am Dienstag, 23. September 2014 um 13:53:08, schrieb Roman Lebedev <
> lebed...@gmail.com <javascript:>> 
> > Hello. 
> > 
> > I'm using Debian GNU/Linux sid. 
> > When i'm trying to build enblend after running cmake with 
> > *-DENABLE_SSE2:BOOL=ON*, it fails: 
> > 
> > $ make 
> > [  3%] Generating signature.h 
> > Possible precedence issue with control flow operator at 
> /home/lebedevri/src/ 
> > enblend/enblend.hg/src/DefaultSig.pm line 137. 
> > Scanning dependencies of target enblend 
> > [  7%] Building CXX object src/CMakeFiles/enblend.dir/filenameparse.cc.o 
> > /home/lebedevri/src/enblend/enblend.hg/src/filenameparse.cc:1:0: error: 
> CPU 
> > you selected does not support x86-64 instruction set 
> > src/CMakeFiles/enblend.dir/build.make:60: recipe for target 
> > 'src/CMakeFiles/enblend.dir/filenameparse.cc.o' failed 
> > make[2]: *** [src/CMakeFiles/enblend.dir/filenameparse.cc.o] Error 1 
> > CMakeFiles/Makefile2:81: recipe for target 
> 'src/CMakeFiles/enblend.dir/all' 
> > failed 
> > make[1]: *** [src/CMakeFiles/enblend.dir/all] Error 2 
> > Makefile:137: recipe for target 'all' failed 
> > make: *** [all] Error 2 
> > This happens with GCC-4.9 and GCC-4.6 (and others too, probably). 
> > 
> > Attached patch fixes issue for me by replacing hardcoded 
> *-mtune=pentium4 *in 
> > CMAKE_CXX_FLAGS_RELEASE 
> > by *-march=native* or *-mtune=native* or *-mtune=generic* depending on 
> > which one is working. 
> > 
> > *Note*: it might be a good idea to set CXXFLAGS to *-mtune=generic* when 
> > doing build for release (for redistribution of binaries), but i have not 
> > found anything about this in CMakeLists.txt 
> > 
> > If there is anything wrong with my patch, i am ready to fix it. 
> > 
> > Thanks! 
> > 
>
> Nothing wrong, as far as I can see. 
> You could also make a new macro (in CMakeModules/HuginMacros.cmake) like 
>         macro(set_sse_cxx_flags) 
>
> and use it in CMakeLists.txt 
>         IF(ENABLE_SSE2) 
>                 set_sse_cxx_flags() 
>         ENDIF(ENABLE_SSE2) 
>
> Just my 2 cents 
>
>         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 hugin-ptx+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/b23f7d96-31a5-426b-9270-21003310d5e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# User Roman Lebedev <lebedev...@gmail.com>
# Date 1411505016 -14400
#      Wed Sep 24 00:43:36 2014 +0400
# Node ID b7ccf5fca8c5099f5a156f60c251198d6a07b5e6
# Parent  fd5bc9fbf0962833e8a0bf834d19893cf766ac00
CMake: replace hardcoded -mtune=pentium4 with -march=native or -mtune=native or -mtune=generic (v2)

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

diff -r fd5bc9fbf096 -r b7ccf5fca8c5 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 b7ccf5fca8c5 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,27 @@
   ENDFOREACH(arg)
   SET(${prefix}_${current_arg_name} ${current_arg_list})
 ENDMACRO(PARSE_ARGUMENTS)
+
+MACRO(set_sse_cxx_flags)
+  include(CheckCXXCompilerFlag)
+
+  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