-
Notifications
You must be signed in to change notification settings - Fork 26
Developer: Notes
- Install
gperftoolsandlibunwind. - Enable
gperfoolssupport in CMake: e.g.cd build/debug && cmake -DDNG_DEVEL_ENABLE_GPERFTOOLS=1 ../.. - Run dng the
CPUPROFILEenv variable set: e.g.env CPUPROFILE=dng-loglike.prof src/dng-loglike .... - Run
pprofto analyze output
Note: gperftools can produce false output if the program links against libraries that have had their symbols stripped. This is because it cannot accurately find the name of non-exported functions without the symbols.
Callgrind is slower than gperftools, but can provide more detailed information including information about cache misses.
valgrind --tool=callgrind [callgrind options] your-program [program options]
-
Review log and write comprehensive commit message
-
Squash branch and add commit message to beginning of log:
git checkout -b feature/xyz-squashed feature/xyz git rebase -i develop -
If needed issue
git mergetool -t meldto resolve issues. Andgit rebase --continueto continue.
In order to build a Linux binary that will work on most systems, use an old version of Linux. We have chosen CentOS 5, which first came out in 2007.
-
Download ISO from http://isoredirect.centos.org/centos/5/isos/x86_64/ and install it on a virtual machine.
-
Install Developer Toolset 2.1 from http://linux.web.cern.ch/linux/devtoolset/#dts21
-
Extract CMake binary from http://www.cmake.org/download/
-
Enable the toolset from the command line:
scl enable devtoolset-2 bash -
Configure and build DeNovoGear:
cd ~/denovogear*/build ~/cmake*/bin/cmake .. -DBUILD_EXTERNAL_PROJECTS=1 -DUSE_STATIC_LIBS=1 -DCMAKE_BUILD_TYPE=Release make make package
curl https://api.github.com/repos/denovogear/denovogear/releases | jq -r '.[].assets[] | [.["name"], .["download_count"]] | @csv'
env CTEST_OUTPUT_ON_FAILURE=1 ninja test
or
ctest -V
If you add or edit files in the test data repository you will need to edit the Tests/CMakeLists.txt file of the denovogear repo to ensure the new data is downloaded when tests are run. Specifically you need to include the sha-1 hash for the commit that includes your changes and an SHA256 checksum for the contents of the repo.
SET(TESTDATA_COMMIT c4ff355)
SET(TESTDATA_SHA256 b8c2f82f6b6662d1826e99722e378b2e6af25499eed553c4ec451633ce45935d)The sha can be found on the repo's github page, or by typing git log on your local machine.
The SHA256 checksum can be generated by editing TESTDATA_COMMIT and calling
make make_testdata_sumSee #113.
The sum can also be generated with a one-liner
wget -q -O - https://api.github.com/repos/denovogear/testdata/tarball/${commit-sha} | sha256sumRun make testdata to verify that it works.
17
http://en.cppreference.com/w/cpp/types/climits
http://en.cppreference.com/w/cpp/types/numeric_limits/max_digits10
- Install Eclipse CDT
- Checkout denovogear (assuming into directory $WORKSPACE/denovogear)
- Open Eclipse and go to File -> New -> C++ Project, create project with properties:
- Empty Project
- (Default) Location should be set to $WORKSPACE
- Project Name: denovogear (Should say 'Directory with that name already exists')
- Linux GCC Toolchains
- Create a Make Target to execute cmake command
- Window -> Show View -> Other -> Make -> Make Target
- In "Make Target" window go to build directory and click on "New Make Target" button. * Target name: CMake Debug * Make target: [leave blank] * Build command: cmake -DCMAKE_BUILD_TYPE=Debug ..
- Once created, click on the hammer to build target. Open Window -> Other -> General -> Console to see the progress of the cmake command.
- Ninja: Create a target for running the ninja. In the build directory Create a target with; * Target name: CMake Debug Ninja * Make target: [leave blank] * Build command: cmake -DCMAKE_BUILD_TYPE=Debug -D"Ninja" ..
- Optional: Create a target for running the unit-tests. In the build directory Create another target with name "Make Test", Make Target = "test", and Build command = "make".
- Get the make command to run properly.
- Right click on the project in the Project Explorer and go to Properties -> C/C++ Build -> Builder Settings tab
- Build command:
make -j4 - Build directory: $WORKSPACE/denovogear/build
-
Open the Behavior tab and: * Tick "Enable parallel build" * Build (Incremental build): [blank value]
-
Click on the Project and go to Project -> Build Project. Output of make will be displayed in the console.
-
Nanja: Make sure target "CMake Debug Ninja" exist and set Build command:
PATH_NINJA_COMMAND -
Get the C++ Indexer working
-
Right click on the Project in the Project Explorer window and go to Project -> Properties -> C/C++ General -> Paths and Symbols -> Source Location Tab: * Set the source folder to only be /denovogear/src * Click Edit Filter and add exclusion rules for **/*.in, **/*.txt and **/*.xmh.
-
Go to C/C++ General -> Preprocessor Include Paths -> Providers tab and select "CDT GCC Build-in Compiler Settings" * To the command line arguments add -std=C++11
-
Click on Project -> C/C++ Index -> Rebuild
-
Note: If Eclipse is still showing unresolved classes in boost/std/htslib, right click on the project and select Index -> Freshen all files and let the index rebuild completely. Otherwise unresolved links should only occur if headers are missing or not properly included.
-
Note: If Eclipse is still showing unresolved classes Eigen, then you need to manually add Eigen to include path. * Right click on the project in the Project Explorer and go to Properties -> C/C++ General -> Paths and Symbols.
* Go to "Includes" tab and select "GNC C++". Click "Add..." and select the location of${INCLUDE_DIR}/eigen3/and${INCLUDE_DIR}/eigen3/unsupported/folder. -
Set up Run/Debug environment.
-
Right click on Project and go to Run As -> Run Configuration
-
Create New C/C++ Application * In Main tab set the C/C++ Application: build/src/dng-call * In the Arguments tab use the add any Program arguments as a single line.
-
Click on the Project, then choose Run -> Run or Run -> Debug. Output will be displayed in console window.
-
Set up Code Style.
-
Go to
Window -> Preferences -> C/C++ -> Code Style -> Name Style* Go toCodeand select the following (based on Naming and Class_Format ):- Constant: Upper Case, Word Delimiter=
_ - Variable: Lower Case, Word Delimiter=
_ - Class Field: Lower Case, Word Delimiter=
_, Suffix='_' - Class Method: Camel Case
- Getter Method: Original
- Setter Method: Original, prefix=
set_* Go toFilesand select the following: - C++ Header File: Lower Case, Word Delimiter=
_, Suffix=.h - C++ Source File: Lower Case, Word Delimiter=
_, Suffix=.cc
- Constant: Upper Case, Word Delimiter=
-
Go to
Window -> Preferences -> C/C++ -> Code Style -> Formatter* Create a new profile based onK&R* ClickEditand change the following-
Indentation- tickStatements with 'switch' body -
New Lines- tickbefore colon in constructor initializer list
-
- TODO: Go to Formatter and Import the denovogear code format configuration file (which does not exist yet)
- Troubleshooting
- If nothing happen after using
build target, try resetting thebuild locationinProperties->C/C++ Build->Builder Settings
TODO: Get Eclipse to run ninja, git, and use proper code formatting.