Skip to content

Commit e4fe261

Browse files
author
Roberto Di Remigio
committed
Silence warnings from libint and libderiv
The CMakeLists.txt used to build Boost is now platform independent Former-commit-id: 13ce72e
1 parent 5b481d1 commit e4fe261

File tree

9 files changed

+162
-71
lines changed

9 files changed

+162
-71
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ set(EXTERNAL_LIBS)
3636
include(ConfigVersion)
3737
include(ConfigArchitecture)
3838
include(ConfigCompilerFlags)
39+
include(PerTargetCompilerFlags)
3940
include(ConfigExternal)
4041
include(ConfigOMP)
4142

boost/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ file(APPEND ${BOOST_BUILD_DIR}/user-config.jam "${MPI_SENT}")
5555
# Unpack Boost and copy boostcpp.jam
5656
add_custom_command(
5757
OUTPUT boost.unpacked
58-
COMMAND tar -xzf ${PROJECT_SOURCE_DIR}/boost/boost_${BOOSTVER}.tar.gz
58+
COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/boost/boost_${BOOSTVER}.tar.gz
5959
# Copy custom boostcpp.jam (to get versioned format as I want it!)
60-
COMMAND cp ${PROJECT_SOURCE_DIR}/boost/boostcpp.jam ${BOOST_BUILD_DIR}
60+
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/boost/boostcpp.jam ${BOOST_BUILD_DIR}
6161
# Append to project-config.jam
6262
# It can't be done with file(APPEND ...) because it will be destroyed when unpacking
6363
COMMAND ${CMAKE_COMMAND} -E echo "${MPI_SENT}" >> ${BOOST_BUILD_DIR}/project-config.jam
@@ -74,7 +74,7 @@ add_custom_command(
7474
--with-libraries="${b2_needed_components}"
7575
--with-python=${PYTHON_EXECUTABLE}
7676
--prefix=${CUSTOM_BOOST_LOCATION} 1> boost.configured.log 2> boost.configured.err
77-
COMMAND touch ${PROJECT_BINARY_DIR}/boost/boost.configured
77+
COMMAND ${CMAKE_COMMAND} -E touch ${PROJECT_BINARY_DIR}/boost/boost.configured
7878
WORKING_DIRECTORY ${BOOST_BUILD_DIR}
7979
DEPENDS boost.unpacked
8080
COMMENT "Configuring Boost")
@@ -83,7 +83,7 @@ add_custom_command(
8383
add_custom_command(
8484
OUTPUT boost.built
8585
COMMAND ./b2 variant=${type} link=static threading=multi 1> boost.built.log 2> boost.built.err
86-
COMMAND touch ${PROJECT_BINARY_DIR}/boost/boost.built
86+
COMMAND ${CMAKE_COMMAND} -E touch ${PROJECT_BINARY_DIR}/boost/boost.built
8787
WORKING_DIRECTORY ${BOOST_BUILD_DIR}
8888
DEPENDS boost.configured
8989
COMMENT "Building Boost")
@@ -92,16 +92,16 @@ add_custom_command(
9292
add_custom_command(
9393
OUTPUT boost.installed
9494
COMMAND ./b2 install variant=${type} link=static threading=multi 1> boost.installed.log 2> boost.installed.err
95-
COMMAND touch ${PROJECT_BINARY_DIR}/boost/boost.installed
95+
COMMAND ${CMAKE_COMMAND} -E touch ${PROJECT_BINARY_DIR}/boost/boost.installed
9696
WORKING_DIRECTORY ${BOOST_BUILD_DIR}
9797
DEPENDS boost.built
9898
COMMENT "Installing Boost")
9999

100100
# Clean-up
101101
add_custom_command(
102102
OUTPUT boost.cleanedup
103-
COMMAND rm -rf ${BOOST_BUILD_DIR}
104-
COMMAND touch ${PROJECT_BINARY_DIR}/boost/boost.cleanedup
103+
COMMAND ${CMAKE_COMMAND} -E remove ${BOOST_BUILD_DIR}
104+
COMMAND ${CMAKE_COMMAND} -E touch ${PROJECT_BINARY_DIR}/boost/boost.cleanedup
105105
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/boost
106106
DEPENDS boost.installed
107107
COMMENT "Clean-up Boost")

cmake/GenericMacros.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,6 @@ endfunction(get_fc_symbol)
142142
# This macro configures all files that depend on some variables known only when
143143
# the setup script or CMake are run
144144
macro(configure_files)
145-
# Configure the touch_cmakelists utility script
146-
configure_file(${PROJECT_SOURCE_DIR}/tools/touch_cmakelists.py.in touch_cmakelists.py)
147-
file(COPY ${PROJECT_BINARY_DIR}/touch_cmakelists.py
148-
DESTINATION ${PROJECT_BINARY_DIR}/bin
149-
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
150-
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
151145
# Configure the counter utility script
152146
configure_file(${PROJECT_SOURCE_DIR}/tools/counter.py.in counter.py)
153147
file(COPY ${PROJECT_BINARY_DIR}/counter.py

src/lib/CMakeLists.libint.txt renamed to cmake/SetupLibint.cmake

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
set(AM 0 p d f g h i k l m n o q r t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
21
#
3-
# A function to populate a list of files expected from LIBINT
2+
# Macros preparing compilation of Libint and Libderiv
3+
# Written by Andrew Simmonett
44
#
5+
6+
set(AM 0 p d f g h i k l m n o q r t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
7+
8+
# This macros populates a list of files expected from LIBINT
9+
# Written by Andrew Simmonett
510
macro(BUILD_LIBINT_FILES MYINTFILES MYOPT_AM)
611
math(EXPR MYNEW_AM ${MYOPT_AM}*2)
712
# hrr_order_WXYZ.cc
@@ -79,10 +84,8 @@ macro(BUILD_LIBINT_FILES MYINTFILES MYOPT_AM)
7984
set(TMPINTFILES "")
8085
endmacro(BUILD_LIBINT_FILES)
8186

82-
83-
#
84-
# A function to populate a list of files expected from LIBINT for derivatives
85-
#
87+
# This macro populates a list of files expected from LIBINT for derivatives
88+
# Written by Andrew Simmonett
8689
macro(BUILD_LIBDERIV_FILES MYINTFILES MYOPT_AM ADDBUILD)
8790
math(EXPR MYNEW_AM ${MYOPT_AM}*2)
8891
# hrr_order_WXYZ.cc

cmake/compilers/CXXFlags.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ else()
1919
endif()
2020
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -DDEBUG -Wall -Wextra -Winit-self -Woverloaded-virtual -Wuninitialized -Wmissing-declarations -Wwrite-strings")
2121
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -Wno-unused")
22-
set (CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -g -pg")
22+
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -g -pg")
2323

2424
if(ENABLE_CODE_COVERAGE)
2525
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
macro(set_libint_compiler_flags)
2+
set(CMAKE_CXX_FLAGS " ")
3+
set(CMAKE_CXX_FLAGS_DEBUG " ")
4+
set(CMAKE_CXX_FLAGS_RELEASE " ")
5+
set(CMAKE_CXX_FLAGS_PROFILE " ")
6+
7+
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
8+
set(CMAKE_CXX_FLAGS "-DRESTRICT=${restrict}")
9+
if(HAS_CXX11_SUPPORT)
10+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ${CXX11_COMPILER_FLAGS}")
11+
else()
12+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=gnu++98")
13+
endif()
14+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -DDEBUG")
15+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -Wno-unused")
16+
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -g -pg")
17+
18+
if(ENABLE_CODE_COVERAGE)
19+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
20+
set (CMAKE_CXX_LINK_FLAGS "-fprofile-arcs -ftest-coverage")
21+
endif()
22+
elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel)
23+
set(CMAKE_CXX_FLAGS "-restrict -DRESTRICT=${restrict}")
24+
if(HAS_CXX11_SUPPORT)
25+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ${CXX11_COMPILER_FLAGS}")
26+
else()
27+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=gnu++98")
28+
endif()
29+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -debug -DDEBUG")
30+
# Check if xHost flag is available and add it CMAKE_CXX_FLAGS_RELEASE
31+
set(xHost "")
32+
check_cxx_compiler_flag("-xHost" has_xHost)
33+
if(has_xHost)
34+
set(xHost "-xHost")
35+
endif()
36+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG ${xHost}")
37+
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -shared-intel")
38+
if(DEFINED MKL_FLAG)
39+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MKL_FLAG}")
40+
endif()
41+
if(ENABLE_VECTORIZATION)
42+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_ARCHITECTURE_FLAGS} ${DEFINITIONS}")
43+
endif()
44+
45+
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -g -pg")
46+
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -shared-intel")
47+
elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang)
48+
set(CMAKE_CXX_FLAGS "-DRESTRICT=${restrict}")
49+
if(HAS_CXX11_SUPPORT)
50+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ${CXX11_COMPILER_FLAGS}")
51+
else()
52+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=gnu++98")
53+
endif()
54+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DDEBUG")
55+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -Wno-unused")
56+
57+
# clang does not use gprof
58+
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
59+
60+
if(ENABLE_CODE_COVERAGE)
61+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
62+
set(CMAKE_CXX_LINK_FLAGS "-fprofile-arcs -ftest-coverage")
63+
endif()
64+
endif()
65+
66+
endmacro(set_libint_compiler_flags)
67+
68+
macro(set_libderiv_compiler_flags)
69+
set(CMAKE_CXX_FLAGS " ")
70+
set(CMAKE_CXX_FLAGS_DEBUG " ")
71+
set(CMAKE_CXX_FLAGS_RELEASE " ")
72+
set(CMAKE_CXX_FLAGS_PROFILE " ")
73+
74+
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
75+
set(CMAKE_CXX_FLAGS "-DRESTRICT=${restrict}")
76+
if(HAS_CXX11_SUPPORT)
77+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ${CXX11_COMPILER_FLAGS}")
78+
else()
79+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=gnu++98")
80+
endif()
81+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -DDEBUG")
82+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -Wno-unused")
83+
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -g -pg")
84+
85+
if(ENABLE_CODE_COVERAGE)
86+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
87+
set (CMAKE_CXX_LINK_FLAGS "-fprofile-arcs -ftest-coverage")
88+
endif()
89+
elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel)
90+
set(CMAKE_CXX_FLAGS "-restrict -DRESTRICT=${restrict}")
91+
if(HAS_CXX11_SUPPORT)
92+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ${CXX11_COMPILER_FLAGS}")
93+
else()
94+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=gnu++98")
95+
endif()
96+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -debug -DDEBUG")
97+
# Check if xHost flag is available and add it CMAKE_CXX_FLAGS_RELEASE
98+
set(xHost "")
99+
check_cxx_compiler_flag("-xHost" has_xHost)
100+
if(has_xHost)
101+
set(xHost "-xHost")
102+
endif()
103+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG ${xHost}")
104+
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -shared-intel")
105+
if(DEFINED MKL_FLAG)
106+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MKL_FLAG}")
107+
endif()
108+
if(ENABLE_VECTORIZATION)
109+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_ARCHITECTURE_FLAGS} ${DEFINITIONS}")
110+
endif()
111+
112+
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -g -pg")
113+
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -shared-intel")
114+
elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang)
115+
set(CMAKE_CXX_FLAGS "-DRESTRICT=${restrict}")
116+
if(HAS_CXX11_SUPPORT)
117+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ${CXX11_COMPILER_FLAGS}")
118+
else()
119+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=gnu++98")
120+
endif()
121+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DDEBUG")
122+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -Wno-unused")
123+
124+
# clang does not use gprof
125+
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
126+
127+
if(ENABLE_CODE_COVERAGE)
128+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
129+
set(CMAKE_CXX_LINK_FLAGS "-fprofile-arcs -ftest-coverage")
130+
endif()
131+
endif()
132+
133+
endmacro(set_libderiv_compiler_flags)

