Compare commits
	
		
			6 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | ba05c8aafc | ||
|  | 9d1ab64720 | ||
|  | 18349229ff | ||
|  | 05f4ad9116 | ||
|  | 1aa7e1a4bd | ||
|  | 4d902ea85c | 
							
								
								
									
										32
									
								
								.default.nix
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								.default.nix
									
									
									
									
									
								
							| @@ -1,32 +0,0 @@ | |||||||
| let |  | ||||||
|   hostPkgs = import <nixpkgs> {}; |  | ||||||
|   nixpkgs = (hostPkgs.fetchFromGitHub { |  | ||||||
|     owner = "NixOS"; |  | ||||||
|     repo = "nixpkgs-channels"; |  | ||||||
|     rev = "nixos-unstable"; |  | ||||||
|     sha256 = "1rc1pjnvfi194gka45zc1nivzsncc819kvxlfv277l2c8ryhgbpc"; |  | ||||||
|   }); |  | ||||||
| in |  | ||||||
|   with import nixpkgs {}; |  | ||||||
|   stdenv.mkDerivation { |  | ||||||
|     name = "Autocmake"; |  | ||||||
|     buildInputs = [ |  | ||||||
|       ccache |  | ||||||
|       cmake |  | ||||||
|       doxygen |  | ||||||
|       gcc |  | ||||||
|       gfortran |  | ||||||
|       liblapack |  | ||||||
|       openmpi |  | ||||||
|       pipenv |  | ||||||
|       python3Packages.pep8 |  | ||||||
|       python3Packages.pytest |  | ||||||
|       python3Packages.pyyaml |  | ||||||
|       zlib |  | ||||||
|     ]; |  | ||||||
|     src = null; |  | ||||||
|     shellHook = '' |  | ||||||
|     export NINJA_STATUS="[Built edge %f of %t in %e sec]" |  | ||||||
|     SOURCE_DATE_EPOCH=$(date +%s) |  | ||||||
|     ''; |  | ||||||
|   } |  | ||||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -10,7 +10,6 @@ test/*/cmake/update.py | |||||||
| test/*/cmake/autocmake/ | test/*/cmake/autocmake/ | ||||||
| test/*/cmake/downloaded/ | test/*/cmake/downloaded/ | ||||||
| test/*/setup | test/*/setup | ||||||
| test/*/cmake_output |  | ||||||
|  |  | ||||||
| # generated by doc/extract_rst.py | # generated by doc/extract_rst.py | ||||||
| doc/module-reference.rst | doc/module-reference.rst | ||||||
|   | |||||||
							
								
								
									
										47
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ matrix: | |||||||
|     - os: linux |     - os: linux | ||||||
|       python: 2.7 |       python: 2.7 | ||||||
|       compiler: gcc |       compiler: gcc | ||||||
|       env: SOURCES=ubuntu-toolchain-r-test |       env: SOURCES=ubuntu-toolchain-r-test TEST_SCRIPT=test.py | ||||||
|       addons: |       addons: | ||||||
|         apt: |         apt: | ||||||
|           sources: |           sources: | ||||||
| @@ -16,6 +16,7 @@ matrix: | |||||||
|              # compilers |              # compilers | ||||||
|             - g++ |             - g++ | ||||||
|             - gfortran |             - gfortran | ||||||
|  |             - cmake | ||||||
|               # math libraries |               # math libraries | ||||||
|             - libblas-dev |             - libblas-dev | ||||||
|             - liblapack-dev |             - liblapack-dev | ||||||
| @@ -25,11 +26,13 @@ matrix: | |||||||
|             - libopenmpi-dev |             - libopenmpi-dev | ||||||
|               # python library, development version |               # python library, development version | ||||||
|             - libpython2.7 |             - libpython2.7 | ||||||
|  |               # boost | ||||||
|  |             - libboost-all-dev | ||||||
|  |  | ||||||
|     - os: linux |     - os: linux | ||||||
|       python: 3.5 |       python: 3.5 | ||||||
|       compiler: gcc |       compiler: gcc | ||||||
|       env: SOURCES=ubuntu-toolchain-r-test |       env: SOURCES=ubuntu-toolchain-r-test TEST_SCRIPT=test.py | ||||||
|       addons: |       addons: | ||||||
|         apt: |         apt: | ||||||
|           sources: |           sources: | ||||||
| @@ -47,36 +50,52 @@ matrix: | |||||||
|             - libopenmpi-dev |             - libopenmpi-dev | ||||||
|               # python library, development version |               # python library, development version | ||||||
|             - libpython2.7 |             - libpython2.7 | ||||||
|  |               # boost | ||||||
|  |             - libboost-all-dev | ||||||
|  |  | ||||||
|  |     - os: linux | ||||||
|  |       python: 3.5 | ||||||
|  |       compiler: gcc | ||||||
|  |       env: SOURCES=ubuntu-toolchain-r-test TEST_SCRIPT=test_openblas.py | ||||||
|  |       addons: | ||||||
|  |         apt: | ||||||
|  |           sources: | ||||||
|  |             - ubuntu-toolchain-r-test | ||||||
|  |           packages: | ||||||
|  |              # compilers | ||||||
|  |             - g++ | ||||||
|  |             - gfortran | ||||||
|  |             - cmake | ||||||
|  |             - libblas-dev | ||||||
|  |             - libopenblas-dev | ||||||
|  |  | ||||||
|     - os: osx |     - os: osx | ||||||
|       osx_image: xcode11 |       osx_image: xcode6.4 | ||||||
|       compiler: gcc |       compiler: gcc | ||||||
|       env: |       env: SOURCES=homebrew | ||||||
|         - SOURCES=homebrew |  | ||||||
|  |  | ||||||
| install: | install: | ||||||
|   - | |   - | | ||||||
|     if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then |     if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then | ||||||
|         brew update &> /dev/null |         brew install cmake boost python gcc open-mpi | ||||||
|         pip install virtualenv |         pip install virtualenv | ||||||
|     elif [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then |     elif [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then | ||||||
|         pip install --user virtualenv |         pip install --user virtualenv | ||||||
|         mkdir -p $HOME/dependencies/cmake |         curl https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | tar xvz | ||||||
|         curl -Ls https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.tar.gz | tar -xz -C $HOME/dependencies/cmake --strip-components=1 |         export PATH=~/cmake-3.5.2-Linux-x86_64/bin:$PATH | ||||||
|         export PATH=$HOME/dependencies/cmake/bin${PATH:+:$PATH} |         export LD_LIBARY_PATH=~/cmake-3.5.2-Linux-x86_64/lib:$LD_LIBRARY_PATH | ||||||
|     fi |     fi | ||||||
|   - cmake --version |  | ||||||
|   - virtualenv venv |   - virtualenv venv | ||||||
|   - source venv/bin/activate |   - source venv/bin/activate | ||||||
|   - pip install -r requirements.txt |   - pip install -r requirements.txt | ||||||
|  |  | ||||||
| script: | script: | ||||||
|     # pycodestyle tests |     # pep8 tests | ||||||
|   - pycodestyle --ignore E501 update.py |   - pep8 --ignore E501 update.py | ||||||
|   - pycodestyle --ignore E501,E265,E741 autocmake --exclude autocmake/external/docopt.py |   - pep8 --ignore E501,E265 autocmake | ||||||
|     # unit tests |     # unit tests | ||||||
|   - py.test -vv autocmake/* |   - py.test -vv autocmake/* | ||||||
|   - py.test -vv test/test.py |   - py.test -vv test/$TEST_SCRIPT | ||||||
|  |  | ||||||
| notifications: | notifications: | ||||||
|   email: false |   email: false | ||||||
|   | |||||||
| @@ -1,14 +1,14 @@ | |||||||
| # Authors | # Authors | ||||||
|  |  | ||||||
| - Radovan Bast |  | ||||||
| - Roberto Di Remigio |  | ||||||
| - Jonas Juselius | - Jonas Juselius | ||||||
|  | - Radovan Bast | ||||||
|  |  | ||||||
| # Contributors | # Contributors | ||||||
|  |  | ||||||
| - Miroslav Ilias (Windows, portability, earliest adopter testing and feedback, math library testing) | - Miroslav Ilias (Windows, portability, earliest adopter testing and feedback, math library testing) | ||||||
| - Ivan Hrasko (Windows, Appveyor testing) | - Ivan Hrasko (Windows, Appveyor testing) | ||||||
| - Dan Jonsson (idea for configuration file approach which preceded YAML solution) | - Dan Jonsson (idea for configuration file approach which preceded YAML solution) | ||||||
|  | - Roberto Di Remigio (design ideas and testing, OS X testing, Boost) | ||||||
|  |  | ||||||
| For a list of all the contributions, | For a list of all the contributions, | ||||||
| see https://github.com/dev-cafe/autocmake/contributors. | see https://github.com/coderefinery/autocmake/contributors. | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| Copyright (c) 2015-2017 by Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors. | Copyright (c) 2015-2016 by Radovan Bast, Jonas Juselius, and contributors. | ||||||
| All rights reserved. | All rights reserved. | ||||||
|  |  | ||||||
| Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								Pipfile
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								Pipfile
									
									
									
									
									
								
							| @@ -1,16 +0,0 @@ | |||||||
| [[source]] |  | ||||||
|  |  | ||||||
| url = "https://pypi.python.org/simple" |  | ||||||
| verify_ssl = true |  | ||||||
| name = "pypi" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| [packages] |  | ||||||
|  |  | ||||||
| pycodestyle = "*" |  | ||||||
| pytest = "*" |  | ||||||
| PyYAML = "==4.2b4" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| [dev-packages] |  | ||||||
|  |  | ||||||
							
								
								
									
										89
									
								
								Pipfile.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										89
									
								
								Pipfile.lock
									
									
									
										generated
									
									
									
								
							| @@ -1,89 +0,0 @@ | |||||||
| { |  | ||||||
|     "_meta": { |  | ||||||
|         "hash": { |  | ||||||
|             "sha256": "f86826fa4239dea24ceb6dbac0dd68caeb99b9c982dc6ace46ea32fbd09ab747" |  | ||||||
|         }, |  | ||||||
|         "pipfile-spec": 6, |  | ||||||
|         "requires": {}, |  | ||||||
|         "sources": [ |  | ||||||
|             { |  | ||||||
|                 "name": "pypi", |  | ||||||
|                 "url": "https://pypi.python.org/simple", |  | ||||||
|                 "verify_ssl": true |  | ||||||
|             } |  | ||||||
|         ] |  | ||||||
|     }, |  | ||||||
|     "default": { |  | ||||||
|         "atomicwrites": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:0312ad34fcad8fac3704d441f7b317e50af620823353ec657a53e981f92920c0", |  | ||||||
|                 "sha256:ec9ae8adaae229e4f8446952d204a3e4b5fdd2d099f9be3aaf556120135fb3ee" |  | ||||||
|             ], |  | ||||||
|             "version": "==1.2.1" |  | ||||||
|         }, |  | ||||||
|         "attrs": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69", |  | ||||||
|                 "sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb" |  | ||||||
|             ], |  | ||||||
|             "version": "==18.2.0" |  | ||||||
|         }, |  | ||||||
|         "more-itertools": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:38a936c0a6d98a38bcc2d03fdaaedaba9f412879461dd2ceff8d37564d6522e4", |  | ||||||
|                 "sha256:c0a5785b1109a6bd7fac76d6837fd1feca158e54e521ccd2ae8bfe393cc9d4fc", |  | ||||||
|                 "sha256:fe7a7cae1ccb57d33952113ff4fa1bc5f879963600ed74918f1236e212ee50b9" |  | ||||||
|             ], |  | ||||||
|             "version": "==5.0.0" |  | ||||||
|         }, |  | ||||||
|         "pluggy": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:8ddc32f03971bfdf900a81961a48ccf2fb677cf7715108f85295c67405798616", |  | ||||||
|                 "sha256:980710797ff6a041e9a73a5787804f848996ecaa6f8a1b1e08224a5894f2074a" |  | ||||||
|             ], |  | ||||||
|             "version": "==0.8.1" |  | ||||||
|         }, |  | ||||||
|         "py": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:bf92637198836372b520efcba9e020c330123be8ce527e535d185ed4b6f45694", |  | ||||||
|                 "sha256:e76826342cefe3c3d5f7e8ee4316b80d1dd8a300781612ddbc765c17ba25a6c6" |  | ||||||
|             ], |  | ||||||
|             "version": "==1.7.0" |  | ||||||
|         }, |  | ||||||
|         "pycodestyle": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:cbc619d09254895b0d12c2c691e237b2e91e9b2ecf5e84c26b35400f93dcfb83", |  | ||||||
|                 "sha256:cbfca99bd594a10f674d0cd97a3d802a1fdef635d4361e1a2658de47ed261e3a" |  | ||||||
|             ], |  | ||||||
|             "index": "pypi", |  | ||||||
|             "version": "==2.4.0" |  | ||||||
|         }, |  | ||||||
|         "pytest": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:41568ea7ecb4a68d7f63837cf65b92ce8d0105e43196ff2b26622995bb3dc4b2", |  | ||||||
|                 "sha256:c3c573a29d7c9547fb90217ece8a8843aa0c1328a797e200290dc3d0b4b823be" |  | ||||||
|             ], |  | ||||||
|             "index": "pypi", |  | ||||||
|             "version": "==4.1.1" |  | ||||||
|         }, |  | ||||||
|         "pyyaml": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:254bf6fda2b7c651837acb2c718e213df29d531eebf00edb54743d10bcb694eb", |  | ||||||
|                 "sha256:3108529b78577327d15eec243f0ff348a0640b0c3478d67ad7f5648f93bac3e2", |  | ||||||
|                 "sha256:3c17fb92c8ba2f525e4b5f7941d850e7a48c3a59b32d331e2502a3cdc6648e76", |  | ||||||
|                 "sha256:8d6d96001aa7f0a6a4a95e8143225b5d06e41b1131044913fecb8f85a125714b", |  | ||||||
|                 "sha256:c8a88edd93ee29ede719080b2be6cb2333dfee1dccba213b422a9c8e97f2967b" |  | ||||||
|             ], |  | ||||||
|             "index": "pypi", |  | ||||||
|             "version": "==4.2b4" |  | ||||||
|         }, |  | ||||||
|         "six": { |  | ||||||
|             "hashes": [ |  | ||||||
|                 "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", |  | ||||||
|                 "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" |  | ||||||
|             ], |  | ||||||
|             "version": "==1.12.0" |  | ||||||
|         } |  | ||||||
|     }, |  | ||||||
|     "develop": {} |  | ||||||
| } |  | ||||||
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,8 +1,8 @@ | |||||||
| [](https://travis-ci.org/dev-cafe/autocmake/builds) | [](https://travis-ci.org/coderefinery/autocmake/builds) | ||||||
| [](http://autocmake.readthedocs.org) | [](http://autocmake.readthedocs.org) | ||||||
| [](../master/LICENSE) | [](../master/LICENSE) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| A CMake plugin composer. | A CMake plugin composer. | ||||||
| Licensed under [BSD-3](../master/LICENSE). | Licensed under [BSD-3](../master/LICENSE). | ||||||
| @@ -17,17 +17,12 @@ See http://autocmake.org. | |||||||
|  |  | ||||||
| ## Projects using Autocmake | ## Projects using Autocmake | ||||||
|  |  | ||||||
| - [Numgrid](https://github.com/dftlibs/numgrid) | - [Numgrid](https://github.com/dftlibs/numgrid/) | ||||||
| - [XCint](https://github.com/dftlibs/xcint) | - [XCint](https://github.com/dftlibs/xcint/) | ||||||
| - [DIRAC](http://diracprogram.org) | - [DIRAC](http://diracprogram.org) | ||||||
| - [mathlib-tester](https://github.com/miroi/mathlibs-tester) | - [mathlib-tester](https://github.com/miroi/mathlibs-tester) | ||||||
| - [Fortran Input Reader](https://github.com/miroi/fortran_input_reader) | - [Fortran Input Reader](https://github.com/miroi/fortran_input_reader) | ||||||
| - [PCMSolver](https://github.com/PCMSolver/pcmsolver) | - [PCMSolver](https://github.com/PCMSolver/pcmsolver) | ||||||
| - GRASP: General-purpose Relativistic Atomic Structure Program | - GRASP: General-purpose Relativistic Atomic Structure Program | ||||||
| - [MRChem](https://github.com/MRChemSoft/mrchem) |  | ||||||
| - [ReSpect](http://rel-qchem.sav.sk) |  | ||||||
| - [Flanders](https://github.com/bast/flanders) |  | ||||||
| - [Polygons](https://github.com/bast/polygons) |  | ||||||
| - [GIMIC](https://github.com/qmcurrents/gimic) |  | ||||||
|  |  | ||||||
| If you use Autocmake, please link to your project via a pull request. | If you use Autocmake, please link to your project via a pull request. | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| __version__ = '1.0.0' | __version__ = '1.0.0-alpha-x' | ||||||
|   | |||||||
| @@ -18,8 +18,7 @@ def check_cmake_exists(cmake_command): | |||||||
|     """ |     """ | ||||||
|     from subprocess import Popen, PIPE |     from subprocess import Popen, PIPE | ||||||
|  |  | ||||||
|     p = Popen( |     p = Popen('{0} --version'.format(cmake_command), | ||||||
|         '{0} --version'.format(cmake_command), |  | ||||||
|               shell=True, |               shell=True, | ||||||
|               stdin=PIPE, |               stdin=PIPE, | ||||||
|               stdout=PIPE) |               stdout=PIPE) | ||||||
| @@ -42,24 +41,55 @@ def setup_build_path(build_path): | |||||||
|         fname = os.path.join(build_path, 'CMakeCache.txt') |         fname = os.path.join(build_path, 'CMakeCache.txt') | ||||||
|         if os.path.exists(fname): |         if os.path.exists(fname): | ||||||
|             sys.stderr.write('aborting setup\n') |             sys.stderr.write('aborting setup\n') | ||||||
|             sys.stderr.write( |             sys.stderr.write('build directory {0} which contains CMakeCache.txt already exists\n'.format(build_path)) | ||||||
|                 'build directory {0} which contains CMakeCache.txt already exists\n'. |             sys.stderr.write('remove the build directory and then rerun setup\n') | ||||||
|                 format(build_path)) |  | ||||||
|             sys.stderr.write( |  | ||||||
|                 'remove the build directory and then rerun setup\n') |  | ||||||
|             sys.exit(1) |             sys.exit(1) | ||||||
|     else: |     else: | ||||||
|         os.makedirs(build_path, 0o755) |         os.makedirs(build_path, 0o755) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def test_adapt_cmake_command_to_platform(): | ||||||
|  |  | ||||||
|  |     cmake_command = "FC=foo CC=bar CXX=RABOOF cmake -DTHIS -DTHAT='this and that cmake' .." | ||||||
|  |     res = adapt_cmake_command_to_platform(cmake_command, 'linux') | ||||||
|  |     assert res == cmake_command | ||||||
|  |     res = adapt_cmake_command_to_platform(cmake_command, 'win32') | ||||||
|  |     assert res == "set FC=foo && set CC=bar && set CXX=RABOOF && cmake -DTHIS -DTHAT='this and that cmake' .." | ||||||
|  |  | ||||||
|  |     cmake_command = "cmake -DTHIS -DTHAT='this and that cmake' .." | ||||||
|  |     res = adapt_cmake_command_to_platform(cmake_command, 'linux') | ||||||
|  |     assert res == cmake_command | ||||||
|  |     res = adapt_cmake_command_to_platform(cmake_command, 'win32') | ||||||
|  |     assert res == cmake_command | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def adapt_cmake_command_to_platform(cmake_command, platform): | ||||||
|  |     """ | ||||||
|  |     Adapt CMake command to MS Windows platform. | ||||||
|  |     """ | ||||||
|  |     if platform == 'win32': | ||||||
|  |         pos = cmake_command.find('cmake') | ||||||
|  |         s = ['set {0} &&'.format(e) for e in cmake_command[:pos].split()] | ||||||
|  |         s.append(cmake_command[pos:]) | ||||||
|  |         return ' '.join(s) | ||||||
|  |     else: | ||||||
|  |         return cmake_command | ||||||
|  |  | ||||||
|  |  | ||||||
| def run_cmake(command, build_path, default_build_path): | def run_cmake(command, build_path, default_build_path): | ||||||
|     """ |     """ | ||||||
|     Execute CMake command. |     Execute CMake command. | ||||||
|     """ |     """ | ||||||
|     from subprocess import Popen, PIPE |     from subprocess import Popen, PIPE | ||||||
|  |     from shutil import rmtree | ||||||
|  |  | ||||||
|     topdir = os.getcwd() |     topdir = os.getcwd() | ||||||
|     p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) |     os.chdir(build_path) | ||||||
|  |     p = Popen(command, | ||||||
|  |               shell=True, | ||||||
|  |               stdin=PIPE, | ||||||
|  |               stdout=PIPE, | ||||||
|  |               stderr=PIPE) | ||||||
|     stdout_coded, stderr_coded = p.communicate() |     stdout_coded, stderr_coded = p.communicate() | ||||||
|     stdout = stdout_coded.decode('UTF-8') |     stdout = stdout_coded.decode('UTF-8') | ||||||
|     stderr = stderr_coded.decode('UTF-8') |     stderr = stderr_coded.decode('UTF-8') | ||||||
| @@ -68,26 +98,24 @@ def run_cmake(command, build_path, default_build_path): | |||||||
|     print(stdout) |     print(stdout) | ||||||
|  |  | ||||||
|     if stderr: |     if stderr: | ||||||
|         # we write out stderr but we do not stop yet |  | ||||||
|         # this is because CMake warnings are sent to stderr |  | ||||||
|         # and they might be benign |  | ||||||
|         sys.stderr.write(stderr) |         sys.stderr.write(stderr) | ||||||
|  |         sys.exit(1) | ||||||
|  |  | ||||||
|     # write cmake output to file |     # write cmake output to file | ||||||
|     with open(os.path.join(build_path, 'cmake_output'), 'w') as f: |     with open('cmake_output', 'w') as f: | ||||||
|         f.write(stdout) |         f.write(stdout) | ||||||
|  |  | ||||||
|     # change directory and return |     # change directory and return | ||||||
|     os.chdir(topdir) |     os.chdir(topdir) | ||||||
|  |  | ||||||
|     # to figure out whether configuration was a success |     if 'Configuring incomplete' in stdout: | ||||||
|     # we check for 3 sentences that should be part of stdout |         # configuration was not successful | ||||||
|     configuring_done = '-- Configuring done' in stdout |         if (build_path == default_build_path): | ||||||
|     generating_done = '-- Generating done' in stdout |             # remove build_path iff not set by the user | ||||||
|     build_files_written = '-- Build files have been written to' in stdout |             # otherwise removal can be dangerous | ||||||
|     configuration_successful = configuring_done and generating_done and build_files_written |             rmtree(default_build_path) | ||||||
|  |     else: | ||||||
|     if configuration_successful: |         # configuration was successful | ||||||
|         save_setup_command(sys.argv, build_path) |         save_setup_command(sys.argv, build_path) | ||||||
|         print_build_help(build_path, default_build_path) |         print_build_help(build_path, default_build_path) | ||||||
|  |  | ||||||
| @@ -129,7 +157,8 @@ def configure(root_directory, build_path, cmake_command, only_show): | |||||||
|     if not only_show: |     if not only_show: | ||||||
|         setup_build_path(build_path) |         setup_build_path(build_path) | ||||||
|  |  | ||||||
|     cmake_command += ' -B' + build_path |     cmake_command = adapt_cmake_command_to_platform(cmake_command, sys.platform) | ||||||
|  |  | ||||||
|     print('{0}\n'.format(cmake_command)) |     print('{0}\n'.format(cmake_command)) | ||||||
|     if only_show: |     if only_show: | ||||||
|         sys.exit(0) |         sys.exit(0) | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								autocmake/external/__init__.py
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								autocmake/external/__init__.py
									
									
									
									
										vendored
									
									
								
							| @@ -1 +0,0 @@ | |||||||
| # empty - this line is here to avoid problem when fetching empty files from web |  | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ def gen_cmake_command(config): | |||||||
|         s.append('    command.append({0})'.format(definition)) |         s.append('    command.append({0})'.format(definition)) | ||||||
|  |  | ||||||
|     s.append("    command.append('-DCMAKE_BUILD_TYPE={0}'.format(arguments['--type']))") |     s.append("    command.append('-DCMAKE_BUILD_TYPE={0}'.format(arguments['--type']))") | ||||||
|     s.append("    command.append('-G\"{0}\"'.format(arguments['--generator']))") |     s.append("    command.append('-G \"{0}\"'.format(arguments['--generator']))") | ||||||
|     s.append("    if arguments['--cmake-options'] != \"''\":") |     s.append("    if arguments['--cmake-options'] != \"''\":") | ||||||
|     s.append("        command.append(arguments['--cmake-options'])") |     s.append("        command.append(arguments['--cmake-options'])") | ||||||
|     s.append("    if arguments['--prefix']:") |     s.append("    if arguments['--prefix']:") | ||||||
| @@ -40,49 +40,12 @@ def autogenerated_notice(): | |||||||
|  |  | ||||||
|     s = [] |     s = [] | ||||||
|     s.append('# This file is autogenerated by Autocmake v{0} http://autocmake.org'.format(__version__)) |     s.append('# This file is autogenerated by Autocmake v{0} http://autocmake.org'.format(__version__)) | ||||||
|     s.append('# Copyright (c) {0} by Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors.'.format(year_range)) |     s.append('# Copyright (c) {0} by Radovan Bast, Jonas Juselius, and contributors.'.format(year_range)) | ||||||
|  |  | ||||||
|     return '\n'.join(s) |     return '\n'.join(s) | ||||||
|  |  | ||||||
|  |  | ||||||
| def gen_cmake_options_wrappers(): | def gen_setup(config, relative_path, setup_script_name): | ||||||
|     s = """\n# Options handling utilities |  | ||||||
| include(CMakeDependentOption) |  | ||||||
| # Macro for printing an option in a consistent manner |  | ||||||
| # Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard) |  | ||||||
| # Syntax: print_option(<option to print> <was specified>) |  | ||||||
| macro(print_option variable default) |  | ||||||
|   if(NOT DEFINED ${variable} OR "${${variable}}" STREQUAL "") |  | ||||||
|     message(STATUS "Setting (unspecified) option ${variable}: ${default}") |  | ||||||
|   else() |  | ||||||
|     message(STATUS "Setting option ${variable}: ${${variable}}") |  | ||||||
|   endif() |  | ||||||
| endmacro() |  | ||||||
|  |  | ||||||
| # Wraps an option with default ON/OFF. Adds nice messaging to option() |  | ||||||
| # Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard) |  | ||||||
| # Syntax: option_with_print(<option name> <description> <default value>) |  | ||||||
| macro(option_with_print variable msge default) |  | ||||||
|   print_option(${variable} ${default}) |  | ||||||
|   option(${variable} ${msge} ${default}) |  | ||||||
| endmacro() |  | ||||||
|  |  | ||||||
| # Wraps an option with a default other than ON/OFF and prints it |  | ||||||
| # Written by Lori A. Burns (@loriab) and Ryan M. Richard (@ryanmrichard) |  | ||||||
| # NOTE: Can't combine with above b/c CMake handles ON/OFF options specially |  | ||||||
| # NOTE2: CMake variables are always defined so need to further check for if |  | ||||||
| #       they are the NULL string. This is also why we need the force |  | ||||||
| # Syntax: option_with_default(<option name> <description> <default value>) |  | ||||||
| macro(option_with_default variable msge default) |  | ||||||
|   print_option(${variable} "${default}") |  | ||||||
|   if(NOT DEFINED ${variable} OR "${${variable}}" STREQUAL "") |  | ||||||
|     set(${variable} "${default}" CACHE STRING ${msge} FORCE) |  | ||||||
|   endif() |  | ||||||
| endmacro()""" |  | ||||||
|     return s |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def gen_setup(config, default_build_type, relative_path, setup_script_name): |  | ||||||
|     """ |     """ | ||||||
|     Generate setup script. |     Generate setup script. | ||||||
|     """ |     """ | ||||||
| @@ -93,7 +56,6 @@ def gen_setup(config, default_build_type, relative_path, setup_script_name): | |||||||
|     s.append('\n{0}'.format(autogenerated_notice())) |     s.append('\n{0}'.format(autogenerated_notice())) | ||||||
|     s.append('\nimport os') |     s.append('\nimport os') | ||||||
|     s.append('import sys') |     s.append('import sys') | ||||||
|     s.append('assert sys.version_info >= (2, 6), \'Python >= 2.6 is required\'') |  | ||||||
|  |  | ||||||
|     s.append("\nsys.path.insert(0, '{0}')".format(relative_path)) |     s.append("\nsys.path.insert(0, '{0}')".format(relative_path)) | ||||||
|  |  | ||||||
| @@ -113,7 +75,7 @@ def gen_setup(config, default_build_type, relative_path, setup_script_name): | |||||||
|         rest = ' '.join(opt.split()[1:]).strip() |         rest = ' '.join(opt.split()[1:]).strip() | ||||||
|         options.append([first, rest]) |         options.append([first, rest]) | ||||||
|  |  | ||||||
|     options.append(['--type=<TYPE>', 'Set the CMake build type (debug, release, relwithdebinfo, minsizerel) [default: {0}].'.format(default_build_type)]) |     options.append(['--type=<TYPE>', 'Set the CMake build type (debug, release, or relwithdeb) [default: release].']) | ||||||
|     options.append(['--generator=<STRING>', 'Set the CMake build system generator [default: Unix Makefiles].']) |     options.append(['--generator=<STRING>', 'Set the CMake build system generator [default: Unix Makefiles].']) | ||||||
|     options.append(['--show', 'Show CMake command and exit.']) |     options.append(['--show', 'Show CMake command and exit.']) | ||||||
|     options.append(['--cmake-executable=<CMAKE_EXECUTABLE>', 'Set the CMake executable [default: cmake].']) |     options.append(['--cmake-executable=<CMAKE_EXECUTABLE>', 'Set the CMake executable [default: cmake].']) | ||||||
| @@ -147,7 +109,7 @@ def gen_setup(config, default_build_type, relative_path, setup_script_name): | |||||||
|     s.append("build_path = arguments['<builddir>']") |     s.append("build_path = arguments['<builddir>']") | ||||||
|     s.append("\n") |     s.append("\n") | ||||||
|     s.append("# create cmake command") |     s.append("# create cmake command") | ||||||
|     s.append("cmake_command = '{0} -H{1}'.format(gen_cmake_command(options, arguments), root_directory)") |     s.append("cmake_command = '{0} {1}'.format(gen_cmake_command(options, arguments), root_directory)") | ||||||
|     s.append("\n") |     s.append("\n") | ||||||
|     s.append("# run cmake") |     s.append("# run cmake") | ||||||
|     s.append("configure.configure(root_directory, build_path, cmake_command, arguments['--show'])") |     s.append("configure.configure(root_directory, build_path, cmake_command, arguments['--show'])") | ||||||
| @@ -155,7 +117,7 @@ def gen_setup(config, default_build_type, relative_path, setup_script_name): | |||||||
|     return s |     return s | ||||||
|  |  | ||||||
|  |  | ||||||
| def gen_cmakelists(project_name, project_language, min_cmake_version, default_build_type, relative_path, modules): | def gen_cmakelists(project_name, min_cmake_version, relative_path, modules): | ||||||
|     """ |     """ | ||||||
|     Generate CMakeLists.txt. |     Generate CMakeLists.txt. | ||||||
|     """ |     """ | ||||||
| @@ -169,31 +131,33 @@ def gen_cmakelists(project_name, project_language, min_cmake_version, default_bu | |||||||
|     s.append('cmake_minimum_required(VERSION {0} FATAL_ERROR)'.format(min_cmake_version)) |     s.append('cmake_minimum_required(VERSION {0} FATAL_ERROR)'.format(min_cmake_version)) | ||||||
|  |  | ||||||
|     s.append('\n# project name') |     s.append('\n# project name') | ||||||
|     s.append('project({0} LANGUAGES {1})'.format(project_name, project_language)) |     s.append('project({0})'.format(project_name)) | ||||||
|  |  | ||||||
|     s.append('\n# do not rebuild if rules (compiler flags) change') |     s.append('\n# do not rebuild if rules (compiler flags) change') | ||||||
|     s.append('set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)') |     s.append('set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)') | ||||||
|  |  | ||||||
|     build_type_capitalized = {'debug': 'Debug', |     s.append('\n# if CMAKE_BUILD_TYPE undefined, we set it to Debug') | ||||||
|                               'release': 'Release', |  | ||||||
|                               'relwithdebinfo': 'RelWithDebInfo', |  | ||||||
|                               'minsizerel': 'MinSizeRel'} |  | ||||||
|  |  | ||||||
|     _build_type = build_type_capitalized[default_build_type] |  | ||||||
|     s.append('\n# if CMAKE_BUILD_TYPE undefined, we set it to {0}'.format(_build_type)) |  | ||||||
|     s.append('if(NOT CMAKE_BUILD_TYPE)') |     s.append('if(NOT CMAKE_BUILD_TYPE)') | ||||||
|     s.append('    set(CMAKE_BUILD_TYPE "{0}")'.format(_build_type)) |     s.append('    set(CMAKE_BUILD_TYPE "Debug")') | ||||||
|     s.append('endif()') |     s.append('endif()') | ||||||
|  |  | ||||||
|     s.append(gen_cmake_options_wrappers()) |     if len(modules) > 0: | ||||||
|  |         s.append('\n# directories which hold included cmake modules') | ||||||
|  |  | ||||||
|  |     module_paths = [module.path for module in modules] | ||||||
|  |     module_paths.append('downloaded')  # this is done to be able to find fetched modules when testing | ||||||
|  |     module_paths = list(set(module_paths)) | ||||||
|  |     module_paths.sort()  # we do this to always get the same order and to minimize diffs | ||||||
|  |     for directory in module_paths: | ||||||
|  |         rel_cmake_module_path = os.path.join(relative_path, directory) | ||||||
|  |         # on windows cmake corrects this so we have to make it wrong again | ||||||
|  |         rel_cmake_module_path = rel_cmake_module_path.replace('\\', '/') | ||||||
|  |         s.append('set(CMAKE_MODULE_PATH ${{CMAKE_MODULE_PATH}} ${{PROJECT_SOURCE_DIR}}/{0})'.format(rel_cmake_module_path)) | ||||||
|  |  | ||||||
|     if len(modules) > 0: |     if len(modules) > 0: | ||||||
|         s.append('\n# included cmake modules') |         s.append('\n# included cmake modules') | ||||||
|     for module in modules: |     for module in modules: | ||||||
|         s.append('include({0})'.format(os.path.join('${PROJECT_SOURCE_DIR}', |         s.append('include({0})'.format(os.path.splitext(module.name)[0])) | ||||||
|                                                     relative_path, |  | ||||||
|                                                     module.path, |  | ||||||
|                                                     module.name))) |  | ||||||
|  |  | ||||||
|     return s |     return s | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ def replace(s, d): | |||||||
|  |  | ||||||
|     if isinstance(s, str): |     if isinstance(s, str): | ||||||
|         for var in findall(r"%\(([A-Za-z0-9_]*)\)", s): |         for var in findall(r"%\(([A-Za-z0-9_]*)\)", s): | ||||||
|             s = s.replace("%({0})".format(var), str(d[var])) |             s = s.replace("%({})".format(var), str(d[var])) | ||||||
|     return s |     return s | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| if(NOT DEFINED ENV{CFLAGS}) | if(NOT DEFINED ENV{CFLAGS}) | ||||||
|     if(CMAKE_C_COMPILER_ID MATCHES Clang) |     if(CMAKE_C_COMPILER_ID MATCHES Clang) | ||||||
|         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") |         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||||||
|         set(CMAKE_C_FLAGS_RELEASE "-O3") |         set(CMAKE_C_FLAGS_RELEASE "-O3") | ||||||
|         set(CMAKE_C_FLAGS_DEBUG "-O0 -g") |         set(CMAKE_C_FLAGS_DEBUG "-O0 -g") | ||||||
|     endif() |     endif() | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| if(NOT DEFINED ENV{CXXFLAGS}) | if(NOT DEFINED ENV{CXXFLAGS}) | ||||||
|     if(CMAKE_CXX_COMPILER_ID MATCHES Clang) |     if(CMAKE_CXX_COMPILER_ID MATCHES Clang) | ||||||
|         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") |         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||||||
|         set(CMAKE_CXX_FLAGS_RELEASE "-Ofast") |         set(CMAKE_CXX_FLAGS_RELEASE "-Ofast") | ||||||
|         set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") |         set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") | ||||||
|     endif() |     endif() | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| if(NOT DEFINED ENV{CFLAGS}) | if(NOT DEFINED ENV{CFLAGS}) | ||||||
|     if(CMAKE_C_COMPILER_ID MATCHES GNU) |     if(CMAKE_C_COMPILER_ID MATCHES GNU) | ||||||
|         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") |         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||||||
|         set(CMAKE_C_FLAGS_RELEASE "-O3") |         set(CMAKE_C_FLAGS_RELEASE "-O3") | ||||||
|         set(CMAKE_C_FLAGS_DEBUG "-O0 -g") |         set(CMAKE_C_FLAGS_DEBUG "-O0 -g") | ||||||
|     endif() |     endif() | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| if(NOT DEFINED ENV{CXXFLAGS}) | if(NOT DEFINED ENV{CXXFLAGS}) | ||||||
|     if(CMAKE_CXX_COMPILER_ID MATCHES GNU) |     if(CMAKE_CXX_COMPILER_ID MATCHES GNU) | ||||||
|         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") |         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||||||
|         set(CMAKE_CXX_FLAGS_RELEASE "-O3") |         set(CMAKE_CXX_FLAGS_RELEASE "-Ofast") | ||||||
|         set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") |         set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") | ||||||
|     endif() |     endif() | ||||||
| endif() | endif() | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| if(NOT DEFINED ENV{FCFLAGS}) | if(NOT DEFINED ENV{FCFLAGS}) | ||||||
|     if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) |     if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) | ||||||
|         set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall -Wextra") |         set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") | ||||||
|         set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -funroll-all-loops") |         set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -funroll-all-loops") | ||||||
|         set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fbacktrace") |         set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fbacktrace") | ||||||
|     endif() |     endif() | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| if(NOT DEFINED ENV{CFLAGS}) | if(NOT DEFINED ENV{CFLAGS}) | ||||||
|     if(CMAKE_C_COMPILER_ID MATCHES Intel) |     if(CMAKE_C_COMPILER_ID MATCHES Intel) | ||||||
|         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") |         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||||||
|         set(CMAKE_C_FLAGS_RELEASE "-O3") |         set(CMAKE_C_FLAGS_RELEASE "-O3") | ||||||
|         set(CMAKE_C_FLAGS_DEBUG "-O0 -g") |         set(CMAKE_C_FLAGS_DEBUG "-O0 -g") | ||||||
|     endif() |     endif() | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| if(NOT DEFINED ENV{CXXFLAGS}) | if(NOT DEFINED ENV{CXXFLAGS}) | ||||||
|     if(CMAKE_CXX_COMPILER_ID MATCHES Intel) |     if(CMAKE_CXX_COMPILER_ID MATCHES Intel) | ||||||
|         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") |         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||||||
|         set(CMAKE_CXX_FLAGS_RELEASE "-O3") |         set(CMAKE_CXX_FLAGS_RELEASE "-O3") | ||||||
|         set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") |         set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") | ||||||
|     endif() |     endif() | ||||||
|   | |||||||
							
								
								
									
										200
									
								
								doc/conf.py
									
									
									
									
									
								
							
							
						
						
									
										200
									
								
								doc/conf.py
									
									
									
									
									
								
							| @@ -1,4 +1,3 @@ | |||||||
| #!/usr/bin/env python3 |  | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
| # | # | ||||||
| # Autocmake documentation build configuration file, created by | # Autocmake documentation build configuration file, created by | ||||||
| @@ -15,21 +14,20 @@ | |||||||
|  |  | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
|  | import shlex | ||||||
|  |  | ||||||
|  | sys.path.append(os.path.relpath(os.path.abspath('.'))) | ||||||
|  | import extract_rst | ||||||
|  |  | ||||||
| # If extensions (or modules to document with autodoc) are in another directory, | # If extensions (or modules to document with autodoc) are in another directory, | ||||||
| # add these directories to sys.path here. If the directory is relative to the | # add these directories to sys.path here. If the directory is relative to the | ||||||
| # documentation root, use os.path.abspath to make it absolute, like shown here. | # documentation root, use os.path.abspath to make it absolute, like shown here. | ||||||
| sys.path.insert(0, os.path.abspath('.')) | #sys.path.insert(0, os.path.abspath('.')) | ||||||
| import extract_rst |  | ||||||
|  |  | ||||||
| sys.path.insert(0, os.path.abspath('..')) |  | ||||||
| from autocmake import __version__ as _version |  | ||||||
|  |  | ||||||
| # -- General configuration ------------------------------------------------ | # -- General configuration ------------------------------------------------ | ||||||
|  |  | ||||||
| # If your documentation needs a minimal Sphinx version, state it here. | # If your documentation needs a minimal Sphinx version, state it here. | ||||||
| # | #needs_sphinx = '1.0' | ||||||
| # needs_sphinx = '1.0' |  | ||||||
|  |  | ||||||
| # Add any Sphinx extension module names here, as strings. They can be | # Add any Sphinx extension module names here, as strings. They can be | ||||||
| # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||||||
| @@ -43,30 +41,28 @@ templates_path = ['_templates'] | |||||||
|  |  | ||||||
| # The suffix(es) of source filenames. | # The suffix(es) of source filenames. | ||||||
| # You can specify multiple suffix as a list of string: | # You can specify multiple suffix as a list of string: | ||||||
| # |  | ||||||
| # source_suffix = ['.rst', '.md'] | # source_suffix = ['.rst', '.md'] | ||||||
| source_suffix = '.rst' | source_suffix = '.rst' | ||||||
|  |  | ||||||
| # The encoding of source files. | # The encoding of source files. | ||||||
| # | #source_encoding = 'utf-8-sig' | ||||||
| # source_encoding = 'utf-8-sig' |  | ||||||
|  |  | ||||||
| # The master toctree document. | # The master toctree document. | ||||||
| master_doc = 'index' | master_doc = 'index' | ||||||
|  |  | ||||||
| # General information about the project. | # General information about the project. | ||||||
| project = u'Autocmake' | project = u'Autocmake' | ||||||
| copyright = u'2015-2017, Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors' | copyright = u'2015-2016, Radovan Bast, Jonas Juselius, and contributors' | ||||||
| author = u'Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors' | author = u'Radovan Bast, Jonas Juselius, and contributors' | ||||||
|  |  | ||||||
| # The version info for the project you're documenting, acts as replacement for | # The version info for the project you're documenting, acts as replacement for | ||||||
| # |version| and |release|, also used in various other places throughout the | # |version| and |release|, also used in various other places throughout the | ||||||
| # built documents. | # built documents. | ||||||
| # | # | ||||||
| # The full version, including alpha/beta/rc tags. |  | ||||||
| release = _version |  | ||||||
| # The short X.Y version. | # The short X.Y version. | ||||||
| version = '.'.join(release.split('.')[0:2]) | version = '1.0' | ||||||
|  | # The full version, including alpha/beta/rc tags. | ||||||
|  | release = '1.0.0-alpha-x' | ||||||
|  |  | ||||||
| # The language for content autogenerated by Sphinx. Refer to documentation | # The language for content autogenerated by Sphinx. Refer to documentation | ||||||
| # for a list of supported languages. | # for a list of supported languages. | ||||||
| @@ -77,45 +73,37 @@ language = None | |||||||
|  |  | ||||||
| # There are two options for replacing |today|: either, you set today to some | # There are two options for replacing |today|: either, you set today to some | ||||||
| # non-false value, then it is used: | # non-false value, then it is used: | ||||||
| # | #today = '' | ||||||
| # today = '' |  | ||||||
| # |  | ||||||
| # Else, today_fmt is used as the format for a strftime call. | # Else, today_fmt is used as the format for a strftime call. | ||||||
| # | #today_fmt = '%B %d, %Y' | ||||||
| # today_fmt = '%B %d, %Y' |  | ||||||
|  |  | ||||||
| # List of patterns, relative to source directory, that match files and | # List of patterns, relative to source directory, that match files and | ||||||
| # directories to ignore when looking for source files. | # directories to ignore when looking for source files. | ||||||
| # This patterns also effect to html_static_path and html_extra_path | exclude_patterns = ['_build'] | ||||||
| exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |  | ||||||
|  |  | ||||||
| # The reST default role (used for this markup: `text`) to use for all | # The reST default role (used for this markup: `text`) to use for all | ||||||
| # documents. | # documents. | ||||||
| # | #default_role = None | ||||||
| # default_role = None |  | ||||||
|  |  | ||||||
| # If true, '()' will be appended to :func: etc. cross-reference text. | # If true, '()' will be appended to :func: etc. cross-reference text. | ||||||
| # | #add_function_parentheses = True | ||||||
| # add_function_parentheses = True |  | ||||||
|  |  | ||||||
| # If true, the current module name will be prepended to all description | # If true, the current module name will be prepended to all description | ||||||
| # unit titles (such as .. function::). | # unit titles (such as .. function::). | ||||||
| # | #add_module_names = True | ||||||
| # add_module_names = True |  | ||||||
|  |  | ||||||
| # If true, sectionauthor and moduleauthor directives will be shown in the | # If true, sectionauthor and moduleauthor directives will be shown in the | ||||||
| # output. They are ignored by default. | # output. They are ignored by default. | ||||||
| # | #show_authors = False | ||||||
| # show_authors = False |  | ||||||
|  |  | ||||||
| # The name of the Pygments (syntax highlighting) style to use. | # The name of the Pygments (syntax highlighting) style to use. | ||||||
| pygments_style = 'sphinx' | pygments_style = 'sphinx' | ||||||
|  |  | ||||||
| # A list of ignored prefixes for module index sorting. | # A list of ignored prefixes for module index sorting. | ||||||
| # modindex_common_prefix = [] | #modindex_common_prefix = [] | ||||||
|  |  | ||||||
| # If true, keep warnings as "system message" paragraphs in the built documents. | # If true, keep warnings as "system message" paragraphs in the built documents. | ||||||
| # keep_warnings = False | #keep_warnings = False | ||||||
|  |  | ||||||
| # If true, `todo` and `todoList` produce output, else they produce nothing. | # If true, `todo` and `todoList` produce output, else they produce nothing. | ||||||
| todo_include_todos = True | todo_include_todos = True | ||||||
| @@ -125,37 +113,31 @@ todo_include_todos = True | |||||||
|  |  | ||||||
| # The theme to use for HTML and HTML Help pages.  See the documentation for | # The theme to use for HTML and HTML Help pages.  See the documentation for | ||||||
| # a list of builtin themes. | # a list of builtin themes. | ||||||
| # |  | ||||||
| html_theme = 'default' | html_theme = 'default' | ||||||
|  |  | ||||||
| # Theme options are theme-specific and customize the look and feel of a theme | # Theme options are theme-specific and customize the look and feel of a theme | ||||||
| # further.  For a list of options available for each theme, see the | # further.  For a list of options available for each theme, see the | ||||||
| # documentation. | # documentation. | ||||||
| # | #html_theme_options = {} | ||||||
| # html_theme_options = {} |  | ||||||
|  |  | ||||||
| # Add any paths that contain custom themes here, relative to this directory. | # Add any paths that contain custom themes here, relative to this directory. | ||||||
| # html_theme_path = [] | #html_theme_path = [] | ||||||
|  |  | ||||||
| # The name for this set of Sphinx documents. | # The name for this set of Sphinx documents.  If None, it defaults to | ||||||
| # "<project> v<release> documentation" by default. | # "<project> v<release> documentation". | ||||||
| # | #html_title = None | ||||||
| # html_title = None |  | ||||||
|  |  | ||||||
| # A shorter title for the navigation bar.  Default is the same as html_title. | # A shorter title for the navigation bar.  Default is the same as html_title. | ||||||
| # | #html_short_title = None | ||||||
| # html_short_title = None |  | ||||||
|  |  | ||||||
| # The name of an image file (relative to this directory) to place at the top | # The name of an image file (relative to this directory) to place at the top | ||||||
| # of the sidebar. | # of the sidebar. | ||||||
| # | #html_logo = None | ||||||
| # html_logo = None |  | ||||||
|  |  | ||||||
| # The name of an image file (relative to this directory) to use as a favicon of | # The name of an image file (within the static path) to use as favicon of the | ||||||
| # the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32 | # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32 | ||||||
| # pixels large. | # pixels large. | ||||||
| # | #html_favicon = None | ||||||
| # html_favicon = None |  | ||||||
|  |  | ||||||
| # Add any paths that contain custom static files (such as style sheets) here, | # Add any paths that contain custom static files (such as style sheets) here, | ||||||
| # relative to this directory. They are copied after the builtin static files, | # relative to this directory. They are copied after the builtin static files, | ||||||
| @@ -165,79 +147,62 @@ html_static_path = ['_static'] | |||||||
| # Add any extra paths that contain custom files (such as robots.txt or | # Add any extra paths that contain custom files (such as robots.txt or | ||||||
| # .htaccess) here, relative to this directory. These files are copied | # .htaccess) here, relative to this directory. These files are copied | ||||||
| # directly to the root of the documentation. | # directly to the root of the documentation. | ||||||
| # | #html_extra_path = [] | ||||||
| # html_extra_path = [] |  | ||||||
|  |  | ||||||
| # If not None, a 'Last updated on:' timestamp is inserted at every page | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, | ||||||
| # bottom, using the given strftime format. | # using the given strftime format. | ||||||
| # The empty string is equivalent to '%b %d, %Y'. | #html_last_updated_fmt = '%b %d, %Y' | ||||||
| # |  | ||||||
| # html_last_updated_fmt = None |  | ||||||
|  |  | ||||||
| # If true, SmartyPants will be used to convert quotes and dashes to | # If true, SmartyPants will be used to convert quotes and dashes to | ||||||
| # typographically correct entities. | # typographically correct entities. | ||||||
| # | #html_use_smartypants = True | ||||||
| # html_use_smartypants = True |  | ||||||
|  |  | ||||||
| # Custom sidebar templates, maps document names to template names. | # Custom sidebar templates, maps document names to template names. | ||||||
| # | #html_sidebars = {} | ||||||
| # html_sidebars = {} |  | ||||||
|  |  | ||||||
| # Additional templates that should be rendered to pages, maps page names to | # Additional templates that should be rendered to pages, maps page names to | ||||||
| # template names. | # template names. | ||||||
| # | #html_additional_pages = {} | ||||||
| # html_additional_pages = {} |  | ||||||
|  |  | ||||||
| # If false, no module index is generated. | # If false, no module index is generated. | ||||||
| # | #html_domain_indices = True | ||||||
| # html_domain_indices = True |  | ||||||
|  |  | ||||||
| # If false, no index is generated. | # If false, no index is generated. | ||||||
| # | #html_use_index = True | ||||||
| # html_use_index = True |  | ||||||
|  |  | ||||||
| # If true, the index is split into individual pages for each letter. | # If true, the index is split into individual pages for each letter. | ||||||
| # | #html_split_index = False | ||||||
| # html_split_index = False |  | ||||||
|  |  | ||||||
| # If true, links to the reST sources are added to the pages. | # If true, links to the reST sources are added to the pages. | ||||||
| # | #html_show_sourcelink = True | ||||||
| # html_show_sourcelink = True |  | ||||||
|  |  | ||||||
| # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. | ||||||
| # | #html_show_sphinx = True | ||||||
| # html_show_sphinx = True |  | ||||||
|  |  | ||||||
| # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. | ||||||
| # | #html_show_copyright = True | ||||||
| # html_show_copyright = True |  | ||||||
|  |  | ||||||
| # If true, an OpenSearch description file will be output, and all pages will | # If true, an OpenSearch description file will be output, and all pages will | ||||||
| # contain a <link> tag referring to it.  The value of this option must be the | # contain a <link> tag referring to it.  The value of this option must be the | ||||||
| # base URL from which the finished HTML is served. | # base URL from which the finished HTML is served. | ||||||
| # | #html_use_opensearch = '' | ||||||
| # html_use_opensearch = '' |  | ||||||
|  |  | ||||||
| # This is the file name suffix for HTML files (e.g. ".xhtml"). | # This is the file name suffix for HTML files (e.g. ".xhtml"). | ||||||
| # html_file_suffix = None | #html_file_suffix = None | ||||||
|  |  | ||||||
| # Language to be used for generating the HTML full-text search index. | # Language to be used for generating the HTML full-text search index. | ||||||
| # Sphinx supports the following languages: | # Sphinx supports the following languages: | ||||||
| #   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' | #   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' | ||||||
| #   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh' | #   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' | ||||||
| # | #html_search_language = 'en' | ||||||
| # html_search_language = 'en' |  | ||||||
|  |  | ||||||
| # A dictionary with options for the search language support, empty by default. | # A dictionary with options for the search language support, empty by default. | ||||||
| # 'ja' uses this config value. | # Now only 'ja' uses this config value | ||||||
| # 'zh' user can custom change `jieba` dictionary path. | #html_search_options = {'type': 'default'} | ||||||
| # |  | ||||||
| # html_search_options = {'type': 'default'} |  | ||||||
|  |  | ||||||
| # The name of a javascript file (relative to the configuration directory) that | # The name of a javascript file (relative to the configuration directory) that | ||||||
| # implements a search results scorer. If empty, the default will be used. | # implements a search results scorer. If empty, the default will be used. | ||||||
| # | #html_search_scorer = 'scorer.js' | ||||||
| # html_search_scorer = 'scorer.js' |  | ||||||
|  |  | ||||||
| # Output file base name for HTML help builder. | # Output file base name for HTML help builder. | ||||||
| htmlhelp_basename = 'Autocmakedoc' | htmlhelp_basename = 'Autocmakedoc' | ||||||
| @@ -245,21 +210,17 @@ htmlhelp_basename = 'Autocmakedoc' | |||||||
| # -- Options for LaTeX output --------------------------------------------- | # -- Options for LaTeX output --------------------------------------------- | ||||||
|  |  | ||||||
| latex_elements = { | latex_elements = { | ||||||
|      # The paper size ('letterpaper' or 'a4paper'). | # The paper size ('letterpaper' or 'a4paper'). | ||||||
|      # | #'papersize': 'letterpaper', | ||||||
|      # 'papersize': 'letterpaper', |  | ||||||
|  |  | ||||||
|      # The font size ('10pt', '11pt' or '12pt'). | # The font size ('10pt', '11pt' or '12pt'). | ||||||
|      # | #'pointsize': '10pt', | ||||||
|      # 'pointsize': '10pt', |  | ||||||
|  |  | ||||||
|      # Additional stuff for the LaTeX preamble. | # Additional stuff for the LaTeX preamble. | ||||||
|      # | #'preamble': '', | ||||||
|      # 'preamble': '', |  | ||||||
|  |  | ||||||
|      # Latex figure (float) alignment | # Latex figure (float) alignment | ||||||
|      # | #'figure_align': 'htbp', | ||||||
|      # 'figure_align': 'htbp', |  | ||||||
| } | } | ||||||
|  |  | ||||||
| # Grouping the document tree into LaTeX files. List of tuples | # Grouping the document tree into LaTeX files. List of tuples | ||||||
| @@ -267,40 +228,28 @@ latex_elements = { | |||||||
| #  author, documentclass [howto, manual, or own class]). | #  author, documentclass [howto, manual, or own class]). | ||||||
| latex_documents = [ | latex_documents = [ | ||||||
|   (master_doc, 'Autocmake.tex', u'Autocmake Documentation', |   (master_doc, 'Autocmake.tex', u'Autocmake Documentation', | ||||||
|    author, 'manual'), |    u'Radovan Bast and Jonas Juselius', 'manual'), | ||||||
| ] | ] | ||||||
|  |  | ||||||
| # The name of an image file (relative to this directory) to place at the top of | # The name of an image file (relative to this directory) to place at the top of | ||||||
| # the title page. | # the title page. | ||||||
| # | #latex_logo = None | ||||||
| # latex_logo = None |  | ||||||
|  |  | ||||||
| # For "manual" documents, if this is true, then toplevel headings are parts, | # For "manual" documents, if this is true, then toplevel headings are parts, | ||||||
| # not chapters. | # not chapters. | ||||||
| # | #latex_use_parts = False | ||||||
| # latex_use_parts = False |  | ||||||
|  |  | ||||||
| # If true, show page references after internal links. | # If true, show page references after internal links. | ||||||
| # | #latex_show_pagerefs = False | ||||||
| # latex_show_pagerefs = False |  | ||||||
|  |  | ||||||
| # If true, show URL addresses after external links. | # If true, show URL addresses after external links. | ||||||
| # | #latex_show_urls = False | ||||||
| # latex_show_urls = False |  | ||||||
|  |  | ||||||
| # Documents to append as an appendix to all manuals. | # Documents to append as an appendix to all manuals. | ||||||
| # | #latex_appendices = [] | ||||||
| # latex_appendices = [] |  | ||||||
|  |  | ||||||
| # It false, will not define \strong, \code, 	itleref, \crossref ... but only |  | ||||||
| # \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added |  | ||||||
| # packages. |  | ||||||
| # |  | ||||||
| # latex_keep_old_macro_names = True |  | ||||||
|  |  | ||||||
| # If false, no module index is generated. | # If false, no module index is generated. | ||||||
| # | #latex_domain_indices = True | ||||||
| # latex_domain_indices = True |  | ||||||
|  |  | ||||||
|  |  | ||||||
| # -- Options for manual page output --------------------------------------- | # -- Options for manual page output --------------------------------------- | ||||||
| @@ -313,8 +262,7 @@ man_pages = [ | |||||||
| ] | ] | ||||||
|  |  | ||||||
| # If true, show URL addresses after external links. | # If true, show URL addresses after external links. | ||||||
| # | #man_show_urls = False | ||||||
| # man_show_urls = False |  | ||||||
|  |  | ||||||
|  |  | ||||||
| # -- Options for Texinfo output ------------------------------------------- | # -- Options for Texinfo output ------------------------------------------- | ||||||
| @@ -329,17 +277,13 @@ texinfo_documents = [ | |||||||
| ] | ] | ||||||
|  |  | ||||||
| # Documents to append as an appendix to all manuals. | # Documents to append as an appendix to all manuals. | ||||||
| # | #texinfo_appendices = [] | ||||||
| # texinfo_appendices = [] |  | ||||||
|  |  | ||||||
| # If false, no module index is generated. | # If false, no module index is generated. | ||||||
| # | #texinfo_domain_indices = True | ||||||
| # texinfo_domain_indices = True |  | ||||||
|  |  | ||||||
| # How to display URL addresses: 'footnote', 'no', or 'inline'. | # How to display URL addresses: 'footnote', 'no', or 'inline'. | ||||||
| # | #texinfo_show_urls = 'footnote' | ||||||
| # texinfo_show_urls = 'footnote' |  | ||||||
|  |  | ||||||
| # If true, do not generate a @detailmenu in the "Top" node's menu. | # If true, do not generate a @detailmenu in the "Top" node's menu. | ||||||
| # | #texinfo_no_detailmenu = False | ||||||
| # texinfo_no_detailmenu = False |  | ||||||
|   | |||||||
| @@ -10,11 +10,11 @@ This documentation is refreshed upon each push to the central repository. | |||||||
| The module reference documentation is generated from the module sources using | The module reference documentation is generated from the module sources using | ||||||
| ``#.rst:`` tags (compare for instance | ``#.rst:`` tags (compare for instance | ||||||
| http://autocmake.readthedocs.io/en/latest/module-reference.html#cc-cmake with | http://autocmake.readthedocs.io/en/latest/module-reference.html#cc-cmake with | ||||||
| https://github.com/dev-cafe/autocmake/blob/master/modules/cc.cmake). | https://github.com/coderefinery/autocmake/blob/master/modules/cc.cmake). | ||||||
|  |  | ||||||
| Please note that the lines following ``# autocmake.yml configuration::`` are | Please note that the lines following ``# autocmake.yml configuration::`` are | ||||||
| understood by the ``update.py`` script to infer autocmake.yml code from the | understood by the ``update.py`` script to infer autocmake.yml code from the | ||||||
| documentation.  As an example consider | documentation.  As an example consider | ||||||
| https://github.com/dev-cafe/autocmake/blob/master/modules/cc.cmake#L20-L26. | https://github.com/coderefinery/autocmake/blob/master/modules/cc.cmake#L20-L26. | ||||||
| Here, ``update.py`` will infer the configurations for ``docopt``, ``export``, | Here, ``update.py`` will infer the configurations for ``docopt``, ``export``, | ||||||
| and ``define``. | and ``define``. | ||||||
|   | |||||||
| @@ -5,14 +5,14 @@ Testing Autocmake | |||||||
|  |  | ||||||
| You will need to install `pytest <http://pytest.org/>`__. | You will need to install `pytest <http://pytest.org/>`__. | ||||||
|  |  | ||||||
| Check also the `Travis  <https://github.com/dev-cafe/autocmake/blob/master/.travis.yml>`__ | Check also the `Travis  <https://github.com/coderefinery/autocmake/blob/master/.travis.yml>`__ | ||||||
| build and test recipe for other requirements. | build and test recipe for other requirements. | ||||||
|  |  | ||||||
| Your contributions and changes should preserve the test set and be PEP8 conform. | Your contributions and changes should preserve the test set and be PEP8 conform. | ||||||
| You can run locally all tests with:: | You can run locally all tests with:: | ||||||
|  |  | ||||||
|   $ pycodestyle --ignore E501 update.py |   $ pep8 --ignore E501 update.py | ||||||
|   $ pycodestyle --ignore E501,E265 autocmake |   $ pep8 --ignore E501,E265 autocmake | ||||||
|   $ py.test -vv autocmake/* |   $ py.test -vv autocmake/* | ||||||
|   $ py.test -vv test/test.py |   $ py.test -vv test/test.py | ||||||
|  |  | ||||||
| @@ -23,5 +23,5 @@ You can also select individual tests, for example those with ``fc_blas`` string | |||||||
| For more options, see the ``py.test`` flags. | For more options, see the ``py.test`` flags. | ||||||
|  |  | ||||||
| This test set is run upon each push to the central repository. | This test set is run upon each push to the central repository. | ||||||
| See also the `Travis <https://travis-ci.org/dev-cafe/autocmake/builds>`__ | See also the `Travis <https://travis-ci.org/coderefinery/autocmake/builds>`__ | ||||||
| build and test history. | build and test history. | ||||||
|   | |||||||
| @@ -12,15 +12,12 @@ infrastructure files which will be needed to build the project:: | |||||||
|  |  | ||||||
|   $ mkdir cmake  # does not have to be called "cmake" - take the name you prefer |   $ mkdir cmake  # does not have to be called "cmake" - take the name you prefer | ||||||
|   $ cd cmake |   $ cd cmake | ||||||
|   $ wget https://github.com/dev-cafe/autocmake/raw/master/update.py |   $ wget https://github.com/coderefinery/autocmake/raw/master/update.py | ||||||
|   $ virtualenv venv |  | ||||||
|   $ source venv/bin/activate |  | ||||||
|   $ pip install pyyaml |  | ||||||
|   $ python update.py --self |   $ python update.py --self | ||||||
|  |  | ||||||
| On the MS Windows system, you can use the PowerShell wget-replacement:: | On the MS Windows system, you can use the PowerShell wget-replacement:: | ||||||
|  |  | ||||||
|   $ Invoke-WebRequest https://github.com/dev-cafe/autocmake/raw/master/update.py -OutFile update.py |   $ Invoke-WebRequest https://github.com/coderefinery/autocmake/raw/master/update.py -OutFile update.py | ||||||
|  |  | ||||||
| This creates (or updates) the following files (an existing ``autocmake.yml`` is | This creates (or updates) the following files (an existing ``autocmake.yml`` is | ||||||
| not overwritten by the script):: | not overwritten by the script):: | ||||||
|   | |||||||
| @@ -1,86 +1,99 @@ | |||||||
|  |  | ||||||
| .. _autocmake_yml: | .. _autocmake_yml: | ||||||
|  |  | ||||||
| Configuring autocmake.yml | Configuring autocmake.cfg | ||||||
| ========================= | ========================= | ||||||
|  |  | ||||||
| The script ``autocmake.yml`` is the high level place where you configure | The script ``autocmake.cfg`` is the high level place where you configure | ||||||
| your project. Here is an example. We will discuss it in detail further | your project. Here is an example. We will discuss it in detail further | ||||||
| below:: | below:: | ||||||
|  |  | ||||||
|  |   [project] | ||||||
|   name: numgrid |   name: numgrid | ||||||
|  |  | ||||||
|   min_cmake_version: 2.8 |   min_cmake_version: 2.8 | ||||||
|  |  | ||||||
|   default_build_type: release |   [fc] | ||||||
|  |   source: https://github.com/coderefinery/autocmake/raw/master/modules/fc.cmake | ||||||
|  |  | ||||||
|   language: |   [cc] | ||||||
|     - Fortran |   source: https://github.com/coderefinery/autocmake/raw/master/modules/cc.cmake | ||||||
|     - C |  | ||||||
|     - CXX |  | ||||||
|  |  | ||||||
|   url_root: https://github.com/dev-cafe/autocmake/raw/master/ |   [cxx] | ||||||
|  |   source: https://github.com/coderefinery/autocmake/raw/master/modules/cxx.cmake | ||||||
|  |  | ||||||
|   modules: |   [flags] | ||||||
|   - compilers: |   source: https://github.com/coderefinery/autocmake/raw/master/compilers/GNU.CXX.cmake | ||||||
|     - source: |           https://github.com/coderefinery/autocmake/raw/master/compilers/Intel.CXX.cmake | ||||||
|       - '%(url_root)modules/fc.cmake' |  | ||||||
|       - '%(url_root)modules/cc.cmake' |   [rpath] | ||||||
|       - '%(url_root)modules/cxx.cmake' |   source: custom/rpath.cmake | ||||||
|   - flags: |  | ||||||
|     - source: |   [definitions] | ||||||
|       - '%(url_root)compilers/GNU.CXX.cmake' |   source: https://github.com/coderefinery/autocmake/raw/master/modules/definitions.cmake | ||||||
|       - '%(url_root)compilers/Intel.CXX.cmake' |  | ||||||
|       - 'compilers/Clang.CXX.cmake' |   [coverage] | ||||||
|   - plugins: |   source: https://github.com/coderefinery/autocmake/raw/master/modules/code_coverage.cmake | ||||||
|     - source: |  | ||||||
|       - '%(url_root)modules/ccache.cmake' |   [safeguards] | ||||||
|       - 'custom/rpath.cmake' |   source: https://github.com/coderefinery/autocmake/raw/master/modules/safeguards.cmake | ||||||
|       - '%(url_root)modules/definitions.cmake' |  | ||||||
|       - '%(url_root)modules/code_coverage.cmake' |   [default_build_paths] | ||||||
|       - '%(url_root)modules/safeguards.cmake' |   source: https://github.com/coderefinery/autocmake/raw/master/modules/default_build_paths.cmake | ||||||
|       - '%(url_root)modules/default_build_paths.cmake' |  | ||||||
|       - '%(url_root)modules/src.cmake' |   [src] | ||||||
|       - '%(url_root)modules/googletest.cmake' |   source: https://github.com/coderefinery/autocmake/raw/master/modules/src.cmake | ||||||
|       - 'custom/api.cmake' |  | ||||||
|       - 'custom/test.cmake' |   [googletest] | ||||||
|  |   source: https://github.com/coderefinery/autocmake/raw/master/modules/googletest.cmake | ||||||
|  |  | ||||||
|  |   [custom] | ||||||
|  |   source: custom/api.cmake | ||||||
|  |           custom/test.cmake | ||||||
|  |  | ||||||
|  |  | ||||||
| Name and order of sections | Name and order of sections | ||||||
| -------------------------- | -------------------------- | ||||||
|  |  | ||||||
| First we define the project name (here "numgrid"). This section has to be there | We see that the configuration file has sections. | ||||||
| and it has to be called "project" (but it does not have to be on top). | The only section where the name matters is ``[project]``:: | ||||||
|  |  | ||||||
| We also have to define ``min_cmake_version`` as well as set the supported language(s). |   [project] | ||||||
|  |   name: numgrid | ||||||
|  |   min_cmake_version: 2.8 | ||||||
|  |  | ||||||
| The definition ``url_root`` is an interpolation (see :ref:`interpolation`) and | This is where we define the project name (here "numgrid"). This section has to | ||||||
| we use it to avoid retyping the same line over and over and to be able to | be there and it has to be called "project" (but it does not have to be on top). | ||||||
| change it in one place.  The explicit name "url_root" has no special meaning to |  | ||||||
| Autocmake and we could have chosen a different name. |  | ||||||
|  |  | ||||||
| The section ``modules`` is a list of CMake plugins.  The names of the list | The names of the other sections do not matter to Autocmake. You could name them like this:: | ||||||
| elements (here "compilers", "flags", and "plugins") does not matter to |  | ||||||
| Autocmake. We could have called them "one", "two", and "whatever", but it would |  | ||||||
| not make much sense. It is better to choose names that are meaningful to you |  | ||||||
| and readers of your code. |  | ||||||
|  |  | ||||||
| The order of the elements under ``modules`` does matter and the list will be |   [project] | ||||||
| processed in the exact order as you specify them in ``autocmake.yml``. |   name: numgrid | ||||||
|  |   min_cmake_version: 2.8 | ||||||
|  |  | ||||||
|  |   [one] | ||||||
|  |   source: https://github.com/coderefinery/autocmake/raw/master/modules/fc.cmake | ||||||
|  |  | ||||||
|  |   [two] | ||||||
|  |   source: https://github.com/coderefinery/autocmake/raw/master/modules/cc.cmake | ||||||
|  |  | ||||||
|  |   [whatever] | ||||||
|  |   source: https://github.com/coderefinery/autocmake/raw/master/modules/cxx.cmake | ||||||
|  |  | ||||||
|  | But it would not make much sense. It is better to choose names that are | ||||||
|  | meaningful to you. | ||||||
|  |  | ||||||
|  | The order of the sections does matter and the sections will be processed in the | ||||||
|  | exact order as you specify them in ``autocmake.cfg``. | ||||||
|  |  | ||||||
|  |  | ||||||
| Minimal example | Minimal example | ||||||
| --------------- | --------------- | ||||||
|  |  | ||||||
| As a minimal example we take an ``autocmake.yml`` which only contains:: | As a minimal example we take an ``autocmake.cfg`` which only contains:: | ||||||
|  |  | ||||||
|  |   [project] | ||||||
|   name: minime |   name: minime | ||||||
|   min_cmake_version: 2.8 |   min_cmake_version: 2.8 | ||||||
|   language: C |  | ||||||
|  |  | ||||||
| If you don't have the ``update.py`` script yet, you need to fetch it from the web:: |  | ||||||
|  |  | ||||||
|   $ wget https://github.com/dev-cafe/autocmake/raw/master/update.py |  | ||||||
|  |  | ||||||
| First we make sure that the ``update.py`` script is up-to-date and that it has access | First we make sure that the ``update.py`` script is up-to-date and that it has access | ||||||
| to all libraries it needs:: | to all libraries it needs:: | ||||||
| @@ -88,22 +101,15 @@ to all libraries it needs:: | |||||||
|   $ python update.py --self |   $ python update.py --self | ||||||
|  |  | ||||||
|   - creating .gitignore |   - creating .gitignore | ||||||
|   - fetching autocmake/configure.py |   - fetching lib/config.py | ||||||
|   - fetching autocmake/__init__.py |   - fetching lib/docopt/docopt.py | ||||||
|   - fetching autocmake/external/docopt.py |  | ||||||
|   - fetching autocmake/external/__init__.py |  | ||||||
|   - fetching autocmake/generate.py |  | ||||||
|   - fetching autocmake/extract.py |  | ||||||
|   - fetching autocmake/interpolate.py |  | ||||||
|   - fetching autocmake/parse_rst.py |  | ||||||
|   - fetching autocmake/parse_yaml.py |  | ||||||
|   - fetching update.py |   - fetching update.py | ||||||
|  |  | ||||||
| Good. Now we can generate ``CMakeLists.txt`` and the setup script:: | Good. Now we can generate ``CMakeLists.txt`` and the setup script:: | ||||||
|  |  | ||||||
|   $ python update.py .. |   $ python update .. | ||||||
|  |  | ||||||
|   - parsing autocmake.yml |   - parsing autocmake.cfg | ||||||
|   - generating CMakeLists.txt |   - generating CMakeLists.txt | ||||||
|   - generating setup script |   - generating setup script | ||||||
|  |  | ||||||
| @@ -113,7 +119,7 @@ Excellent. Here is the generated ``CMakeLists.txt``:: | |||||||
|   cmake_minimum_required(VERSION 2.8 FATAL_ERROR) |   cmake_minimum_required(VERSION 2.8 FATAL_ERROR) | ||||||
|  |  | ||||||
|   # project name |   # project name | ||||||
|   project(minime C) |   project(minime) | ||||||
|  |  | ||||||
|   # do not rebuild if rules (compiler flags) change |   # do not rebuild if rules (compiler flags) change | ||||||
|   set(CMAKE_SKIP_RULE_DEPENDENCY TRUE) |   set(CMAKE_SKIP_RULE_DEPENDENCY TRUE) | ||||||
| @@ -123,6 +129,8 @@ Excellent. Here is the generated ``CMakeLists.txt``:: | |||||||
|       set(CMAKE_BUILD_TYPE "Debug") |       set(CMAKE_BUILD_TYPE "Debug") | ||||||
|   endif() |   endif() | ||||||
|  |  | ||||||
|  |   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/downloaded) | ||||||
|  |  | ||||||
| This is the very bare minimum. Every Autocmake project will have at least these | This is the very bare minimum. Every Autocmake project will have at least these | ||||||
| settings. | settings. | ||||||
|  |  | ||||||
| @@ -139,38 +147,38 @@ the following default options:: | |||||||
|     --show                                 Show CMake command and exit. |     --show                                 Show CMake command and exit. | ||||||
|     --cmake-executable=<CMAKE_EXECUTABLE>  Set the CMake executable [default: cmake]. |     --cmake-executable=<CMAKE_EXECUTABLE>  Set the CMake executable [default: cmake]. | ||||||
|     --cmake-options=<STRING>               Define options to CMake [default: '']. |     --cmake-options=<STRING>               Define options to CMake [default: '']. | ||||||
|     --prefix=<PATH>                        Set the install path for make install. |  | ||||||
|     <builddir>                             Build directory. |     <builddir>                             Build directory. | ||||||
|     -h --help                              Show this screen. |     -h --help                              Show this screen. | ||||||
|  |  | ||||||
| That's not too bad although currently we cannot do much with this since there | That's not too bad although currently we cannot do much with this since there | ||||||
| are no sources listed, no targets, hence nothing to build. We need to flesh out | are no sources listed, no targets, hence nothing to build. We need to flesh out | ||||||
| ``CMakeLists.txt`` by extending ``autocmake.yml`` and this is what we will do | ``CMakeLists.txt`` by extending ``autocmake.cfg`` | ||||||
| in the next section. | and this is what we will do in the next section. | ||||||
|  |  | ||||||
|  |  | ||||||
| Assembling CMake plugins | Assembling CMake plugins | ||||||
| ------------------------ | ------------------------ | ||||||
|  |  | ||||||
| The preferred way to extend ``CMakeLists.txt`` is by editing ``autocmake.yml`` | The preferred way to extend ``CMakeLists.txt`` is by editing ``autocmake.cfg`` | ||||||
| and using the ``source`` option:: | and using the ``source`` option:: | ||||||
|  |  | ||||||
|   - compilers: |   [fc] | ||||||
|     - source: |   source: https://github.com/coderefinery/autocmake/raw/master/modules/fc.cmake | ||||||
|       - '%(url_root)modules/fc.cmake' |  | ||||||
|       - '%(url_root)modules/cc.cmake' |  | ||||||
|       - '%(url_root)modules/cxx.cmake' |  | ||||||
|  |  | ||||||
| This will download ``fc.cmake``, ``cc.cmake``, and ``cxx.cmake``, and include | This will download ``fc.cmake`` and include it in ``CMakeLists.txt``. | ||||||
| them in ``CMakeLists.txt``, in this order. |  | ||||||
|  |  | ||||||
| You can also include local CMake modules, e.g.:: | You can also include local CMake modules, e.g.:: | ||||||
|  |  | ||||||
|   - source: |   [rpath] | ||||||
|     - 'custom/rpath.cmake' |   source: custom/rpath.cmake | ||||||
|  |  | ||||||
| It is also OK to include several modules at once as we have seen above.  The | It is also OK to include several modules at once:: | ||||||
| modules will be included in the same order as they appear in ``autocmake.yml``. |  | ||||||
|  |   [flags] | ||||||
|  |   source: https://github.com/coderefinery/autocmake/raw/master/compilers/GNU.CXX.cmake | ||||||
|  |           https://github.com/coderefinery/autocmake/raw/master/compilers/Intel.CXX.cmake | ||||||
|  |  | ||||||
|  | The modules will be included in the same order as they appear in ``autocmake.cfg``. | ||||||
|  |  | ||||||
|  |  | ||||||
| Fetching files without including them in CMakeLists.txt | Fetching files without including them in CMakeLists.txt | ||||||
| @@ -179,9 +187,9 @@ Fetching files without including them in CMakeLists.txt | |||||||
| Sometimes you want to fetch a file without including it in ``CMakeLists.txt``. | Sometimes you want to fetch a file without including it in ``CMakeLists.txt``. | ||||||
| This can be done with the ``fetch`` option.  This is for instance done by the | This can be done with the ``fetch`` option.  This is for instance done by the | ||||||
| ``git_info.cmake`` module (see | ``git_info.cmake`` module (see | ||||||
| https://github.com/dev-cafe/autocmake/blob/master/modules/git_info/git_info.cmake#L10-L13). | https://github.com/coderefinery/autocmake/blob/master/modules/git_info/git_info.cmake#L10-L11). | ||||||
|  |  | ||||||
| If ``fetch`` is invoked in ``autocmake.yml``, then the fetched file is placed | If ``fetch`` is invoked in ``autocmake.cfg``, then the fetched file is placed | ||||||
| under ``downloaded/``.  If ``fetch`` is invoked from within a CMake module | under ``downloaded/``.  If ``fetch`` is invoked from within a CMake module | ||||||
| documentation (see below), then the fetched file is placed into the same | documentation (see below), then the fetched file is placed into the same | ||||||
| directory as the CMake module file which fetches it. | directory as the CMake module file which fetches it. | ||||||
| @@ -191,11 +199,11 @@ Generating setup options | |||||||
| ------------------------ | ------------------------ | ||||||
|  |  | ||||||
| Options for the setup script can be generated with the ``docopt`` | Options for the setup script can be generated with the ``docopt`` | ||||||
| option. As an example, the following ``autocmake.yml`` snippet will add a | option. As an example, the following ``autocmake.cfg`` snippet will add a | ||||||
| ``--something`` flag:: | ``--something`` flag:: | ||||||
|  |  | ||||||
|   - my_section: |   [my_section] | ||||||
|     - docopt: "--something Enable something [default: False]." |   docopt: --something Enable something [default: False]. | ||||||
|  |  | ||||||
|  |  | ||||||
| Setting CMake options | Setting CMake options | ||||||
| @@ -205,9 +213,9 @@ Configure-time CMake options can be generated with the ``define`` option. | |||||||
| Consider the following example which toggles the CMake variable | Consider the following example which toggles the CMake variable | ||||||
| ``ENABLE_SOMETHING``:: | ``ENABLE_SOMETHING``:: | ||||||
|  |  | ||||||
|   - my_section: |   [my_section] | ||||||
|     - docopt: "--something Enable something [default: False]." |   docopt: --something Enable something [default: False]. | ||||||
|     - define: "'-DENABLE_SOMETHING={0}'.format(arguments['--enable-something'])" |   define: '-DENABLE_SOMETHING={0}'.format(arguments['--something']) | ||||||
|  |  | ||||||
|  |  | ||||||
| Setting environment variables | Setting environment variables | ||||||
| @@ -216,23 +224,33 @@ Setting environment variables | |||||||
| You can export environment variables at configure-time using the ``export`` | You can export environment variables at configure-time using the ``export`` | ||||||
| option. Consider the following example:: | option. Consider the following example:: | ||||||
|  |  | ||||||
|   docopt: |   [cc] | ||||||
|     - "--cc=<CC> C compiler [default: gcc]." |   docopt: --cc=<CC> C compiler [default: gcc]. | ||||||
|     - "--extra-cc-flags=<EXTRA_CFLAGS> Extra C compiler flags [default: '']." |           --extra-cc-flags=<EXTRA_CFLAGS> Extra C compiler flags [default: '']. | ||||||
|   export: "'CC={0}'.format(arguments['--cc'])" |   export: 'CC=%s' % arguments['--cc'] | ||||||
|   define: "'-DEXTRA_CFLAGS=\"{0}\"'.format(arguments['--extra-cc-flags'])" |   define: '-DEXTRA_CFLAGS="%s"' % arguments['--extra-cc-flags'] | ||||||
|  |  | ||||||
|  |  | ||||||
| Auto-generating configurations from the documentation | Auto-generating configurations from the documentation | ||||||
| ----------------------------------------------------- | ----------------------------------------------------- | ||||||
|  |  | ||||||
| To avoid a boring re-typing of boilerplate ``autocmake.yml`` code it is possible | To avoid a boring re-typing of boilerplate ``autocmake.cfg`` code it is possible | ||||||
| to auto-generate configurations from the documentation. This is the case | to auto-generate configurations from the documentation. This is the case | ||||||
| for many core modules which come with own options once you have sourced them. | for many core modules which come with own options once you have sourced them. | ||||||
|  |  | ||||||
| The lines following ``# autocmake.yml configuration::`` are | The lines following ``# autocmake.cfg configuration::`` are | ||||||
| understood by the ``update.py`` script to infer ``autocmake.yml`` code from the | understood by the ``update.py`` script to infer ``autocmake.cfg`` code from the | ||||||
| documentation. As an example consider | documentation. As an example consider | ||||||
| https://github.com/dev-cafe/autocmake/blob/master/modules/cc.cmake#L20-L26. | https://github.com/coderefinery/autocmake/blob/master/modules/cc.cmake#L20-L25. | ||||||
| Here, ``update.py`` will infer the configurations for ``docopt``, ``export``, | Here, ``update.py`` will infer the configurations for ``docopt``, ``export``, | ||||||
| and ``define``. | and ``define``. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Overriding documented configurations | ||||||
|  | ------------------------------------ | ||||||
|  |  | ||||||
|  | Configurable documented defaults can be achieved using interpolations.  See for | ||||||
|  | instance | ||||||
|  | https://github.com/coderefinery/autocmake/blob/master/modules/boost/boost.cmake#L33-L36. | ||||||
|  | These can be modified within ``autocmake.cfg`` with a dictionary, e.g.: | ||||||
|  | https://github.com/coderefinery/autocmake/blob/master/test/boost_libs/cmake/autocmake.cfg#L9 | ||||||
|   | |||||||
| @@ -47,11 +47,11 @@ Settings in ``autocmake.yml`` take precedence over | |||||||
| settings imported by a sourced module. | settings imported by a sourced module. | ||||||
|  |  | ||||||
| As an example consider the Boost module which defines and uses | As an example consider the Boost module which defines and uses | ||||||
| interpolation variables ``major``, ``minor``, ``patch``, and ``components``, see | interpolation variables ``major``, ``minor``, and ``patch``, see | ||||||
| https://github.com/dev-cafe/autocmake/blob/master/modules/boost/boost.cmake#L52-L55. | https://github.com/coderefinery/autocmake/blob/master/modules/boost/boost.cmake#L52-L54. | ||||||
|  |  | ||||||
| The recommended way to customize these is in ``autocmake.yml``, e.g.: | The recommended way to customize these is in ``autocmake.yml``, e.g.: | ||||||
| https://github.com/dev-cafe/autocmake/blob/master/test/boost_libs/cmake/autocmake.yml#L12-L17. | https://github.com/coderefinery/autocmake/blob/master/test/boost_libs/cmake/autocmake.yml#L12-L17. | ||||||
|  |  | ||||||
|  |  | ||||||
| Create own CMake modules | Create own CMake modules | ||||||
| @@ -65,5 +65,5 @@ Contribute customizations to the "standard library" | |||||||
|  |  | ||||||
| If you think that your customization will be useful for other users as well, | If you think that your customization will be useful for other users as well, | ||||||
| you may consider contributing the changes directly to | you may consider contributing the changes directly to | ||||||
| https://github.com/dev-cafe/autocmake/. We very much encourage such | https://github.com/coderefinery/autocmake/. We very much encourage such | ||||||
| contributions. But we also strive for generality and portability. | contributions. But we also strive for generality and portability. | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| Example hello world project | Example Hello World project | ||||||
| =========================== | =========================== | ||||||
|  |  | ||||||
| This is a brief example for the busy and impatient programmer. For a longer | This is a brief example for the busy and impatient programmer. For a longer | ||||||
| @@ -23,53 +23,40 @@ there. This is not necessary for Autocmake but it is a generally good practice:: | |||||||
|  |  | ||||||
| Now we create ``cmake/`` and fetch ``update.py``:: | Now we create ``cmake/`` and fetch ``update.py``:: | ||||||
|  |  | ||||||
|   $ mkdir cmake  # does not have to be called "cmake" - take the name you prefer |   $ mkdir cmake | ||||||
|   $ cd cmake |   $ cd cmake/ | ||||||
|   $ wget https://github.com/dev-cafe/autocmake/raw/master/update.py |   $ wget https://raw.githubusercontent.com/coderefinery/autocmake/master/update.py | ||||||
|   $ python update.py --self |   $ python update.py --self | ||||||
|  |  | ||||||
| Now from top-level our file tree looks like this:: | Now from top-level our file tree looks like this:: | ||||||
|  |  | ||||||
|   . |   . | ||||||
|   |-- cmake |   |-- cmake | ||||||
|   |   |-- autocmake |   |   |-- autocmake.cfg | ||||||
|   |   |   |-- __init__.py |   |   |-- lib | ||||||
|   |   |   |-- configure.py |   |   |   |-- config.py | ||||||
|   |   |   |-- external |   |   |   `-- docopt | ||||||
|   |   |   |   |-- __init__.py |   |   |       `-- docopt.py | ||||||
|   |   |   |   `-- docopt.py |  | ||||||
|   |   |   |-- extract.py |  | ||||||
|   |   |   |-- generate.py |  | ||||||
|   |   |   |-- interpolate.py |  | ||||||
|   |   |   |-- parse_rst.py |  | ||||||
|   |   |   `-- parse_yaml.py |  | ||||||
|   |   |-- autocmake.yml |  | ||||||
|   |   `-- update.py |   |   `-- update.py | ||||||
|   `-- src |   `-- src | ||||||
|       |-- feature1.F90 |       |-- feature1.F90 | ||||||
|       |-- feature2.c |       |-- feature2.c | ||||||
|       `-- main.F90 |       `-- main.F90 | ||||||
|  |  | ||||||
| Now we edit ``cmake/autocmake.yml`` to look like this:: | Now we edit ``cmake/autocmake.cfg`` to look like this:: | ||||||
|  |  | ||||||
|  |   [project] | ||||||
|   name: hello |   name: hello | ||||||
|  |  | ||||||
|   min_cmake_version: 2.8 |   min_cmake_version: 2.8 | ||||||
|  |  | ||||||
|   language: |   [fc] | ||||||
|     - Fortran |   source: https://github.com/coderefinery/autocmake/raw/master/modules/fc.cmake | ||||||
|     - C |  | ||||||
|  |  | ||||||
|   url_root: https://github.com/dev-cafe/autocmake/raw/master/ |   [cc] | ||||||
|  |   source: https://github.com/coderefinery/autocmake/raw/master/modules/cc.cmake | ||||||
|  |  | ||||||
|   modules: |   [src] | ||||||
|   - compilers: |   source: https://github.com/coderefinery/autocmake/raw/master/modules/src.cmake | ||||||
|     - source: |  | ||||||
|       - '%(url_root)modules/fc.cmake' |  | ||||||
|       - '%(url_root)modules/cc.cmake' |  | ||||||
|   - src_support: |  | ||||||
|     - source: |  | ||||||
|       - '%(url_root)modules/src.cmake' |  | ||||||
|  |  | ||||||
| What we have specified here is the project name and that we wish Fortran and C | What we have specified here is the project name and that we wish Fortran and C | ||||||
| support. The ``src.cmake`` module tells CMake to include a ``src/CMakeLists.txt``. | support. The ``src.cmake`` module tells CMake to include a ``src/CMakeLists.txt``. | ||||||
| @@ -89,32 +76,20 @@ Now we have everything to generate ``CMakeLists.txt`` and a setup script:: | |||||||
|   $ cd cmake |   $ cd cmake | ||||||
|   $ python update .. |   $ python update .. | ||||||
|  |  | ||||||
|   - parsing autocmake.yml |  | ||||||
|   - assembling modules: [##############################] (3/3) |  | ||||||
|   - generating CMakeLists.txt |  | ||||||
|   - generating setup script |  | ||||||
|  |  | ||||||
| And this is what we got:: | And this is what we got:: | ||||||
|  |  | ||||||
|   . |   . | ||||||
|   |-- CMakeLists.txt |   |-- CMakeLists.txt | ||||||
|   |-- cmake |   |-- cmake | ||||||
|   |   |-- autocmake |   |   |-- autocmake.cfg | ||||||
|   |   |   |-- __init__.py |  | ||||||
|   |   |   |-- configure.py |  | ||||||
|   |   |   |-- external |  | ||||||
|   |   |   |   |-- __init__.py |  | ||||||
|   |   |   |   `-- docopt.py |  | ||||||
|   |   |   |-- extract.py |  | ||||||
|   |   |   |-- generate.py |  | ||||||
|   |   |   |-- interpolate.py |  | ||||||
|   |   |   |-- parse_rst.py |  | ||||||
|   |   |   `-- parse_yaml.py |  | ||||||
|   |   |-- autocmake.yml |  | ||||||
|   |   |-- downloaded |   |   |-- downloaded | ||||||
|   |   |   |-- autocmake_cc.cmake |   |   |   |-- autocmake_cc.cmake | ||||||
|   |   |   |-- autocmake_fc.cmake |   |   |   |-- autocmake_fc.cmake | ||||||
|   |   |   `-- autocmake_src.cmake |   |   |   `-- autocmake_src.cmake | ||||||
|  |   |   |-- lib | ||||||
|  |   |   |   |-- config.py | ||||||
|  |   |   |   `-- docopt | ||||||
|  |   |   |       `-- docopt.py | ||||||
|   |   `-- update.py |   |   `-- update.py | ||||||
|   |-- setup |   |-- setup | ||||||
|   `-- src |   `-- src | ||||||
| @@ -125,12 +100,12 @@ And this is what we got:: | |||||||
|  |  | ||||||
| Now we are ready to build:: | Now we are ready to build:: | ||||||
|  |  | ||||||
|   $ ./setup --fc=gfortran --cc=gcc |   $ python setup --fc=gfortran --cc=gcc | ||||||
|  |  | ||||||
|   FC=gfortran CC=gcc cmake -DEXTRA_FCFLAGS="''" -DEXTRA_CFLAGS="''" -DCMAKE_BUILD_TYPE=release -G "Unix Makefiles" /home/user/hello |   FC=gfortran CC=gcc cmake -DEXTRA_FCFLAGS="''" -DENABLE_FC_SUPPORT="ON" -DEXTRA_CFLAGS="''" -DCMAKE_BUILD_TYPE=release -G "Unix Makefiles" None /home/user/example | ||||||
|  |  | ||||||
|   -- The C compiler identification is GNU 6.1.1 |   -- The C compiler identification is GNU 4.9.2 | ||||||
|   -- The CXX compiler identification is GNU 6.1.1 |   -- The CXX compiler identification is GNU 4.9.2 | ||||||
|   -- Check for working C compiler: /usr/bin/gcc |   -- Check for working C compiler: /usr/bin/gcc | ||||||
|   -- Check for working C compiler: /usr/bin/gcc -- works |   -- Check for working C compiler: /usr/bin/gcc -- works | ||||||
|   -- Detecting C compiler ABI info |   -- Detecting C compiler ABI info | ||||||
| @@ -143,7 +118,7 @@ Now we are ready to build:: | |||||||
|   -- Detecting CXX compiler ABI info - done |   -- Detecting CXX compiler ABI info - done | ||||||
|   -- Detecting CXX compile features |   -- Detecting CXX compile features | ||||||
|   -- Detecting CXX compile features - done |   -- Detecting CXX compile features - done | ||||||
|   -- The Fortran compiler identification is GNU 6.1.1 |   -- The Fortran compiler identification is GNU 4.9.2 | ||||||
|   -- Check for working Fortran compiler: /usr/bin/gfortran |   -- Check for working Fortran compiler: /usr/bin/gfortran | ||||||
|   -- Check for working Fortran compiler: /usr/bin/gfortran  -- works |   -- Check for working Fortran compiler: /usr/bin/gfortran  -- works | ||||||
|   -- Detecting Fortran compiler ABI info |   -- Detecting Fortran compiler ABI info | ||||||
| @@ -152,14 +127,14 @@ Now we are ready to build:: | |||||||
|   -- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes |   -- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes | ||||||
|   -- Configuring done |   -- Configuring done | ||||||
|   -- Generating done |   -- Generating done | ||||||
|   -- Build files have been written to: /home/user/hello/build |   -- Build files have been written to: /home/user/example/build | ||||||
|  |  | ||||||
|      configure step is done |      configure step is done | ||||||
|      now you need to compile the sources: |      now you need to compile the sources: | ||||||
|      $ cd build |      $ cd build | ||||||
|      $ make |      $ make | ||||||
|  |  | ||||||
|   $ cd build |   $ cd build/ | ||||||
|   $ make |   $ make | ||||||
|  |  | ||||||
|   Scanning dependencies of target hello.x |   Scanning dependencies of target hello.x | ||||||
|   | |||||||
| @@ -4,18 +4,6 @@ FAQ for developers | |||||||
| ================== | ================== | ||||||
|  |  | ||||||
|  |  | ||||||
| Which files do I need to edit? |  | ||||||
| ------------------------------ |  | ||||||
|  |  | ||||||
| Let us start with files which you normally never edit: ``CMakeLists.txt`` and |  | ||||||
| ``setup`` - these are generated based on ``autocmake.yml``. Have a look in |  | ||||||
| ``autocmake.yml`` and you will see all CMake files which are assembled into |  | ||||||
| ``CMakeLists.txt``.  You can edit those files. If you change the order of files |  | ||||||
| listed in ``autocmake.yml`` or if you add or remove CMake modules, then you |  | ||||||
| need to rerun the ``update.py`` script to refresh ``CMakeLists.txt`` and |  | ||||||
| ``setup``. |  | ||||||
|  |  | ||||||
|  |  | ||||||
| Autocmake does not do feature X - I really need feature X and a setup flag --X | Autocmake does not do feature X - I really need feature X and a setup flag --X | ||||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ||||||
|  |  | ||||||
| @@ -31,22 +19,18 @@ naming):: | |||||||
|  |  | ||||||
|   cmake/custom/my_feature.cmake |   cmake/custom/my_feature.cmake | ||||||
|  |  | ||||||
| And include this feature to the main ``CMakeLists.txt`` in ``autocmake.yml`` | And include this feature to the main ``CMakeLists.txt`` in ``autocmake.cfg``:: | ||||||
| under the ``modules`` section:: |  | ||||||
|  |  | ||||||
|   modules: |   [my_feature] | ||||||
|   - my_feature: |   source: custom/my_feature.cmake | ||||||
|     - source: |  | ||||||
|       - custom/my_feature.cmake |  | ||||||
|  |  | ||||||
| Now your code is included in the main ``CMakeLists.txt``. Perhaps you also | Now your code is included in the main ``CMakeLists.txt``. Perhaps you also | ||||||
| want a setup script flag to toggle the feature:: | want a setup script flag to toggle the feature:: | ||||||
|  |  | ||||||
|   - my_feature: |   [my_feature] | ||||||
|     - docopt: "--enable-my-feature Enable my feature [default: False]." |   source: custom/my_feature.cmake | ||||||
|     - define: "'-DENABLE_MY_FEATURE={0}'.format(arguments['--enable-my-feature'])" |   docopt: --my-feature Enable my feature [default: False]. | ||||||
|     - source: |   define: '-DENABLE_MY_FEATURE={0}'.format(arguments['--my-feature']) | ||||||
|       - custom/my_feature.cmake |  | ||||||
|  |  | ||||||
| Implement your ideas, test them, and share them.  If your module is portable, | Implement your ideas, test them, and share them.  If your module is portable, | ||||||
| good code quality, and of general interest, you can suggest it to be part of | good code quality, and of general interest, you can suggest it to be part of | ||||||
| @@ -59,33 +43,20 @@ How can I get a setup flag --X that toggles a CMake variable? | |||||||
| The following will add a ``--something`` flag which toggles the CMake variable | The following will add a ``--something`` flag which toggles the CMake variable | ||||||
| ``ENABLE_SOMETHING``:: | ``ENABLE_SOMETHING``:: | ||||||
|  |  | ||||||
|   - my_section: |   [my_section] | ||||||
|     - docopt: "--something Enable something [default: False]." |   docopt: --something Enable something [default: False]. | ||||||
|     - define: "'-DENABLE_SOMETHING={0}'.format(arguments['--enable-something'])" |   define: '-DENABLE_SOMETHING={0}'.format(arguments['--something']) | ||||||
|  |  | ||||||
|  |  | ||||||
| Can I change the name of the setup script? | Can I change the name of the setup script? | ||||||
| ------------------------------------------ | ------------------------------------------ | ||||||
|  |  | ||||||
| Yes you can do that in ``autocmake.yml``. Here we for instance change the name to "configure": | Yes you can do that in ``autocmake.cfg``. Here we for instance change the name to "configure":: | ||||||
|  |  | ||||||
| .. code-block:: yaml |  | ||||||
|   :emphasize-lines: 4 |  | ||||||
|  |  | ||||||
|  |   [project] | ||||||
|   name: myproject |   name: myproject | ||||||
|   min_cmake_version: 2.8 |   min_cmake_version: 2.8 | ||||||
|   default_build_type: release |  | ||||||
|   setup_script: configure |   setup_script: configure | ||||||
|   language: |  | ||||||
|     - Fortran |  | ||||||
|     - C |  | ||||||
|     - CXX |  | ||||||
|  |  | ||||||
|  |  | ||||||
| Can I prevent Autocmake from creating any front-end setup script? |  | ||||||
| ----------------------------------------------------------------- |  | ||||||
|  |  | ||||||
| Yes, with ``setup_script: None``. |  | ||||||
|  |  | ||||||
|  |  | ||||||
| In CMake I can do feature X - can I do that also with Autocmake? | In CMake I can do feature X - can I do that also with Autocmake? | ||||||
| @@ -99,13 +70,12 @@ realized in Autocmake. | |||||||
| Should I include and track also files generated by Autocmake in my repository? | Should I include and track also files generated by Autocmake in my repository? | ||||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ||||||
|  |  | ||||||
| Yes, you probably want to do that. Autocmake downloads and generates a number | Yes, you probably want to do that. Autocmake generates a number of files which | ||||||
| of files which in principle could be generated at configure- or build-time. | in principle could be generated at configure- or build-time.  However, you | ||||||
| However, you probably do not want the users of your code to run any Autocmake | probably do not want the users of your code to run any Autocmake scripts like | ||||||
| scripts like ``update.py`` to generate the files they need to build the | ``update.py`` to generate the files they need to build the project. The users | ||||||
| project. The users of your code will run ``setup`` directly and typically expect | of your code will run ``setup`` directly and expect everything to just work | ||||||
| everything to just work (TM). Note also that the users of your code will | (TM). | ||||||
| not need to install the pyyaml package. |  | ||||||
|  |  | ||||||
|  |  | ||||||
| The update.py script is overwriting my CMakeLists.txt and setup, isn't this bad? | The update.py script is overwriting my CMakeLists.txt and setup, isn't this bad? | ||||||
| @@ -123,7 +93,7 @@ But I need to manually edit and customize CMakeLists.txt and setup every time I | |||||||
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| You typically never need to manually edit and customize ``CMakeLists.txt`` and | You typically never need to manually edit and customize ``CMakeLists.txt`` and | ||||||
| ``setup`` directly. You can introduce customizations in ``autocmake.yml`` | ``setup`` directly. You can introduce customizations in ``autocmake.cfg`` | ||||||
| which get assembled into the front-end scripts. | which get assembled into the front-end scripts. | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -131,21 +101,19 @@ Where is a good place to list my sources and targets? | |||||||
| ----------------------------------------------------- | ----------------------------------------------------- | ||||||
|  |  | ||||||
| As mentioned above ``CMakeLists.txt`` is not a good place because this file is | As mentioned above ``CMakeLists.txt`` is not a good place because this file is | ||||||
| generated from ``autocmake.yml`` and your modifications would become | generated from ``autocmake.cfg`` and your modifications would become | ||||||
| overwritten at some point.  A good standard is to organize your sources under | overwritten at some point.  A good standard is to organize your sources under | ||||||
| ``src/`` and to list your sources and targets in ``src/CMakeLists.txt``.  You | ``src/`` and to list your sources and targets in ``src/CMakeLists.txt``.  You | ||||||
| can include the latter in ``autocmake.yml`` using:: | can include the latter in ``autocmake.cfg`` using:: | ||||||
|  |  | ||||||
|   - my_sources: |   [src] | ||||||
|     - source: |   source: https://github.com/coderefinery/autocmake/raw/master/modules/src.cmake | ||||||
|       - https://github.com/dev-cafe/autocmake/raw/master/modules/src.cmake |  | ||||||
|  |  | ||||||
| If you really do not like to do it this way, you can describe your sources and | If you really don't like to do it this way, you can describe your sources and | ||||||
| targets in a custom module in a local file and include it like this:: | targets in a custom module in a local file and include it like this:: | ||||||
|  |  | ||||||
|   - my_sources: |   [my_sources] | ||||||
|     - source: |   source: custom/my_sources.cmake | ||||||
|       - custom/my_sources.cmake |  | ||||||
|  |  | ||||||
|  |  | ||||||
| How can I do some more sophisticated validation of setup flags? | How can I do some more sophisticated validation of setup flags? | ||||||
| @@ -153,7 +121,7 @@ How can I do some more sophisticated validation of setup flags? | |||||||
|  |  | ||||||
| Sometimes you need to do more sophisticated validation and post-processing | Sometimes you need to do more sophisticated validation and post-processing | ||||||
| of setup flags. This can be done by placing a module called ``extensions.py`` | of setup flags. This can be done by placing a module called ``extensions.py`` | ||||||
| under ``cmake/`` (or wherever you have ``autocmake.yml``). | under ``cmake/`` (or wherever you have ``autocmake.cfg``). | ||||||
| This file should implement a function with the following signature: | This file should implement a function with the following signature: | ||||||
|  |  | ||||||
| .. code-block:: python | .. code-block:: python | ||||||
| @@ -167,37 +135,5 @@ This file should implement a function with the following signature: | |||||||
|       return arguments |       return arguments | ||||||
|  |  | ||||||
| In this function you can do any validation and post-processing you like. | In this function you can do any validation and post-processing you like. | ||||||
| This function is run after the flags are parsed and before the CMake command | This function is run after the flags are parsed and before the ``CMake`` command | ||||||
| is run. | is run. | ||||||
|  |  | ||||||
| Example for a validation of MPI flags to the setup script: |  | ||||||
|  |  | ||||||
| .. code-block:: python |  | ||||||
|  |  | ||||||
|   import sys |  | ||||||
|  |  | ||||||
|   def contains_flag(sys_argv, flag): |  | ||||||
|       return (any(x for x in sys_argv if x.startswith('--{0}='.format(flag)))) |  | ||||||
|  |  | ||||||
|   def postprocess_args(sys_argv, arguments): |  | ||||||
|  |  | ||||||
|       # if --mpi is selected and compilers are not selected |  | ||||||
|       # then compilers default to mpif90, mpicc, and mpicxx |  | ||||||
|       if arguments['--mpi']: |  | ||||||
|           if not contains_flag(sys_argv, 'fc') and not contains_flag(sys_argv, 'cc') and not contains_flag(sys_argv, 'cxx'): |  | ||||||
|              arguments['--fc'] = 'mpif90' |  | ||||||
|              arguments['--cc'] = 'mpicc' |  | ||||||
|              arguments['--cxx'] = 'mpicxx' |  | ||||||
|  |  | ||||||
|       # if one of the compilers contains "mpi" and --mpi is not selected, it is probably a user error |  | ||||||
|       # in this case stop the configuration |  | ||||||
|       asking_for_mpi_compiler = False |  | ||||||
|       for flag in ['fc', 'cc', 'cxx']: |  | ||||||
|           if contains_flag(sys_argv, 'fc'): |  | ||||||
|               if 'mpi' in arguments['--fc']: |  | ||||||
|                   asking_for_mpi_compiler = True |  | ||||||
|       if asking_for_mpi_compiler and not arguments['--mpi']: |  | ||||||
|           sys.stderr.write('ERROR: you ask for an MPI compiler but have not specified --mpi\n') |  | ||||||
|           sys.exit(1) |  | ||||||
|  |  | ||||||
|       return arguments |  | ||||||
|   | |||||||
| @@ -1,34 +0,0 @@ | |||||||
|  |  | ||||||
| .. _interpolation: |  | ||||||
|  |  | ||||||
| Interpolation |  | ||||||
| ============= |  | ||||||
|  |  | ||||||
| In a custom extension to the YAML specification you can define and reuse |  | ||||||
| variables like this (observe how we interpolate ``url_root``, ``major``, |  | ||||||
| ``minor``, ``patch``, and ``components`` in this example):: |  | ||||||
|  |  | ||||||
|   url_root: https://github.com/dev-cafe/autocmake/raw/master/ |  | ||||||
|   major: 1 |  | ||||||
|   minor: 48 |  | ||||||
|   patch: 0 |  | ||||||
|   components: "" |  | ||||||
|   fetch: |  | ||||||
|     - "%(url_root)modules/boost/boost_unpack.cmake" |  | ||||||
|     - "%(url_root)modules/boost/boost_userconfig.cmake" |  | ||||||
|     - "%(url_root)modules/boost/boost_configure.cmake" |  | ||||||
|     - "%(url_root)modules/boost/boost_build.cmake" |  | ||||||
|     - "%(url_root)modules/boost/boost_install.cmake" |  | ||||||
|     - "%(url_root)modules/boost/boost_headers.cmake" |  | ||||||
|     - "%(url_root)modules/boost/boost_cleanup.cmake" |  | ||||||
|     - "http://sourceforge.net/projects/boost/files/boost/%(major).%(minor).%(patch)/boost_%(major)_%(minor)_%(patch).zip" |  | ||||||
|   docopt: |  | ||||||
|     - "--boost-headers=<BOOST_INCLUDEDIR> Include directories for Boost [default: '']." |  | ||||||
|     - "--boost-libraries=<BOOST_LIBRARYDIR> Library directories for Boost [default: '']." |  | ||||||
|     - "--build-boost=<FORCE_CUSTOM_BOOST> Deactivate Boost detection and build on-the-fly <ON/OFF> [default: OFF]." |  | ||||||
|   define: |  | ||||||
|     - "'-DBOOST_INCLUDEDIR=\"{0}\"'.format(arguments['--boost-headers'])" |  | ||||||
|     - "'-DBOOST_LIBRARYDIR=\"{0}\"'.format(arguments['--boost-libraries'])" |  | ||||||
|     - "'-DFORCE_CUSTOM_BOOST={0}'.format(arguments['--build-boost'])" |  | ||||||
|     - "'-DBOOST_MINIMUM_REQUIRED=\"%(major).%(minor).%(patch)\"'" |  | ||||||
|     - "'-DBOOST_COMPONENTS_REQUIRED=\"%(components)\"'" |  | ||||||
| @@ -20,11 +20,11 @@ Sometimes you may want to avoid using the latest version of a CMake module and | |||||||
| rather fetch an older version, for example with the hash ``abcd123``. To | rather fetch an older version, for example with the hash ``abcd123``. To | ||||||
| achieve this, instead of:: | achieve this, instead of:: | ||||||
|  |  | ||||||
|   - my_feature: |   [foo] | ||||||
|     - source: https://github.com/dev-cafe/autocmake/raw/master/modules/foo.cmake |   source: https://github.com/coderefinery/autocmake/raw/master/modules/foo.cmake | ||||||
|  |  | ||||||
| pin the version to ``abcd123`` (you do not need to specify the full Git hash, a unique | pin the version to ``abcd123`` (you do not need to specify the full Git hash, a unique | ||||||
| beginning will do):: | beginning will do):: | ||||||
|  |  | ||||||
|   - my_feature: |   [foo] | ||||||
|     - source: https://github.com/dev-cafe/autocmake/raw/abcd123/modules/foo.cmake |   source: https://github.com/coderefinery/autocmake/raw/abcd123/modules/foo.cmake | ||||||
|   | |||||||
| @@ -73,7 +73,7 @@ def main(): | |||||||
|             if s_out != '': |             if s_out != '': | ||||||
|                 output.append('\n\n%s' % file_name) |                 output.append('\n\n%s' % file_name) | ||||||
|                 output.append('-'*len(file_name)) |                 output.append('-'*len(file_name)) | ||||||
|                 output.append('`[Source code] <https://github.com/dev-cafe/autocmake/blob/master/modules/%s>`__' % full_file_name) |                 output.append('`[Source code] <https://github.com/coderefinery/autocmake/blob/master/modules/%s>`__' % full_file_name) | ||||||
|                 output.append(s_out) |                 output.append(s_out) | ||||||
|  |  | ||||||
|     with open(os.path.join(THIS_DIR, 'module-reference.rst'), 'w') as f: |     with open(os.path.join(THIS_DIR, 'module-reference.rst'), 'w') as f: | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ file:: | |||||||
|   Build/install/test targets |   Build/install/test targets | ||||||
|  |  | ||||||
| Our main motivation to create Autocmake as a CMake framework library and | Our main motivation to create Autocmake as a CMake framework library and | ||||||
| CMake module composer is to simplify CMake code transfer between programs. We got | CMake module composer is to simplify CMake code transfer between codes. We got | ||||||
| tired of manually diffing and copy-pasting boiler-plate CMake code and watching | tired of manually diffing and copy-pasting boiler-plate CMake code and watching | ||||||
| it diverge while maintaining the CMake infrastructure in a growing number of | it diverge while maintaining the CMake infrastructure in a growing number of | ||||||
| scientific projects which typically have very similar requirements: | scientific projects which typically have very similar requirements: | ||||||
|   | |||||||
| @@ -8,6 +8,3 @@ support Python 3 (we automatically test with 2.7 and 3.5). | |||||||
|  |  | ||||||
| The generated setup script runs with Python >= 2.6 (also tested with Python | The generated setup script runs with Python >= 2.6 (also tested with Python | ||||||
| 3.5). | 3.5). | ||||||
|  |  | ||||||
| To generate ``CMakeLists.txt`` and the ``setup`` script, Autocmake |  | ||||||
| requires the pyyaml package. |  | ||||||
|   | |||||||
| @@ -1,21 +1,25 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| Autocmake | Autocmake (this documentation is outdated, see stable-0.x branch) | ||||||
| ========= | ================================================================= | ||||||
|  |  | ||||||
|  |  | ||||||
|  | General | ||||||
|  | ------- | ||||||
|  |  | ||||||
| .. toctree:: | .. toctree:: | ||||||
|    :maxdepth: 2 |    :maxdepth: 2 | ||||||
|    :caption: General |  | ||||||
|  |  | ||||||
|    general/about.rst |    general/about.rst | ||||||
|    general/requirements.rst |    general/requirements.rst | ||||||
|    general/help.rst |    general/help.rst | ||||||
|  |  | ||||||
|  |  | ||||||
|  | For developers who use Autocmake | ||||||
|  | -------------------------------- | ||||||
|  |  | ||||||
| .. toctree:: | .. toctree:: | ||||||
|    :maxdepth: 2 |    :maxdepth: 2 | ||||||
|    :caption: For developers who use Autocmake |  | ||||||
|  |  | ||||||
|    developers/faq.rst |    developers/faq.rst | ||||||
|    developers/bootstrap.rst |    developers/bootstrap.rst | ||||||
| @@ -23,27 +27,32 @@ Autocmake | |||||||
|    developers/example.rst |    developers/example.rst | ||||||
|    developers/customizing-modules.rst |    developers/customizing-modules.rst | ||||||
|    developers/updating-modules.rst |    developers/updating-modules.rst | ||||||
|    developers/interpolation.rst |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | For users of projects which use Autocmake | ||||||
|  | ----------------------------------------- | ||||||
|  |  | ||||||
| .. toctree:: | .. toctree:: | ||||||
|    :maxdepth: 2 |    :maxdepth: 2 | ||||||
|    :caption: For users of projects which use Autocmake |  | ||||||
|  |  | ||||||
|    users/faq.rst |    users/faq.rst | ||||||
|  |  | ||||||
|  |  | ||||||
|  | For developers/contributors to Autocmake | ||||||
|  | ---------------------------------------- | ||||||
|  |  | ||||||
| .. toctree:: | .. toctree:: | ||||||
|    :maxdepth: 2 |    :maxdepth: 2 | ||||||
|    :caption: For developers/contributors to Autocmake |  | ||||||
|  |  | ||||||
|    contributors/guidelines.rst |    contributors/guidelines.rst | ||||||
|    contributors/testing.rst |    contributors/testing.rst | ||||||
|    contributors/doc.rst |    contributors/doc.rst | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Reference | ||||||
|  | --------- | ||||||
|  |  | ||||||
| .. toctree:: | .. toctree:: | ||||||
|    :maxdepth: 2 |    :maxdepth: 2 | ||||||
|    :caption: Reference |  | ||||||
|  |  | ||||||
|    module-reference.rst |    module-reference.rst | ||||||
|   | |||||||
| @@ -49,7 +49,9 @@ Like this:: | |||||||
|  |  | ||||||
|   $ python setup --cmake-options='"-DTHIS_OPTION=ON -DTHAT_OPTION=OFF"' |   $ python setup --cmake-options='"-DTHIS_OPTION=ON -DTHAT_OPTION=OFF"' | ||||||
|  |  | ||||||
| We use two sets of quotes because the shell swallows one set of them before | We use two sets of quotes because the shell swallows one set of them | ||||||
| passing the arguments to Python. Yeah that's not nice, but nothing we can do | before passing the arguments to Python. Yeah that's not nice, but nothing | ||||||
| about it on the Python side. If you do not use two sets of quotes then the | we can do about it on the Python side. | ||||||
| setup command may end up incorrectly saved in `build/setup_command`. | If you do not use two sets | ||||||
|  | of quotes then the setup command may end up | ||||||
|  | incorrectly saved in `build/setup_command`. | ||||||
|   | |||||||
| @@ -1,13 +0,0 @@ | |||||||
| import glob |  | ||||||
|  |  | ||||||
| license_text = '''# (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| ''' |  | ||||||
|  |  | ||||||
| for filename in glob.iglob('**/*.cmake', recursive=True): |  | ||||||
|     with open(filename, 'r') as old: |  | ||||||
|         text = old.read() |  | ||||||
|     with open(filename, 'w') as new: |  | ||||||
|         new.write(license_text) |  | ||||||
|         new.write(text) |  | ||||||
							
								
								
									
										189
									
								
								modules/boost/boost.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										189
									
								
								modules/boost/boost.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,189 @@ | |||||||
|  | #.rst: | ||||||
|  | # | ||||||
|  | # Detect, build, and link Boost libraries. | ||||||
|  | # This modules downloads the .zip archive from SourceForge at | ||||||
|  | # Autocmake update time. | ||||||
|  | # Note that the build-up commands are not Windows-compatible! | ||||||
|  | # | ||||||
|  | # Your autocmake.yml should look like this:: | ||||||
|  | # | ||||||
|  | # - boost: | ||||||
|  | #   - major: 1 | ||||||
|  | #   - minor: 59 | ||||||
|  | #   - patch: 0 | ||||||
|  | #   - components: "chrono;timer;system" | ||||||
|  | #   - source: "https://github.com/coderefinery/autocmake/raw/master/modules/boost/boost.cmake" | ||||||
|  | # | ||||||
|  | # Cross-dependencies between required components are not checked for. | ||||||
|  | # For example, Boost.Timer depends on Boost.Chrono and Boost.System thus you | ||||||
|  | # should ask explicitly for all three. | ||||||
|  | # If the self-build of Boost components is triggered the `BUILD_CUSTOM_BOOST` variable is set | ||||||
|  | # to `TRUE`. The CMake target `custom_boost` is also added. | ||||||
|  | # You should use these two to ensure the right dependencies between your targets | ||||||
|  | # and the Boost headers/libraries, in case the self-build is triggered. | ||||||
|  | # For example:: | ||||||
|  | # | ||||||
|  | #   if(BUILD_CUSTOM_BOOST) | ||||||
|  | #     add_dependencies(your_target custom_boost) | ||||||
|  | #   endif() | ||||||
|  | # | ||||||
|  | # will ensure that `your_target` is built after `custom_boost` if and only if the self-build | ||||||
|  | # of Boost took place. This is an important step to avoid race conditions when building | ||||||
|  | # on multiple processes. | ||||||
|  | # | ||||||
|  | # Dependencies:: | ||||||
|  | # | ||||||
|  | #   mpi                        - Only if the Boost.MPI library is a needed component | ||||||
|  | #   python_libs                - Only if the Boost.Python library is a needed component | ||||||
|  | # | ||||||
|  | # Variables used:: | ||||||
|  | # | ||||||
|  | #   BOOST_MINIMUM_REQUIRED     - Minimum required version of Boost | ||||||
|  | #   BOOST_COMPONENTS_REQUIRED  - Components (compiled Boost libraries) required | ||||||
|  | #   PROJECT_SOURCE_DIR | ||||||
|  | #   PROJECT_BINARY_DIR | ||||||
|  | #   CMAKE_BUILD_TYPE | ||||||
|  | #   MPI_FOUND | ||||||
|  | #   BUILD_CUSTOM_BOOST | ||||||
|  | # | ||||||
|  | # autocmake.yml configuration:: | ||||||
|  | # | ||||||
|  | #   url_root: https://github.com/coderefinery/autocmake/raw/master/ | ||||||
|  | #   major: 1 | ||||||
|  | #   minor: 48 | ||||||
|  | #   patch: 0 | ||||||
|  | #   components: "" | ||||||
|  | #   fetch: | ||||||
|  | #     - "%(url_root)modules/boost/boost_unpack.cmake" | ||||||
|  | #     - "%(url_root)modules/boost/boost_userconfig.cmake" | ||||||
|  | #     - "%(url_root)modules/boost/boost_configure.cmake" | ||||||
|  | #     - "%(url_root)modules/boost/boost_build.cmake" | ||||||
|  | #     - "%(url_root)modules/boost/boost_install.cmake" | ||||||
|  | #     - "%(url_root)modules/boost/boost_headers.cmake" | ||||||
|  | #     - "%(url_root)modules/boost/boost_cleanup.cmake" | ||||||
|  | #     - "http://sourceforge.net/projects/boost/files/boost/%(major).%(minor).%(patch)/boost_%(major)_%(minor)_%(patch).zip" | ||||||
|  | #   docopt: | ||||||
|  | #     - "--boost-headers=<BOOST_INCLUDEDIR> Include directories for Boost [default: '']." | ||||||
|  | #     - "--boost-libraries=<BOOST_LIBRARYDIR> Library directories for Boost [default: '']." | ||||||
|  | #     - "--build-boost=<FORCE_CUSTOM_BOOST> Deactivate Boost detection and build on-the-fly <ON/OFF> [default: OFF]." | ||||||
|  | #   define: | ||||||
|  | #     - "'-DBOOST_INCLUDEDIR=\"{0}\"'.format(arguments['--boost-headers'])" | ||||||
|  | #     - "'-DBOOST_LIBRARYDIR=\"{0}\"'.format(arguments['--boost-libraries'])" | ||||||
|  | #     - "'-DFORCE_CUSTOM_BOOST={0}'.format(arguments['--build-boost'])" | ||||||
|  | #     - "'-DBOOST_MINIMUM_REQUIRED=\"%(major).%(minor).%(patch)\"'" | ||||||
|  | #     - "'-DBOOST_COMPONENTS_REQUIRED=\"%(components)\"'" | ||||||
|  |  | ||||||
|  | # FIXME Maintainer should be able to choose between fail (end-user has to satisfy dependency | ||||||
|  | #       on its own) and soft-fail (self-build of Boost) | ||||||
|  | # Underscore-separated version number | ||||||
|  | string(REGEX REPLACE "\\." "_" BOOSTVER ${BOOST_MINIMUM_REQUIRED}) | ||||||
|  |  | ||||||
|  | # Where the Boost .zip archive is located | ||||||
|  | set(BOOST_ARCHIVE_LOCATION ${PROJECT_SOURCE_DIR}/cmake/downloaded) | ||||||
|  |  | ||||||
|  | set(BOOST_ARCHIVE boost_${BOOSTVER}.zip) | ||||||
|  |  | ||||||
|  | # FIXME These are possibly not always good settings | ||||||
|  | set(Boost_USE_STATIC_LIBS    ON) | ||||||
|  | set(Boost_USE_MULTITHREADED  ON) | ||||||
|  | set(Boost_USE_STATIC_RUNTIME OFF) | ||||||
|  | set(Boost_DEBUG OFF) | ||||||
|  | set(Boost_DETAILED_FAILURE_MESSAGE OFF) | ||||||
|  |  | ||||||
|  | set(BUILD_CUSTOM_BOOST FALSE) | ||||||
|  | if(FORCE_CUSTOM_BOOST) | ||||||
|  |     set(BUILD_CUSTOM_BOOST TRUE) | ||||||
|  |     message(STATUS "Force automatic build of Boost") | ||||||
|  |     # Just to avoid unused variable warning from CMake | ||||||
|  |     set(BOOST_INCLUDEDIR "") | ||||||
|  |     set(BOOST_LIBRARYDIR "") | ||||||
|  | else() | ||||||
|  |     # Read from cache, needed for rebuilds | ||||||
|  |     set(BOOST_INCLUDEDIR ${Boost_INCLUDE_DIR}) | ||||||
|  |     set(BOOST_LIBRARYDIR ${Boost_LIBRARY_DIR}) | ||||||
|  |     find_package(Boost ${BOOST_MINIMUM_REQUIRED} COMPONENTS "${BOOST_COMPONENTS_REQUIRED}") | ||||||
|  |     if(NOT Boost_FOUND) | ||||||
|  |         set(BUILD_CUSTOM_BOOST TRUE) | ||||||
|  |     endif() | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | if(BUILD_CUSTOM_BOOST) | ||||||
|  |     ## Preliminary work | ||||||
|  |     # 0. Root directory for the custom build | ||||||
|  |     set(CUSTOM_BOOST_LOCATION ${PROJECT_BINARY_DIR}/boost) | ||||||
|  |     file(MAKE_DIRECTORY ${CUSTOM_BOOST_LOCATION}) | ||||||
|  |     # 1. Where Boost will be built | ||||||
|  |     set(BOOST_BUILD_DIR ${CUSTOM_BOOST_LOCATION}/boost_${BOOSTVER}) | ||||||
|  |     # 2. Select toolset according to compilers specified by the user | ||||||
|  |     set(toolset   "") | ||||||
|  |     if(CMAKE_CXX_COMPILER_ID MATCHES Intel) | ||||||
|  |         set(toolset "intel-linux") | ||||||
|  |     elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang) | ||||||
|  |         set(toolset "clang") | ||||||
|  |     else() | ||||||
|  |         if(CMAKE_SYSTEM_NAME MATCHES Darwin) | ||||||
|  |             set(toolset "darwin") | ||||||
|  |         else() | ||||||
|  |             set(toolset "gcc") | ||||||
|  |         endif() | ||||||
|  |     endif() | ||||||
|  |     string(TOLOWER ${CMAKE_BUILD_TYPE} type) | ||||||
|  |  | ||||||
|  |    # CMAKE_CURRENT_LIST_DIR is undefined in CMake 2.8.2 | ||||||
|  |    # see https://public.kitware.com/Bug/print_bug_page.php?bug_id=11675 | ||||||
|  |    # workaround: create CMAKE_CURRENT_LIST_DIR | ||||||
|  |     get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) | ||||||
|  |     include(${CMAKE_CURRENT_LIST_DIR}/boost_unpack.cmake) | ||||||
|  |     include(${CMAKE_CURRENT_LIST_DIR}/boost_userconfig.cmake) | ||||||
|  |  | ||||||
|  |     if(NOT "${BOOST_COMPONENTS_REQUIRED}" STREQUAL "") | ||||||
|  |         # Non-empty list. Compiled libraries needed | ||||||
|  |         # Transform the ;-separated list to a ,-separated list (digested by the Boost build toolchain!) | ||||||
|  |         string(REPLACE ";" "," b2_needed_components "${BOOST_COMPONENTS_REQUIRED}") | ||||||
|  |         # Replace unit_test_framework (used by CMake's find_package) with test (understood by Boost build toolchain) | ||||||
|  |         string(REPLACE "unit_test_framework" "test" b2_needed_components "${b2_needed_components}") | ||||||
|  |         set(select_libraries "--with-libraries=${b2_needed_components}") | ||||||
|  |         string(REPLACE ";" ", " printout "${BOOST_COMPONENTS_REQUIRED}") | ||||||
|  |         message(STATUS "  Libraries to be built: ${printout}") | ||||||
|  |         message(STATUS "  Toolset to be used: ${toolset}") | ||||||
|  |         include(${CMAKE_CURRENT_LIST_DIR}/boost_configure.cmake) | ||||||
|  |         include(${CMAKE_CURRENT_LIST_DIR}/boost_build.cmake) | ||||||
|  |         include(${CMAKE_CURRENT_LIST_DIR}/boost_install.cmake) | ||||||
|  |     else() | ||||||
|  |         # Empty list. Header-only libraries needed | ||||||
|  |         # Just unpack to known location | ||||||
|  |         message(STATUS "  No libraries required, installing headers") | ||||||
|  |         include(${CMAKE_CURRENT_LIST_DIR}/boost_headers.cmake) | ||||||
|  |     endif() | ||||||
|  |  | ||||||
|  |     include(${CMAKE_CURRENT_LIST_DIR}/boost_cleanup.cmake) | ||||||
|  |     add_custom_target(custom_boost DEPENDS ${CUSTOM_BOOST_LOCATION}/boost.cleanedup) | ||||||
|  |     # 4. Set all variables related to Boost that find_package would have set | ||||||
|  |     set(Boost_FOUND TRUE) | ||||||
|  |     string(REGEX REPLACE "\\." "0" Boost_VERSION ${BOOST_MINIMUM_REQUIRED}) | ||||||
|  |     math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") | ||||||
|  |     math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") | ||||||
|  |     math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") | ||||||
|  |     set(Boost_LIB_VERSION ${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}) | ||||||
|  |     set(Boost_INCLUDE_DIR ${CUSTOM_BOOST_LOCATION}/include CACHE PATH "Boost include directory" FORCE) | ||||||
|  |     set(Boost_LIBRARY_DIR ${CUSTOM_BOOST_LOCATION}/lib CACHE PATH "Boost library directory" FORCE) | ||||||
|  |  | ||||||
|  |     foreach(_component ${BOOST_COMPONENTS_REQUIRED}) | ||||||
|  |         string(TOUPPER ${_component} _COMP) | ||||||
|  |         set(Boost_${_COMP}_FOUND TRUE) | ||||||
|  |         set(Boost_${_COMP}_LIBRARY libboost_${_component}.a) | ||||||
|  |         set(Boost_${_COMP}_LIBRARY_DEBUG ${Boost_LIBRARY_DIR}/${Boost_${_COMP}_LIBRARY} CACHE FILEPATH "Boost ${_component} library (debug)" FORCE) | ||||||
|  |         set(Boost_${_COMP}_LIBRARY_RELEASE ${Boost_LIBRARY_DIR}/${Boost_${_COMP}_LIBRARY} CACHE FILEPATH "Boost ${_component} library (release)" FORCE) | ||||||
|  |         list(APPEND Boost_LIBRARIES ${Boost_${_COMP}_LIBRARY}) | ||||||
|  |     endforeach() | ||||||
|  |  | ||||||
|  |     set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) | ||||||
|  |     set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR}) | ||||||
|  |     if(CMAKE_SYSTEM_NAME MATCHES Linux) | ||||||
|  |         list(APPEND Boost_LIBRARIES rt) | ||||||
|  |     endif() | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) | ||||||
|  |  | ||||||
|  | link_directories(${Boost_LIBRARY_DIRS}) | ||||||
							
								
								
									
										10
									
								
								modules/boost/boost_build.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								modules/boost/boost_build.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | # Build Boost | ||||||
