Actually there are no CMake "scripts" in the source tree, merely CMake build 
system files. Due to dependencies on libtiff (and Qt for the fully 
cross-platform rvu), and of course CMake, there is slight brain pain in getting 
your personal system ready to build, but from there a little scripting skill is 
all you need to use the CMake system. Check it out:

This is the script that we call on our nightly test machines (this builds the 
project and runs the ctests, and relies on a Kitware git clone of the Radiance 
CVS repo):

#!/usr/bin/ruby

##############################################################################
# Build Radiance
##############################################################################

require 'pathname'
require 'fileutils'
require 'erb'
require 'socket'

##############################################################################
#Common Functions
def configure(rcmake,cmake,env)
  template_text = ''
  File.open(rcmake) { |f| template_text << f.read }
  template = ERB.new(template_text)

  FileUtils.mkdir_p(cmake.dirname)
  File.open(cmake,'w+') { |f| f << template.result(env) }
end

def run(cmake)
  build_config = ''
  verbose_cmd = ''
  if VERBOSE_OUTPUT
    verbose_cmd = '-VV'
  end
  if /mswin/.match(RUBY_PLATFORM)
    build_config = "-C \"Release\""
  end
  system("ctest #{verbose_cmd} #{build_config} -S #{cmake}")
end

def run_nightly(rcmake,cmake,env)
  configure(rcmake,cmake,env)
  run(cmake)
end

##############################################################################
# Script Variables
case Socket.gethostname

when "hooper-2.local"
  win_version = "none"
  site = "hooper"
  build_name_modifer = "OSX-10.8-Universal"
  dashroot = Pathname.new("/Users/rpg/repos/radiance_build/radiance/")
else
  win_version = "none"
  build_name_modifer = ""
end

script_dir = Pathname.new(__FILE__).dirname.realpath
clean_build = true
VERBOSE_OUTPUT = true
if /mswin/.match(RUBY_PLATFORM)
  dashroot = Pathname.new("C:/radiance_build/radiance/")
  generator = "Visual Studio 9 2008 Express"
else generator = "Unix Makefiles"
end
jobs = "2"
if /linux/.match(RUBY_PLATFORM)
  ENV['LC_CTYPE'] = 'en_US.UTF-8'
  ENV['LANG'] = 'en_US.UTF-8'
  display = ENV['DISPLAY']
  dashroot = Pathname.new("/home/bldadmin/radiance_build/radiance/")
elsif /darwin/.match(RUBY_PLATFORM)
  dashroot = Pathname.new("/rad/radiance_build/radiance/")
end

Dir.chdir(dashroot)
system("git pull")

source_directory = (dashroot).to_s
binary_directory = (dashroot + "build").to_s
radiance_build_dir = binary_directory
model = "Nightly"


run_nightly("#{script_dir}/radiance.rcmake",dashroot + "radiance.cmake",binding)

#EOF

...and this is the .rcmake file contents that I think Denny can get a lot of 
tips from:

CMAKE_MINIMUM_REQUIRED( VERSION 2.8.4 )
##############################################################################
# Build Radiance
##############################################################################
# Configuration variables to be set by the managing ruby script
#
# Path configuration for build and source directories
SET( CTEST_SOURCE_DIRECTORY "<%=source_directory%>" )
SET( CTEST_BINARY_DIRECTORY "<%=binary_directory%>" )
# generator
SET( generator "<%=generator%>" )
# win_version
SET( win_version "<%=win_version%>" )
# model
SET( model "<%=model%>" )

SET( CTEST_ENVIRONMENT "DISPLAY=<%=display%>" )

# clean_build
SET( clean_build <%=clean_build%> )
# jobs
SET( jobs "<%=jobs%>" )
# build name modifer
SET( build_name_modifer "<%=build_name_modifer%>" )
SET( radiance_build_dir "<%=radiance_build_dir%>" )
SET( site "<%=site%>" )

##############################################################################
# Project, Site, and Build name configuration
#SITE_NAME( SITE )
SET( CTEST_SITE <%=site%> )
SET( CTEST_BUILD_NAME "${CMAKE_SYSTEM_NAME}-${build_name_modifer}" )


###############################################################################
# Configure for CDash
SET( CTEST_PROJECT_NAME "Radiance" )
SET( CTEST_NIGHTLY_START_TIME "00:00:00 MST" )
SET( CTEST_DROP_METHOD "http" )
SET( CTEST_DROP_SITE "my.cdash.org" )
SET( CTEST_DROP_LOCATION "/submit.php?project=Radiance" )
SET( CTEST_DROP_SITE_CDASH TRUE )


###############################################################################
# Set the package type
# Can only have one package type
SET( UNIX_PACKAGE_NAME "all" )
SET( MSVC_PACKAGE_NAME "ALL_BUILD" )

###############################################################################
# Build type
# Configures CTest to use the correct build command depending on platform

#### Linux and Mac
IF( ${generator} STREQUAL "Unix Makefiles" )
  SET( CTEST_CMAKE_GENERATOR "Unix Makefiles" )
  SET( CTEST_BUILD_COMMAND "make ${UNIX_PACKAGE_NAME} -j${jobs}" )