src/lib/libderiv/CMakeLists.txt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#
22
# Figure out which files libint will produce, and compile them
33
#
4-
include(../CMakeLists.libint.txt)
4+
include(SetupLibint)
55
set(LD_SRC "init_libderiv.cc" "d1hrr_order_0000.cc" "d1vrr_order_0000.cc" "d12hrr_order_0000.cc" "d12vrr_order_0000.cc")
66
build_libderiv_files(LD_SRC1 ${LIBDERIV_OPT_AM1} TRUE)
7-
foreach (f ${LD_SRC1})
7+
foreach(f ${LD_SRC1})
88
set(LD_SRC ${LD_SRC} "d1${f}")
99
endforeach()
1010
build_libderiv_files(LD_SRC2 ${LIBDERIV_OPT_AM2} FALSE)
11-
foreach (f ${LD_SRC2})
11+
foreach(f ${LD_SRC2})
1212
set(LD_SRC ${LD_SRC} "d12${f}")
1313
endforeach()
1414
set(ABC A B C D)
@@ -22,32 +22,23 @@ foreach(abcval ${ABC})
2222
endforeach()
2323
endforeach()
2424
endforeach()
25+
set_libderiv_compiler_flags()
2526
add_library(deriv STATIC ${LD_SRC})
2627