|  | # This is not Windows-friendly! | ||||||
|  | add_custom_command( | ||||||
|  |     OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.built | ||||||
|  |     COMMAND ./b2 toolset=${toolset} variant=${type} link=static cxxflags=-fPIC | ||||||
|  |     threading=multi --user-config=user-config.jam 1> ${CUSTOM_BOOST_LOCATION}/boost.built.log 2> ${CUSTOM_BOOST_LOCATION}/boost.built.err | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E touch ${CUSTOM_BOOST_LOCATION}/boost.built | ||||||
|  |     WORKING_DIRECTORY ${BOOST_BUILD_DIR} | ||||||
|  |     DEPENDS ${CUSTOM_BOOST_LOCATION}/boost.configured | ||||||
|  |     COMMENT "Building Boost") | ||||||
							
								
								
									
										8
									
								
								modules/boost/boost_cleanup.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								modules/boost/boost_cleanup.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | # Clean-up | ||||||
|  | add_custom_command( | ||||||
|  |     OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.cleanedup | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E remove_directory ${BOOST_BUILD_DIR} | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E touch ${CUSTOM_BOOST_LOCATION}/boost.cleanedup | ||||||
|  |     WORKING_DIRECTORY ${CUSTOM_BOOST_LOCATION} | ||||||
|  |     DEPENDS ${CUSTOM_BOOST_LOCATION}/boost.installed | ||||||
|  |     COMMENT "Clean-up Boost") | ||||||
							
								
								
									
										12
									
								
								modules/boost/boost_configure.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								modules/boost/boost_configure.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | # Run bootstrap.sh to configure the build. We will install in ${PROJECT_BINARY_DIR}/boost | ||||||
