[Lunar-commits] <lunar> build.lunar: Adding some functions to handle the basic cmake build/confiugre

Stefan Wold ratler at lunar-linux.org
Tue Jun 7 21:53:34 CEST 2011


commit 3849df3114585b4404d838a4a0e553b7f32ea5a9
Author: Dennis `stumbles` Veatch <stumbles at lunar-linux.org>
Date:   Tue Jun 7 13:55:36 2011 -0400

    build.lunar: Adding some functions to handle the basic cmake build/confiugre
    
    process. In short;
    
    cmake_build_target(); figures out if an in source or out of source build is needed.
    
    default_cmake_config(); like the default_config function uses some basic defaults, mainly
    RELEASE build type and shoves everything into $MODULE_PREFIX (default /usr).
    
    default_cmake_build(); executes the default_cmake_config.
    
    If you are dealing with a basic cmake module, all you need in a BUILD is; default_cmake_build
    
    If you encounter a module that is OK with default_cmake_config but needs some type of
    adjustment before the make is run you can do something like this;
    
    default_cmake_config &&
    $DO_YOUR_FIDDLING    &&
    default_make
    
    Signed-off-by: Stefan Wold <ratler at lunar-linux.org>
---
 var/lib/lunar/functions/build.lunar |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/var/lib/lunar/functions/build.lunar b/var/lib/lunar/functions/build.lunar
index 4efda36..c743d90 100644
--- a/var/lib/lunar/functions/build.lunar
+++ b/var/lib/lunar/functions/build.lunar
@@ -163,6 +163,19 @@ _configure()
 }
 
 
+# cmake can be run two ways: in source and out of source. The determinante method is
+# to look for a cmake macro, if it exists then do out of source.
+cmake_build_target() {
+  debug_msg "cmake_build_target ($@)"
+  if [ -e cmake/modules/MacroEnsureOutOfSourceBuild.cmake ]; then
+    verbose_msg "running \"Out of source build is required; configuring\""
+    OOSB_DIR="$SOURCE_DIRECTORY/$MODULE-oosb"  &&
+    mkdir $OOSB_DIR                            &&
+    cd $OOSB_DIR
+  fi
+}
+
+
 default_config() {
   debug_msg "default_config ($@)"
   verbose_msg "running \"default_config\""
@@ -206,6 +219,19 @@ default_cvs_config() {
 } > $C_FIFO 2>&1
 
 
+default_cmake_config() {
+  debug_msg "default_cmake_config ($@)"
+  verbose_msg "running \"default_cmake_config\""
+  verbose_msg "MODULE_PREFIX=\"$MODULE_PREFIX\""
+
+  cmake_build_target
+
+  cmake -DCMAKE_INSTALL_PREFIX=$MODULE_PREFIX  \
+        -DCMAKE_BUILD_TYPE=RELEASE             \
+        $OPTS $SOURCE_DIRECTORY
+} > $C_FIFO 2>&1
+
+
 default_make() {
   debug_msg "default_make ($@)"
   verbose_msg "running \"default_make\""
@@ -223,6 +249,13 @@ default_game_build() {
 } > $C_FIFO 2>&1
 
 
+default_cmake_build() {
+  debug_msg "default_cmake_build ($@)"
+  verbose_msg "running \"default_cmake_build\""
+  default_cmake_config &&
+  default_make
+} > $C_FIFO 2>&1
+
 default_build() {
   debug_msg "default_build ($@)"
   verbose_msg "running \"default_build\""


More information about the Lunar-commits mailing list