View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011807CMakeCMakepublic2011-02-05 16:122016-06-10 14:31
ReporterBrian J. Davis 
Assigned ToKitware Robot 
PrioritylowSeverityfeatureReproducibilityN/A
StatusclosedResolutionmoved 
Platformx64OSWinXP/Win7/Vista64/Ubutntu 64OS Versionna
Product VersionCMake 2.8.3 
Target VersionFixed in Version 
Summary0011807: SAP - Super Awesome Projects - boost-cmake like macros with added project inheritance feature.
DescriptionSAP - Super Awesome Projects - boost-cmake like macros with added project inheritance feature. Some of this may be being tackled with in the project ryppl which I have not tried. I recently created this for a class I am taking and put it in compact form which I am now uploading to ask for as a feature request. I did this to limit the verbosity of CMake when adding new libs and exe's. I also wanted a mechanism closer to bjam syntax. Maybe there is a better way of doing this with vanilla CMake if so I don't see it.

After using CMake for a while and browsing through the boost-cmake repo I came up with a mechanism to create projects. One of my other goals was to include other CMake Projects such as VTK, ITK, boost-cmake, dcmtk, and others into an uber project. This attempt met with drastically awful results. Maybe CMake can be made to play nicely with itself in this regard. For more open the google and search "build only what you need in third party libs". There are posts on the forums regarding my trails and tribulations on this front.

These macros have an inheritance feature where one project can be specified. This is currently a prototype example and there are likely better ways of doing this. I also need to fix the inherited projects and library linking issue, but this serves at least as a working example.

Not every feature of CMake is supported and I have been working to figure out away to do this in a modular fasion. Supported features can be seen by looking through the .cmake files and looking for:

 set( ARGUMENT_NAMES
        INHERIT_CONFIGURATIONS
        SOURCE_DIRECTORIES
        CPP_SOURCES
        CU_SOURCES
        DEFINES
        LINK_LIBS
        INCLUDE_DIRECTORIES
        LINK_DIRECTORIES
        CUDA_APP
        INSTALL_DIRECTORIES
        DEPENDENCIES
        LINK_FLAGS
        LINKER_LANGUAGE
        ${COMPILE_FLAG_TYPES}
   )


The scripts are located in the ./CMake/Modules section of the provided zip.

./CMake/Modules
./CMake/Modules/Findsap.cmake
./CMake/Modules/sap
./CMake/Modules/sap/add_project.cmake
./CMake/Modules/sap/add_project_configuration.cmake
./CMake/Modules/sap/add_project_executable.cmake
./CMake/Modules/sap/add_project_library.cmake
./CMake/Modules/sap/debug_message.cmake
./CMake/Modules/sap/parse_project_arguments.cmake
./CMake/Modules/sap/patch.cmake
./CMake/Modules/sap/set_if_found.cmake
./CMake/Modules/sap/touch_file.cmake
./CMake/Modules/sap/unpack.cmake
    

The inheritance feature can be specified as an example by:

project( project_name )

add_project_configuration(
    boost_headers_config
    INCLUDE_DIRECTORIES
       ${BOOST_INCLUDE_DIR}
)

SET( BOOST_LIB_POSTFIX "-vc90-mt-1_41" )
SET( BOOST_LIB_PREFIX "lib" )

add_project_configuration(
    boost_config
    INCLUDE_DIRECTORIES
       ${BOOST_INCLUDE_DIR}
    LINK_DIRECTORIES
        ${CMAKE_INSTALL_PREFIX}/lib
        ${BOOST_STAGE_DIR}/lib
    LINK_LIBS
        ${BOOST_LIB_PREFIX}boost_system${BOOST_LIB_POSTFIX}
        ${BOOST_LIB_PREFIX}boost_date_time${BOOST_LIB_POSTFIX}
        ${BOOST_LIB_PREFIX}boost_filesystem${BOOST_LIB_POSTFIX}
        ${BOOST_LIB_PREFIX}boost_serialization${BOOST_LIB_POSTFIX}
        
)