|  | # This is not Windows-friendly! | ||||||
|  | add_custom_command( | ||||||
|  |     OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.configured | ||||||
|  |     COMMAND ./bootstrap.sh --with-toolset=${toolset} | ||||||
|  |             ${select_libraries} | ||||||
|  | 	    --with-python=${PYTHON_EXECUTABLE} | ||||||
|  |         --prefix=${CUSTOM_BOOST_LOCATION} 1> ${CUSTOM_BOOST_LOCATION}/boost.configured.log 2> ${CUSTOM_BOOST_LOCATION}/boost.configured.err | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E touch ${CUSTOM_BOOST_LOCATION}/boost.configured | ||||||
|  |     WORKING_DIRECTORY ${BOOST_BUILD_DIR} | ||||||
|  |     DEPENDS ${CUSTOM_BOOST_LOCATION}/boost.user-config | ||||||
|  |     COMMENT "Configuring Boost") | ||||||
							
								
								
									
										8
									
								
								modules/boost/boost_headers.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								modules/boost/boost_headers.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | # Install Boost | ||||||
|  | add_custom_command( | ||||||
|  |     OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.installed | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E copy_directory ${BOOST_BUILD_DIR}/boost ${CUSTOM_BOOST_LOCATION}/include/boost | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E touch ${CUSTOM_BOOST_LOCATION}/boost.installed | ||||||
|  |     WORKING_DIRECTORY ${BOOST_BUILD_DIR} | ||||||
|  |     DEPENDS ${CUSTOM_BOOST_LOCATION}/boost.user-config | ||||||
|  |     COMMENT "Installing Boost headers") | ||||||
							
								
								
									
										10
									
								
								modules/boost/boost_install.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								modules/boost/boost_install.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | # Install Boost | ||||||
