-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from kahypar/build_release_archive_fix
Script for Building Mt-KaHyPar from a Release Archive (#127)
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,8 @@ The following command will install most of the required dependencies on a Ubuntu | |
Building Mt-KaHyPar | ||
----------- | ||
|
||
To build Mt-KaHyPar, you can run the `build.sh` script (creates a `build` folder) or use the following commands: | ||
|
||
1. Clone the repository including submodules: | ||
|
||
```git clone --depth=1 --recursive [email protected]:kahypar/mt-kahypar.git``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
function get_num_cores { | ||
if [[ $(uname) == "Linux" ]]; then grep -c ^processor /proc/cpuinfo; fi | ||
if [[ $(uname) == "Darwin" ]]; then sysctl -n hw.ncpu; fi | ||
} | ||
|
||
ROOT=${PWD} | ||
if [ -d .git ]; then | ||
# Mt-KaHyPar is build from a git repository | ||
git submodule update --init; | ||
else | ||
# Mt-KaHyPar is build from a release archive | ||
# which does not include submodules | ||
./scripts/checkout_submodules.sh | ||
fi | ||
|
||
CMAKE_COMMANDS=$1 | ||
if [ ! -f build/Makefile ]; then | ||
mkdir -p build | ||
fi | ||
|
||
cd build && cmake .. -DCMAKE_BUILD_TYPE=Release $CMAKE_COMMANDS && cd ${ROOT} | ||
cmake --build build --parallel "$(get_num_cores)" --target MtKaHyPar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
source scripts/submodule_heads.sh | ||
ROOT=${PWD} | ||
|
||
# Initialize GOOGLETEST | ||
[ ! "$(ls -A external_tools/googletest)" ] && | ||
git clone https://github.com/google/googletest.git external_tools/googletest && | ||
cd external_tools/googletest && git checkout ${GOOGLETEST_HEAD} && cd ${ROOT} | ||
|
||
# Initialize KAHYPAR | ||
[ ! "$(ls -A external_tools/kahypar)" ] && | ||
git clone https://github.com/SebastianSchlag/kahypar.git external_tools/kahypar && | ||
cd external_tools/kahypar && git checkout ${KAHYPAR_HEAD} && cd ${ROOT} | ||
|
||
# Initialize WHFC | ||
[ ! "$(ls -A external_tools/WHFC)" ] && | ||
git clone https://github.com/larsgottesbueren/WHFC.git external_tools/WHFC && | ||
cd external_tools/WHFC && git checkout ${WHFC_HEAD} && cd ${ROOT} | ||
|
||
# Initialize PYBIND11 | ||
[ ! "$(ls -A python/pybind11)" ] && | ||
git clone https://github.com/pybind/pybind11.git python/pybind11 && | ||
cd python/pybind11 && git checkout ${PYBIND11_HEAD} && cd ${ROOT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
SUBMODULE_FILE=".gitmodules" | ||
|
||
IFS=$'\n' | ||
submodule_dirs=( $(grep path $SUBMODULE_FILE | cut -d'=' -f2 | cut -d' ' -f2) ) | ||
module_names=( $(grep path $SUBMODULE_FILE | cut -d'=' -f2 | cut -d' ' -f2 | cut -d"/" -f2 | awk '{print toupper($0)}') ) | ||
git_repos=( $(grep url $SUBMODULE_FILE | cut -d'=' -f2 | cut -d' ' -f2) ) | ||
|
||
# Generate script exporting commit hashes of submodules as environment variable | ||
echo "#!/bin/bash" > scripts/submodule_heads.sh | ||
for i in "${!submodule_dirs[@]}"; do | ||
echo "export ${module_names[$i]}_HEAD=\"$(cat .git/modules/${submodule_dirs[$i]}/HEAD)\"" >> scripts/submodule_heads.sh | ||
done | ||
|
||
# Generate script that checkouts submodules | ||
echo "#!/bin/bash" > scripts/checkout_submodules.sh | ||
echo "source scripts/submodule_heads.sh" >> scripts/checkout_submodules.sh | ||
echo "ROOT=\${PWD}" >> scripts/checkout_submodules.sh | ||
for i in "${!submodule_dirs[@]}"; do | ||
echo "" >> scripts/checkout_submodules.sh | ||
echo "# Initialize ${module_names[$i]}" >> scripts/checkout_submodules.sh | ||
echo "[ ! \"\$(ls -A ${submodule_dirs[$i]})\" ] &&" >> scripts/checkout_submodules.sh | ||
echo "git clone ${git_repos[$i]} ${submodule_dirs[$i]} &&" >> scripts/checkout_submodules.sh | ||
echo "cd ${submodule_dirs[$i]} && git checkout \${${module_names[$i]}_HEAD} && cd \${ROOT}" >> scripts/checkout_submodules.sh | ||
done | ||
|
||
chmod u+x scripts/submodule_heads.sh | ||
chmod u+x scripts/checkout_submodules.sh | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
export GOOGLETEST_HEAD="53495a2a7d6ba7e0691a7f3602e9a5324bba6e45" | ||
export KAHYPAR_HEAD="e38d82c712b9c892b50f924c155290d6823642cb" | ||
export WHFC_HEAD="a6c1a11cbc35f18f54ce2124ec1cd60c8249c28a" | ||
export PYBIND11_HEAD="ee2b5226295d67b690faddd446a329bb2840a1a8" |