-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve TribitsExampleProject and TribitsExampleApp readme #445
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
The project `TribitsExampleProject` defines a TriBITS CMake project designed to | ||
provide a simple example to demonstrate how to use the TriBITS system to | ||
create a CMake build, test, and deployment system using a package-based | ||
architecture. | ||
architecture. To build all of the packages from `TribitsExampleProject`, | ||
a Fortran compiler is needed. | ||
|
||
To build and test the project, one must first create a build directory and | ||
configure by pointing to the TriBITS source dir `<tribits-dir>` | ||
|
@@ -19,16 +20,28 @@ with: | |
-DTribitsExProj_TRIBITS_DIR=<tribits-dir> \ | ||
-DTribitsExProj_ENABLE_TESTS=ON \ | ||
-DTribitsExProj_ENABLE_ALL_PACKAGES=ON | ||
-DTribitsExProj_ENABLE_SECONDARY_TESTED_CODE=ON \ | ||
-DCMAKE_CXX_COMPILER=g++ \ | ||
<path-to-TribitsExampleProject> | ||
``` | ||
|
||
and then build and test with: | ||
then build and test with: | ||
|
||
``` | ||
make -j4 && ctest -j4 | ||
``` | ||
|
||
and then install: | ||
|
||
``` | ||
make DESTDIR=<path-to-install-dir> install | ||
``` | ||
|
||
`TribitsExampleProject` will be installed to | ||
`<path-to-install-dir>/usr/local/` and this path should be then used | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that true? It will install to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello Ross, marcin@pop-os ~/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/build
ls -la ../install
total 8
drwxrwxr-x 2 marcin marcin 4096 lut 4 10:47 .
drwxrwxr-x 7 marcin marcin 4096 lut 4 10:47 ..
marcin@pop-os ~/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/build
make DESTDIR=/home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install install
Consolidate compiler generated dependencies of target simplecxx
[ 5%] Built target simplecxx
Consolidate compiler generated dependencies of target simplecxx-helloworld
[ 10%] Built target simplecxx-helloworld
Consolidate compiler generated dependencies of target SimpleCxx_HelloWorldTests
[ 16%] Built target SimpleCxx_HelloWorldTests
Consolidate compiler generated dependencies of target mixedlang
[ 29%] Built target mixedlang
Consolidate compiler generated dependencies of target MixedLang_RayTracerTests
[ 35%] Built target MixedLang_RayTracerTests
Consolidate compiler generated dependencies of target pws_a
[ 40%] Built target pws_a
Consolidate compiler generated dependencies of target WithSubpackagesA_a_test
[ 45%] Built target WithSubpackagesA_a_test
Consolidate compiler generated dependencies of target pws_b
[ 51%] Built target pws_b
Consolidate compiler generated dependencies of target WithSubpackagesB_b_test
[ 56%] Built target WithSubpackagesB_b_test
Consolidate compiler generated dependencies of target b_test_utils
[ 62%] Built target b_test_utils
Consolidate compiler generated dependencies of target b_mixed_lang
[ 67%] Built target b_mixed_lang
Consolidate compiler generated dependencies of target WithSubpackagesB_test_of_b_mixed_lang
[ 72%] Built target WithSubpackagesB_test_of_b_mixed_lang
Consolidate compiler generated dependencies of target c_util
[ 78%] Built target c_util
Consolidate compiler generated dependencies of target pws_c
[ 83%] Built target pws_c
Consolidate compiler generated dependencies of target WithSubpackagesC_c_test
[ 89%] Built target WithSubpackagesC_c_test
Consolidate compiler generated dependencies of target c_b_mixed_lang
[ 94%] Built target c_b_mixed_lang
Consolidate compiler generated dependencies of target WithSubpackagesC_test_of_c_b_mixed_lang
[100%] Built target WithSubpackagesC_test_of_c_b_mixed_lang
Install the project...
-- Install configuration: "RELEASE"
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/external_packages/HeaderOnlyTpl/HeaderOnlyTplConfig.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/external_packages/HeaderOnlyTpl/HeaderOnlyTplConfigVersion.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/TribitsExProj_version.h
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/libsimplecxx.a
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/SimpleCxx_config.h
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/SimpleCxx_HelloWorld.hpp
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/bin/simplecxx-helloworld
-- Set runtime path of "/home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/bin/simplecxx-helloworld" to "/usr/local/lib"
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/SimpleCxx/SimpleCxxConfig.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/SimpleCxx/SimpleCxxTargets.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/SimpleCxx/SimpleCxxTargets-release.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/libmixedlang.a
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/MixedLang_config.h
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/MixedLang.hpp
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/Ray_Tracer.hh
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/Ray.hh
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/MixedLang/MixedLangConfig.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/MixedLang/MixedLangTargets.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/MixedLang/MixedLangTargets-release.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/libpws_a.a
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/A.hpp
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesA/WithSubpackagesAConfig.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesA/WithSubpackagesATargets.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesA/WithSubpackagesATargets-release.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/libpws_b.a
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/B.hpp
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/WithSubpackagesB_config.h
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/share/WithSubpackagesB/stuff
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/share/WithSubpackagesB/stuff/regular_file.txt
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/share/WithSubpackagesB/stuff/exec_script.sh
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesB/WithSubpackagesBConfig.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesB/WithSubpackagesBTargets.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesB/WithSubpackagesBTargets-release.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/libpws_c.a
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/wsp_c/C.hpp
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesC/WithSubpackagesCConfig.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesC/WithSubpackagesCTargets.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackagesC/WithSubpackagesCTargets-release.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackages/WithSubpackagesConfig.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/WithSubpackages/WithSubpackagesTargets.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/TribitsExProj/TribitsExProjConfig.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/lib/cmake/TribitsExProj/TribitsExProjConfigVersion.cmake
-- Installing: /home/marcin/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/install/usr/local/include/TribitsExProjConfig.cmake
marcin@pop-os ~/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/build
ls -la ../install
total 12
drwxrwxr-x 3 marcin marcin 4096 lut 4 10:50 .
drwxrwxr-x 7 marcin marcin 4096 lut 4 10:47 ..
drwxrwxr-x 3 marcin marcin 4096 lut 4 10:50 usr
marcin@pop-os ~/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/build
ls -la ../install/usr
total 12
drwxrwxr-x 3 marcin marcin 4096 lut 4 10:50 .
drwxrwxr-x 3 marcin marcin 4096 lut 4 10:50 ..
drwxrwxr-x 6 marcin marcin 4096 lut 4 10:50 local
marcin@pop-os ~/Dokumenty/NGA/projects/tribits_test/TriBITS/tribits/examples/TribitsExampleProject/build
ls -la ../install/usr/local
total 24
drwxrwxr-x 6 marcin marcin 4096 lut 4 10:50 .
drwxrwxr-x 3 marcin marcin 4096 lut 4 10:50 ..
drwxrwxr-x 2 marcin marcin 4096 lut 4 10:50 bin
drwxrwxr-x 3 marcin marcin 4096 lut 4 10:50 include
drwxrwxr-x 4 marcin marcin 4096 lut 4 10:50 lib
drwxrwxr-x 3 marcin marcin 4096 lut 4 10:50 share There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay then, you definitely don't want to encourage that. No one wants things installed under
|
||
to point `-DCMAKE_PREFIX_PATH=<path-to-install-dir>/usr/local/` when | ||
building e.g. `TribitsExampleApp` | ||
|
||
The layout of a TriBITS project is described in: | ||
|
||
* https://tribits.org/doc/TribitsUsersGuide.html#tribits-project-structure | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you confirm this works? I know this works if the CMake project is using
GNUInstallDirs.cmake
and specifyinginstall()
commands correctly but I am not sure if TriBITS is doing that yet. See #411.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine for my, that's what I did on my machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! But I thinks that only works if you specify relative paths for the various install dirs fir includes, libs, etc. But that is the default so that is why this is working I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here some more info about DESTDIR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that is really what DESTDIR does then you don't want to use it. No one wants things installed under
<install-prefix>/user/local
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is wrong with using
-D CMAKE_INSTALL_PREFIX=<install-prefix>
? That does what people want (i.e. installs headers under<install-prefix>/include
, libraries under<install-prefix>/libs
, etc.) and has worked for years. The other option is to use the newercmake --install <build-dir> --prefix <install-prefix>
command supported with CMake 3.15+. Have you tried that? That has the advantage that it works with any build tool (i.e. Makefiles or Ninja).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ross, there is nothing wrong with it. It was just a proposal. It could stay as it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DESTDIR
is mentioned here as well. I will change it as you wanted.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DESTDIR
is obviously an old Makefiles standard and CMake supports it to be a drop-in replacement for other old Makefile-based build systems. But that does not mean that you have to use it or encourage that people use it. It seems the purpose is to allow people to test the installation of things that should go under /usr/local without actually doing it. That is never that case with most of the software we are installing.Let's never mention or use
DESTDIR
in TriBITS documentation or processes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcinwrobel1986, more careful reading of:
make it clear that
DESTDIR
is just used for "staging installs" and not for the actual final install location itself. I got confirmation from Kitware that this is how this is used. It seems the CMake documentation for DESTDIR and "Professional CMake: 10th edition" don't really mention howDESTDIR
is supposed to be used (that it is not for the final install destination). That variable name DESTDIR is a terrible name because it does not explain the intent of the variable. Based on its intent, it should be called something likeSTAGING_PREFIX
(see section "The Most Important Naming Consideration" in Chapter 11 "The Power of Variable Names" in the book "Code Complete: 2nd Edition").