|  | # This is not Windows-friendly! | ||||||
|  | add_custom_command( | ||||||
|  |     OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.installed | ||||||
|  |     COMMAND ./b2 install toolset=${toolset} variant=${type} link=static | ||||||
|  |     threading=multi --user-config=user-config.jam 1> ${CUSTOM_BOOST_LOCATION}/boost.installed.log 2> ${CUSTOM_BOOST_LOCATION}/boost.installed.err | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E touch ${CUSTOM_BOOST_LOCATION}/boost.installed | ||||||
|  |     WORKING_DIRECTORY ${BOOST_BUILD_DIR} | ||||||
|  |     DEPENDS ${CUSTOM_BOOST_LOCATION}/boost.built | ||||||
|  |     COMMENT "Installing Boost headers and libs") | ||||||
							
								
								
									
										8
									
								
								modules/boost/boost_unpack.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								modules/boost/boost_unpack.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | # Unpack Boost | ||||||
|  | add_custom_command( | ||||||
|  |     OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.unpacked | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E tar xzf ${BOOST_ARCHIVE_LOCATION}/${BOOST_ARCHIVE} | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E touch boost.unpacked | ||||||
|  |     DEPENDS ${BOOST_ARCHIVE_LOCATION}/${BOOST_ARCHIVE} | ||||||
|  |     WORKING_DIRECTORY ${CUSTOM_BOOST_LOCATION} | ||||||
|  |     COMMENT "Unpacking Boost") | ||||||
							
								
								
									
										15
									
								
								modules/boost/boost_userconfig.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								modules/boost/boost_userconfig.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | # To get boost to compile MPI we need to append "using mpi ;" to the end of the | ||||||
