Skip to content
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

Build w/o sudo & Use cmake --install #11

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
- name: Build an Example
shell: bash
run: |
./cmake-easyinstall --prefix="C:\\\\Program Files\PNGwriter" git+https://github.com/openPMD/openPMD-api.git
./cmake-easyinstall --prefix="C:\\\\Program Files\openPMD\openPMD-api" git+https://github.com/openPMD/openPMD-api.git
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ Note: `cmake-options` take precedence over `--prefix` takes precedence over envi
## Dependencies

- bash
- cmake 3.12.0+
- cmake 3.15.0+
- git
- ninja, make, or any other [native build system](https://cmake.org/cmake/help/v3.16/manual/cmake-generators.7.html)
19 changes: 10 additions & 9 deletions cmake-easyinstall
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# License: BSD-2-Clause
#
# dependencies: bash, cmake 3.12.0+, git
# dependencies: bash, cmake 3.15.0+, git

set -eu -o pipefail

Expand Down Expand Up @@ -73,23 +73,24 @@ git clone \
--depth 1 --shallow-submodules \
${git_url} ${git_branch} ${tmp_dir}/src

# execute
# configure
cd ${tmp_dir}/build
if [ -z "${CEI_PREFIX}" ]; then
${CEI_CMAKE} ../src -DCMAKE_BUILD_TYPE=${CEI_CONFIG} ${cmake_opts}
else
${CEI_CMAKE} ../src -DCMAKE_BUILD_TYPE=${CEI_CONFIG} -DCMAKE_INSTALL_PREFIX="${CEI_PREFIX}" ${cmake_opts}
fi

# build
${CEI_CMAKE} --build . --config ${CEI_CONFIG} --parallel ${CEI_PARALLEL}

# install
if [ -z "${CEI_SUDO}" ]; then
${CEI_CMAKE} --build . --target install --config ${CEI_CONFIG} --parallel ${CEI_PARALLEL}
${CEI_CMAKE} --install . --config ${CEI_CONFIG}
else
${CEI_SUDO} ${CEI_CMAKE} --build . --target install --config ${CEI_CONFIG} --parallel ${CEI_PARALLEL}
${CEI_SUDO} ${CEI_CMAKE} --install . --config ${CEI_CONFIG}
fi

# remove temporary directory
cd -
if [ -z "${CEI_SUDO}" ]; then
rm -rf ${tmp_dir}
else
${CEI_SUDO} rm -rf ${tmp_dir}
fi
rm -rf ${tmp_dir}