add_project_configuration(
    vtk_config
    LINK_DIRECTORIES
        ${CMAKE_INSTALL_PREFIX}/lib
        ${CMAKE_INSTALL_PREFIX}/lib/vtk-${VTK_LIB_VERSION_INCLUDE}
        ${CMAKE_INSTALL_PREFIX}/lib/VTKEdge
    LINK_LIBS
            vtkCommon
            vtkDICOMParser
            vtkFiltering
            vtkGraphics
            vtkImaging
            vtkIO
            vtkRendering
            vtkVolumeRendering
            vtkKWEVolumeRendering
            vtkKWECommon
)


add_project_library
    myLib
    INHERIT_CONFIGURATIONS
        project_name_boost_config
        project_name_vtk_config
    INCLUDE_DIRECTORIES
        ${CMAKE_CURRENT_SOURCE_DIR}/../include
    CPP_SOURCES
        myLib.cpp
    CU_SOURCES
        myLib.cu
    INSTALL_DIRECTORIES
        lib
)
    
add_project_configuration(
    mylib_config
    LINK_LIBS
        myLib
)
        
add_project_executable(
    myApp
    INHERIT_CONFIGURATIONS
        project_name_mylib_config
    INSTALL_DIRECTORIES
        bin
)



See add_project_configuration, add_project_ececutable.cmake add_project_library, and parse_project_arguments.cmake in attached zip.

parse_project_arguments may be found to be interesting as this is what generates the xml files so that a developer can see what sap reads from the configuration. I thought about calling this a Parse Arguments Hack (PAH) instead of SAP, but sap was preferred and the letters are flexible enough to make other acronyms for people that despise this approach like stupid analytical processing, [put yours here],....

An example is below:

- <project>
- <ME964_cuda_config>
  <DEFAULT_ARGS />
- <INCLUDE_DIRECTORIES>
  <paramater>"C:/CUDA/include"</paramater>
  <paramater>"C:/Documents and Settings/All Users/Application Data/NVIDIA Corporation/NVIDIA GPU Computing SDK/C/common/inc"</paramater>
  </INCLUDE_DIRECTORIES>
- <LINK_DIRECTORIES>
  <paramater>"C:/Documents and Settings/All Users/Application Data/NVIDIA Corporation/NVIDIA GPU Computing SDK/C/common/lib"</paramater>
  </LINK_DIRECTORIES>
- <LINK_LIBS>
  <paramater>"cublas"</paramater>
  <paramater>"cuda"</paramater>
  <paramater>"cudart"</paramater>
  <paramater>"cufft"</paramater>
  <paramater>"cutil_x86_64D"</paramater>
  </LINK_LIBS>
  </ME964_cuda_config>
  </project>
Steps To Reproduce- unzip the archive
- read the README.txt at top of tree
- install missing CMake .tar.gz (Linux) or .zip (WinXP/Windows7 x64/Windows Server 2008 x64 and ver B) boost if desired (not necessary) and GNUWin32 unzip.exe
- move in to place CMakeLists.txt.example to CMakeLists.txt
- run go.bat if the .zips, .tars, and unzip.exe are in place and wait for the CMake magic (unpack) to happen
- use cmake to configure the example.
- browse through the various .xml generated files and project example in source/cpp/project1

Needed bits if you want it to auto configure itself.

Windows
./platform/3rdParty/Win/boost/boost-cmake-1_41_0.zip
./platform/3rdParty/Win/cmake/cmake-2.8.2-win32-x86.zip

Linux
./platform/3rdParty/Linux/boost/boost_1_45_0.tar.gz
./platform/3rdParty/Linux/cmake/cmake-2.8.3.tar.gz

Linux and Windows
./platform/3rdParty/Win/GNUWin32/unzip.exe
TagsNo tags attached.
Attached Fileszip file icon release.zip [^] (26,014 bytes) 2011-02-05 16:12

 Relationships

  Notes
(0030230)
David Cole (manager)
2012-08-11 11:09

Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041796)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2011-02-05 16:12 Brian J. Davis New Issue
2011-02-05 16:12 Brian J. Davis File Added: release.zip
2012-08-11 11:09 David Cole Status new => backlog
2012-08-11 11:09 David Cole Note Added: 0030230
2016-06-10 14:28 Kitware Robot Note Added: 0041796
2016-06-10 14:28 Kitware Robot Status backlog => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team