From 96ccd82d5287377ec87427905c33e3940cff4367 Mon Sep 17 00:00:00 2001
From: Emmanuel Le Guirriec <emmanuel.le.guirriec@cern.ch>
Date: Thu, 13 Apr 2017 11:33:55 +0200
Subject: [PATCH] Not in my git

---
 Projects/WorkDir/CMakeLists.txt              | 68 ++++++++++++++++++++
 Projects/WorkDir/README.md                   | 53 +++++++++++++++
 Projects/WorkDir/package_filters_example.txt | 19 ++++++
 3 files changed, 140 insertions(+)
 create mode 100644 Projects/WorkDir/CMakeLists.txt
 create mode 100644 Projects/WorkDir/README.md
 create mode 100644 Projects/WorkDir/package_filters_example.txt

diff --git a/Projects/WorkDir/CMakeLists.txt b/Projects/WorkDir/CMakeLists.txt
new file mode 100644
index 00000000000..d6872700008
--- /dev/null
+++ b/Projects/WorkDir/CMakeLists.txt
@@ -0,0 +1,68 @@
+#
+# Project file for building a selected set of packages against an
+# installed ATLAS release/nightly.
+#
+
+# Set the minimum required CMake version:
+cmake_minimum_required( VERSION 3.2 FATAL_ERROR )
+
+# Let the user pick up updated AtlasCMake/AtlasLCG versions for testing.
+# Remember that it's not a problem if AtlasCMake is not found, that's why
+# we use the QUIET keyword.
+find_package( AtlasCMake QUIET )
+
+# Try to figure out what project is our parent. Just using a hard-coded list
+# of possible project names. Basically the names of all the other
+# sub-directories inside the Projects/ directory in the repository.
+set( _parentProjectNames Athena AthenaP1 AnalysisBase AthAnalysisBase
+   AthSimulation )
+set( _defaultParentProject Athena )
+set( _defaultUseFortran TRUE )
+foreach( _pp ${_parentProjectNames} )
+   if( NOT "$ENV{${_pp}_DIR}" STREQUAL "" )
+      set( _defaultParentProject ${_pp} )
+      # Only turn off Fortran support for the AnalysisBase project for now:
+      if( "${_pp}" STREQUAL "AnalysisBase" )
+         set( _defaultUseFortran FALSE )
+      endif()
+      break()
+   endif()
+endforeach()
+
+# Set the parent project name based on the previous findings:
+set( ATLAS_PROJECT ${_defaultParentProject}
+   CACHE STRING "The name of the parent project to build against" )
+# Set whether to use Fortran, based on the previous simple logic:
+option( ATLAS_USE_FORTRAN
+   "Whether the WorkDir project should provide support for Fortran"
+   ${_defaultUseFortran} )
+
+# Clean up:
+unset( _parentProjectNames )
+unset( _defaultParentProject )
+unset( _defaultUseFortran )
+
+# Find the project that we depend on:
+find_package( ${ATLAS_PROJECT} REQUIRED )
+
+# Set up CTest:
+atlas_ctest_setup()
+
+# Set up a work directory project:
+set( _useFortran )
+if( ATLAS_USE_FORTRAN )
+   set( _useFortran FORTRAN )
+endif()
+atlas_project( WorkDir ${${ATLAS_PROJECT}_VERSION}
+   USE ${ATLAS_PROJECT} ${${ATLAS_PROJECT}_VERSION}
+   PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../..
+   ${_useFortran} )
+unset( _useFortran )
+
+# Set up the runtime environment setup script(s):
+lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh )
+install( FILES ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh
+   DESTINATION . )
+
+# Set up CPack:
+atlas_cpack_setup()
diff --git a/Projects/WorkDir/README.md b/Projects/WorkDir/README.md
new file mode 100644
index 00000000000..71478a3976a
--- /dev/null
+++ b/Projects/WorkDir/README.md
@@ -0,0 +1,53 @@
+ATLAS WorkDir Project
+=====================
+
+This project can be used to build just a few packages from the repository
+against an installed ATLAS release/nightly. That means any base project,
+offline, trigger, simulation or analysis.
+
+The project can be used in two ways.
+
+Using a fully checked out repository
+------------------------------------
+
+If you have the entire `athena` repository checked out, you need to tell
+the CMake configuration which packages you actually want to build. Otherwise
+it will go ahead and attempt to build everything. Even packages not part of
+the selected base release itself.
+
+You should make a copy of the `package_filters_example.txt` file found in
+this directory, and modify it to select the packages you're interested in,
+for compilation. There is some documentation in the file explaining its
+format.
+
+Then, configure the build of the project like:
+
+    asetup ...
+    mkdir build
+    cd build/
+    cmake -DATLAS_PACKAGE_FILTER_FILE=/your/specific/package_filters.txt \
+       ../athena/Projects/WorkDir/
+
+Using a partially checked out repository
+----------------------------------------
+
+If you only checked out the packages that you want to compile, along with
+this `Projects/WorkDir` directory, then you don't need to worry about
+setting up a package filtering file. You can simply just do:
+
+    asetup ...
+    mkdir build
+    cd build/
+    cmake ../athena/Projects/WorkDir/
+
+This will set up the build of all checked out packages.
+
+Using the local build
+---------------------
+
+After being done with the build, you have to remember to source the
+`setup.sh` file of the build area to pick up your modifications! So, you
+would do something like this to set up your runtime environment from scratch:
+
+    asetup ...
+    source build/x86_64-slc6-gcc49-opt/setup.sh
diff --git a/Projects/WorkDir/package_filters_example.txt b/Projects/WorkDir/package_filters_example.txt
new file mode 100644
index 00000000000..f4497d38115
--- /dev/null
+++ b/Projects/WorkDir/package_filters_example.txt
@@ -0,0 +1,19 @@
+#
+# This is an example file for setting up which packages to pick up
+# for a sparse build, when you have a full checkout of the repository,
+# but only wish to rebuild some packages.
+#
+# The syntax is very simple:
+#
+# + REGEXP will include the package in the build
+# - REGEXP will exclude the package from the build
+#
+# The first match against the package path wins, so list
+# more specific matches above more general ones.
+#
+# Note that when you use git-atlas to make a sparse checkout, you will 
+# only have the packages available that you want to compile anyway. 
+# So in that case you should not bother with using such a filter file.
+#
++ Control/AthenaExamples/AthExHelloWorld
+- .*
-- 
GitLab