Added module for Boost detection and automatic build-up
This commit is contained in:
committed by
Roberto Di Remigio
parent
ea694c0bdd
commit
1780e4a189
19
test/boost_header_only/cmake/autocmake.cfg
Normal file
19
test/boost_header_only/cmake/autocmake.cfg
Normal file
@ -0,0 +1,19 @@
|
||||
[project]
|
||||
name: example
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[custom]
|
||||
source: custom/boost_version-components.cmake
|
||||
|
||||
[boost]
|
||||
source: ../../../modules/boost/boost.cmake
|
||||
fetch: http://sourceforge.net/projects/boost/files/boost/1.48.0/boost_1_48_0.zip
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
@ -0,0 +1,2 @@
|
||||
set(BOOST_MINIMUM_REQUIRED 1.48.0)
|
||||
list(APPEND BOOST_COMPONENTS_REQUIRED)
|
1
test/boost_header_only/src/CMakeLists.txt
Normal file
1
test/boost_header_only/src/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_executable(example example.cpp)
|
17
test/boost_header_only/src/example.cpp
Normal file
17
test/boost_header_only/src/example.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <iostream>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Boost version: "
|
||||
<< BOOST_VERSION / 100000
|
||||
<< "."
|
||||
<< BOOST_VERSION / 100 % 1000
|
||||
<< "."
|
||||
<< BOOST_VERSION % 100
|
||||
<< std::endl;
|
||||
|
||||
std::cout << "PASSED" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
19
test/boost_libs/cmake/autocmake.cfg
Normal file
19
test/boost_libs/cmake/autocmake.cfg
Normal file
@ -0,0 +1,19 @@
|
||||
[project]
|
||||
name: example
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[custom]
|
||||
source: custom/boost_version-components.cmake
|
||||
|
||||
[boost]
|
||||
source: ../../../modules/boost/boost.cmake
|
||||
fetch: http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.zip
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
@ -0,0 +1,2 @@
|
||||
set(BOOST_MINIMUM_REQUIRED 1.59.0)
|
||||
list(APPEND BOOST_COMPONENTS_REQUIRED chrono timer system)
|
5
test/boost_libs/src/CMakeLists.txt
Normal file
5
test/boost_libs/src/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_executable(example example.cpp)
|
||||
if(BUILD_CUSTOM_BOOST)
|
||||
add_dependencies(example custom_boost)
|
||||
endif()
|
||||
target_link_libraries(example ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY} ${Boost_SYSTEM_LIBRARY})
|
28
test/boost_libs/src/example.cpp
Normal file
28
test/boost_libs/src/example.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <boost/timer/timer.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::timer::auto_cpu_timer t;
|
||||
|
||||
std::cout << "Boost version: "
|
||||
<< BOOST_VERSION / 100000
|
||||
<< "."
|
||||
<< BOOST_VERSION / 100 % 1000
|
||||
<< "."
|
||||
<< BOOST_VERSION % 100
|
||||
<< std::endl;
|
||||
|
||||
|
||||
std::cout << "Measuring some timings..." << std::endl;
|
||||
for (long i = 0; i < 100000000; ++i)
|
||||
std::sqrt(123.456L); // burn some time
|
||||
|
||||
std::cout << "PASSED" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
22
test/boost_mpi_libs/cmake/autocmake.cfg
Normal file
22
test/boost_mpi_libs/cmake/autocmake.cfg
Normal file
@ -0,0 +1,22 @@
|
||||
[project]
|
||||
name: example
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[mpi]
|
||||
source: ../../../modules/mpi.cmake
|
||||
|
||||
[custom]
|
||||
source: custom/boost_version-components.cmake
|
||||
|
||||
[boost]
|
||||
source: ../../../modules/boost/boost.cmake
|
||||
fetch: http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.zip
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
@ -0,0 +1,2 @@
|
||||
set(BOOST_MINIMUM_REQUIRED 1.59.0)
|
||||
list(APPEND BOOST_COMPONENTS_REQUIRED mpi serialization)
|
5
test/boost_mpi_libs/src/CMakeLists.txt
Normal file
5
test/boost_mpi_libs/src/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_executable(example example.cpp)
|
||||
if(BUILD_CUSTOM_BOOST)
|
||||
add_dependencies(example custom_boost)
|
||||
endif()
|
||||
target_link_libraries(example ${Boost_MPI_LIBRARY} ${Boost_SERIALIZATION_LIBRARY} ${MPI_CXX_LIBRARIES})
|
26
test/boost_mpi_libs/src/example.cpp
Normal file
26
test/boost_mpi_libs/src/example.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/mpi/environment.hpp>
|
||||
#include <boost/mpi/communicator.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
namespace mpi = boost::mpi;
|
||||
std::cout << "Boost version: "
|
||||
<< BOOST_VERSION / 100000
|
||||
<< "."
|
||||
<< BOOST_VERSION / 100 % 1000
|
||||
<< "."
|
||||
<< BOOST_VERSION % 100
|
||||
<< std::endl;
|
||||
|
||||
mpi::environment env;
|
||||
mpi::communicator world;
|
||||
std::cout << "I am process " << world.rank() << " of " << world.size()
|
||||
<< "." << std::endl;
|
||||
|
||||
std::cout << "PASSED" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
25
test/boost_python_libs/cmake/autocmake.cfg
Normal file
25
test/boost_python_libs/cmake/autocmake.cfg
Normal file
@ -0,0 +1,25 @@
|
||||
[project]
|
||||
name: example
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[python_interpreter]
|
||||
source: ../../../modules/python_interpreter.cmake
|
||||
|
||||
[python_libs]
|
||||
source: ../../../modules/python_libs.cmake
|
||||
|
||||
[custom]
|
||||
source: custom/boost_version-components.cmake
|
||||
|
||||
[boost]
|
||||
source: ../../../modules/boost/boost.cmake
|
||||
fetch: http://sourceforge.net/projects/boost/files/boost/1.56.0/boost_1_56_0.zip
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
@ -0,0 +1,2 @@
|
||||
set(BOOST_MINIMUM_REQUIRED 1.56.0)
|
||||
list(APPEND BOOST_COMPONENTS_REQUIRED python)
|
5
test/boost_python_libs/src/CMakeLists.txt
Normal file
5
test/boost_python_libs/src/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_executable(example example.cpp)
|
||||
if(BUILD_CUSTOM_BOOST)
|
||||
add_dependencies(example custom_boost)
|
||||
endif()
|
||||
target_link_libraries(example ${Boost_PYTHON_LIBRARY} ${PYTHON_LIBRARIES})
|
38
test/boost_python_libs/src/example.cpp
Normal file
38
test/boost_python_libs/src/example.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
||||
std::cout << "Boost version: "
|
||||
<< BOOST_VERSION / 100000
|
||||
<< "."
|
||||
<< BOOST_VERSION / 100 % 1000
|
||||
<< "."
|
||||
<< BOOST_VERSION % 100
|
||||
<< std::endl;
|
||||
|
||||
try {
|
||||
Py_Initialize();
|
||||
|
||||
object main_module((
|
||||
handle<>(borrowed(PyImport_AddModule("__main__")))));
|
||||
|
||||
object main_namespace = main_module.attr("__dict__");
|
||||
|
||||
handle<> ignored(( PyRun_String( "print \"Hello, World\"",
|
||||
Py_file_input,
|
||||
main_namespace.ptr(),
|
||||
main_namespace.ptr() ) ));
|
||||
} catch( error_already_set ) {
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
|
||||
std::cout << "PASSED" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cc]
|
||||
source: ../../../modules/cc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cc]
|
||||
source: ../../../modules/cc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[fc]
|
||||
source: ../../../modules/fc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[fc]
|
||||
source: ../../../modules/fc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[fc]
|
||||
source: ../../../modules/fc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[fc]
|
||||
source: ../../../modules/fc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[fc]
|
||||
source: ../../../modules/fc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[fc]
|
||||
source: ../../../modules/fc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[fc]
|
||||
source: ../../../modules/fc.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name: example
|
||||
minimum_cmake_version: 2.8
|
||||
min_cmake_version: 2.8
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
24
test/test.py
24
test/test.py
@ -230,5 +230,25 @@ def test_python_libs():
|
||||
|
||||
|
||||
def test_python_libs_custom():
|
||||
setup = 'python setup.py --cxx=g++ --python=%s' % sys.executable
|
||||
configure_build_and_exe('python_libs_custom', setup)
|
||||
python_executable = sys.executable
|
||||
configure_build_and_exe('python_libs_custom', 'python setup.py --cxx=g++ --python={}'.format(python_executable))
|
||||
|
||||
|
||||
@skip_on_windows
|
||||
def test_boost_header_only():
|
||||
configure_build_and_exe('boost_header_only', 'python setup.py --cxx=g++')
|
||||
|
||||
|
||||
@skip_on_windows
|
||||
def test_boost_libs():
|
||||
configure_build_and_exe('boost_libs', 'python setup.py --cxx=g++')
|
||||
|
||||
|
||||
@skip_on_windows
|
||||
def test_boost_mpi_libs():
|
||||
configure_build_and_exe('boost_mpi_libs', 'python setup.py --cxx=g++ --mpi')
|
||||
|
||||
|
||||
@skip_on_windows
|
||||
def test_boost_python_libs():
|
||||
configure_build_and_exe('boost_python_libs', 'python setup.py --cxx=g++')
|
||||
|
Reference in New Issue
Block a user