27-
#
2828
# Build the compiler
29-
#
3029
set(COMPILER_SRC build_libderiv.c emit_d1hrr_build_macro.c emit_deriv1_managers.c emit_deriv_build_macro.c
3130
emit_d1hrr_build.c emit_deriv12_managers.c emit_deriv_build.c mem_man.c)
3231
add_executable(libderiv_compiler ${COMPILER_SRC})
3332
add_dependencies(libderiv_compiler int)
3433

35-
#
3634
# Generate the libderiv files, after building the compiler, only if libderiv.compiled doesn't exist
37-
#
3835
add_custom_command(
3936
COMMAND libderiv_compiler
4037
COMMAND touch libderiv.compiled
4138
DEPENDS libderiv_compiler
4239
OUTPUT libderiv.compiled
4340
OUTPUT ${LD_SRC}
41+
COMMENT "Generating libderiv files"
4442
)
4543

46-
47-
#
48-
# This target is always executed
49-
#
50-
#add_custom_target(
51-
# libderiv ALL
52-
# DEPENDS libderiv.compiled
53-
#)
44+
add_custom_target(libderiv DEPENDS libderiv.compiled int)

src/lib/libint/CMakeLists.txt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#
22
# Figure out which files libint will produce, and compile them
33
#
4-
include(../CMakeLists.libint.txt)
4+
include(SetupLibint)
55
build_libint_files(LI_SRC ${LIBINT_OPT_AM})
66
set(LI_SRC ${LI_SRC} init_libint.cc vrr_build.c)
77

88
#foreach (f ${LI_SRC})
99
# message(STATUS "LIBINT CONTAINS ${f}")
1010
#endforeach()
11+
set_libint_compiler_flags()
1112
add_library(int STATIC ${LI_SRC})
13+
1214
#
1315
# Build the compiler
1416
#
@@ -25,23 +27,16 @@ add_executable(libint_compiler ${COMPILER_SRC})
2527
#)
2628

2729

28-
#
2930
# Generate the libint files, after building the compiler, only if libint.compiled doesn't exist
30-
#
3131
add_custom_command(
3232
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/src/lib/libint/vrr_build.c ${PROJECT_BINARY_DIR}/src/lib/libint
3333
COMMAND libint_compiler
3434
COMMAND touch libint.compiled
3535
DEPENDS libint_compiler
3636
OUTPUT libint.compiled
3737
OUTPUT ${LI_SRC}
38+
COMMENT "Generating libint files"
3839
)
3940

40-
41-
#
4241
# This target is always executed
43-
#
44-
add_custom_target(
45-
libint ALL
46-
DEPENDS libint.compiled
47-
)
42+
add_custom_target(libint ALL DEPENDS libint.compiled)

tools/touch_cmakelists.py.in

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)