|  | # user-config.jam file. MPI_SENT will be the command we append | ||||||
|  | set(MPI_SENT "") | ||||||
|  | if(ENABLE_MPI AND MPI_FOUND) | ||||||
|  |     set(MPI_SENT "using mpi \;") | ||||||
|  | endif() | ||||||
|  | file(WRITE ${CUSTOM_BOOST_LOCATION}/user-config.jam ${MPI_SENT}) | ||||||
|  | # Write user-config.jam | ||||||
|  | add_custom_command( | ||||||
|  |     OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.user-config | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CUSTOM_BOOST_LOCATION}/user-config.jam ${BOOST_BUILD_DIR}/user-config.jam | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -E touch boost.user-config | ||||||
|  |     DEPENDS ${CUSTOM_BOOST_LOCATION}/boost.unpacked | ||||||
|  |     WORKING_DIRECTORY ${CUSTOM_BOOST_LOCATION} | ||||||
|  |     COMMENT "Generating user-config.jam") | ||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Adds C support. | # Adds C support. | ||||||
| @@ -25,7 +22,10 @@ | |||||||
| #   docopt: | #   docopt: | ||||||
| #     - "--cc=<CC> C compiler [default: gcc]." | #     - "--cc=<CC> C compiler [default: gcc]." | ||||||
| #     - "--extra-cc-flags=<EXTRA_CFLAGS> Extra C compiler flags [default: '']." | #     - "--extra-cc-flags=<EXTRA_CFLAGS> Extra C compiler flags [default: '']." | ||||||
| #   define: "'-DCMAKE_C_COMPILER={0} -DEXTRA_CFLAGS=\"{1}\"'.format(arguments['--cc'], arguments['--extra-cc-flags'])" | #   export: "'CC={0}'.format(arguments['--cc'])" | ||||||
|  | #   define: "'-DEXTRA_CFLAGS=\"{0}\"'.format(arguments['--extra-cc-flags'])" | ||||||
|  |  | ||||||
|  | enable_language(C) | ||||||
|  |  | ||||||
| if(NOT DEFINED CMAKE_C_COMPILER_ID) | if(NOT DEFINED CMAKE_C_COMPILER_ID) | ||||||
|     message(FATAL_ERROR "CMAKE_C_COMPILER_ID variable is not defined!") |     message(FATAL_ERROR "CMAKE_C_COMPILER_ID variable is not defined!") | ||||||
| @@ -36,9 +36,7 @@ if(NOT CMAKE_C_COMPILER_WORKS) | |||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(DEFINED EXTRA_CFLAGS) | if(DEFINED EXTRA_CFLAGS) | ||||||
|   if(NOT EXTRA_CFLAGS STREQUAL "") |  | ||||||
|     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") |     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") | ||||||
|   endif() |  | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(DEFINED ENV{CFLAGS}) | if(DEFINED ENV{CFLAGS}) | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Adds ccache support. | # Adds ccache support. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Enables code coverage by appending corresponding compiler flags. | # Enables code coverage by appending corresponding compiler flags. | ||||||
| @@ -13,54 +10,30 @@ | |||||||
| # | # | ||||||
| # autocmake.yml configuration:: | # autocmake.yml configuration:: | ||||||
| # | # | ||||||
| #   docopt: "--coverage Enable code coverage [default: OFF]." | #   docopt: "--coverage Enable code coverage [default: False]." | ||||||
| #   define: "'-DENABLE_CODE_COVERAGE={0}'.format(arguments['--coverage'])" | #   define: "'-DENABLE_CODE_COVERAGE={0}'.format(arguments['--coverage'])" | ||||||
|  |  | ||||||
| option(ENABLE_CODE_COVERAGE "Enable code coverage" OFF) | option(ENABLE_CODE_COVERAGE "Enable code coverage" OFF) | ||||||
|  |  | ||||||
| if(ENABLE_CODE_COVERAGE) | if(ENABLE_CODE_COVERAGE) | ||||||
|   if(NOT CMAKE_BUILD_TYPE STREQUAL "debug") |  | ||||||
|     message(WARNING "Code coverage analysis results with an optimized (non-Debug) build may be misleading") |  | ||||||
|   endif() |  | ||||||
|  |  | ||||||
|   find_program(GCOV_PATH gcov) |  | ||||||
|   if(NOT GCOV_PATH) |  | ||||||
|     message(FATAL_ERROR "Code coverage analysis requires gcov!") |  | ||||||
|   endif() |  | ||||||
|  |  | ||||||
|     if(DEFINED CMAKE_Fortran_COMPILER_ID) |     if(DEFINED CMAKE_Fortran_COMPILER_ID) | ||||||
|         if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) |         if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) | ||||||
|             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fprofile-arcs -ftest-coverage") |             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fprofile-arcs -ftest-coverage") | ||||||
|     else() |  | ||||||
|       message(FATAL_ERROR "Code coverage analysis requires the GNU Fortran compiler!") |  | ||||||
|         endif() |         endif() | ||||||
|     endif() |     endif() | ||||||
|  |  | ||||||
|     if(DEFINED CMAKE_C_COMPILER_ID) |     if(DEFINED CMAKE_C_COMPILER_ID) | ||||||
|     if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang") |         if(CMAKE_C_COMPILER_ID MATCHES GNU) | ||||||
|       if(CMAKE_C_COMPILER_VERSION VERSION_LESS 3) |  | ||||||
|         message(FATAL_ERROR "Code coverage analysis on Mac OS X requires Clang version 3.0.0 or greater!") |  | ||||||
|       else() |  | ||||||
|             set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") |             set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") | ||||||
|         endif() |         endif() | ||||||
|     elseif(CMAKE_C_COMPILER_ID MATCHES GNU) |  | ||||||
|       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") |  | ||||||
|     else() |  | ||||||
|       message(FATAL_ERROR "Code coverage analysis requires the GNU C compiler!") |  | ||||||
|     endif() |  | ||||||
|     endif() |     endif() | ||||||
|  |  | ||||||
|     if(DEFINED CMAKE_CXX_COMPILER_ID) |     if(DEFINED CMAKE_CXX_COMPILER_ID) | ||||||
|     if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") |         if(CMAKE_CXX_COMPILER_ID MATCHES GNU) | ||||||
|       if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3) |  | ||||||
|         message(FATAL_ERROR "Code coverage analysis on Mac OS X requires Clang version 3.0.0 or greater!") |  | ||||||
|       else() |  | ||||||
|             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") |             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") | ||||||
|         endif() |         endif() | ||||||
|     elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU) |         if(CMAKE_CXX_COMPILER_ID MATCHES Clang) | ||||||
|             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") |             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") | ||||||
|     else() |  | ||||||
|       message(FATAL_ERROR "Code coverage analysis requires the GNU C++ compiler!") |  | ||||||
|         endif() |         endif() | ||||||
|     endif() |     endif() | ||||||
| endif() | endif() | ||||||
|   | |||||||
| @@ -1,63 +0,0 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: |  | ||||||
| # |  | ||||||
| # Colorize CMake output. |  | ||||||
| # Code was found on StackOverflow: http://stackoverflow.com/a/19578320 |  | ||||||
| # |  | ||||||
| # Usage within CMake code: |  | ||||||
| #   message("This is normal") |  | ||||||
| #   message("${Red}This is Red${ColourReset}") |  | ||||||
| #   message("${Green}This is Green${ColourReset}") |  | ||||||
| #   message("${Yellow}This is Yellow${ColourReset}") |  | ||||||
| #   message("${Blue}This is Blue${ColourReset}") |  | ||||||
| #   message("${Magenta}This is Magenta${ColourReset}") |  | ||||||
| #   message("${Cyan}This is Cyan${ColourReset}") |  | ||||||
| #   message("${White}This is White${ColourReset}") |  | ||||||
| #   message("${BoldRed}This is BoldRed${ColourReset}") |  | ||||||
| #   message("${BoldGreen}This is BoldGreen${ColourReset}") |  | ||||||
| #   message("${BoldYellow}This is BoldYellow${ColourReset}") |  | ||||||
| #   message("${BoldBlue}This is BoldBlue${ColourReset}") |  | ||||||
| #   message("${BoldMagenta}This is BoldMagenta${ColourReset}") |  | ||||||
| #   message("${BoldCyan}This is BoldCyan${ColourReset}") |  | ||||||
| #   message("${BoldWhite}This is BoldWhite\n\n${ColourReset}") |  | ||||||
| # |  | ||||||
| # Has no effect on WIN32. |  | ||||||
|  |  | ||||||
| if(WIN32) |  | ||||||
|     set(ColourReset "") |  | ||||||
|     set(ColourBold  "") |  | ||||||
|     set(Red         "") |  | ||||||
|     set(Green       "") |  | ||||||
|     set(Yellow      "") |  | ||||||
|     set(Blue        "") |  | ||||||
|     set(Magenta     "") |  | ||||||
|     set(Cyan        "") |  | ||||||
|     set(White       "") |  | ||||||
|     set(BoldRed     "") |  | ||||||
|     set(BoldGreen   "") |  | ||||||
|     set(BoldYellow  "") |  | ||||||
|     set(BoldBlue    "") |  | ||||||
|     set(BoldMagenta "") |  | ||||||
|     set(BoldCyan    "") |  | ||||||
|     set(BoldWhite   "") |  | ||||||
| else() |  | ||||||
|     string(ASCII 27 Esc) |  | ||||||
|     set(ColourReset "${Esc}[m") |  | ||||||
|     set(ColourBold  "${Esc}[1m") |  | ||||||
|     set(Red         "${Esc}[31m") |  | ||||||
|     set(Green       "${Esc}[32m") |  | ||||||
|     set(Yellow      "${Esc}[33m") |  | ||||||
|     set(Blue        "${Esc}[34m") |  | ||||||
|     set(Magenta     "${Esc}[35m") |  | ||||||
|     set(Cyan        "${Esc}[36m") |  | ||||||
|     set(White       "${Esc}[37m") |  | ||||||
|     set(BoldRed     "${Esc}[1;31m") |  | ||||||
|     set(BoldGreen   "${Esc}[1;32m") |  | ||||||
|     set(BoldYellow  "${Esc}[1;33m") |  | ||||||
|     set(BoldBlue    "${Esc}[1;34m") |  | ||||||
|     set(BoldMagenta "${Esc}[1;35m") |  | ||||||
|     set(BoldCyan    "${Esc}[1;36m") |  | ||||||
|     set(BoldWhite   "${Esc}[1;37m") |  | ||||||
| endif() |  | ||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Adds C++ support. | # Adds C++ support. | ||||||
| @@ -25,20 +22,21 @@ | |||||||
| #   docopt: | #   docopt: | ||||||
| #     - "--cxx=<CXX> C++ compiler [default: g++]." | #     - "--cxx=<CXX> C++ compiler [default: g++]." | ||||||
| #     - "--extra-cxx-flags=<EXTRA_CXXFLAGS> Extra C++ compiler flags [default: '']." | #     - "--extra-cxx-flags=<EXTRA_CXXFLAGS> Extra C++ compiler flags [default: '']." | ||||||
| #   define: "'-DCMAKE_CXX_COMPILER={0} -DEXTRA_CXXFLAGS=\"{1}\"'.format(arguments['--cxx'], arguments['--extra-cxx-flags'])" | #   export: "'CXX={0}'.format(arguments['--cxx'])" | ||||||
|  | #   define: "'-DEXTRA_CXXFLAGS=\"{0}\"'.format(arguments['--extra-cxx-flags'])" | ||||||
|  |  | ||||||
| if(NOT DEFINED CMAKE_CXX_COMPILER_ID) | enable_language(CXX) | ||||||
|     message(FATAL_ERROR "CMAKE_CXX_COMPILER_ID variable is not defined!") |  | ||||||
|  | if(NOT DEFINED CMAKE_C_COMPILER_ID) | ||||||
|  |     message(FATAL_ERROR "CMAKE_C_COMPILER_ID variable is not defined!") | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(NOT CMAKE_CXX_COMPILER_WORKS) | if(NOT CMAKE_C_COMPILER_WORKS) | ||||||
|     message(FATAL_ERROR "CMAKE_CXX_COMPILER_WORKS is false!") |     message(FATAL_ERROR "CMAKE_C_COMPILER_WORKS is false!") | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(DEFINED EXTRA_CXXFLAGS) | if(DEFINED EXTRA_CXXFLAGS) | ||||||
|   if(NOT EXTRA_CXXFLAGS STREQUAL "") |  | ||||||
|     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}") |     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}") | ||||||
|   endif() |  | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(DEFINED ENV{CXXFLAGS}) | if(DEFINED ENV{CXXFLAGS}) | ||||||
|   | |||||||
| @@ -1,19 +1,12 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Sets binary and library output directories to ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR} | # Sets binary and library output directories to ${PROJECT_BINARY_DIR}/bin | ||||||
| # and ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}, respectively. | # and ${PROJECT_BINARY_DIR}/lib, respectively. | ||||||
| # | # | ||||||
| # Variables modified:: | # Variables modified:: | ||||||
| # | # | ||||||
| #   CMAKE_ARCHIVE_OUTPUT_DIRECTORY |  | ||||||
| #   CMAKE_LIBRARY_OUTPUT_DIRECTORY |  | ||||||
| #   CMAKE_RUNTIME_OUTPUT_DIRECTORY | #   CMAKE_RUNTIME_OUTPUT_DIRECTORY | ||||||
|  | #   CMAKE_LIBRARY_OUTPUT_DIRECTORY | ||||||
|  |  | ||||||
| include(GNUInstallDirs) | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) | ||||||
|  | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) | ||||||
| set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) |  | ||||||
| set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) |  | ||||||
| set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) |  | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Add preprocessor definitions (example: --add-definitions="-DTHIS -DTHAT=137"). | # Add preprocessor definitions (example: --add-definitions="-DTHIS -DTHAT=137"). | ||||||
|   | |||||||
| @@ -1,26 +0,0 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: |  | ||||||
| # |  | ||||||
| # Generates export header for your API using best practices. |  | ||||||
| # This module wraps https://cmake.org/cmake/help/v3.0/module/GenerateExportHeader.html and |  | ||||||
| # it is needed because of these, Very Good Indeed, reasons: https://gcc.gnu.org/wiki/Visibility. |  | ||||||
| # If you are not afraid of jargon, please also have a look at https://www.akkadia.org/drepper/dsohowto.pdf. |  | ||||||
| # |  | ||||||
| # Variables used:: |  | ||||||
| # |  | ||||||
| #   PROJECT_NAME (defined by project()) |  | ||||||
|  |  | ||||||
| include(GenerateExportHeader) |  | ||||||
|  |  | ||||||
| generate_export_header(${PROJECT_NAME} |  | ||||||
|     BASE_NAME "${PROJECT_NAME}" |  | ||||||
|     EXPORT_MACRO_NAME "${PROJECT_NAME}_EXPORT" |  | ||||||
|     EXPORT_FILE_NAME "include/${PROJECT_NAME}_export.h" |  | ||||||
|     DEPRECATED_MACRO_NAME "${PROJECT_NAME}_DEPRECATED" |  | ||||||
|     NO_EXPORT_MACRO_NAME "${PROJECT_NAME}_NO_EXPORT" |  | ||||||
|     STATIC_DEFINE "${PROJECT_NAME}_STATIC_DEFINE" |  | ||||||
|     NO_DEPRECATED_MACRO_NAME "${PROJECT_NAME}_NO_DEPRECATED" |  | ||||||
|     DEFINE_NO_DEPRECATED |  | ||||||
|     ) |  | ||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Adds Fortran support. | # Adds Fortran support. | ||||||
| @@ -29,7 +26,10 @@ | |||||||
| #   docopt: | #   docopt: | ||||||
| #     - "--fc=<FC> Fortran compiler [default: gfortran]." | #     - "--fc=<FC> Fortran compiler [default: gfortran]." | ||||||
| #     - "--extra-fc-flags=<EXTRA_FCFLAGS> Extra Fortran compiler flags [default: '']." | #     - "--extra-fc-flags=<EXTRA_FCFLAGS> Extra Fortran compiler flags [default: '']." | ||||||
| #   define: "'-DCMAKE_Fortran_COMPILER={0} -DEXTRA_FCFLAGS=\"{1}\"'.format(arguments['--fc'], arguments['--extra-fc-flags'])" | #   export: "'FC={0}'.format(arguments['--fc'])" | ||||||
|  | #   define: "'-DEXTRA_FCFLAGS=\"{0}\"'.format(arguments['--extra-fc-flags'])" | ||||||
|  |  | ||||||
|  | enable_language(Fortran) | ||||||
|  |  | ||||||
| set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/modules) | set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/modules) | ||||||
| include_directories(${PROJECT_BINARY_DIR}/modules) | include_directories(${PROJECT_BINARY_DIR}/modules) | ||||||
| @@ -43,9 +43,7 @@ if(NOT CMAKE_Fortran_COMPILER_WORKS) | |||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(DEFINED EXTRA_FCFLAGS) | if(DEFINED EXTRA_FCFLAGS) | ||||||
|   if(NOT EXTRA_FCFLAGS STREQUAL "") |  | ||||||
|     set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${EXTRA_FCFLAGS}") |     set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${EXTRA_FCFLAGS}") | ||||||
|   endif() |  | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(DEFINED ENV{FCFLAGS}) | if(DEFINED ENV{FCFLAGS}) | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Adds optional Fortran support. | # Adds optional Fortran support. | ||||||
| @@ -35,8 +32,9 @@ | |||||||
| #     - "--fc=<FC> Fortran compiler [default: gfortran]." | #     - "--fc=<FC> Fortran compiler [default: gfortran]." | ||||||
| #     - "--extra-fc-flags=<EXTRA_FCFLAGS> Extra Fortran compiler flags [default: '']." | #     - "--extra-fc-flags=<EXTRA_FCFLAGS> Extra Fortran compiler flags [default: '']." | ||||||
| #     - "--fc-support=<FC_SUPPORT> Toggle Fortran language support (ON/OFF) [default: ON]." | #     - "--fc-support=<FC_SUPPORT> Toggle Fortran language support (ON/OFF) [default: ON]." | ||||||
|  | #   export: "'FC={0}'.format(arguments['--fc'])" | ||||||
| #   define: | #   define: | ||||||
| #     - "'-DCMAKE_Fortran_COMPILER={0} -DEXTRA_FCFLAGS=\"{1}\"'.format(arguments['--fc'], arguments['--extra-fc-flags'])" | #     - "'-DEXTRA_FCFLAGS=\"{0}\"'.format(arguments['--extra-fc-flags'])" | ||||||
| #     - "'-DENABLE_FC_SUPPORT={0}'.format(arguments['--fc-support'])" | #     - "'-DENABLE_FC_SUPPORT={0}'.format(arguments['--fc-support'])" | ||||||
|  |  | ||||||
| option(ENABLE_FC_SUPPORT "Enable Fortran language support" ON) | option(ENABLE_FC_SUPPORT "Enable Fortran language support" ON) | ||||||
| @@ -56,10 +54,8 @@ if(ENABLE_FC_SUPPORT) | |||||||
|     endif() |     endif() | ||||||
|  |  | ||||||
|     if(DEFINED EXTRA_FCFLAGS) |     if(DEFINED EXTRA_FCFLAGS) | ||||||
|       if(NOT EXTRA_FCFLAGS STREQUAL "") |  | ||||||
|         set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${EXTRA_FCFLAGS}") |         set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${EXTRA_FCFLAGS}") | ||||||
|     endif() |     endif() | ||||||
|     endif() |  | ||||||
|  |  | ||||||
|     if(DEFINED ENV{FCFLAGS}) |     if(DEFINED ENV{FCFLAGS}) | ||||||
|         message(STATUS "FCFLAGS is set to '$ENV{FCFLAGS}'.") |         message(STATUS "FCFLAGS is set to '$ENV{FCFLAGS}'.") | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| include(CheckIncludeFile) | include(CheckIncludeFile) | ||||||
|  |  | ||||||
| function(_find_include_dir _names _hints _result) | function(_find_include_dir _names _hints _result) | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| include(CheckFunctionExists) | include(CheckFunctionExists) | ||||||
|  |  | ||||||
| function(_find_library _names _check_function _result) | function(_find_library _names _check_function _result) | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Creates git_info.h in the build directory. | # Creates git_info.h in the build directory. | ||||||
| @@ -10,65 +7,22 @@ | |||||||
| # | # | ||||||
| # autocmake.yml configuration:: | # autocmake.yml configuration:: | ||||||
| # | # | ||||||
| #   url_root: https://github.com/dev-cafe/autocmake/raw/master/ | #   url_root: https://github.com/coderefinery/autocmake/raw/master/ | ||||||
| #   fetch: | #   fetch: | ||||||
|  | #     - "%(url_root)modules/git_info/git_info_sub.cmake" | ||||||
| #     - "%(url_root)modules/git_info/git_info.h.in" | #     - "%(url_root)modules/git_info/git_info.h.in" | ||||||
|  |  | ||||||
| get_filename_component(_current_dir ${CMAKE_CURRENT_LIST_FILE} PATH) | # CMAKE_CURRENT_LIST_DIR is undefined in CMake 2.8.2 | ||||||
|  | # see https://public.kitware.com/Bug/print_bug_page.php?bug_id=11675 | ||||||
| function(generate_git_info_header _header_location _header_name) | # workaround: create CMAKE_CURRENT_LIST_DIR  | ||||||
|   # _header_location: where the Git info header file should be generated | get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) | ||||||
|   # _header_name: the Git info header name, complete with extension (.h, .hpp, .hxx or whatever) | add_custom_command( | ||||||
|   find_package(Git) |     OUTPUT ${PROJECT_BINARY_DIR}/git_info.h | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -D_target_dir=${PROJECT_BINARY_DIR} -P git_info_sub.cmake | ||||||
|   set(_git_last_commit_hash "unknown") |     WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} | ||||||
|   set(_git_last_commit_author "unknown") |  | ||||||
|   set(_git_last_commit_date "unknown") |  | ||||||
|   set(_git_branch "unknown") |  | ||||||
|  |  | ||||||
|   if(GIT_FOUND) |  | ||||||
|     execute_process( |  | ||||||
|       COMMAND ${GIT_EXECUTABLE} --no-pager show -s --pretty=format:%h -n 1 |  | ||||||
|       OUTPUT_VARIABLE _git_last_commit_hash |  | ||||||
|       OUTPUT_STRIP_TRAILING_WHITESPACE |  | ||||||
|       ERROR_QUIET |  | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|     execute_process( | add_custom_target( | ||||||
|       COMMAND ${GIT_EXECUTABLE} --no-pager show -s --pretty=format:%aN -n 1 |  | ||||||
|       OUTPUT_VARIABLE _git_last_commit_author |  | ||||||
|       OUTPUT_STRIP_TRAILING_WHITESPACE |  | ||||||
|       ERROR_QUIET |  | ||||||
|       ) |  | ||||||
|  |  | ||||||
|     execute_process( |  | ||||||
|       COMMAND ${GIT_EXECUTABLE} --no-pager show -s --pretty=format:%ad -n 1 |  | ||||||
|       OUTPUT_VARIABLE _git_last_commit_date |  | ||||||
|       OUTPUT_STRIP_TRAILING_WHITESPACE |  | ||||||
|       ERROR_QUIET |  | ||||||
|       ) |  | ||||||
|  |  | ||||||
|     execute_process( |  | ||||||
|       COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD |  | ||||||
|       OUTPUT_VARIABLE _git_branch |  | ||||||
|       OUTPUT_STRIP_TRAILING_WHITESPACE |  | ||||||
|       ERROR_QUIET |  | ||||||
|       ) |  | ||||||
|   endif() |  | ||||||
|  |  | ||||||
|   configure_file( |  | ||||||
|     ${_current_dir}/git_info.h.in |  | ||||||
|     ${_header_location}/${_header_name} |  | ||||||
|     @ONLY |  | ||||||
|     ) |  | ||||||
|  |  | ||||||
|   unset(_git_last_commit_hash) |  | ||||||
|   unset(_git_last_commit_author) |  | ||||||
|   unset(_git_last_commit_date) |  | ||||||
|   unset(_git_branch) |  | ||||||
|  |  | ||||||
|   add_custom_target( |  | ||||||
|     git_info |     git_info | ||||||
|     ALL DEPENDS ${_header_location}/${_header_name} |     ALL DEPENDS ${PROJECT_BINARY_DIR}/git_info.h | ||||||
|     ) |     ) | ||||||
| endfunction() |  | ||||||
|   | |||||||
							
								
								
									
										64
									
								
								modules/git_info/git_info_sub.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								modules/git_info/git_info_sub.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,64 @@ | |||||||
|  | #.rst: | ||||||
|  | # | ||||||
|  | # Creates git_info.h in the build directory. | ||||||
|  | # This file can be included in sources to print | ||||||
|  | # Git status information to the program output | ||||||
|  | # for reproducibility reasons. | ||||||
|  |  | ||||||
|  | find_package(Git) | ||||||
|  |  | ||||||
|  | set(_git_last_commit_hash "unknown") | ||||||
|  | set(_git_last_commit_author "unknown") | ||||||
|  | set(_git_last_commit_date "unknown") | ||||||
|  | set(_git_branch "unknown") | ||||||
|  |  | ||||||
|  | if(GIT_FOUND) | ||||||
|  |     execute_process( | ||||||
|  |         COMMAND ${GIT_EXECUTABLE} rev-list --max-count=1 --abbrev-commit HEAD | ||||||
|  |         OUTPUT_VARIABLE _git_last_commit_hash | ||||||
|  |         ERROR_QUIET | ||||||
|  |         ) | ||||||
|  |  | ||||||
|  |     if(_git_last_commit_hash) | ||||||
|  |         string(STRIP ${_git_last_commit_hash} _git_last_commit_hash) | ||||||
|  |     endif() | ||||||
|  |  | ||||||
|  |     execute_process( | ||||||
|  |         COMMAND ${GIT_EXECUTABLE} log --max-count=1 HEAD | ||||||
|  |         OUTPUT_VARIABLE _git_last_commit | ||||||
|  |         ERROR_QUIET | ||||||
|  |         ) | ||||||
|  |  | ||||||
|  |     if(_git_last_commit) | ||||||
|  | 	string(REGEX MATCH "Author: +([^<]*) <" temp "${_git_last_commit}") | ||||||
|  |         set(_git_last_commit_author ${CMAKE_MATCH_1}) | ||||||
|  |         string(STRIP ${_git_last_commit_author} _git_last_commit_author) | ||||||
|  |         string(REGEX MATCH "Date: +(.+[0-9][0-9][0-9][0-9] [+-][0-9][0-9][0-9][0-9])" temp "${_git_last_commit}") | ||||||
|  |         set(_git_last_commit_date ${CMAKE_MATCH_1}) | ||||||
|  |     endif() | ||||||
|  |  | ||||||
|  |     execute_process( | ||||||
|  |         COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD | ||||||
|  |         OUTPUT_VARIABLE _git_branch | ||||||
|  |         ERROR_QUIET | ||||||
|  |         ) | ||||||
|  |  | ||||||
|  |     if(_git_branch) | ||||||
|  |         string(STRIP ${_git_branch} _git_branch) | ||||||
|  |     endif() | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | # CMAKE_CURRENT_LIST_DIR is undefined in CMake 2.8.2 | ||||||
|  | # see https://public.kitware.com/Bug/print_bug_page.php?bug_id=11675 | ||||||
|  | # workaround: create CMAKE_CURRENT_LIST_DIR | ||||||
|  | get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) | ||||||
|  | configure_file( | ||||||
|  |     ${CMAKE_CURRENT_LIST_DIR}/git_info.h.in | ||||||
|  |     ${_target_dir}/git_info.h | ||||||
|  |     @ONLY | ||||||
|  |     ) | ||||||
|  |  | ||||||
|  | unset(_git_last_commit_hash) | ||||||
|  | unset(_git_last_commit_author) | ||||||
|  | unset(_git_last_commit_date) | ||||||
|  | unset(_git_branch) | ||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Includes Google Test sources and adds a library "googletest". | # Includes Google Test sources and adds a library "googletest". | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Enables 64-bit integer support for Fortran projects. | # Enables 64-bit integer support for Fortran projects. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Find and link to ACCELERATE. | # Find and link to ACCELERATE. | ||||||
| @@ -13,7 +10,7 @@ | |||||||
| # | # | ||||||
| # autocmake.yml configuration:: | # autocmake.yml configuration:: | ||||||
| # | # | ||||||
| #   url_root: https://github.com/dev-cafe/autocmake/raw/master/ | #   url_root: https://github.com/coderefinery/autocmake/raw/master/ | ||||||
| #   docopt: "--accelerate Find and link to ACCELERATE [default: False]." | #   docopt: "--accelerate Find and link to ACCELERATE [default: False]." | ||||||
| #   define: "'-DENABLE_ACCELERATE={0}'.format(arguments['--accelerate'])" | #   define: "'-DENABLE_ACCELERATE={0}'.format(arguments['--accelerate'])" | ||||||
| #   fetch: | #   fetch: | ||||||
| @@ -23,8 +20,8 @@ | |||||||
| option(ENABLE_ACCELERATE "Find and link to ACCELERATE" OFF) | option(ENABLE_ACCELERATE "Find and link to ACCELERATE" OFF) | ||||||
|  |  | ||||||
| if(ENABLE_ACCELERATE) | if(ENABLE_ACCELERATE) | ||||||
|     include(${CMAKE_CURRENT_LIST_DIR}/../find/find_libraries.cmake) |     include(find_libraries) | ||||||
|     include(${CMAKE_CURRENT_LIST_DIR}/../find/find_include_files.cmake) |     include(find_include_files) | ||||||
|  |  | ||||||
|     set(ACCELERATE_FOUND FALSE) |     set(ACCELERATE_FOUND FALSE) | ||||||
|     set(ACCELERATE_LIBRARIES "NOTFOUND") |     set(ACCELERATE_LIBRARIES "NOTFOUND") | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Find and link to ACML. | # Find and link to ACML. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Find and link to ATLAS. | # Find and link to ATLAS. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Find and link to BLAS. | # Find and link to BLAS. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Find and link to CBLAS. | # Find and link to CBLAS. | ||||||
| @@ -13,7 +10,7 @@ | |||||||
| # | # | ||||||
| # autocmake.yml configuration:: | # autocmake.yml configuration:: | ||||||
| # | # | ||||||
| #   url_root: https://github.com/dev-cafe/autocmake/raw/master/ | #   url_root: https://github.com/coderefinery/autocmake/raw/master/ | ||||||
| #   docopt: "--cblas Find and link to CBLAS [default: False]." | #   docopt: "--cblas Find and link to CBLAS [default: False]." | ||||||
| #   define: "'-DENABLE_CBLAS={0}'.format(arguments['--cblas'])" | #   define: "'-DENABLE_CBLAS={0}'.format(arguments['--cblas'])" | ||||||
| #   fetch: | #   fetch: | ||||||
| @@ -23,8 +20,8 @@ | |||||||
| option(ENABLE_CBLAS "Find and link to CBLAS" OFF) | option(ENABLE_CBLAS "Find and link to CBLAS" OFF) | ||||||
|  |  | ||||||
| if(ENABLE_CBLAS) | if(ENABLE_CBLAS) | ||||||
|     include(${CMAKE_CURRENT_LIST_DIR}/../find/find_libraries.cmake) |     include(find_libraries) | ||||||
|     include(${CMAKE_CURRENT_LIST_DIR}/../find/find_include_files.cmake) |     include(find_include_files) | ||||||
|  |  | ||||||
|     set(CBLAS_FOUND FALSE) |     set(CBLAS_FOUND FALSE) | ||||||
|     set(CBLAS_LIBRARIES "NOTFOUND") |     set(CBLAS_LIBRARIES "NOTFOUND") | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Find and link to Goto BLAS. | # Find and link to Goto BLAS. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Find and link to LAPACK. | # Find and link to LAPACK. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Find and link to LAPACKE. | # Find and link to LAPACKE. | ||||||
| @@ -13,7 +10,7 @@ | |||||||
| # | # | ||||||
| # autocmake.yml configuration:: | # autocmake.yml configuration:: | ||||||
| # | # | ||||||
| #   url_root: https://github.com/dev-cafe/autocmake/raw/master/ | #   url_root: https://github.com/coderefinery/autocmake/raw/master/ | ||||||
| #   docopt: "--lapacke Find and link to LAPACKE [default: False]." | #   docopt: "--lapacke Find and link to LAPACKE [default: False]." | ||||||
| #   define: "'-DENABLE_LAPACKE={0}'.format(arguments['--lapacke'])" | #   define: "'-DENABLE_LAPACKE={0}'.format(arguments['--lapacke'])" | ||||||
| #   fetch: | #   fetch: | ||||||
| @@ -23,8 +20,8 @@ | |||||||
| option(ENABLE_LAPACKE "Find and link to LAPACKE" OFF) | option(ENABLE_LAPACKE "Find and link to LAPACKE" OFF) | ||||||
|  |  | ||||||
| if(ENABLE_LAPACKE) | if(ENABLE_LAPACKE) | ||||||
|     include(${CMAKE_CURRENT_LIST_DIR}/find_libraries.cmake) |     include(find_libraries) | ||||||
|     include(${CMAKE_CURRENT_LIST_DIR}/find_include_files.cmake) |     include(find_include_files) | ||||||
|  |  | ||||||
|     set(LAPACKE_FOUND FALSE) |     set(LAPACKE_FOUND FALSE) | ||||||
|     set(LAPACKE_LIBRARIES "NOTFOUND") |     set(LAPACKE_LIBRARIES "NOTFOUND") | ||||||
|   | |||||||
							
								
								
									
										124
									
								
								modules/math/openblas.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								modules/math/openblas.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,124 @@ | |||||||
