shithub: tinygl

Download patch

ref: 3d80174a853f38ae9501774ae9946cd87d520c36
parent: b833e3a78434e4956e434a9e86781b879c2d6f96
parent: e50ca7681754f98085e41c7f0f5701749151a819
author: DMHSW <6974902+gek169@users.noreply.github.com>
date: Mon Sep 6 14:02:09 EDT 2021

Merge pull request #12 from ccawley2011/march-native

Avoid building with -march=native when cross-compiling

(Merging because well you cmake people can have what you want)

--- a/SDL_Examples/CMakeLists.txt
+++ b/SDL_Examples/CMakeLists.txt
@@ -17,7 +17,10 @@
       target_link_libraries(${DEMO_NAME} ${TINYGL_LIB} ${M_LIBRARY} ${SDL_LIBRARY})
       target_include_directories(${DEMO_NAME} PUBLIC ${SDL_INCLUDE_DIR})
       if(NOT MSVC)
-	target_compile_options(${DEMO_NAME} PRIVATE -O3 -DNDEBUG -pedantic -march=native -Wall)
+        target_compile_options(${DEMO_NAME} PRIVATE -O3 -DNDEBUG -pedantic -Wall)
+        if(NOT CMAKE_CROSSCOMPILING)
+          target_compile_options(tinygl PRIVATE -march=native)
+        endif(NOT CMAKE_CROSSCOMPILING)
       endif(NOT MSVC)
     endforeach()
 
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,7 +36,10 @@
     LIBRARY DESTINATION ${LIB_DIR}
     ARCHIVE DESTINATION ${LIB_DIR})
   if(NOT MSVC)
-    target_compile_options(tinygl PRIVATE -O3 -DNDEBUG -pedantic -march=native -Wall -Wno-unused-function)
+    target_compile_options(tinygl PRIVATE -O3 -DNDEBUG -pedantic -Wall -Wno-unused-function)
+    if(NOT CMAKE_CROSSCOMPILING)
+      target_compile_options(tinygl PRIVATE -march=native)
+    endif(NOT CMAKE_CROSSCOMPILING)
   endif(NOT MSVC)
 endif(TINYGL_BUILD_SHARED)
 
@@ -48,7 +51,10 @@
     LIBRARY DESTINATION ${LIB_DIR}
     ARCHIVE DESTINATION ${LIB_DIR})
   if(NOT MSVC)
-    target_compile_options(tinygl-static PRIVATE -O3 -DNDEBUG -pedantic -march=native -Wall -Wno-unused-function)
+    target_compile_options(tinygl-static PRIVATE -O3 -DNDEBUG -pedantic -Wall -Wno-unused-function)
+    if(NOT CMAKE_CROSSCOMPILING)
+      target_compile_options(tinygl-static PRIVATE -march=native)
+    endif(NOT CMAKE_CROSSCOMPILING)
   endif(NOT MSVC)
 endif(TINYGL_BUILD_STATIC)