Python interpreter and libraries/headers detection.
- The user can now pass its own interpreter. - Development libraries and headers can be requested. - Travis-CI switched to new container-based workers.
This commit is contained in:
14
test/python_interpreter/cmake/autocmake.cfg
Normal file
14
test/python_interpreter/cmake/autocmake.cfg
Normal file
@ -0,0 +1,14 @@
|
||||
[project]
|
||||
name: example
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[python_interpreter]
|
||||
source: ../../../modules/python_interpreter.cmake
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
1
test/python_interpreter/src/CMakeLists.txt
Normal file
1
test/python_interpreter/src/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_executable(example example.cpp)
|
7
test/python_interpreter/src/example.cpp
Normal file
7
test/python_interpreter/src/example.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "PASSED";
|
||||
return 0;
|
||||
}
|
14
test/python_interpreter_custom/cmake/autocmake.cfg
Normal file
14
test/python_interpreter_custom/cmake/autocmake.cfg
Normal file
@ -0,0 +1,14 @@
|
||||
[project]
|
||||
name: example
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[python_interpreter]
|
||||
source: ../../../modules/python_interpreter.cmake
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
1
test/python_interpreter_custom/src/CMakeLists.txt
Normal file
1
test/python_interpreter_custom/src/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_executable(example example.cpp)
|
7
test/python_interpreter_custom/src/example.cpp
Normal file
7
test/python_interpreter_custom/src/example.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "PASSED";
|
||||
return 0;
|
||||
}
|
17
test/python_libs/cmake/autocmake.cfg
Normal file
17
test/python_libs/cmake/autocmake.cfg
Normal file
@ -0,0 +1,17 @@
|
||||
[project]
|
||||
name: example
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[python_interpreter]
|
||||
source: ../../../modules/python_interpreter.cmake
|
||||
|
||||
[python_libs]
|
||||
source: ../../../modules/python_libs.cmake
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
2
test/python_libs/src/CMakeLists.txt
Normal file
2
test/python_libs/src/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
add_executable(example example.cpp)
|
||||
target_link_libraries(example ${PYTHON_LIBRARIES})
|
11
test/python_libs/src/example.cpp
Normal file
11
test/python_libs/src/example.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <iostream>
|
||||
#include <Python.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Py_SetProgramName(argv[0]); /* optional but recommended */
|
||||
Py_Initialize();
|
||||
PyRun_SimpleString("print('PASSED')\n");
|
||||
Py_Finalize();
|
||||
return 0;
|
||||
}
|
17
test/python_libs_custom/cmake/autocmake.cfg
Normal file
17
test/python_libs_custom/cmake/autocmake.cfg
Normal file
@ -0,0 +1,17 @@
|
||||
[project]
|
||||
name: example
|
||||
|
||||
[cxx]
|
||||
source: ../../../modules/cxx.cmake
|
||||
|
||||
[python_interpreter]
|
||||
source: ../../../modules/python_interpreter.cmake
|
||||
|
||||
[python_libs]
|
||||
source: ../../../modules/python_libs.cmake
|
||||
|
||||
[default_build_paths]
|
||||
source: ../../../modules/default_build_paths.cmake
|
||||
|
||||
[src]
|
||||
source: ../../../modules/src.cmake
|
2
test/python_libs_custom/src/CMakeLists.txt
Normal file
2
test/python_libs_custom/src/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
add_executable(example example.cpp)
|
||||
target_link_libraries(example ${PYTHON_LIBRARIES})
|
11
test/python_libs_custom/src/example.cpp
Normal file
11
test/python_libs_custom/src/example.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <iostream>
|
||||
#include <Python.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Py_SetProgramName(argv[0]); /* optional but recommended */
|
||||
Py_Initialize();
|
||||
PyRun_SimpleString("print('PASSED')\n");
|
||||
Py_Finalize();
|
||||
return 0;
|
||||
}
|
18
test/test.py
18
test/test.py
@ -193,3 +193,21 @@ def test_fc_lapack():
|
||||
@skip_on_windows
|
||||
def test_fc_lapack_static():
|
||||
configure_build_and_exe('fc_lapack', 'python setup.py --fc=gfortran --static --cmake-options="-DMATH_LIB_SEARCH_ORDER=\'ATLAS;MKL\'"')
|
||||
|
||||
|
||||
def test_python_interpreter():
|
||||
configure_build_and_exe('python_interpreter', 'python setup.py --cxx=g++')
|
||||
|
||||
|
||||
def test_python_interpreter_custom():
|
||||
python_executable = sys.executable
|
||||
configure_build_and_exe('python_interpreter_custom', 'python setup.py --cxx=g++ --python={}'.format(python_executable))
|
||||
|
||||
|
||||
def test_python_libs():
|
||||
configure_build_and_exe('python_libs', 'python setup.py --cxx=g++')
|
||||
|
||||
|
||||
def test_python_libs_custom():
|
||||
python_executable = sys.executable
|
||||
configure_build_and_exe('python_libs_custom', 'python setup.py --cxx=g++ --python={}'.format(python_executable))
|
||||
|
Reference in New Issue
Block a user