#### Windows - ${win_version} needs to be set if building on windows 7
# Visual Studio 2008
ELSEIF( ${generator} STREQUAL "Visual Studio 9 2008" )
  SET( CTEST_CMAKE_GENERATOR "Visual Studio 9 2008" )
  SET( MSVC_IS_EXPRESS "OFF" )
  IF( ${win_version} STREQUAL "7" )
    SET( CTEST_BUILD_COMMAND "\"C:\\Program Files (x86)\\Microsoft Visual 
Studio 9.0\\Common7\\IDE\\devenv.com\" Radiance.sln /build Release /project 
${MSVC_PACKAGE_NAME}" ) 
  ELSE()
    SET( CTEST_BUILD_COMMAND "\"C:\\Program Files\\Microsoft Visual Studio 
9.0\\Common7\\IDE\\devenv.com\" Radiance.sln /build Release /project 
${MSVC_PACKAGE_NAME}" ) 
  ENDIF( ${win_version} STREQUAL "7" )
# Visual Studio Express 2008
ELSEIF( ${generator} STREQUAL "Visual Studio 9 2008 Express" )
  SET( CTEST_CMAKE_GENERATOR "Visual Studio 9 2008" )
  SET( MSVC_IS_EXPRESS "ON" )
  IF( ${win_version} STREQUAL "7" )
    SET( CTEST_BUILD_COMMAND "\"C:\\Program Files (x86)\\Microsoft Visual 
Studio 9.0\\Common7\\IDE\\vcexpress.exe\" Radiance.sln /build Release /project 
${MSVC_PACKAGE_NAME}" ) 
  ELSE()
    SET( CTEST_BUILD_COMMAND "\"C:\\Program Files\\Microsoft Visual Studio 
9.0\\Common7\\IDE\\vcexpress.exe\" Radiance.sln /build Release /project 
${MSVC_PACKAGE_NAME}" ) 
  ENDIF( ${win_version} STREQUAL "7" )
# Visual Studio 10
ELSEIF( ${generator} STREQUAL "Visual Studio 10" )
  SET( CTEST_CMAKE_GENERATOR "Visual Studio 10" )
  SET( MSVC_IS_EXPRESS "OFF" )
  SET( CTEST_BUILD_COMMAND "\"C:\\Program Files\\Microsoft Visual Studio 
10.0\\Common7\\IDE\\devenv.com\" Radiance.sln /build Release /project 
${MSVC_PACKAGE_NAME}" )
# Visual Studio Express 10
ELSEIF( ${generator} STREQUAL "Visual Studio 10 Express" )
  SET( CTEST_CMAKE_GENERATOR "Visual Studio 10" )
  SET( MSVC_IS_EXPRESS "ON" )
  SET( CTEST_BUILD_COMMAND "\"C:\\Program Files\\Microsoft Visual Studio 
10.0\\Common7\\IDE\\vcexpress.exe\" Radiance.sln /build Release /project 
${MSVC_PACKAGE_NAME}" )  
ENDIF()


###############################################################################
# Start with a completely empty binary directory?
IF( clean_build )
  CTEST_EMPTY_BINARY_DIRECTORY( "${CTEST_BINARY_DIRECTORY}" )
ENDIF()


###############################################################################
# Start
message("CTest: Starting ${model} in ${CTEST_BINARY_DIRECTORY}")
ctest_start("${model}" "${CTEST_SOURCE_DIRECTORY}" "${CTEST_BINARY_DIRECTORY}" )


###############################################################################
# Set the initial cache and other model specific variables

SET( INITIAL_CACHE "
#  BUILD_TESTING:BOOL=ON
  MSVC_IS_EXPRESS:BOOL=${MSVC_IS_EXPRESS}
  CTEST_SITE:STRING=<%=site%>
")

# Mac specific cache stuff
IF( APPLE )
  SET( INITIAL_CACHE "
     ${INITIAL_CACHE}
     CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5
     CMAKE_OSX_SYSROOT:STRING=/Developer/SDKs/MacOSX10.5.sdk
     CMAKE_OSX_ARCHITECTURES:STRING=i386;x86_64
  ")
ENDIF()

###############################################################################
# If binary directory does not exist, we create it and add the initial cache
# If it does exist we just update the svn version
IF( NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
  # Write initial cache.
  file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "${INITIAL_CACHE}")
ELSE()
  file(READ "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" CACHE_TEXT) 
  string(REGEX REPLACE "CMAKE_VERSION_BUILD:STRING=[A-Za-z0-9]*"
        "CMAKE_VERSION_BUILD:STRING=${REPO_VERSION}"
        NEW_CACHE_TEXT "${CACHE_TEXT}" )
  file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "${NEW_CACHE_TEXT}") 
ENDIF()


###############################################################################
# Configure
message("CTest: Configuring ${model}")
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}" SOURCE 
"${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res )
IF(NOT res EQUAL 0 )
  message("CTest: Configure failed")
ENDIF()


###############################################################################
# Build
message("CTest: Building ${model}")
ctest_build( BUILD "${CTEST_BINARY_DIRECTORY}" NUMBER_ERRORS res )
IF(NOT res EQUAL 0 )
  message("CTest: Build failed")
ELSE()
  message("CTest: Build succeeded")
ENDIF()


###############################################################################
# Test
message("CTest: Testing ${model}")
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res )


###############################################################################
# Submit
message("CTest: Submitting results to CDash")
ctest_submit(RETURN_VALUE res )

# EOF

This is an entirely automated process, just a cron job. No reason why you 
couldn't request a "make package", here. I know that CMake supports the 
creation of RPMs too, I'm just not familiar with the specifics.

- Rob




_______________________________________________
Radiance-dev mailing list
Radiance-dev@radiance-online.org
http://www.radiance-online.org/mailman/listinfo/radiance-dev

Reply via email to