tCMake now used as the build system - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
 (HTM) git clone git://src.adamsgaard.dk/sphere
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit e498b289dd22fb495f3c0891039f8015b19cf28c
 (DIR) parent d30540ae62abcfd984b3eda396cf534e72aaad66
 (HTM) Author: Anders Damsgaard <adc@geo.au.dk>
       Date:   Wed, 19 Dec 2012 11:01:44 +0100
       
       CMake now used as the build system
       
       Diffstat:
         A CMakeLists.txt                      |      20 ++++++++++++++++++++
         M README.rst                          |      20 +++++++++++++++-----
         A src/CMakeLists.txt                  |      27 +++++++++++++++++++++++++++
       
       3 files changed, 62 insertions(+), 5 deletions(-)
       ---
 (DIR) diff --git a/CMakeLists.txt b/CMakeLists.txt
       t@@ -0,0 +1,20 @@
       +# Create input/output folders
       +FILE(MAKE_DIRECTORY input)
       +FILE(MAKE_DIRECTORY output)
       +FILE(MAKE_DIRECTORY img_out)
       +
       +# The name of the project.
       +PROJECT(sphere_CUDA)
       +
       +# CMake minimum version required
       +# FindCUDA script is distributed since version 2.8
       +CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
       +
       +# Find CUDA
       +FIND_PACKAGE(CUDA)
       +# Find OpenMP
       +FIND_PACKAGE(OpenMP)
       +
       +
       +#Add source directory to project.
       +ADD_SUBDIRECTORY(src)
 (DIR) diff --git a/README.rst b/README.rst
       t@@ -12,7 +12,8 @@ Requirements
        ------------
        The build requirements are:
          * A Nvidia CUDA-supported version of Linux or Mac OS X (see the `CUDA toolkit release notes <http://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html>`_ for more information)
       -  * The `GNU Compiler Collection <http://gcc.gnu.org/>`_ (GCC)
       +  * `CMake <http://cmake.org>`_, version 2.8 or higher
       +  * A C/C++ compiler toolkit, e.g. the `GNU Compiler Collection <http://gcc.gnu.org/>`_ (GCC)
          * The `Nvidia CUDA toolkit and SDK <https://developer.nvidia.com/cuda-downloads>`_
        
        The runtime requirements are:
       t@@ -31,7 +32,7 @@ Optional tools, required for building the documentation:
          * `Doxygen <http://www.stack.nl/~dimitri/doxygen/>`_
          * `Breathe <http://michaeljones.github.com/breathe/>`_
        
       -Obtaining SPHERE
       +Obtaining sphere
        ----------------
        The best way to keep up to date with subsequent updates, bugfixes
        and development, is to use the Git version control system.
       t@@ -41,6 +42,15 @@ To obtain a local copy, execute:
        
        Build instructions
        ------------------
       -  ``cd src/ && make``
       -
       -This will generate a command-line executable in the root folder.
       +Sphere is built using `cmake`, the platform-specific c/c++ compilers,
       +and `nvcc` from the cuda toolkit. Execute the following commands from
       +the root directory::
       + cmake .
       + make
       +
       +In some cases the CMake FindCUDA module will have troubles locating the
       +CUDA SDK directory. In that case, modify the `NVSDKCOMPUTE_ROOT` environment
       +variable in `INSTALL.sh`, and execute it.
       +
       +After a successfull installation, the `sphere` executable will be located
       +in the root folder.
 (DIR) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
       t@@ -0,0 +1,27 @@
       +# Create input/output folders
       +FILE(MAKE_DIRECTORY input)
       +FILE(MAKE_DIRECTORY output)
       +FILE(MAKE_DIRECTORY img_out)
       +
       +# Link with libcutil (expected to be in ${CUDA_SDK_ROOT_DIR}/C/lib)
       +#LINK_LIBRARIES("-L${CUDA_SDK_ROOT_DIR}/lib -lcutil")        # For 32 bit systems
       +LINK_LIBRARIES("-L${CUDA_SDK_ROOT_DIR}/lib -lcutil_x86_64") # For 64 bit systems
       +
       +# Ohter folders to include
       +INCLUDE_DIRECTORIES("${CUDA_SDK_ROOT_DIR}/common/inc")
       +INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/src")
       +
       +# Include FindCUDA script
       +INCLUDE(FindCUDA)
       +
       +# Additional NVCC command line arguments
       +# NOTE: Multiple arguments must be semi-colon selimited
       +SET(CUDA_NVCC_FLAGS "--use_fast_math;-O3;-gencode=arch=compute_20,code=\"sm_20,compute_20\"")  # without debug flags
       +#SET(CUDA_NVCC_FLAGS "--use_fast_math;-O3;-gencode=arch=compute_20,code=\"sm_20,compute_20\"-g;-G")   # with debug flags
       +
       +
       +
       +# Rule to build executable program 
       +CUDA_ADD_EXECUTABLE(../sphere main.cpp file_io.cpp sphere.cpp device.cu utility.cu)
       +CUDA_ADD_EXECUTABLE(../porosity porosity.cpp file_io.cpp sphere.cpp device.cu utility.cu)
       +