summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2012-12-03 13:49:48 -0500
committerErik Schnetter <schnetter@gmail.com>2012-12-03 13:49:48 -0500
commit56c6bf68961e4590c030d26383a3587ce8afd480 (patch)
tree53c3eeeb1efc08bbcca732a3592fe0d5f738bff6
parent425f64c7835532161f11a84ab8eba4e244d97754 (diff)
downloadvecmathlib-56c6bf68961e4590c030d26383a3587ce8afd480.zip
vecmathlib-56c6bf68961e4590c030d26383a3587ce8afd480.tar.gz
Use CMake to generate build instructions
-rw-r--r--CMakeLists.txt11
-rw-r--r--build.ninja131
-rw-r--r--rules.ninja72
3 files changed, 190 insertions, 24 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..7e322d4
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,11 @@
+# build via ninja: cmake -G Ninja
+# build via make: cmake .
+# clean: rm CMakeCache.txt
+
+cmake_minimum_required (VERSION 2.6)
+project (vecmathlib)
+
+add_executable (example example.cc)
+add_executable (test test.cc)
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -std=gnu++11 -march=native -Ofast")
diff --git a/build.ninja b/build.ninja
index 23566c4..f7e5bbf 100644
--- a/build.ninja
+++ b/build.ninja
@@ -1,32 +1,115 @@
-ar = ar
-cxx = g++
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Ninja" Generator, CMake Version 2.8
-cppflags =
-cxxflags = -std=gnu++11 -Wall -g -march=native -Ofast
-ldflags = -L.
+# This file contains all the build statements describing the
+# compilation DAG.
-rule cxx
- command = $cxx $cppflags -MMD -MT $out -MF $out.d $cxxflags -c $in -o $out
- description = CXX $out
- depfile = $out.d
+# =============================================================================
+# Write statements declared in CMakeLists.txt:
+# /Users/eschnett/src/cc/vecmathlib/CMakeLists.txt
+# Which is the root file.
+# =============================================================================
-rule ar
- command = rm -f $out && $ar crs $out $in && ranlib $out
- description = AR $out
+# =============================================================================
+# Project: vecmathlib
+# Configuration:
+# =============================================================================
+# =============================================================================
+# Include auxiliary files.
-rule link
- command = $cxx $cppflags $cxxflags $ldflags -o $out $in $libs
- description = LINK $out
-build empty.o: cxx empty.cc
-build example.o: cxx example.cc
-build test.o: cxx test.cc
+#############################################
+# Include rules file.
-build libvecmath.a: ar empty.o
+include rules.ninja
-build example: link example.o | libvecmath.a
- libs = -lvecmath
-build test: link test.o | libvecmath.a
- libs = -lvecmath
-default example test
+#############################################
+# Utility command for edit_cache
+
+build CMakeFiles/edit_cache.util: CUSTOM_COMMAND
+ COMMAND = cd /Users/eschnett/src/cc/vecmathlib && /opt/local/bin/ccmake -H/Users/eschnett/src/cc/vecmathlib -B/Users/eschnett/src/cc/vecmathlib
+ DESC = Running CMake cache editor...
+build edit_cache: phony CMakeFiles/edit_cache.util
+# =============================================================================
+# Object build statements for EXECUTABLE target example
+
+build CMakeFiles/example.dir/example.cc.o: CXX_COMPILER example.cc
+ DEP_FILE = CMakeFiles/example.dir/example.cc.o.d
+ FLAGS = -Wall -g -std=gnu++11 -march=native -Ofast
+
+# =============================================================================
+# Link build statements for EXECUTABLE target example
+
+
+#############################################
+# Link the executable example
+
+build example: CXX_EXECUTABLE_LINKER CMakeFiles/example.dir/example.cc.o
+ FLAGS = -Wall -g -std=gnu++11 -march=native -Ofast
+ POST_BUILD = :
+ PRE_LINK = :
+ TARGET_PDB = example.dbg
+
+#############################################
+# Utility command for rebuild_cache
+
+build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND
+ COMMAND = cd /Users/eschnett/src/cc/vecmathlib && /opt/local/bin/cmake -H/Users/eschnett/src/cc/vecmathlib -B/Users/eschnett/src/cc/vecmathlib
+ DESC = Running CMake to regenerate build system...
+build rebuild_cache: phony CMakeFiles/rebuild_cache.util
+# =============================================================================
+# Object build statements for EXECUTABLE target test
+
+build CMakeFiles/test.dir/test.cc.o: CXX_COMPILER test.cc
+ DEP_FILE = CMakeFiles/test.dir/test.cc.o.d
+ FLAGS = -Wall -g -std=gnu++11 -march=native -Ofast
+
+# =============================================================================
+# Link build statements for EXECUTABLE target test
+
+
+#############################################
+# Link the executable test
+
+build test: CXX_EXECUTABLE_LINKER CMakeFiles/test.dir/test.cc.o
+ FLAGS = -Wall -g -std=gnu++11 -march=native -Ofast
+ POST_BUILD = :
+ PRE_LINK = :
+ TARGET_PDB = test.dbg
+# =============================================================================
+# Target aliases.
+
+# =============================================================================
+# Built-in targets
+
+
+#############################################
+# The main all target.
+
+build all: phony example test
+
+#############################################
+# Make the all target the default.
+
+default all
+
+#############################################
+# Re-run CMake if any of its inputs changed.
+
+build build.ninja: RERUN_CMAKE | /Users/eschnett/src/cc/vecmathlib/CMakeFiles/CMakeCCompiler.cmake /Users/eschnett/src/cc/vecmathlib/CMakeFiles/CMakeCXXCompiler.cmake /Users/eschnett/src/cc/vecmathlib/CMakeFiles/CMakeSystem.cmake /Users/eschnett/src/cc/vecmathlib/CMakeLists.txt /opt/local/share/cmake-2.8/Modules/CMakeCInformation.cmake /opt/local/share/cmake-2.8/Modules/CMakeCXXInformation.cmake /opt/local/share/cmake-2.8/Modules/CMakeCommonLanguageInclude.cmake /opt/local/share/cmake-2.8/Modules/CMakeGenericSystem.cmake /opt/local/share/cmake-2.8/Modules/CMakeSystemSpecificInformation.cmake /opt/local/share/cmake-2.8/Modules/Compiler/GNU-C.cmake /opt/local/share/cmake-2.8/Modules/Compiler/GNU-CXX.cmake /opt/local/share/cmake-2.8/Modules/Compiler/GNU.cmake /opt/local/share/cmake-2.8/Modules/Platform/Darwin-GNU-C.cmake /opt/local/share/cmake-2.8/Modules/Platform/Darwin-GNU-CXX.cmake /opt/local/share/cmake-2.8/Modules/Platform/Darwin-GNU.cmake /opt/local/share/cmake-2.8/Modules/Platform/Darwin.cmake /opt/local/share/cmake-2.8/Modules/Platform/UnixPaths.cmake CMakeCache.txt
+
+#############################################
+# A missing CMake input file is not an error.
+
+build /Users/eschnett/src/cc/vecmathlib/CMakeFiles/CMakeCCompiler.cmake /Users/eschnett/src/cc/vecmathlib/CMakeFiles/CMakeCXXCompiler.cmake /Users/eschnett/src/cc/vecmathlib/CMakeFiles/CMakeSystem.cmake /Users/eschnett/src/cc/vecmathlib/CMakeLists.txt /opt/local/share/cmake-2.8/Modules/CMakeCInformation.cmake /opt/local/share/cmake-2.8/Modules/CMakeCXXInformation.cmake /opt/local/share/cmake-2.8/Modules/CMakeCommonLanguageInclude.cmake /opt/local/share/cmake-2.8/Modules/CMakeGenericSystem.cmake /opt/local/share/cmake-2.8/Modules/CMakeSystemSpecificInformation.cmake /opt/local/share/cmake-2.8/Modules/Compiler/GNU-C.cmake /opt/local/share/cmake-2.8/Modules/Compiler/GNU-CXX.cmake /opt/local/share/cmake-2.8/Modules/Compiler/GNU.cmake /opt/local/share/cmake-2.8/Modules/Platform/Darwin-GNU-C.cmake /opt/local/share/cmake-2.8/Modules/Platform/Darwin-GNU-CXX.cmake /opt/local/share/cmake-2.8/Modules/Platform/Darwin-GNU.cmake /opt/local/share/cmake-2.8/Modules/Platform/Darwin.cmake /opt/local/share/cmake-2.8/Modules/Platform/UnixPaths.cmake CMakeCache.txt: phony
+
+#############################################
+# Clean all the built files.
+
+build clean: CLEAN
+
+#############################################
+# Print all primary targets available.
+
+build help: HELP
diff --git a/rules.ninja b/rules.ninja
new file mode 100644
index 0000000..11318d2
--- /dev/null
+++ b/rules.ninja
@@ -0,0 +1,72 @@
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Ninja" Generator, CMake Version 2.8
+
+# This file contains all the rules used to get the outputs files
+# built from the input files.
+# It is included in the main 'build.ninja'.
+
+# =============================================================================
+# Project: vecmathlib
+# Configuration:
+# =============================================================================
+
+#############################################
+# Rule for running custom commands.
+
+rule CUSTOM_COMMAND
+ command = $COMMAND
+ description = $DESC
+ restat = 1
+
+
+#############################################
+# Rule for compiling CXX files.
+
+rule CXX_COMPILER
+ depfile = $DEP_FILE
+ command = /opt/local/bin/c++ $DEFINES $FLAGS -MMD -MT $out -MF "$DEP_FILE" -o $out -c $in
+ description = Building CXX object $out
+
+
+#############################################
+# Rule for linking CXX executable.
+
+rule CXX_EXECUTABLE_LINKER
+ command = $PRE_LINK && /opt/local/bin/c++ $FLAGS -Wl,-search_paths_first -Wl,-headerpad_max_install_names $LINK_FLAGS $in -o $out $LINK_LIBRARIES && $POST_BUILD
+ description = Linking CXX executable $out
+
+
+#############################################
+# Rule for linking CXX executable.
+
+rule CXX_EXECUTABLE_LINKER_RSPFILE
+ command = $PRE_LINK && /opt/local/bin/c++ $FLAGS -Wl,-search_paths_first -Wl,-headerpad_max_install_names $LINK_FLAGS @$out.rsp -o $out && $POST_BUILD
+ description = Linking CXX executable $out
+ rspfile = $out.rsp
+ rspfile_content = $in $LINK_LIBRARIES
+
+
+#############################################
+# Rule for re-running cmake.
+
+rule RERUN_CMAKE
+ command = /opt/local/bin/cmake -H/Users/eschnett/src/cc/vecmathlib -B/Users/eschnett/src/cc/vecmathlib
+ description = Re-running CMake...
+ generator = 1
+
+
+#############################################
+# Rule for cleaning all built files.
+
+rule CLEAN
+ command = /opt/local/bin/ninja -t clean
+ description = Cleaning all built files...
+
+
+#############################################
+# Rule for printing all primary targets available.
+
+rule HELP
+ command = /opt/local/bin/ninja -t targets
+ description = All primary targets available:
+
OpenPOWER on IntegriCloud