* [Buildroot] [PATCH 0/4] CMake package and infra improvements
@ 2015-03-08 9:47 Samuel Martin
2015-03-08 9:47 ` [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too Samuel Martin
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Samuel Martin @ 2015-03-08 9:47 UTC (permalink / raw)
To: buildroot
Hi all,
Here is a short CMake related series.
The first 2 patches improve the cmake package, and the last ones fix cmake infrastructure.
Regards,
Samuel
--
Davide Viti (1):
package/cmake: make ctest a target package too
Samuel Martin (3):
package/cmake: only build what is necessary
toolchainfile.cmake: only search the sysroot for CMake module
toolchainfile.cmake: set CXX variables wrt BR2_INSTALL_LIBSTDCPP value
package/Config.in | 1 +
package/cmake/0001-rename_cmake_rootfile.patch | 23 ++
...-allow-to-select-what-program-to-be-built.patch | 231 +++++++++++++++++++++
package/cmake/Config.in | 14 ++
package/cmake/cmake.mk | 36 ++++
package/pkg-cmake.mk | 1 +
support/misc/toolchainfile.cmake.in | 34 ++-
7 files changed, 334 insertions(+), 6 deletions(-)
create mode 100644 package/cmake/0001-rename_cmake_rootfile.patch
create mode 100644 package/cmake/0002-CMake-allow-to-select-what-program-to-be-built.patch
create mode 100644 package/cmake/Config.in
--
2.3.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too
2015-03-08 9:47 [Buildroot] [PATCH 0/4] CMake package and infra improvements Samuel Martin
@ 2015-03-08 9:47 ` Samuel Martin
2015-03-08 9:53 ` Baruch Siach
2015-03-15 17:41 ` Thomas Petazzoni
2015-03-08 9:47 ` [Buildroot] [PATCH 2/4 v2] package/cmake: only build what is necessary Samuel Martin
` (2 subsequent siblings)
3 siblings, 2 replies; 12+ messages in thread
From: Samuel Martin @ 2015-03-08 9:47 UTC (permalink / raw)
To: buildroot
From: Davide Viti <zinosat@tiscali.it>
Useful for packages shipped with a testsuite which makes use of ctest
Since ctest is just a tool provided by the cmake sources, this change
introduces a hidden BR2_PACKAGE_CMAKE symbol which is automatically
selected by the BR2_PACKAGE_CMAKE_CTEST one.
This is like this mostly for consistency (cmake is the actual package,
not ctest).
CMake is a particular package:
* CMake can be built using the generic infrastructure or the cmake one.
Since Buildroot has no requirement regarding the host system cmake
program presence, it uses the generic infrastructure to build the
host-cmake package, then the (target-)cmake package can be built
using the cmake infrastructure;
* CMake bundles its dependencies within its sources. This is the reason
why the host-cmake package only has host-pkgconf as (runtime)
dependency, whereas the (target-)cmake package has a lot of
dependencies, using only the system-wide libraries instead of
rebuilding and staitcally linking with the ones bundles into the CMake
sources.
Signed-off-by: Davide Viti <zinosat@tiscali.it>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
v4->v5: (Samuel)
- make BR2_PACKAGE_CMAKE a hidden symbol, and introduce
BR2_PACKAGE_CMAKE_CTEST
- cleanup indentation in the *.mk
- update commit message
- add missing xz dependency
- fix CMAKE_INSTALL_CTEST_CFG_FILE hook
- do not hard-code cmake version in hooks commands
- rename patch to match new policy
v3->v4: (Davide)
This version of the patch was mainly reworked to fix the following
error seen on the taget:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/share/cmake-3.0
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/share/cmake-3.0
caused by "target-finalize" target in the toplevel Buildroot Makefile
which removes Modules/CMake.cmake file from the target filesystem.
The following solutions were evaluated:
1. add special exceptions to the main Makefile
2. specify CMAKE_DATA_DIR at configure time, so that "Modules" and
"Templates" folders don't get cleaned up by "target-finalize" rule
3. instruct ctest to look for CMake.cmake.ctest instead of CMake.cmake
the last option (3) was implemented and now ctest looks for
CMake.cmake first and then tries to open Modules/CMake.cmake.ctest
If both files are not found ctest issues the above error.
- fix CMAKE_REMOVE_EXTRA_DATA target
v2->v3: (Davide)
- specify DESTDIR when installing (Samuel Martin)
- rename Modules/CMake.cmake Modules/CMake.cmake.ctest
- add patch to make ctest look for Modules/CMake.cmake{.ctest}
v1->v2: (Davide)
- rebase
- use CMAKE_CONF_OPTS in place of bootstrap (Samuel Martin)
- use system libraries to speed up compilation [1] (Samuel Martin)
- install only ctest on the target (Samuel Martin)
- system curl and expat rely on disabled libxmlrpc (Samuel Martin)
- usa CMAKE_POST_INSTALL_TARGET_HOOKS
- specify host tools path during install [2]
[1] Using system libraries speeds up compilation of around 20%
[2] the install rule has to be overridden because of http://public.kitware.com/Bug/view.php?id=15248
http://www.cmake.org/gitweb?p=stage/cmake.git;a=patch;h=15f55cca does not work for me on BR
---
package/Config.in | 1 +
package/cmake/0001-rename_cmake_rootfile.patch | 23 ++++++++++++++++++++
package/cmake/Config.in | 14 ++++++++++++
package/cmake/cmake.mk | 30 ++++++++++++++++++++++++++
4 files changed, 68 insertions(+)
create mode 100644 package/cmake/0001-rename_cmake_rootfile.patch
create mode 100644 package/cmake/Config.in
diff --git a/package/Config.in b/package/Config.in
index 1bce00a..cc494a7 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -105,6 +105,7 @@ menu "Development tools"
source "package/binutils/Config.in"
source "package/bsdiff/Config.in"
source "package/bustle/Config.in"
+ source "package/cmake/Config.in"
source "package/cppunit/Config.in"
source "package/cvs/Config.in"
if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
diff --git a/package/cmake/0001-rename_cmake_rootfile.patch b/package/cmake/0001-rename_cmake_rootfile.patch
new file mode 100644
index 0000000..915b7e3
--- /dev/null
+++ b/package/cmake/0001-rename_cmake_rootfile.patch
@@ -0,0 +1,23 @@
+ctest fails on the target, because it cannot find CMake.cmake inside
+CMAKE_DATA_DIR (typically set to "/usr/share/cmake-3.0"): all *.cmake
+files are removed at build time via the target-finalize rule.
+
+This buildroot-specific patch makes sure ctest looks also for
+"Modules/CMake.cmake.ctest" before complaining
+
+Signed-off-by: Davide Viti <zinosat@tiscali.it>
+
+--- cmake-3.0.2/Source/cmake.cxx~ 2014-09-11 15:24:01.000000000 +0200
++++ cmake-3.0.2/Source/cmake.cxx 2014-11-25 15:48:04.461033690 +0100
+@@ -957,7 +957,10 @@
+ "Path to cpack program executable.", cmCacheManager::INTERNAL);
+ #endif
+ if(!cmSystemTools::FileExists(
+- (cmSystemTools::GetCMakeRoot()+"/Modules/CMake.cmake").c_str()))
++ (cmSystemTools::GetCMakeRoot()+"/Modules/CMake.cmake").c_str()) &&
++ !cmSystemTools::FileExists(
++ (cmSystemTools::GetCMakeRoot()+"/Modules/CMake.cmake.ctest").c_str())
++ )
+ {
+ // couldn't find modules
+ cmSystemTools::Error("Could not find CMAKE_ROOT !!!\n"
diff --git a/package/cmake/Config.in b/package/cmake/Config.in
new file mode 100644
index 0000000..3d31d7a
--- /dev/null
+++ b/package/cmake/Config.in
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_CMAKE
+ bool
+
+config BR2_PACKAGE_CMAKE_CTEST
+ bool "ctest"
+ select BR2_PACKAGE_CMAKE
+ help
+ CTest is a testing tool distributed as a part of CMake. It
+ can be used to automate updating (using CVS for example),
+ configuring, building, testing, performing memory checking,
+ performing coverage, and submitting results to a CDash or
+ Dart dashboard system.
+
+ http://www.cmake.org/
diff --git a/package/cmake/cmake.mk b/package/cmake/cmake.mk
index a00b8cd..9a939bf 100644
--- a/package/cmake/cmake.mk
+++ b/package/cmake/cmake.mk
@@ -11,6 +11,14 @@ CMAKE_LICENSE = BSD-3c
CMAKE_LICENSE_FILES = Copyright.txt
HOST_CMAKE_DEPENDENCIES = host-pkgconf
+CMAKE_DEPENDENCIES = zlib libcurl libarchive expat bzip2 xz
+
+CMAKE_CONF_OPTS = \
+ -DKWSYS_LFS_WORKS=$(if $(BR2_LARGEFILE),TRUE,FALSE) \
+ -DKWSYS_CHAR_IS_SIGNED=TRUE \
+ -DCMAKE_USE_SYSTEM_LIBRARIES=1 \
+ -DCTEST_USE_XMLRPC=OFF \
+ -DBUILD_CursesDialog=OFF
# Get rid of -I* options from $(HOST_CPPFLAGS) to prevent that a
# header available in $(HOST_DIR)/usr/include is used instead of a
@@ -39,4 +47,26 @@ define HOST_CMAKE_INSTALL_CMDS
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) install
endef
+define CMAKE_REMOVE_EXTRA_DATA
+ rm $(TARGET_DIR)/usr/bin/{cmake,cpack}
+ rm -fr $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/{completions,editors}
+ rm -fr $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/{Help,include}
+endef
+
+define CMAKE_INSTALL_CTEST_CFG_FILE
+ $(INSTALL) -m 0644 -D $(@D)/Modules/CMake.cmake \
+ $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/Modules/CMake.cmake.ctest
+endef
+
+CMAKE_POST_INSTALL_TARGET_HOOKS += CMAKE_REMOVE_EXTRA_DATA
+CMAKE_POST_INSTALL_TARGET_HOOKS += CMAKE_INSTALL_CTEST_CFG_FILE
+
+define CMAKE_INSTALL_TARGET_CMDS
+ (cd $(@D); \
+ $(HOST_MAKE_ENV) DESTDIR=$(TARGET_DIR) \
+ cmake -P cmake_install.cmake \
+ )
+endef
+
+$(eval $(cmake-package))
$(eval $(host-generic-package))
--
2.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 2/4 v2] package/cmake: only build what is necessary
2015-03-08 9:47 [Buildroot] [PATCH 0/4] CMake package and infra improvements Samuel Martin
2015-03-08 9:47 ` [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too Samuel Martin
@ 2015-03-08 9:47 ` Samuel Martin
2015-03-15 17:52 ` Thomas Petazzoni
2015-03-08 9:47 ` [Buildroot] [PATCH 3/4] toolchainfile.cmake: only search the sysroot for CMake module Samuel Martin
2015-03-08 9:47 ` [Buildroot] [PATCH 4/4] toolchainfile.cmake: set CXX variables wrt BR2_INSTALL_LIBSTDCPP value Samuel Martin
3 siblings, 1 reply; 12+ messages in thread
From: Samuel Martin @ 2015-03-08 9:47 UTC (permalink / raw)
To: buildroot
Add a patch allowing to select the binaries to be built.
After applying this change, the time to build host-cmake is roughly
25% shorter.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: Romain Naour <romain.naour@openwide.fr>
Tested-by: Romain Naour <romain.naour@openwide.fr>
---
changes v1 -> v2:
- handle target build (update _CONF_OPTS, cleanup
CMAKE_REMOVE_EXTRA_DATA hook)
---
Here is the actual results of the build I run on my machine:
4x Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
8GB RAM
SSD
w/o the patch, automatic job-level (i.e. 5 in my case):
675.36user 29.59system 4:21.72elapsed 269%CPU
686.98user 31.07system 4:26.85elapsed 269%CPU
694.84user 31.11system 4:35.42elapsed 263%CPU
697.24user 31.19system 4:32.17elapsed 267%CPU
686.62user 30.89system 4:23.00elapsed 272%CPU
696.28user 31.33system 4:29.15elapsed 270%CPU
677.73user 30.18system 4:15.15elapsed 277%CPU
692.62user 31.45system 4:47.56elapsed 251%CPU
679.78user 31.53system 4:20.99elapsed 272%CPU
685.63user 32.10system 4:28.15elapsed 267%CPU
w/o the patch, w/ BR2_JLEVEL=1:
340.58user 18.57system 6:19.26elapsed 94%CPU
337.48user 18.70system 6:16.41elapsed 94%CPU
335.39user 18.53system 6:13.74elapsed 94%CPU
335.93user 17.94system 6:13.84elapsed 94%CPU
335.49user 18.19system 6:13.67elapsed 94%CPU
w/ the patch, automatic job-level (i.e. 5 in my case):
494.96user 23.91system 3:13.87elapsed 267%CPU
506.90user 24.37system 3:16.83elapsed 269%CPU
504.37user 24.42system 3:17.57elapsed 267%CPU
499.79user 24.19system 3:04.50elapsed 284%CPU
507.02user 23.67system 3:04.93elapsed 286%CPU
510.93user 24.43system 3:08.19elapsed 284%CPU
512.43user 24.16system 3:08.53elapsed 284%CPU
510.80user 24.65system 3:08.64elapsed 283%CPU
512.28user 24.38system 3:09.62elapsed 283%CPU
514.90user 24.46system 3:08.96elapsed 285%CPU
w/ the patch, w/ BR2_JLEVEL=1:
244.56user 14.88system 4:36.88elapsed 93%CPU
247.02user 15.43system 4:39.89elapsed 93%CPU
247.14user 15.04system 4:39.76elapsed 93%CPU
246.32user 14.75system 4:38.93elapsed 93%CPU
247.53user 14.64system 4:40.27elapsed 93%CPU
---
...-allow-to-select-what-program-to-be-built.patch | 231 +++++++++++++++++++++
package/cmake/cmake.mk | 10 +-
2 files changed, 239 insertions(+), 2 deletions(-)
create mode 100644 package/cmake/0002-CMake-allow-to-select-what-program-to-be-built.patch
diff --git a/package/cmake/0002-CMake-allow-to-select-what-program-to-be-built.patch b/package/cmake/0002-CMake-allow-to-select-what-program-to-be-built.patch
new file mode 100644
index 0000000..37ade11
--- /dev/null
+++ b/package/cmake/0002-CMake-allow-to-select-what-program-to-be-built.patch
@@ -0,0 +1,231 @@
+From e727eebf04883c6af4a6d4584e33989c204b9b8f Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Sun, 25 Jan 2015 18:11:13 +0100
+Subject: [PATCH] CMake: allow to select what program to be built
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+---
+ CMakeLists.txt | 24 ++++++++++++++++++++++++
+ Source/CMakeLists.txt | 33 ++++++++++++++++++++++++++++++++-
+ 2 files changed, 56 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 71850de..cb9375e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -43,6 +43,16 @@ if(CMAKE_ENCODING_UTF8)
+ set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
+ endif()
+
++# options to select what programs to be built
++option(BUILD_CMAKE "Build cmake program" ON)
++mark_as_advanced(BUILD_CMAKE)
++
++option(BUILD_CTEST "Build ctest program" ON)
++mark_as_advanced(BUILD_CTEST)
++
++option(BUILD_CPACK "Build cpack program" ON)
++mark_as_advanced(BUILD_CPACK)
++
+ #-----------------------------------------------------------------------
+ # a macro to deal with system libraries, implemented as a macro
+ # simply to improve readability of the main script
+@@ -241,6 +251,7 @@ macro (CMAKE_BUILD_UTILITIES)
+
+ #---------------------------------------------------------------------
+ # Build zlib library for Curl, CMake, and CTest.
++ if(BUILD_CMAKE OR BUILD_CTEST OR NOT CMAKE_USE_SYSTEM_CURL)
+ set(CMAKE_ZLIB_HEADER "cm_zlib.h")
+ if(CMAKE_USE_SYSTEM_ZLIB)
+ find_package(ZLIB)
+@@ -256,9 +267,11 @@ macro (CMAKE_BUILD_UTILITIES)
+ add_subdirectory(Utilities/cmzlib)
+ CMAKE_SET_TARGET_FOLDER(cmzlib "Utilities/3rdParty")
+ endif()
++ endif()
+
+ #---------------------------------------------------------------------
+ # Build Curl library for CTest.
++ if(BUILD_CMAKE OR BUILD_CTEST)
+ if(CMAKE_USE_SYSTEM_CURL)
+ find_package(CURL)
+ if(NOT CURL_FOUND)
+@@ -284,9 +297,11 @@ macro (CMAKE_BUILD_UTILITIES)
+ CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
+ CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")
+ endif()
++ endif()
+
+ #---------------------------------------------------------------------
+ # Build Compress library for CTest.
++ if(BUILD_CMAKE OR BUILD_CTEST)
+ set(CMAKE_COMPRESS_INCLUDES
+ "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
+ set(CMAKE_COMPRESS_LIBRARIES "cmcompress")
+@@ -301,6 +316,7 @@ macro (CMAKE_BUILD_UTILITIES)
+ add_subdirectory(Utilities/cmbzip2)
+ CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
+ endif()
++ endif()
+
+ #---------------------------------------------------------------------
+ # Build or use system liblzma for libarchive.
+@@ -321,6 +337,7 @@ macro (CMAKE_BUILD_UTILITIES)
+
+ #---------------------------------------------------------------------
+ # Build or use system libarchive for CMake and CTest.
++ if(BUILD_CMAKE OR BUILD_CTEST)
+ if(CMAKE_USE_SYSTEM_LIBARCHIVE)
+ find_package(LibArchive)
+ if(NOT LibArchive_FOUND)
+@@ -347,9 +364,11 @@ macro (CMAKE_BUILD_UTILITIES)
+ CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty")
+ set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})
+ endif()
++ endif()
+
+ #---------------------------------------------------------------------
+ # Build expat library for CMake and CTest.
++ if(BUILD_CMAKE OR BUILD_CTEST)
+ if(CMAKE_USE_SYSTEM_EXPAT)
+ find_package(EXPAT)
+ if(NOT EXPAT_FOUND)
+@@ -364,9 +383,11 @@ macro (CMAKE_BUILD_UTILITIES)
+ add_subdirectory(Utilities/cmexpat)
+ CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
+ endif()
++ endif()
+
+ #---------------------------------------------------------------------
+ # Build XMLRPC library for CMake and CTest.
++ if(BUILD_CMAKE OR BUILD_CTEST)
+ if(CTEST_USE_XMLRPC)
+ find_package(XMLRPC QUIET REQUIRED libwww-client)
+ if(NOT XMLRPC_FOUND)
+@@ -376,6 +397,7 @@ macro (CMAKE_BUILD_UTILITIES)
+ set(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS})
+ set(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES})
+ endif()
++ endif()
+
+ #---------------------------------------------------------------------
+ # Use curses?
+@@ -583,7 +605,9 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ add_subdirectory(Utilities)
+ endif()
+
++if(BUILD_CTEST)
+ add_subdirectory(Tests)
++endif()
+
+ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ if(BUILD_TESTING)
+diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
+index 1ff1c16..d0145af 100644
+--- a/Source/CMakeLists.txt
++++ b/Source/CMakeLists.txt
+@@ -482,6 +482,7 @@ if(WIN32 AND NOT CYGWIN AND NOT BORLAND)
+ endif()
+
+ # create a library used by the command line and the GUI
++if(BUILD_CMAKE OR BUILD_CTEST OR BUILD_CPACK)
+ add_library(CMakeLib ${SRCS})
+ target_link_libraries(CMakeLib cmsys
+ ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES}
+@@ -497,6 +498,7 @@ endif()
+ if(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW)
+ target_link_libraries(CMakeLib rpcrt4)
+ endif()
++endif()
+
+ #
+ # CTestLib
+@@ -566,8 +568,10 @@ set(CTEST_SRCS cmCTest.cxx
+ )
+
+ # Build CTestLib
++if(BUILD_CTEST)
+ add_library(CTestLib ${CTEST_SRCS})
+ target_link_libraries(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_LIBRARIES})
++endif()
+
+ #
+ # Sources for CPack
+@@ -629,9 +633,12 @@ if(APPLE)
+ endif()
+
+ # Build CPackLib
++if(BUILD_CPACK)
+ add_library(CPackLib ${CPACK_SRCS})
+ target_link_libraries(CPackLib CMakeLib)
++endif()
+
++if(BUILD_CMAKE)
+ if(APPLE)
+ add_executable(cmakexbuild cmakexbuild.cxx)
+ target_link_libraries(cmakexbuild CMakeLib)
+@@ -640,36 +647,60 @@ if(APPLE)
+ target_link_libraries(OSXScriptLauncher cmsys)
+ target_link_libraries(OSXScriptLauncher "-framework CoreFoundation")
+ endif()
++endif()
+
+ # Build CMake executable
++if(BUILD_CMAKE)
+ add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h)
+ target_link_libraries(cmake CMakeLib)
++endif()
+
+ # Build CTest executable
++if(BUILD_CTEST)
+ add_executable(ctest ctest.cxx)
+ target_link_libraries(ctest CTestLib)
++endif()
+
+ # Build CPack executable
++if(BUILD_CPACK)
+ add_executable(cpack CPack/cpack.cxx)
+ target_link_libraries(cpack CPackLib)
++endif()
+
+ # Curses GUI
++if(BUILD_CMAKE)
+ if(BUILD_CursesDialog)
+ include(${CMake_SOURCE_DIR}/Source/CursesDialog/CMakeLists.txt)
+ endif()
++endif()
+
+ # Qt GUI
+ option(BUILD_QtDialog "Build Qt dialog for CMake" FALSE)
++if(BUILD_CMAKE)
+ if(BUILD_QtDialog)
+ add_subdirectory(QtDialog)
+ endif()
++endif()
+
+ include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
+ include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
+
+-install(TARGETS cmake ctest cpack DESTINATION bin)
++if(BUILD_CMAKE)
++install(TARGETS cmake DESTINATION bin)
++endif()
++
++if(BUILD_CTEST)
++install(TARGETS ctest DESTINATION bin)
++endif()
++
++if(BUILD_CPACK)
++install(TARGETS cpack DESTINATION bin)
++endif()
++
++if(BUILD_CMAKE)
+ if(APPLE)
+ install(TARGETS cmakexbuild DESTINATION bin)
+ endif()
++endif()
+
+ install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include)
+--
+2.3.1
+
diff --git a/package/cmake/cmake.mk b/package/cmake/cmake.mk
index 9a939bf..7e67c31 100644
--- a/package/cmake/cmake.mk
+++ b/package/cmake/cmake.mk
@@ -18,7 +18,10 @@ CMAKE_CONF_OPTS = \
-DKWSYS_CHAR_IS_SIGNED=TRUE \
-DCMAKE_USE_SYSTEM_LIBRARIES=1 \
-DCTEST_USE_XMLRPC=OFF \
- -DBUILD_CursesDialog=OFF
+ -DBUILD_CursesDialog=OFF \
+ -DBUILD_CMAKE=OFF \
+ -DBUILD_CTEST=ON \
+ -DBUILD_CPACK=OFF
# Get rid of -I* options from $(HOST_CPPFLAGS) to prevent that a
# header available in $(HOST_DIR)/usr/include is used instead of a
@@ -36,6 +39,10 @@ define HOST_CMAKE_CONFIGURE_CMDS
-DCMAKE_CXX_FLAGS="$(HOST_CMAKE_CXXFLAGS)" \
-DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
-DBUILD_CursesDialog=OFF \
+ -DBUILD_CMAKE=ON \
+ -DBUILD_CTEST=OFF \
+ -DBUILD_CPACK=OFF \
+ -DBUILD_TESTING=OFF \
)
endef
@@ -48,7 +55,6 @@ define HOST_CMAKE_INSTALL_CMDS
endef
define CMAKE_REMOVE_EXTRA_DATA
- rm $(TARGET_DIR)/usr/bin/{cmake,cpack}
rm -fr $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/{completions,editors}
rm -fr $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/{Help,include}
endef
--
2.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 3/4] toolchainfile.cmake: only search the sysroot for CMake module
2015-03-08 9:47 [Buildroot] [PATCH 0/4] CMake package and infra improvements Samuel Martin
2015-03-08 9:47 ` [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too Samuel Martin
2015-03-08 9:47 ` [Buildroot] [PATCH 2/4 v2] package/cmake: only build what is necessary Samuel Martin
@ 2015-03-08 9:47 ` Samuel Martin
2015-03-08 10:23 ` Yegor Yefremov
2015-03-16 21:17 ` Thomas Petazzoni
2015-03-08 9:47 ` [Buildroot] [PATCH 4/4] toolchainfile.cmake: set CXX variables wrt BR2_INSTALL_LIBSTDCPP value Samuel Martin
3 siblings, 2 replies; 12+ messages in thread
From: Samuel Martin @ 2015-03-08 9:47 UTC (permalink / raw)
To: buildroot
This change prevents CMake from searching outside the sysroot location
for CMake modules when cross-compiling.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
This patch is a better fix to [1] wrt the Arnout's comment [2]
[1] http://lists.busybox.net/pipermail/buildroot/2015-January/117994.html
[2] http://lists.busybox.net/pipermail/buildroot/2015-January/118154.html
---
support/misc/toolchainfile.cmake.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
index 816af13..cd41254 100644
--- a/support/misc/toolchainfile.cmake.in
+++ b/support/misc/toolchainfile.cmake.in
@@ -21,6 +21,7 @@ set(CMAKE_INSTALL_SO_NO_EXE 0)
set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin")
set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
--
2.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 4/4] toolchainfile.cmake: set CXX variables wrt BR2_INSTALL_LIBSTDCPP value
2015-03-08 9:47 [Buildroot] [PATCH 0/4] CMake package and infra improvements Samuel Martin
` (2 preceding siblings ...)
2015-03-08 9:47 ` [Buildroot] [PATCH 3/4] toolchainfile.cmake: only search the sysroot for CMake module Samuel Martin
@ 2015-03-08 9:47 ` Samuel Martin
2015-03-16 21:24 ` Thomas Petazzoni
3 siblings, 1 reply; 12+ messages in thread
From: Samuel Martin @ 2015-03-08 9:47 UTC (permalink / raw)
To: buildroot
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
package/pkg-cmake.mk | 1 +
support/misc/toolchainfile.cmake.in | 33 +++++++++++++++++++++++++++------
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 2404c40..c6b9eff 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -231,6 +231,7 @@ $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
@mkdir -p $(@D)
sed \
-e 's:@@STAGING_SUBDIR@@:$(call qstrip,$(STAGING_SUBDIR)):' \
+ -e 's:@@TARGET_HAS_LIBSTDCXX@@:$(if $(BR2_INSTALL_LIBSTDCPP),TRUE,FALSE):' \
-e 's:@@TARGET_CFLAGS@@:$(call qstrip,$(TARGET_CFLAGS)):' \
-e 's:@@TARGET_CXXFLAGS@@:$(call qstrip,$(TARGET_CXXFLAGS)):' \
-e 's:@@TARGET_LDFLAGS@@:$(call qstrip,$(TARGET_LDFLAGS)):' \
diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
index cd41254..395cf3f 100644
--- a/support/misc/toolchainfile.cmake.in
+++ b/support/misc/toolchainfile.cmake.in
@@ -17,6 +17,7 @@ set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@ ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot C
set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@ ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS")
set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@ ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Buildroot LDFLAGS")
set(CMAKE_INSTALL_SO_NO_EXE 0)
+set(TARGET_HAS_LIBSTDCXX @@TARGET_HAS_LIBSTDCXX@@)
set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin")
set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
@@ -35,25 +36,45 @@ if(DEFINED USE_CCACHE)
if(USE_CCACHE)
set(CMAKE_ASM_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/usr/bin/ccache")
- set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/usr/bin/ccache")
set(CMAKE_C_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
- set(CMAKE_CXX_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
+ if(TARGET_HAS_LIBSTDCXX)
+ set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/usr/bin/ccache")
+ set(CMAKE_CXX_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
+ else()
+ message(STATUS "Disabling C++ compiler because libstdc++ is not installed in the target filsystem")
+ set(CMAKE_CXX_COMPILER "CMAKE_CXX_COMPILER-NOTFOUND")
+ endif()
else()
set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
- set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
+ if(TARGET_HAS_LIBSTDCXX)
+ set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
+ else()
+ message(STATUS "Disabling C++ compiler because libstdc++ is not installed in the target filsystem")
+ set(CMAKE_CXX_COMPILER "CMAKE_CXX_COMPILER-NOTFOUND")
+ endif()
endif()
else()
find_program(CCACHE ccache HINTS "${RELOCATED_HOST_DIR}/usr/bin")
if(CCACHE)
set(CMAKE_ASM_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
set(CMAKE_C_COMPILER "${CCACHE}")
- set(CMAKE_CXX_COMPILER "${CCACHE}")
set(CMAKE_C_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
- set(CMAKE_CXX_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
+ if(TARGET_HAS_LIBSTDCXX)
+ set(CMAKE_CXX_COMPILER "${CCACHE}")
+ set(CMAKE_CXX_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
+ else()
+ message(STATUS "Disabling C++ compiler because libstdc++ is not installed in the target filsystem")
+ set(CMAKE_CXX_COMPILER "CMAKE_CXX_COMPILER-NOTFOUND")
+ endif()
message(STATUS "ccache program has been found and will be used for the build.")
message(STATUS " To disable ccache, add -DUSE_CCACHE=OFF on the cmake command line.")
else()
set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
- set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
+ if(TARGET_HAS_LIBSTDCXX)
+ set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
+ else()
+ message(STATUS "Disabling C++ compiler because libstdc++ is not installed in the target filsystem")
+ set(CMAKE_CXX_COMPILER "CMAKE_CXX_COMPILER-NOTFOUND")
+ endif()
endif()
endif()
--
2.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too
2015-03-08 9:47 ` [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too Samuel Martin
@ 2015-03-08 9:53 ` Baruch Siach
2015-03-08 11:29 ` Samuel Martin
2015-03-15 17:41 ` Thomas Petazzoni
1 sibling, 1 reply; 12+ messages in thread
From: Baruch Siach @ 2015-03-08 9:53 UTC (permalink / raw)
To: buildroot
Hi Samuel, Davide,
On Sun, Mar 08, 2015 at 10:47:20AM +0100, Samuel Martin wrote:
> From: Davide Viti <zinosat@tiscali.it>
>
> Useful for packages shipped with a testsuite which makes use of ctest
>
> Since ctest is just a tool provided by the cmake sources, this change
> introduces a hidden BR2_PACKAGE_CMAKE symbol which is automatically
> selected by the BR2_PACKAGE_CMAKE_CTEST one.
> This is like this mostly for consistency (cmake is the actual package,
> not ctest).
>
> CMake is a particular package:
peculiar ?
> * CMake can be built using the generic infrastructure or the cmake one.
> Since Buildroot has no requirement regarding the host system cmake
> program presence, it uses the generic infrastructure to build the
> host-cmake package, then the (target-)cmake package can be built
> using the cmake infrastructure;
> * CMake bundles its dependencies within its sources. This is the reason
> why the host-cmake package only has host-pkgconf as (runtime)
> dependency, whereas the (target-)cmake package has a lot of
> dependencies, using only the system-wide libraries instead of
> rebuilding and staitcally linking with the ones bundles into the CMake
> sources.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 3/4] toolchainfile.cmake: only search the sysroot for CMake module
2015-03-08 9:47 ` [Buildroot] [PATCH 3/4] toolchainfile.cmake: only search the sysroot for CMake module Samuel Martin
@ 2015-03-08 10:23 ` Yegor Yefremov
2015-03-16 21:17 ` Thomas Petazzoni
1 sibling, 0 replies; 12+ messages in thread
From: Yegor Yefremov @ 2015-03-08 10:23 UTC (permalink / raw)
To: buildroot
On Sun, Mar 8, 2015 at 10:47 AM, Samuel Martin <s.martin49@gmail.com> wrote:
> This change prevents CMake from searching outside the sysroot location
> for CMake modules when cross-compiling.
>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
> This patch is a better fix to [1] wrt the Arnout's comment [2]
>
> [1] http://lists.busybox.net/pipermail/buildroot/2015-January/117994.html
> [2] http://lists.busybox.net/pipermail/buildroot/2015-January/118154.html
> ---
> support/misc/toolchainfile.cmake.in | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
> index 816af13..cd41254 100644
> --- a/support/misc/toolchainfile.cmake.in
> +++ b/support/misc/toolchainfile.cmake.in
> @@ -21,6 +21,7 @@ set(CMAKE_INSTALL_SO_NO_EXE 0)
> set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin")
> set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
> set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> --
> 2.3.2
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too
2015-03-08 9:53 ` Baruch Siach
@ 2015-03-08 11:29 ` Samuel Martin
0 siblings, 0 replies; 12+ messages in thread
From: Samuel Martin @ 2015-03-08 11:29 UTC (permalink / raw)
To: buildroot
On Sun, Mar 8, 2015 at 10:53 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> Hi Samuel, Davide,
>
> On Sun, Mar 08, 2015 at 10:47:20AM +0100, Samuel Martin wrote:
>> From: Davide Viti <zinosat@tiscali.it>
>>
>> Useful for packages shipped with a testsuite which makes use of ctest
>>
>> Since ctest is just a tool provided by the cmake sources, this change
>> introduces a hidden BR2_PACKAGE_CMAKE symbol which is automatically
>> selected by the BR2_PACKAGE_CMAKE_CTEST one.
>> This is like this mostly for consistency (cmake is the actual package,
>> not ctest).
>>
>> CMake is a particular package:
>
> peculiar ?
argh! some remaining frenchism :-s
good catch btw ;-)
--
Samuel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too
2015-03-08 9:47 ` [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too Samuel Martin
2015-03-08 9:53 ` Baruch Siach
@ 2015-03-15 17:41 ` Thomas Petazzoni
1 sibling, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2015-03-15 17:41 UTC (permalink / raw)
To: buildroot
Dear Samuel Martin,
On Sun, 8 Mar 2015 10:47:20 +0100, Samuel Martin wrote:
> diff --git a/package/cmake/Config.in b/package/cmake/Config.in
> new file mode 100644
> index 0000000..3d31d7a
> --- /dev/null
> +++ b/package/cmake/Config.in
> @@ -0,0 +1,14 @@
> +config BR2_PACKAGE_CMAKE
> + bool
> +
> +config BR2_PACKAGE_CMAKE_CTEST
> + bool "ctest"
> + select BR2_PACKAGE_CMAKE
There was a missing dependency on C++ (CMake is written entirely in
C++), and also you forgot to 'select' all the libraries you have in
CMAKE_DEPENDENCIES. And one of them, libarchive, has a dependency on
wchar, that had to be propagated here.
Committed with those issues fixed.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 2/4 v2] package/cmake: only build what is necessary
2015-03-08 9:47 ` [Buildroot] [PATCH 2/4 v2] package/cmake: only build what is necessary Samuel Martin
@ 2015-03-15 17:52 ` Thomas Petazzoni
0 siblings, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2015-03-15 17:52 UTC (permalink / raw)
To: buildroot
Dear Samuel Martin,
On Sun, 8 Mar 2015 10:47:21 +0100, Samuel Martin wrote:
> Add a patch allowing to select the binaries to be built.
>
> After applying this change, the time to build host-cmake is roughly
> 25% shorter.
>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Reviewed-by: Romain Naour <romain.naour@openwide.fr>
> Tested-by: Romain Naour <romain.naour@openwide.fr>
To be honest, I am not sure if we should apply such a large patch just
for the sake of build speed. Can you submit the patch upstream and see
what they think about it? If it gets merged upstream, then we have a
better case for backporting it until upstream makes a new release.
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 3/4] toolchainfile.cmake: only search the sysroot for CMake module
2015-03-08 9:47 ` [Buildroot] [PATCH 3/4] toolchainfile.cmake: only search the sysroot for CMake module Samuel Martin
2015-03-08 10:23 ` Yegor Yefremov
@ 2015-03-16 21:17 ` Thomas Petazzoni
1 sibling, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2015-03-16 21:17 UTC (permalink / raw)
To: buildroot
Dear Samuel Martin,
On Sun, 8 Mar 2015 10:47:22 +0100, Samuel Martin wrote:
> This change prevents CMake from searching outside the sysroot location
> for CMake modules when cross-compiling.
>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Applied, thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 4/4] toolchainfile.cmake: set CXX variables wrt BR2_INSTALL_LIBSTDCPP value
2015-03-08 9:47 ` [Buildroot] [PATCH 4/4] toolchainfile.cmake: set CXX variables wrt BR2_INSTALL_LIBSTDCPP value Samuel Martin
@ 2015-03-16 21:24 ` Thomas Petazzoni
0 siblings, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2015-03-16 21:24 UTC (permalink / raw)
To: buildroot
Dear Samuel Martin,
On Sun, 8 Mar 2015 10:47:23 +0100, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
This is a non-trivial patch, and the commit log is empty. Why?
> diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
> index cd41254..395cf3f 100644
> --- a/support/misc/toolchainfile.cmake.in
> +++ b/support/misc/toolchainfile.cmake.in
> @@ -17,6 +17,7 @@ set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@ ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot C
> set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@ ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS")
> set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@ ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Buildroot LDFLAGS")
> set(CMAKE_INSTALL_SO_NO_EXE 0)
> +set(TARGET_HAS_LIBSTDCXX @@TARGET_HAS_LIBSTDCXX@@)
>
> set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin")
> set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> @@ -35,25 +36,45 @@ if(DEFINED USE_CCACHE)
> if(USE_CCACHE)
> set(CMAKE_ASM_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
> set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/usr/bin/ccache")
> - set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/usr/bin/ccache")
> set(CMAKE_C_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
> - set(CMAKE_CXX_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
> + if(TARGET_HAS_LIBSTDCXX)
> + set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/usr/bin/ccache")
> + set(CMAKE_CXX_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
> + else()
> + message(STATUS "Disabling C++ compiler because libstdc++ is not installed in the target filsystem")
> + set(CMAKE_CXX_COMPILER "CMAKE_CXX_COMPILER-NOTFOUND")
> + endif()
> else()
> set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
> - set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
> + if(TARGET_HAS_LIBSTDCXX)
> + set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
> + else()
> + message(STATUS "Disabling C++ compiler because libstdc++ is not installed in the target filsystem")
> + set(CMAKE_CXX_COMPILER "CMAKE_CXX_COMPILER-NOTFOUND")
> + endif()
> endif()
> else()
> find_program(CCACHE ccache HINTS "${RELOCATED_HOST_DIR}/usr/bin")
> if(CCACHE)
> set(CMAKE_ASM_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
> set(CMAKE_C_COMPILER "${CCACHE}")
> - set(CMAKE_CXX_COMPILER "${CCACHE}")
> set(CMAKE_C_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
> - set(CMAKE_CXX_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
> + if(TARGET_HAS_LIBSTDCXX)
> + set(CMAKE_CXX_COMPILER "${CCACHE}")
> + set(CMAKE_CXX_COMPILER_ARG1 "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
> + else()
> + message(STATUS "Disabling C++ compiler because libstdc++ is not installed in the target filsystem")
> + set(CMAKE_CXX_COMPILER "CMAKE_CXX_COMPILER-NOTFOUND")
> + endif()
> message(STATUS "ccache program has been found and will be used for the build.")
> message(STATUS " To disable ccache, add -DUSE_CCACHE=OFF on the cmake command line.")
> else()
> set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC_NOCCACHE@@")
> - set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
> + if(TARGET_HAS_LIBSTDCXX)
> + set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX_NOCCACHE@@")
> + else()
> + message(STATUS "Disabling C++ compiler because libstdc++ is not installed in the target filsystem")
> + set(CMAKE_CXX_COMPILER "CMAKE_CXX_COMPILER-NOTFOUND")
> + endif()
> endif()
> endif()
This is doing multiple times the same thing.
First of all, why do we have those two cases for the ccache support:
if(DEFINED USE_CCACHE)
if(USE_CCACHE)
...
else()
...
endif()
else()
find_program(CCACHE ccache HINTS "${RELOCATED_HOST_DIR}/usr/bin")
if(CCACHE)
...
else()
...
endif()
endif()
The first case is when the toolchain file is used by Buildroot itself,
the second case when it's used outside of Buildroot. But why don't we
use the find_program() trick in both cases ?
Shouldn't we instead do:
find_program(CCACHE ccache HINTS "${RELOCATED_HOST_DIR}/usr/bin")
if (CCACHE and USE_CCACHE)
...
else()
...
endif()
Regarding the C++ stuff, the non-C++ case is the same between having
ccache and not having ccache, so you could factorize that a bit.
Could you rework this a bit?
Thanks a lot,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-03-16 21:24 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-08 9:47 [Buildroot] [PATCH 0/4] CMake package and infra improvements Samuel Martin
2015-03-08 9:47 ` [Buildroot] [PATCH 1/4 v5] package/cmake: make ctest a target package too Samuel Martin
2015-03-08 9:53 ` Baruch Siach
2015-03-08 11:29 ` Samuel Martin
2015-03-15 17:41 ` Thomas Petazzoni
2015-03-08 9:47 ` [Buildroot] [PATCH 2/4 v2] package/cmake: only build what is necessary Samuel Martin
2015-03-15 17:52 ` Thomas Petazzoni
2015-03-08 9:47 ` [Buildroot] [PATCH 3/4] toolchainfile.cmake: only search the sysroot for CMake module Samuel Martin
2015-03-08 10:23 ` Yegor Yefremov
2015-03-16 21:17 ` Thomas Petazzoni
2015-03-08 9:47 ` [Buildroot] [PATCH 4/4] toolchainfile.cmake: set CXX variables wrt BR2_INSTALL_LIBSTDCPP value Samuel Martin
2015-03-16 21:24 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox