commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/04: cmake: Create a cmake file to hold v


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/04: cmake: Create a cmake file to hold various project build types.
Date: Wed, 23 Jul 2014 16:14:42 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch master
in repository gnuradio.

commit 015db3a354ba29bfc09aef14daf29e4b672040ce
Author: Tom Rondeau <address@hidden>
Date:   Wed Jul 23 10:40:44 2014 -0400

    cmake: Create a cmake file to hold various project build types.
    
    Addes build types for debugging by saving all temporary build files 
(including the .s ASM files) for various levels of optimization.
---
 CMakeLists.txt                   |  38 ++----------
 cmake/Modules/GrBuildTypes.cmake | 129 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+), 34 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5b4cd8..39edf49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,38 +29,9 @@ cmake_minimum_required(VERSION 2.6)
 project(gnuradio CXX C)
 enable_testing()
 
-########################################################################
-# For GCC and Clang, we can set a build type:
-#
-# -DCMAKE_BUILD_TYPE=NoOptWithASM
-#
-# This type uses no optimization (-O0), outputs debug symbols (-g) and
-# outputs all intermediary files the build system produces, including
-# all assembly (.s) files. Look in the build directory for these
-# files.
-# NOTE: This is not defined on Windows systems.
-########################################################################
-if(NOT WIN32)
-  SET( CMAKE_CXX_FLAGS_NOOPTWITHASM "-Wall -save-temps -g -O0" CACHE STRING
-    "Flags used by the C++ compiler during NoOptWithASM builds."
-    FORCE )
-  SET( CMAKE_C_FLAGS_NOOPTWITHASM "-Wall -save-temps -g -O0" CACHE STRING
-    "Flags used by the C compiler during NoOptWithASM builds."
-    FORCE )
-  SET( CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
-    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
-    "Flags used for linking binaries during NoOptWithASM builds."
-    FORCE )
-  SET( CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM
-    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
-    "Flags used by the shared libraries linker during NoOptWithASM builds."
-    FORCE )
-  MARK_AS_ADVANCED(
-    CMAKE_CXX_FLAGS_NOOPTWITHASM
-    CMAKE_C_FLAGS_NOOPTWITHASM
-    CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
-    CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM)
-endif(NOT WIN32)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+
+include(GrBuildTypes)
 
 #select the release build type by default to get optimization flags
 if(NOT CMAKE_BUILD_TYPE)
@@ -68,8 +39,7 @@ if(NOT CMAKE_BUILD_TYPE)
    message(STATUS "Build type not specified: defaulting to release.")
 endif(NOT CMAKE_BUILD_TYPE)
 set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.")
 
 # Set the version information here
 set(VERSION_INFO_MAJOR_VERSION 3)
