-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add linux build instructions #60
base: main
Are you sure you want to change the base?
Changes from all commits
2bff28a
5ec81a1
fcdcfa7
fc97639
8c7d593
3371856
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Build and Package {{cookiecutter.project_name}} | ||
|
||
This document summarizes how to build and package {{cookiecutter.project_name}} on Linux. | ||
|
||
{{cookiecutter.project_name}} is a custom Slicer application. Reading the [3D Slicer Developer Documentation](https://slicer.readthedocs.io/en/latest/developer_guide/index.html) may help answer additional questions. | ||
|
||
The initial source files were created using [KitwareMedical/SlicerCustomAppTemplate](https://github.com/KitwareMedical/SlicerCustomAppTemplate). | ||
|
||
## Clone | ||
|
||
```sh | ||
git clone https://github.com/{{cookiecutter.github_organization}}/{{cookiecutter.github_project}}.git | ||
``` | ||
|
||
## Prerequisites | ||
|
||
Install the prerequisites as described in the [Slicer documentation for building on Linux](https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/linux.html). This includes development tools, support libraries, and Qt. | ||
|
||
## Build | ||
|
||
Note: The build process can take hours. | ||
|
||
Build: | ||
|
||
```sh | ||
cmake \ | ||
-DCMAKE_BUILD_TYPE:STRING=Release \ | ||
-DQt5_DIR:PATH=/opt/qt/5.15.2/gcc_64/lib/cmake/Qt5 \ | ||
-S {{cookiecutter.github_project}} \ | ||
-B {{cookiecutter.github_project}}-SuperBuild-Release | ||
cd {{cookiecutter.github_project}}-SuperBuild-Release | ||
make -j<N> | ||
``` | ||
|
||
where `<N>` is the number of parallel builds. As a rule of thumb, many use the `number of CPU threads - 1` as the number of parallel builds. | ||
On Ubuntu 20.04, the default Qt5 packages are too old and so the Slicer documentation linked above should have suggested a method of installing Qt 5.15.2; | ||
if you installed it to `/opt/qt`, for example, then an extra option like `-DQt5_DIR:PATH=/opt/qt/5.15.2/gcc_64/lib/cmake/Qt5` would be needed in the `cmake` command above. | ||
|
||
Once the application is built, there will be an _inner build_ inside the _superbuild_ folder, located at `{{cookiecutter.app_name}}-SuperBuild-Release/Slicer-build`. The application executable is contained in this _inner build_ folder. | ||
|
||
## Package | ||
|
||
From the _inner build_ folder: | ||
|
||
```sh | ||
make package | ||
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. Likwwise, it could be best as is, though my usual approach is cmake --build . --target package -j<N> (Also usually including 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. Sorry, I'm wrong. I do that from the inner build folder. 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. I guess the advantage is that it's a more platform-independent command. I like that aspect of it, but I also prefer a simple and easy to remember command. |
||
``` |
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.
It could be best as is, though my usual approach is instead
(Actually, I usually also throw in a
--config Release
for good measure, but I have no idea whether that is useful.)