|  | # this file is adapted from https://github.com/BVLC/caffe/blob/master/cmake/Modules/FindOpenBLAS.cmake | ||||||
|  | # and reused by providing the corresponding copyright notice: | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # COPYRIGHT | ||||||
|  | # | ||||||
|  | # All contributions by the University of California: | ||||||
|  | # Copyright (c) 2014, 2015, The Regents of the University of California (Regents) | ||||||
|  | # All rights reserved. | ||||||
|  | # | ||||||
|  | # All other contributions: | ||||||
|  | # Copyright (c) 2014, 2015, the respective contributors | ||||||
|  | # All rights reserved. | ||||||
|  | # | ||||||
|  | # Caffe uses a shared copyright model: each contributor holds copyright over | ||||||
|  | # their contributions to Caffe. The project versioning records all such | ||||||
|  | # contribution and copyright details. If a contributor wants to further mark | ||||||
|  | # their specific copyright on a particular contribution, they should indicate | ||||||
|  | # their copyright solely in the commit message of the change when it is | ||||||
|  | # committed. | ||||||
|  | # | ||||||
|  | # LICENSE | ||||||
|  | # | ||||||
|  | # Redistribution and use in source and binary forms, with or without | ||||||
|  | # modification, are permitted provided that the following conditions are met: | ||||||
|  | # | ||||||
|  | # 1. Redistributions of source code must retain the above copyright notice, this | ||||||
|  | #    list of conditions and the following disclaimer. | ||||||
|  | # 2. Redistributions in binary form must reproduce the above copyright notice, | ||||||
|  | #    this list of conditions and the following disclaimer in the documentation | ||||||
|  | #    and/or other materials provided with the distribution. | ||||||
|  | # | ||||||
|  | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||||||
|  | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||||
|  | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||||
|  | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||||||
|  | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||||||
|  | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||||||
|  | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||||||
|  | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||||
|  | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||||
|  | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||
|  | # | ||||||
|  | # | ||||||
|  | #.rst: | ||||||
|  | # | ||||||
|  | # Find and link to OpenBLAS. | ||||||
|  | # | ||||||
|  | # Variables defined:: | ||||||
|  | # | ||||||
|  | #   OpenBLAS_FOUND | ||||||
|  | #   OpenBLAS_LIB | ||||||
|  | #   OpenBLAS_INCLUDE_DIR | ||||||
|  | # | ||||||
|  | # autocmake.yml configuration:: | ||||||
|  | # | ||||||
|  | #   docopt: "--openblas Find and link to OpenBLAS [default: False]." | ||||||
|  | #   define: "'-DENABLE_OPENBLAS={0}'.format(arguments['--openblas'])" | ||||||
|  |  | ||||||
|  | option(ENABLE_OPENBLAS "Find and link to OpenBLAS" OFF) | ||||||
|  |  | ||||||
|  | if (ENABLE_OPENBLAS) | ||||||
|  | SET(Open_BLAS_INCLUDE_SEARCH_PATHS | ||||||
|  |   /usr/include | ||||||
|  |   /usr/include/openblas | ||||||
|  |   /usr/include/openblas-base | ||||||
|  |   /usr/local/include | ||||||
|  |   /usr/local/include/openblas | ||||||
|  |   /usr/local/include/openblas-base | ||||||
|  |   /opt/OpenBLAS/include | ||||||
|  |   $ENV{OpenBLAS_HOME} | ||||||
|  |   $ENV{OpenBLAS_HOME}/include | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | SET(Open_BLAS_LIB_SEARCH_PATHS | ||||||
|  |         /lib/ | ||||||
|  |         /lib/openblas-base | ||||||
|  |         /lib64/ | ||||||
|  |         /usr/lib | ||||||
|  |         /usr/lib/openblas-base | ||||||
|  |         /usr/lib64 | ||||||
|  |         /usr/local/lib | ||||||
|  |         /usr/local/lib64 | ||||||
|  |         /opt/OpenBLAS/lib | ||||||
|  |         $ENV{OpenBLAS}cd | ||||||
|  |         $ENV{OpenBLAS}/lib | ||||||
|  |         $ENV{OpenBLAS_HOME} | ||||||
|  |         $ENV{OpenBLAS_HOME}/lib | ||||||
|  |  ) | ||||||
|  |  | ||||||
|  | FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS}) | ||||||
|  | FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS}) | ||||||
|  |  | ||||||
|  | SET(OpenBLAS_FOUND ON) | ||||||
|  |  | ||||||
|  | #    Check include files | ||||||
|  | IF(NOT OpenBLAS_INCLUDE_DIR) | ||||||
|  |     SET(OpenBLAS_FOUND OFF) | ||||||
|  |     MESSAGE(STATUS "Could not find OpenBLAS include. Turning OpenBLAS_FOUND off") | ||||||
|  | ENDIF() | ||||||
|  |  | ||||||
|  | #    Check libraries | ||||||
|  | IF(NOT OpenBLAS_LIB) | ||||||
|  |     SET(OpenBLAS_FOUND OFF) | ||||||
|  |     MESSAGE(STATUS "Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off") | ||||||
|  | ENDIF() | ||||||
|  |  | ||||||
|  | IF (OpenBLAS_FOUND) | ||||||
|  |   IF (NOT OpenBLAS_FIND_QUIETLY) | ||||||
|  |     MESSAGE(STATUS "Found OpenBLAS libraries: ${OpenBLAS_LIB}") | ||||||
|  |     MESSAGE(STATUS "Found OpenBLAS include: ${OpenBLAS_INCLUDE_DIR}") | ||||||
|  |   ENDIF (NOT OpenBLAS_FIND_QUIETLY) | ||||||
|  | ELSE (OpenBLAS_FOUND) | ||||||
|  |   IF (OpenBLAS_FIND_REQUIRED) | ||||||
|  |     MESSAGE(FATAL_ERROR "Could not find OpenBLAS") | ||||||
|  |   ENDIF (OpenBLAS_FIND_REQUIRED) | ||||||
|  | ENDIF (OpenBLAS_FOUND) | ||||||
|  |  | ||||||
|  | MARK_AS_ADVANCED( | ||||||
|  |     OpenBLAS_INCLUDE_DIR | ||||||
|  |     OpenBLAS_LIB | ||||||
|  |     OpenBLAS | ||||||
|  | ) | ||||||
|  | endif() | ||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Detects and links to BLAS and LAPACK libraries. | # Detects and links to BLAS and LAPACK libraries. | ||||||
| @@ -46,8 +43,6 @@ | |||||||
| #     - "--blas=<BLAS> Detect and link BLAS library (auto or off) [default: auto]." | #     - "--blas=<BLAS> Detect and link BLAS library (auto or off) [default: auto]." | ||||||
| #     - "--lapack=<LAPACK> Detect and link LAPACK library (auto or off) [default: auto]." | #     - "--lapack=<LAPACK> Detect and link LAPACK library (auto or off) [default: auto]." | ||||||
| #     - "--mkl=<MKL> Pass MKL flag to the Intel compiler and linker and skip BLAS/LAPACK detection (sequential, parallel, cluster, or off) [default: off]." | #     - "--mkl=<MKL> Pass MKL flag to the Intel compiler and linker and skip BLAS/LAPACK detection (sequential, parallel, cluster, or off) [default: off]." | ||||||
| #     - "--scalapack=<SCALAPACK_LIBRARIES> Link line for ScaLAPACK libraries [default: ]" |  | ||||||
| #     - "--blacs=<BLACS_IMPLEMENTATION> Implementation of BLACS for MKL ScaLAPACK (openmpi, intelmpi, sgimpt) [default: openmpi]" |  | ||||||
| #   define: | #   define: | ||||||
| #     - "'-DENABLE_BLAS={0}'.format(arguments['--blas'])" | #     - "'-DENABLE_BLAS={0}'.format(arguments['--blas'])" | ||||||
| #     - "'-DENABLE_LAPACK={0}'.format(arguments['--lapack'])" | #     - "'-DENABLE_LAPACK={0}'.format(arguments['--lapack'])" | ||||||
| @@ -55,51 +50,8 @@ | |||||||
| #     - "'-DMATH_LIB_SEARCH_ORDER=\"MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE\"'" | #     - "'-DMATH_LIB_SEARCH_ORDER=\"MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE\"'" | ||||||
| #     - "'-DBLAS_LANG=Fortran'" | #     - "'-DBLAS_LANG=Fortran'" | ||||||
| #     - "'-DLAPACK_LANG=Fortran'" | #     - "'-DLAPACK_LANG=Fortran'" | ||||||
| #     - "'-DSCALAPACK_LIBRARIES=\"{0}\"'.format(arguments['--scalapack'])" |  | ||||||
| #     - "'-DBLACS_IMPLEMENTATION=\"{0}\"'.format(arguments['--blacs'])" |  | ||||||
| #   warning: "the math_libs.cmake module is deprecated and will be removed in future versions" | #   warning: "the math_libs.cmake module is deprecated and will be removed in future versions" | ||||||
|  |  | ||||||
| option_with_default( |  | ||||||
|   NAME ENABLE_BLAS |  | ||||||
|   MESSAGE "Enable BLAS autodetection" |  | ||||||
|   DEFAULT "auto" |  | ||||||
|   ) |  | ||||||
| option_with_default( |  | ||||||
|   NAME ENABLE_LAPACK |  | ||||||
|   MESSAGE "Enable LAPACK autodetection" |  | ||||||
|   DEFAULT "auto" |  | ||||||
|   ) |  | ||||||
| option_with_default( |  | ||||||
|   NAME MKL_FLAG |  | ||||||
|   MESSAGE "MKL flag for the Intel compiler and linker. Skips BLAS/LAPACK autodetection" |  | ||||||
|   DEFAULT "off" |  | ||||||
|   ) |  | ||||||
| option_with_default( |  | ||||||
|   NAME MATH_LIB_SEARCH_ORDER |  | ||||||
|   MESSAGE "Search order for autodetection of math libraries" |  | ||||||
|   DEFAULT "MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE" |  | ||||||
|   ) |  | ||||||
| option_with_default( |  | ||||||
|   NAME BLAS_LANG |  | ||||||
|   MESSAGE "Linker language for BLAS detection" |  | ||||||
|   DEFAULT "Fortran" |  | ||||||
|   ) |  | ||||||
| option_with_default( |  | ||||||
|   NAME LAPACK_LANG |  | ||||||
|   MESSAGE "Linker language for LAPACK detection" |  | ||||||
|   DEFAULT "Fortran" |  | ||||||
|   ) |  | ||||||
| option_with_default( |  | ||||||
|   NAME SCALAPACK_LIBRARIES |  | ||||||
|   MESSAGE "Link line for ScaLAPACK libraries" |  | ||||||
|   DEFAULT "" |  | ||||||
|   ) |  | ||||||
| option_with_default( |  | ||||||
|   NAME BLACS_IMPLEMENTATION |  | ||||||
|   MESSAGE "Implementation of BLACS for MKL ScaLAPACK" |  | ||||||
|   DEFAULT "openmpi" |  | ||||||
|   ) |  | ||||||
|  |  | ||||||
| #------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||||||
| # ENABLE_STATIC_LINKING | # ENABLE_STATIC_LINKING | ||||||
|  |  | ||||||
| @@ -242,7 +194,7 @@ if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") | |||||||
|     endif() |     endif() | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(ENABLE_SCALAPACK AND NOT SCALAPACK_LIBRARIES) | if(ENABLE_SCALAPACK) | ||||||
|     set(_scalapack_lib      mkl_scalapack${_lib_suffix}) |     set(_scalapack_lib      mkl_scalapack${_lib_suffix}) | ||||||
|     if(${BLACS_IMPLEMENTATION} STREQUAL "intelmpi") |     if(${BLACS_IMPLEMENTATION} STREQUAL "intelmpi") | ||||||
|         set(_blacs_lib mkl_blacs_intelmpi${_lib_suffix}) |         set(_blacs_lib mkl_blacs_intelmpi${_lib_suffix}) | ||||||
| @@ -256,7 +208,6 @@ if(ENABLE_SCALAPACK AND NOT SCALAPACK_LIBRARIES) | |||||||
| else() | else() | ||||||
|     set(_scalapack_lib) |     set(_scalapack_lib) | ||||||
|     set(_blacs_lib) |     set(_blacs_lib) | ||||||
|     set(BLACS_IMPLEMENTATION) |  | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| # MKL 10.0.1.014 | # MKL 10.0.1.014 | ||||||
| @@ -478,7 +429,7 @@ foreach(_service BLAS LAPACK) | |||||||
|     endif() |     endif() | ||||||
| endforeach() | endforeach() | ||||||
|  |  | ||||||
| if(MKL_FLAG AND NOT MKL_FLAG STREQUAL "off") | if(NOT MKL_FLAG STREQUAL "off") | ||||||
|     set(EXTERNAL_LIBS ${EXTERNAL_LIBS} -mkl=${MKL_FLAG}) |     set(EXTERNAL_LIBS ${EXTERNAL_LIBS} -mkl=${MKL_FLAG}) | ||||||
|     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mkl=${MKL_FLAG}") |     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mkl=${MKL_FLAG}") | ||||||
|     message(STATUS "User set explicit MKL flag which is passed to the compiler and linker: -mkl=${MKL_FLAG}") |     message(STATUS "User set explicit MKL flag which is passed to the compiler and linker: -mkl=${MKL_FLAG}") | ||||||
| @@ -541,21 +492,12 @@ foreach(_service BLAS LAPACK) | |||||||
| endforeach() | endforeach() | ||||||
|  |  | ||||||
| # first lapack, then blas as lapack might need blas routine | # first lapack, then blas as lapack might need blas routine | ||||||
| if(SCALAPACK_LIBRARIES) | set(MATH_LIBS | ||||||
|   list(APPEND MATH_LIBS |  | ||||||
|       ${MATH_LIBS} |  | ||||||
|       ${SCALAPACK_LIBRARIES} |  | ||||||
|       ${LAPACK_LIBRARIES} |  | ||||||
|       ${BLAS_LIBRARIES} |  | ||||||
|       ) |  | ||||||
| else() |  | ||||||
|   list(APPEND MATH_LIBS |  | ||||||
|     ${MATH_LIBS} |     ${MATH_LIBS} | ||||||
|     ${LAPACK_LIBRARIES} |     ${LAPACK_LIBRARIES} | ||||||
|     ${BLAS_LIBRARIES} |     ${BLAS_LIBRARIES} | ||||||
|  |     CACHE STRING "Math libraries" | ||||||
|     ) |     ) | ||||||
| endif() |  | ||||||
| set(MATH_LIBS ${MATH_LIBS} CACHE STRING "Math libraries") |  | ||||||
|  |  | ||||||
| # further adaptation for the static linking | # further adaptation for the static linking | ||||||
| if (ENABLE_STATIC_LINKING) | if (ENABLE_STATIC_LINKING) | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Enables MPI support. | # Enables MPI support. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Enables OpenMP support. | # Enables OpenMP support. | ||||||
| @@ -24,6 +21,25 @@ | |||||||
| option(ENABLE_OPENMP "Enable OpenMP parallelization" OFF) | option(ENABLE_OPENMP "Enable OpenMP parallelization" OFF) | ||||||
|  |  | ||||||
| if(ENABLE_OPENMP) | if(ENABLE_OPENMP) | ||||||
|  |     if(DEFINED CMAKE_Fortran_COMPILER_ID) | ||||||
|  |         # we do this in a pedestrian way because the Fortran support is relatively recent | ||||||
|  |         if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) | ||||||
|  |             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fopenmp") | ||||||
|  |         endif() | ||||||
|  |         if(CMAKE_Fortran_COMPILER_ID MATCHES Intel) | ||||||
|  |             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -openmp") | ||||||
|  |         endif() | ||||||
|  |         if(CMAKE_Fortran_COMPILER_ID MATCHES PGI) | ||||||
|  |             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mp") | ||||||
|  |         endif() | ||||||
|  |         if(CMAKE_Fortran_COMPILER_ID MATCHES XL) | ||||||
|  |             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qsmp") | ||||||
|  |         endif() | ||||||
|  |         if(CMAKE_Fortran_COMPILER_ID MATCHES Cray) | ||||||
|  |             # do nothing in this case | ||||||
|  |         endif() | ||||||
|  |         set(OPENMP_FOUND TRUE) | ||||||
|  |     endif() | ||||||
|  |  | ||||||
|     if(NOT OPENMP_FOUND) |     if(NOT OPENMP_FOUND) | ||||||
|         find_package(OpenMP) |         find_package(OpenMP) | ||||||
| @@ -37,35 +53,5 @@ if(ENABLE_OPENMP) | |||||||
|         if(DEFINED CMAKE_CXX_COMPILER_ID) |         if(DEFINED CMAKE_CXX_COMPILER_ID) | ||||||
|             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") |             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") | ||||||
|         endif() |         endif() | ||||||
|         if(DEFINED CMAKE_Fortran_COMPILER_ID) |  | ||||||
|             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}") |  | ||||||
|         endif() |  | ||||||
|     endif() |  | ||||||
|  |  | ||||||
|     # this is only needed for CMake below 3.5 |  | ||||||
|     if(DEFINED CMAKE_Fortran_COMPILER_ID AND NOT DEFINED OpenMP_Fortran_FLAGS) |  | ||||||
|         # we do this in a pedestrian way because the Fortran support is relatively recent |  | ||||||
|         if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) |  | ||||||
|             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fopenmp") |  | ||||||
|         endif() |  | ||||||
|         if(CMAKE_Fortran_COMPILER_ID MATCHES Intel) |  | ||||||
|             if(WIN32) |  | ||||||
|                 set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Qopenmp") |  | ||||||
|             elseif("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528") |  | ||||||
|                 set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -openmp") |  | ||||||
|             else() |  | ||||||
|                 set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qopenmp") |  | ||||||
|             endif() |  | ||||||
|         endif() |  | ||||||
|         if(CMAKE_Fortran_COMPILER_ID MATCHES PGI) |  | ||||||
|             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mp") |  | ||||||
|         endif() |  | ||||||
|         if(CMAKE_Fortran_COMPILER_ID MATCHES XL) |  | ||||||
|             set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qsmp=omp") |  | ||||||
|         endif() |  | ||||||
|         if(CMAKE_Fortran_COMPILER_ID MATCHES Cray) |  | ||||||
|             # do nothing in this case |  | ||||||
|         endif() |  | ||||||
|         set(OPENMP_FOUND TRUE) |  | ||||||
|     endif() |     endif() | ||||||
| endif() | endif() | ||||||
|   | |||||||
| @@ -1,33 +0,0 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: |  | ||||||
| # |  | ||||||
| # Enable profiling by appending corresponding compiler flags. |  | ||||||
| # |  | ||||||
| # Variables modified (provided the corresponding language is enabled):: |  | ||||||
| # |  | ||||||
| #   CMAKE_Fortran_FLAGS |  | ||||||
| #   CMAKE_C_FLAGS |  | ||||||
| #   CMAKE_CXX_FLAGS |  | ||||||
| # |  | ||||||
| # autocmake.yml configuration:: |  | ||||||
| # |  | ||||||
| #   docopt: "--profile Enable profiling [default: False]" |  | ||||||
| #   define: "'-DENABLE_PROFILING={0}'.format(arguments['--profile'])" |  | ||||||
|  |  | ||||||
| option(ENABLE_PROFILING "Enable profiling" OFF) |  | ||||||
|  |  | ||||||
| message(STATUS "Enable profiling: ${ENABLE_PROFILING}") |  | ||||||
|  |  | ||||||
| if(ENABLE_PROFILING) |  | ||||||
|     if(DEFINED CMAKE_Fortran_COMPILER_ID) |  | ||||||
|         set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -pg") |  | ||||||
|     endif() |  | ||||||
|     if(DEFINED CMAKE_C_COMPILER_ID) |  | ||||||
|         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pg") |  | ||||||
|     endif() |  | ||||||
|     if(DEFINED CMAKE_CXX_COMPILER_ID) |  | ||||||
|         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pg") |  | ||||||
|     endif() |  | ||||||
| endif() |  | ||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Detects Python interpreter. | # Detects Python interpreter. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Detects Python libraries and headers. | # Detects Python libraries and headers. | ||||||
| @@ -78,9 +75,12 @@ find_package_handle_standard_args(PythonLibs | |||||||
|     PYTHON_EXECUTABLE) |     PYTHON_EXECUTABLE) | ||||||
|  |  | ||||||
| if(NOT PYTHONLIBS_FOUND) | if(NOT PYTHONLIBS_FOUND) | ||||||
|     message(FATAL_ERROR "Could NOT find PythonLibs - did you install the python-dev package?") |     message(FATAL_ERROR "Could NOT find PythonLibs") | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| # Hook-up script variables to cache variables | # Hook-up script variables to cache variables | ||||||
| set(PYTHON_LIBRARIES ${PYTHON_LIBRARY}) | set(PYTHON_LIBRARIES ${PYTHON_LIBRARY}) | ||||||
| set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR}) | set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR}) | ||||||
|  |  | ||||||
|  | include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS}) | ||||||
|  | link_directories(${PYTHON_LIBRARIES}) | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Provides safeguards against in-source builds and bad build types. | # Provides safeguards against in-source builds and bad build types. | ||||||
| @@ -20,7 +17,6 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper) | |||||||
|  |  | ||||||
| if(NOT cmake_build_type_tolower STREQUAL "debug" AND | if(NOT cmake_build_type_tolower STREQUAL "debug" AND | ||||||
|    NOT cmake_build_type_tolower STREQUAL "release" AND |    NOT cmake_build_type_tolower STREQUAL "release" AND | ||||||
|    NOT cmake_build_type_tolower STREQUAL "minsizerel" AND |  | ||||||
|    NOT cmake_build_type_tolower STREQUAL "relwithdebinfo") |    NOT cmake_build_type_tolower STREQUAL "relwithdebinfo") | ||||||
|     message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo, and MinSizeRel (case-insensitive).") |     message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).") | ||||||
| endif() | endif() | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Take care of updating the cache for fresh configurations. | # Take care of updating the cache for fresh configurations. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Adds ${PROJECT_SOURCE_DIR}/src as subdirectory containing CMakeLists.txt. | # Adds ${PROJECT_SOURCE_DIR}/src as subdirectory containing CMakeLists.txt. | ||||||
|   | |||||||
| @@ -1,6 +1,3 @@ | |||||||
| # (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md |  | ||||||
| # licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE |  | ||||||
|  |  | ||||||
| #.rst: | #.rst: | ||||||
| # | # | ||||||
| # Determine program version from file "VERSION" (example: "14.1") | # Determine program version from file "VERSION" (example: "14.1") | ||||||
|   | |||||||
| @@ -1,3 +1,3 @@ | |||||||
| pycodestyle | pep8 | ||||||
| pytest | pytest | ||||||
| pyyaml | pyyaml | ||||||
|   | |||||||
							
								
								
									
										0
									
								
								test/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								test/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										14
									
								
								test/boost_header_only/cmake/autocmake.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/boost_header_only/cmake/autocmake.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | name: example | ||||||