diff --git a/cmake/Modules/GrBuildTypes.cmake b/cmake/Modules/GrBuildTypes.cmake
new file mode 100644
index 0000000..4a157e4
--- /dev/null
+++ b/cmake/Modules/GrBuildTypes.cmake
@@ -0,0 +1,129 @@
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+if(DEFINED __INCLUDED_GR_BUILD_TYPES_CMAKE)
+    return()
+endif()
+set(__INCLUDED_GR_BUILD_TYPES_CMAKE TRUE)
+
+# Standard CMake Build Types and their basic CFLAGS:
+#  - Debug: -O2 -g
+#  - Release: -O3
+#  - RelWithDebInfo: -O3 -g
+
+# Addtional Build Types, defined below:
+#  - NoOptWithASM: -O0 -g -save-temps
+#  - O2WithASM: -O2 -g -save-temps
+#  - O3WithASM: -O3 -g -save-temps
+
+
+########################################################################
+# For GCC and Clang, we can set a build type:
+#
+# -DCMAKE_BUILD_TYPE=NoOptWithASM
+#
+# This type uses no optimization (-O0), outputs debug symbols (-g) and
+# outputs all intermediary files the build system produces, including
+# all assembly (.s) files. Look in the build directory for these
+# files.
+# NOTE: This is not defined on Windows systems.
+########################################################################
+if(NOT WIN32)
+  SET(CMAKE_CXX_FLAGS_NOOPTWITHASM "-Wall -save-temps -g -O0" CACHE STRING
+    "Flags used by the C++ compiler during NoOptWithASM builds." FORCE)
+  SET(CMAKE_C_FLAGS_NOOPTWITHASM "-Wall -save-temps -g -O0" CACHE STRING
+    "Flags used by the C compiler during NoOptWithASM builds." FORCE)
+  SET(CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
+    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
+    "Flags used for linking binaries during NoOptWithASM builds." FORCE)
+  SET(CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM
+    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
+    "Flags used by the shared lib linker during NoOptWithASM builds." FORCE)
+
+  MARK_AS_ADVANCED(
+    CMAKE_CXX_FLAGS_NOOPTWITHASM
+    CMAKE_C_FLAGS_NOOPTWITHASM
+    CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
+    CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM)
+endif(NOT WIN32)
+
+
+
+########################################################################
+# For GCC and Clang, we can set a build type:
+#
+# -DCMAKE_BUILD_TYPE=O2WithASM
+#
+# This type uses level 2 optimization (-O2), outputs debug symbols
+# (-g) and outputs all intermediary files the build system produces,
+# including all assembly (.s) files. Look in the build directory for
+# these files.
+# NOTE: This is not defined on Windows systems.
+########################################################################
+
+if(NOT WIN32)
+  SET(CMAKE_CXX_FLAGS_O2WITHASM "-Wall -save-temps -g -O2" CACHE STRING
+    "Flags used by the C++ compiler during O2WithASM builds." FORCE)
+  SET(CMAKE_C_FLAGS_O2WITHASM "-Wall -save-temps -g -O2" CACHE STRING
+    "Flags used by the C compiler during O2WithASM builds." FORCE)
+  SET(CMAKE_EXE_LINKER_FLAGS_O2WITHASM
+    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
+    "Flags used for linking binaries during O2WithASM builds." FORCE)
+  SET(CMAKE_SHARED_LINKER_FLAGS_O2WITHASM
+    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
+    "Flags used by the shared lib linker during O2WithASM builds." FORCE)
+
+  MARK_AS_ADVANCED(
+    CMAKE_CXX_FLAGS_O2WITHASM
+    CMAKE_C_FLAGS_O2WITHASM
+    CMAKE_EXE_LINKER_FLAGS_O2WITHASM
+    CMAKE_SHARED_LINKER_FLAGS_O2WITHASM)
+endif(NOT WIN32)
+
+
+########################################################################
+# For GCC and Clang, we can set a build type:
+#
+# -DCMAKE_BUILD_TYPE=O3WithASM
+#
+# This type uses level 3 optimization (-O3), outputs debug symbols
+# (-g) and outputs all intermediary files the build system produces,
+# including all assembly (.s) files. Look in the build directory for
+# these files.
+# NOTE: This is not defined on Windows systems.
+########################################################################
+
+if(NOT WIN32)
+  SET(CMAKE_CXX_FLAGS_O3WITHASM "-Wall -save-temps -g -O3" CACHE STRING
+    "Flags used by the C++ compiler during O3WithASM builds." FORCE)
+  SET(CMAKE_C_FLAGS_O3WITHASM "-Wall -save-temps -g -O3" CACHE STRING
+    "Flags used by the C compiler during O3WithASM builds." FORCE)
+  SET(CMAKE_EXE_LINKER_FLAGS_O3WITHASM
+    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
+    "Flags used for linking binaries during O3WithASM builds." FORCE)
+  SET(CMAKE_SHARED_LINKER_FLAGS_O3WITHASM
+    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
+    "Flags used by the shared lib linker during O3WithASM builds." FORCE)
+
+  MARK_AS_ADVANCED(
+    CMAKE_CXX_FLAGS_O3WITHASM
+    CMAKE_C_FLAGS_O3WITHASM
+    CMAKE_EXE_LINKER_FLAGS_O3WITHASM
+    CMAKE_SHARED_LINKER_FLAGS_O3WITHASM)
+endif(NOT WIN32)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]