Gentoo Archives: gentoo-dev

From: Maciej Mrozowski <reavertm@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency
Date: Fri, 04 Nov 2016 00:55:22
Message-Id: 2201079.NzSpTVdek2@liwardyna
In Reply to: Re: [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency by "Michał Górny"
1 On czwartek, 3 listopada 2016 07:31:10 CET Michał Górny wrote:
2 > On Thu, 3 Nov 2016 00:52:16 +0100
3 >
4 > Maciej Mrozowski <reavertm@×××××.com> wrote:
5 > > From: Maciej Mrozowski <reavertm@g.o>
6 > >
7 > > ---
8 > >
9 > > eclass/cmake-utils.eclass | 54
10 > > ++++++++++++++++++----------------------------- 1 file changed, 21
11 > > insertions(+), 33 deletions(-)
12 > >
13 > > diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
14 > > index 393ee28..88d2163 100644
15 > > --- a/eclass/cmake-utils.eclass
16 > > +++ b/eclass/cmake-utils.eclass
17 > > @@ -517,13 +517,10 @@ enable_cmake-utils_src_configure() {
18 > >
19 > > includes="<INCLUDES>"
20 > >
21 > > fi
22 > > cat > "${build_rules}" <<- _EOF_ || die
23 > >
24 > > - SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive
25 manager"
26 > > FORCE)>
27 > > SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> $
28 {includes}
29 > > ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM
30 compile
31 > > command" FORCE) SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER>
32 > > <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c
33 <SOURCE>"
34 > > CACHE STRING "C compile command" FORCE) SET
35 (CMAKE_CXX_COMPILE_OBJECT
36 > > "<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS>
37 -o
38 > > <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
39 SET
40 > > (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER>
41 <DEFINES>
42 > > ${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE
43 STRING
44 > > "Fortran compile command" FORCE)>
45 > > - SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH
46 "Archive
47 > > index generator" FORCE) - SET (PKG_CONFIG_EXECUTABLE $(type -P
48 > > $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)>
49 > > _EOF_
50 > >
51 > > local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
52 > >
53 > > @@ -531,6 +528,8 @@ enable_cmake-utils_src_configure() {
54 > >
55 > > SET (CMAKE_C_COMPILER $(tc-getCC))
56 > > SET (CMAKE_CXX_COMPILER $(tc-getCXX))
57 > > SET (CMAKE_Fortran_COMPILER $(tc-getFC))
58 > >
59 > > + SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive
60 manager"
61 > > FORCE) + SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH
62 > > "Archive index generator" FORCE)>
63 > > _EOF_
64 > >
65 > > if tc-is-cross-compiler; then
66 > >
67 > > @@ -571,32 +570,29 @@ enable_cmake-utils_src_configure() {
68 > >
69 > > # in Prefix we need rpath and must ensure cmake gets our
70 default
71 > > linker path # right ... except for Darwin hosts
72 > > IF (NOT APPLE)
73 > >
74 > > - SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
75 > > - SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH
76 > > "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/u
77 > > sr/$(get_libdir);${EPREFIX}/$(get_libdir)" - CACHE STRING ""
78 FORCE)
79 > > -
80 > > + SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
81 > > + SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH
82 > > "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/u
83 > > sr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)>
84 > > ELSE ()
85 > >
86 > > -
87 > > - SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING ""
88 FORCE)
89 > > - SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
90 > > - SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
91 > > - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
92 > > - SET(CMAKE_INSTALL_RPATH
93 > > "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/$
94 > > {CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE
95 > > STRING "" FORCE) - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH
96 TRUE CACHE
97 > > BOOL "" FORCE) - SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}$
98 {PREFIX}/lib"
99 > > CACHE STRING "" FORCE) -
100 > > + SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE
101 STRING "" FORCE)
102 > > + SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
103 > > + SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
104 > > + SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
105 > > + SET(CMAKE_INSTALL_RPATH
106 > > "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/$
107 > > {CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE
108 > > STRING "" FORCE) + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH
109 TRUE CACHE
110 > > BOOL "" FORCE) + SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}$
111 {PREFIX}/lib"
112 > > CACHE STRING "" FORCE)>
113 > > ENDIF (NOT APPLE)
114 > >
115 > > _EOF_
116 > >
117 > > fi
118 > >
119 > > # Common configure parameters (invariants)
120 > >
121 > > - local common_config=${BUILD_DIR}/gentoo_common_config.cmake
122 > >
123 > > local libdir=$(get_libdir)
124 > >
125 > > - cat > "${common_config}" <<- _EOF_ || die
126 > > - SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix"
127 FORCE)
128 > > - SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory
129 for
130 > > libraries") - _EOF_
131 > > - [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET
132 > > (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)'
133 > > >> "${common_config}" + local cmakeargs=(
134 > > + -DLIB_SUFFIX="${libdir/lib}"
135 > > + -DCMAKE_INSTALL_LIBDIR="${libdir}"
136 > > + -DPKG_CONFIG_EXECUTABLE="$(type -P $(tc-getPKG_CONFIG))"
137 > > + -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
138 > > + -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
139 > > + )
140 >
141 > Wasn't the point of using a config file to avoid warnings when the
142 > variables aren't used?
143
144 Nah, config file was there even before CMake supported warning about unused
145 variables (or at least definitely long before we enabled it in eclass).
146 The problem _I_ have with config file is that its contents is not visible in
147 build log.
148 Though I admit extra warnings are not nice.
149 -D PKG_CONFIG_EXECUTABLE could be replaced with PKG_CONFIG env var.
150 But LIB_SUFFIX is some KDE early invention, populated in kde-related projects
151 (otherwise GNUInstallDirs should be used or manually setting
152 CMAKE_INSTALL_LIBDIR).
153 Not sure whether config file is worth having to eliminate one or two CMake
154 warnings, let's see what others think.
155
156 --
157 regards
158 MM

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies