Skip to content

Commit c402ecb

Browse files
robertodrstigrj
authored andcommitted
Update Autocmake (#89)
* Update Autocmake * Update license headers * Update CFlags and CXXFlags * Fix more CMake errors * Fix compilation of Python bindings
1 parent b3ea54b commit c402ecb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+155
-183
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ src/taylor/*.cpp !licensefile
1717

1818
python/init.py licensefile=.githooks/LICENSE-Python
1919
python/xcfun.py licensefile=.githooks/LICENSE-Python
20+
21+
cmake/update.py !licensefile
22+
cmake/autocmake/*.py !licensefile

CMakeLists.txt

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is autogenerated by Autocmake v1.0.0-alpha-x http://autocmake.org
2-
# Copyright (c) 2015-2018 by Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors.
2+
# Copyright (c) 2015-2019 by Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors.
33

44
# set minimum cmake version
55
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
@@ -49,22 +49,17 @@ macro(option_with_default variable msge default)
4949
endif()
5050
endmacro()
5151

52-
# directories which hold included cmake modules
53-
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/custom)
54-
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/custom/compilers)
55-
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/downloaded)
56-
5752
# included cmake modules
58-
include(autocmake_custom_color_messages)
59-
include(autocmake_default_build_paths)
60-
include(autocmake_safeguards)
61-
include(autocmake_cxx)
62-
include(autocmake_cc)
63-
include(fc_optional)
64-
include(code_coverage)
65-
include(CXXFlags)
66-
include(CFlags)
67-
include(static_library)
68-
include(xcfun)
69-
include(autocmake_src)
70-
include(test)
53+
include(${PROJECT_SOURCE_DIR}/cmake/downloaded/autocmake_custom_color_messages.cmake)
54+
include(${PROJECT_SOURCE_DIR}/cmake/downloaded/autocmake_default_build_paths.cmake)
55+
include(${PROJECT_SOURCE_DIR}/cmake/downloaded/autocmake_safeguards.cmake)
56+
include(${PROJECT_SOURCE_DIR}/cmake/downloaded/autocmake_cxx.cmake)
57+
include(${PROJECT_SOURCE_DIR}/cmake/downloaded/autocmake_cc.cmake)
58+
include(${PROJECT_SOURCE_DIR}/cmake/custom/fc_optional.cmake)
59+
include(${PROJECT_SOURCE_DIR}/cmake/custom/code_coverage.cmake)
60+
include(${PROJECT_SOURCE_DIR}/cmake/custom/compilers/CXXFlags.cmake)
61+
include(${PROJECT_SOURCE_DIR}/cmake/custom/compilers/CFlags.cmake)
62+
include(${PROJECT_SOURCE_DIR}/cmake/custom/static_library.cmake)
63+
include(${PROJECT_SOURCE_DIR}/cmake/custom/xcfun.cmake)
64+
include(${PROJECT_SOURCE_DIR}/cmake/downloaded/autocmake_src.cmake)
65+
include(${PROJECT_SOURCE_DIR}/cmake/custom/test.cmake)

Pipfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ name = "pypi"
77

88
[packages]
99

10-
Sphinx = "*"
11-
sphinx_rtd_theme = "*"
12-
fprettify = "*"
1310
numpy = "*"
1411

1512

1613
[dev-packages]
1714

15+
Sphinx = "*"
16+
sphinx_rtd_theme = "*"
17+
fprettify = "*"

Pipfile.lock

Lines changed: 33 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmake/autocmake/generate.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -187,23 +187,13 @@ def gen_cmakelists(project_name, project_language, min_cmake_version, default_bu
187187

188188
s.append(gen_cmake_options_wrappers())
189189

190-
if len(modules) > 0:
191-
s.append('\n# directories which hold included cmake modules')
192-
193-
module_paths = [module.path for module in modules]
194-
module_paths.append('downloaded') # this is done to be able to find fetched modules when testing
195-
module_paths = list(set(module_paths))
196-
module_paths.sort() # we do this to always get the same order and to minimize diffs
197-
for directory in module_paths:
198-
rel_cmake_module_path = os.path.join(relative_path, directory)
199-
# on windows cmake corrects this so we have to make it wrong again
200-
rel_cmake_module_path = rel_cmake_module_path.replace('\\', '/')
201-
s.append('list(APPEND CMAKE_MODULE_PATH ${{PROJECT_SOURCE_DIR}}/{0})'.format(rel_cmake_module_path))
202-
203190
if len(modules) > 0:
204191
s.append('\n# included cmake modules')
205192
for module in modules:
206-
s.append('include({0})'.format(os.path.splitext(module.name)[0]))
193+
s.append('include({0})'.format(os.path.join('${PROJECT_SOURCE_DIR}',
194+
relative_path,
195+
module.path,
196+
module.name)))
207197

208198
return s
209199

cmake/custom/compilers/CFlags.cmake

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
include(SetCompilerFlag)
2-
31
set(XCFun_C_FLAGS)
42
set(XCFun_C_FLAGS_DEBUG)
53
set(XCFun_C_FLAGS_RELEASE)
64
set(XCFun_C_FLAGS_COVERAGE)
75

86
# C99
9-
set_compiler_flag(
10-
RESULT c99_flag
11-
LANGUAGE C
12-
REQUIRED
13-
FLAGS "-std=c99;-c99;-c9x"
14-
)
7+
set(CMAKE_C_STANDARD 99)
8+
set(CMAKE_C_STANDARD_REQUIRED TRUE)
9+
set(CMAKE_C_EXTENSIONS FALSE)
1510

1611
if(CMAKE_C_COMPILER_ID MATCHES GNU)
1712
list(APPEND XCFun_C_FLAGS
18-
"${c99_flag}"
1913
"-ffloat-store"
2014
"-m64"
2115
)
@@ -44,7 +38,6 @@ endif()
4438

4539
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
4640
list(APPEND XCFun_C_FLAGS
47-
"${c99_flag}"
4841
"-m64"
4942
)
5043
list(APPEND XCFun_C_FLAGS_DEBUG
@@ -69,7 +62,6 @@ endif()
6962

7063
if(CMAKE_C_COMPILER_ID MATCHES Intel)
7164
list(APPEND XCFun_C_FLAGS
72-
"${c99_flag}"
7365
"-g"
7466
"-wd981"
7567
"-wd279"
@@ -94,7 +86,6 @@ endif ()
9486

9587
if(CMAKE_C_COMPILER_ID MATCHES PGI)
9688
list(APPEND XCFun_C_FLAGS
97-
"${c99_flag}"
9889
"-Mpreprocess"
9990
)
10091
list(APPEND XCFun_C_FLAGS_DEBUG

cmake/custom/compilers/CXXFlags.cmake

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
include(SetCompilerFlag)
2-
31
set(XCFun_CXX_FLAGS)
42
set(XCFun_CXX_FLAGS_DEBUG)
53
set(XCFun_CXX_FLAGS_RELEASE)
64
set(XCFun_CXX_FLAGS_COVERAGE)
75

86
# C++11
9-
set_compiler_flag(
10-
RESULT cxx11_flag
11-
LANGUAGE CXX
12-
REQUIRED
13-
FLAGS "-std=c++11;-std=c++0x;--c++11;--c++0x"
14-
)
7+
set(CMAKE_CXX_STANDARD 11)
8+
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
9+
set(CMAKE_CXX_EXTENSIONS FALSE)
1510

1611
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
1712
list(APPEND XCFun_CXX_FLAGS
18-
"${cxx11_flag}"
1913
"-ffloat-store"
2014
"-fno-rtti"
2115
"-fno-exceptions"
@@ -48,7 +42,6 @@ endif()
4842

4943
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
5044
list(APPEND XCFun_CXX_FLAGS
51-
"${cxx11_flag}"
5245
"-fno-rtti"
5346
"-fno-exceptions"
5447
"-m64"
@@ -78,7 +71,6 @@ endif()
7871

7972
if(CMAKE_CXX_COMPILER_ID MATCHES Intel)
8073
list(APPEND XCFun_CXX_FLAGS
81-
"${cxx11_flag}"
8274
"-g"
8375
"-wd981"
8476
"-wd279"
@@ -101,7 +93,6 @@ endif ()
10193
if(CMAKE_CXX_COMPILER_ID MATCHES PGI)
10294
#236 suppress assert warnings and 175 suppress subscript out of range warning /SR
10395
list(APPEND XCFun_CXX_FLAGS
104-
"${cxx11_flag}"
10596
"-Mpreprocess"
10697
"--diag_suppress 236"
10798
"--diag_suppress 175"

cmake/custom/xcfun.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ if(ENABLE_FC_SUPPORT)
4848
include(FortranCInterface)
4949
FortranCInterface_VERIFY(CXX)
5050
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/modules)
51-
include(FortranFlags)
52-
include(int64)
51+
include(${CMAKE_CURRENT_LIST_DIR}/compilers/FortranFlags.cmake)
52+
include(${CMAKE_CURRENT_LIST_DIR}/int64.cmake)
5353
endif()
5454

5555
if(ENABLE_PYTHON_INTERFACE)

python/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
find_package(SWIG REQUIRED)
22
include(UseSWIG)
33

4+
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/custom)
45
find_package(PythonLibsNew 2.7 REQUIRED)
56
find_package(NumPy REQUIRED)
67

@@ -9,7 +10,7 @@ set_source_files_properties(xcfun_swig.i
910
CPLUSPLUS
1011
ON
1112
SWIG_FLAGS
12-
"-I${CMAKE_BINARY_DIR}/include;-I${PROJECT_SOURCE_DIR}/api"
13+
"-I${PROJECT_BINARY_DIR}/include;-I${PROJECT_SOURCE_DIR}/api"
1314
)
1415
set(CMAKE_SWIG_OUTDIR ${PROJECT_BINARY_DIR}/${PYMOD_INSTALL_FULLDIR})
1516

python/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
#
33
# XCFun, an arbitrary order exchange-correlation library
4-
# Copyright (C) 2018 Ulf Ekström and contributors.
4+
# Copyright (C) 2019 Ulf Ekström and contributors.
55
#
66
# This file is part of XCFun.
77
#

0 commit comments

Comments
 (0)