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

Update CMake build #7

Merged
merged 4 commits into from
Oct 19, 2023
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
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.12)

project(bmic C)
project(bmic LANGUAGES C)

set(BMI_VERSION 2.0)
include(GNUInstallDirs)

configure_file(${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pc.cmake
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc)

install(
FILES bmi.h
DESTINATION include
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
FILES ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc
DESTINATION lib/pkgconfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ into an Anaconda distribution with

### Linux and macOS

To install the C BMI bindings from source with cmake, run
To install the C BMI bindings from source with CMake, run

mkdir _build && cd _build
cmake .. -DCMAKE_INSTALL_PREFIX=<path-to-installation>
make install

where `<path-to-installation>` is the base directory
in which to install the bindings (`/usr/local` is the default).
When using a conda environment,
use the `$CONDA_PREFIX` environment variable.

The installation will look like:

Expand All @@ -54,7 +56,7 @@ An additional prerequisite is needed for Windows:

* Microsoft Visual Studio 2017 or Microsoft Build Tools for Visual Studio 2017

To configure and install the C BMI bindings from source with cmake,
To configure and install the C BMI bindings from source with CMake,
run the following in a [Developer Command Prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs)

mkdir _build && cd _build
Expand All @@ -64,10 +66,10 @@ run the following in a [Developer Command Prompt](https://docs.microsoft.com/en-
-DCMAKE_BUILD_TYPE=Release
cmake --build . --target install --config Release

where `<path-to-installation>` is the base directory
in which to install the bindings (`"C:\Program Files (x86)"` is the default;
note that quotes and an absolute path are needed).

where `<path-to-installation>` is the base directory in which to install the bindings.
The default is `"C:\Program Files (x86)"`.
Note that quotes and an absolute path are needed.
When using a conda environment, use `"%CONDA_PREFIX%\Library"`.

## Use

Expand Down
4 changes: 2 additions & 2 deletions bmic.pc.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: Bmi
Description: The Basic Model Interface
Version: ${BMI_VERSION}
Libs: -L${CMAKE_INSTALL_PREFIX}/lib -lbmic
Cflags: -I${CMAKE_INSTALL_PREFIX}/include
Libs: -L${CMAKE_INSTALL_LIBDIR} -lbmic
Cflags: -I${CMAKE_INSTALL_INCLUDEDIR}