|  | min_cmake_version: 2.8 | ||||||
|  | modules: | ||||||
|  | - cxx: | ||||||
|  |   - source: ../../../modules/cxx.cmake | ||||||
|  | - boost: | ||||||
|  |   - major: 1 | ||||||
|  |   - minor: 48 | ||||||
|  |   - patch: 0 | ||||||
|  |   - source: ../../../modules/boost/boost.cmake | ||||||
|  | - default_build_paths: | ||||||
|  |   - source: ../../../modules/default_build_paths.cmake | ||||||
|  | - src: | ||||||
|  |   - source: ../../../modules/src.cmake | ||||||
							
								
								
									
										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; | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								test/boost_libs/cmake/autocmake.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								test/boost_libs/cmake/autocmake.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | name: example | ||||||
|  | min_cmake_version: 2.8 | ||||||
|  | modules: | ||||||
|  | - cxx: | ||||||
|  |   - source: ../../../modules/cxx.cmake | ||||||
|  | - mpi: | ||||||
|  |   - source: ../../../modules/mpi.cmake | ||||||
|  | - python_interpreter: | ||||||
|  |   - source: ../../../modules/python_interpreter.cmake | ||||||
|  | - python_libs: | ||||||
|  |   - source: ../../../modules/python_libs.cmake | ||||||
|  | - boost: | ||||||
|  |   - major: 1 | ||||||
|  |   - minor: 59 | ||||||
|  |   - patch: 0 | ||||||
|  |   - components: 'mpi;serialization;python' | ||||||
|  |   - source: ../../../modules/boost/boost.cmake | ||||||
|  | - default_build_paths: | ||||||
|  |   - source: ../../../modules/default_build_paths.cmake | ||||||
|  | - src: | ||||||
|  |   - source: ../../../modules/src.cmake | ||||||
							
								
								
									
										8
									
								
								test/boost_libs/src/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								test/boost_libs/src/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | 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} | ||||||
|  |                               ${Boost_PYTHON_LIBRARY} ${PYTHON_LIBRARIES}) | ||||||
							
								
								
									
										45
									
								
								test/boost_libs/src/example.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								test/boost_libs/src/example.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | |||||||
|  | #include <iostream> | ||||||
|  |  | ||||||
|  | #include <boost/mpi/environment.hpp> | ||||||
|  | #include <boost/mpi/communicator.hpp> | ||||||
|  | #include <boost/python.hpp> | ||||||
|  | #include <boost/version.hpp> | ||||||
|  |  | ||||||
|  | int main() | ||||||
|  | { | ||||||
|  |     using namespace boost::python; | ||||||
|  |     namespace mpi = boost::mpi; | ||||||
|  |  | ||||||
|  |     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(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     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; | ||||||
|  | } | ||||||
| @@ -1,7 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: CXX |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - cxx: | - cxx: | ||||||
|   - source: ../../../modules/cxx.cmake |   - source: ../../../modules/cxx.cmake | ||||||
|   | |||||||
| @@ -1,9 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: |  | ||||||
| - CXX |  | ||||||
| - C |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - cxx: | - cxx: | ||||||
|   - source: ../../../modules/cxx.cmake |   - source: ../../../modules/cxx.cmake | ||||||
|   | |||||||
| @@ -1,9 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: |  | ||||||
|   - C |  | ||||||
|   - CXX |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - cxx: | - cxx: | ||||||
|   - source: ../../../modules/cxx.cmake |   - source: ../../../modules/cxx.cmake | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: CXX |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - cxx: | - cxx: | ||||||
|   - source: ../../../modules/cxx.cmake |   - source: ../../../modules/cxx.cmake | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: Fortran |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - fc: | - fc: | ||||||
|   - source: ../../../modules/fc.cmake |   - source: ../../../modules/fc.cmake | ||||||
|   | |||||||
| @@ -1,10 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: |  | ||||||
|   - Fortran |  | ||||||
|   - C |  | ||||||
|   - CXX |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - fc: | - fc: | ||||||
|   - source: ../../../modules/fc.cmake |   - source: ../../../modules/fc.cmake | ||||||
|   | |||||||
| @@ -1,13 +1,11 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: Fortran |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - fc: | - fc: | ||||||
|   - source: ../../../modules/fc.cmake |   - source: ../../../modules/fc.cmake | ||||||
| - default_build_paths: | - default_build_paths: | ||||||
|   - source: ../../../modules/default_build_paths.cmake |   - source: ../../../modules/default_build_paths.cmake | ||||||
| - git_info: |  | ||||||
|   - source: ../../../modules/git_info/git_info.cmake |  | ||||||
| - src: | - src: | ||||||
|   - source: ../../../modules/src.cmake |   - source: ../../../modules/src.cmake | ||||||
|  | - git_info: | ||||||
|  |   - source: ../../../modules/git_info/git_info.cmake | ||||||
|   | |||||||
| @@ -1,5 +1,3 @@ | |||||||
| generate_git_info_header(${PROJECT_BINARY_DIR} git_info.h) |  | ||||||
|  |  | ||||||
| include_directories(${PROJECT_BINARY_DIR}) | include_directories(${PROJECT_BINARY_DIR}) | ||||||
|  |  | ||||||
| add_executable(example example.F90) | add_executable(example example.F90) | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: Fortran |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - fc: | - fc: | ||||||
|   - source: ../../../modules/fc.cmake |   - source: ../../../modules/fc.cmake | ||||||
|   | |||||||
| @@ -1,10 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: |  | ||||||
|   - Fortran |  | ||||||
|   - C |  | ||||||
|   - CXX |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - fc: | - fc: | ||||||
|   - source: ../../../modules/fc.cmake |   - source: ../../../modules/fc.cmake | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| name: example | name: example | ||||||
| min_cmake_version: 2.8 | min_cmake_version: 2.8 | ||||||
| language: Fortran |  | ||||||
| default_build_type: debug |  | ||||||
| modules: | modules: | ||||||
| - fc: | - fc: | ||||||
|   - source: ../../../modules/fc.cmake |   - source: ../../../modules/fc.cmake | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								test/fc_openblas/cmake/autocmake.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/fc_openblas/cmake/autocmake.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | name: example | ||||||
|  | min_cmake_version: 2.8 | ||||||
|  | modules: | ||||||
|  | - fc: | ||||||
|  |   - source: ../../../modules/fc.cmake | ||||||
|  | - math: | ||||||
|  |   - source: ../../../modules/math/openblas.cmake | ||||||
|  | - default_build_paths: | ||||||
|  |   - source: ../../../modules/default_build_paths.cmake | ||||||
|  | - src: | ||||||
|  |   - source: ../../../modules/src.cmake | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user