Commit a62a4419 authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: Added BOOST program_options static library

parent 26326f2b
......@@ -74,6 +74,7 @@ selxmodule_enable( ModuleSinksAndSources )
selxmodule_enable( ModuleItkSmoothingRecursiveGaussianImageFilter )
selxmodule_enable( ModuleItkImageRegistrationMethodv4 )
selxmodule_enable( ModuleElastixComponent )
selxmodule_enable( ModuleCommandLine )
# TODO: Build tests depending on enabled modules
# ---------------------------------------------------------------------
......
set( MODULE ModuleCommandLine )
# Export include files
set( ${MODULE}_INCLUDE_DIRS
${${MODULE}_SOURCE_DIR}/include
)
# Collect header files for Visual Studio Project
# http://stackoverflow.com/questions/8316104/specify-how-cmake-creates-visual-studio-project
file(GLOB ${MODULE}_HEADER_FILES "${${MODULE}_SOURCE_DIR}/*/include/*.*")
# Export libraries
set( ${MODULE}_LIBRARIES
${MODULE}
)
# Export tests
set( ${MODULE}_TESTS
)
# Module source files
set( ${MODULE}_SOURCE_FILES
${${MODULE}_SOURCE_DIR}/src/CommandLine.cxx
)
message(STATUS "BOOST_LIBRARYDIR: ${BOOST_LIBRARYDIR}")
message(STATUS "BOOST_ROOT: ${BOOST_ROOT}")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
#set(Boost_USE_STATIC_RUNTIME OFF)
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib)
message(STATUS "BOOST_LIBRARYDIR: ${BOOST_LIBRARYDIR}")
find_package(Boost COMPONENTS program_options REQUIRED)
#find_package(Boost REQUIRED)
# Compile library
add_library( ${MODULE} STATIC ${${MODULE}_SOURCE_FILES} ${${MODULE}_HEADER_FILES} )
# Compile executable
add_executable( SuperElastix ${${MODULE}_SOURCE_FILES} ${${MODULE}_HEADER_FILES} )
target_link_libraries( SuperElastix ${SUPERELASTIX_LIBRARIES} )
// Copyright Vladimir Prus 2002-2004.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
/* The simplest usage of the library.
*/
#include <boost/program_options.hpp>
namespace po = boost::program_options;
#include <iostream>
#include <algorithm>
#include <iterator>
using namespace std;
template<class T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
return os;
}
int main(int ac, char* av[])
{
try {
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("levels", po::value<int>(), "number of resolution levels")
("iterations", po::value<vector<int>>()->multitoken(), "number of iterations per level")
;
po::variables_map vm;
po::store(po::parse_command_line(ac, av, desc), vm);
po::notify(vm);
if (vm.count("help")) {
cout << desc << "\n";
return 0;
}
if (vm.count("levels")) {
cout << "number of resolution levels was set to "
<< vm["levels"].as<int>() << ".\n";
}
else {
cout << "number of resolution levels was not set.\n";
}
if (vm.count("iterations")) {
cout << "number of iterations per level was set to "
<< vm["iterations"].as< vector<int> >() << "\n";
}
else {
cout << "number of iterations per level was not set.\n";
}
}
catch (exception& e) {
cerr << "error: " << e.what() << "\n";
return 1;
}
catch (...) {
cerr << "Exception of unknown type!\n";
}
return 0;
}
......@@ -9,13 +9,13 @@ if( UNIX )
set( BOOST_URL "http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz")
set( BOOST_MD5 51528a0e3b33d9e10aaa311d9eb451e3 )
set( BOOST_CONFIGURE_COMMAND ./bootstrap.sh )
set( BOOST_BUILD_COMMAND ./b2 )
set( BOOST_BUILD_COMMAND ./b2 --with-program_options )
else()
if( WIN32 )
set( BOOST_URL "http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.zip")
set( BOOST_MD5 08d29a2d85db3ebc8c6fdfa3a1f2b83c )
set( BOOST_CONFIGURE_COMMAND cmd /C bootstrap.bat msvc )
set( BOOST_BUILD_COMMAND b2.exe )
set( BOOST_BUILD_COMMAND b2.exe --with-program_options )
endif()
endif()
......@@ -32,5 +32,6 @@ ExternalProject_Add( BOOST
)
set( BOOST_ROOT "${CMAKE_INSTALL_PREFIX}/${proj}-prefix/src/BOOST" )
set( BOOST_LIBRARYDIR "${BOOST_ROOT}/stage/lib/" )
list( APPEND SUPERELASTIX_DEPENDENCIES ${proj} )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment