Proposal: adding default_cmake_config and default_cmake_build functions to build.lunar

Dennis Veatch dennisveatch at bellsouth.net
Sun May 22 16:15:27 CEST 2011


On Saturday, May 21, 2011 2:46:04 PM Auke Kok wrote:
> On 05/21/2011 05:33 AM, Dennis Veatch wrote:
> > Cmake can be run two ways;
> 
> when will the hurting stop? :D
> 

Never. If it does it will only be momentary while a *new and better* build 
environment is thrust upon us.

> 
> seems the indentation here is futzed up - can you fix that up?
> 

Not sure which indentaion you are referring.

> I think you'll be fine with only 1 verbose_msg call in the entire
> function, the rest can become debug level messages.
> 
> Also, I don't like if-then statements that call the same external
> program (`cmake`) twice with almost the same arguments - can you reduce
> this to something like
> 
> if .... ; then
>     set options for this case
> else
>     set different options
> fi
> 
> cmake $options
> 
> ?

See attachment.

> 
> > +}>  $C_FIFO 2>&1
> > 
> >   default_make() {
> >   
> >     debug_msg "default_make ($@)"
> > 
> > @@ -223,6 +248,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&&
> 
> throw in a free 0x20 will ya?

Where?

> 

> 
> Auke
> _______________________________________________

Stab #2 is attached and here for your viewing pleasure (not responsible for 
hosed appearance here);

diff --git a/var/lib/lunar/functions/build.lunar 
b/var/lib/lunar/functions/build.lunar
index 4efda36..c6d3e5f 100644
--- a/var/lib/lunar/functions/build.lunar
+++ b/var/lib/lunar/functions/build.lunar
@@ -163,6 +163,23 @@ _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_type() {
+  debug_msg "_cmake_build_type($@)"
+  if [ -e cmake/modules/MacroEnsureOutOfSourceBuild.cmake ]; then
+    verbose_msg "running \"Out of source build is required; configuring\""
+    BUILD_TYPE="$SOURCE_DIRECTORY/$MODULE-oosb"  &&
+    mkdir $BUILD_TYPE                            &&
+    cd $BUILD_TYPE                               &&
+    BUILD_TYPE="../"
+  else
+    verbose_msg "running \"configuring for an in source build\""
+    BUILD_TYPE="."               
+  fi
+}
+
+
 default_config() {
   debug_msg "default_config ($@)"
   verbose_msg "running \"default_config\""
@@ -206,6 +223,18 @@ 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_type                     
+  cmake -DCMAKE_INSTALL_PREFIX=$MODULE_PREFIX  \
+        -DCMAKE_BUILD_TYPE=RELEASE             \
+        $OPTS                                  \
+        $BUILD_TYPE
+} > $C_FIFO 2>&1
+
 default_make() {
   debug_msg "default_make ($@)"
   verbose_msg "running \"default_make\""
@@ -223,6 +252,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\""


-- 
Dennis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.lunar-cmake-configure-build.02.patch
Type: text/x-patch
Size: 1899 bytes
Desc: not available
URL: <http://foo-projects.org/pipermail/lunar-dev/attachments/20110522/12615118/attachment.bin>


More information about the Lunar-dev mailing list