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

fix shared library build #195

Merged
merged 9 commits into from
Sep 26, 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
25 changes: 19 additions & 6 deletions .github/workflows/Linux_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
CC: gcc-11
strategy:
matrix:
options: [-DBUILD_D=OFF, -DBUILD_4=OFF, '-D-DBUILD_SHARED_LIBS=ON -DBUILD_WITH_BUFR=OFF -DBUILD_WITH_EXTRA_DEPS=OFF']
options: [-DBUILD_D=OFF, -DBUILD_4=OFF, '-DBUILD_SHARED_LIBS=ON -DBUILD_WITH_BUFR=OFF -DBUILD_WITH_EXTRA_DEPS=OFF']

steps:

Expand All @@ -29,21 +29,27 @@ jobs:
with:
repository: NOAA-EMC/NCEPLIBS-bacio
path: bacio
ref: v2.5.0
ref: v2.6.0

- name: cache-bacio
id: cache-bacio
uses: actions/cache@v2
with:
path: ~/bacio
key: bacio-Linux_options_${{ runner.os }}-v2.5.0
key: bacio-Linux_options_${{ runner.os }}-v2.5.0-${{ matrix.options }}

- name: build-bacio
if: steps.cache-bacio.outputs.cache-hit != 'true'
run: |
set -x
cd bacio
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=~/bacio ..
if [ "${{ matrix.options }}" = "-DBUILD_SHARED_LIBS=ON -DBUILD_WITH_BUFR=OFF -DBUILD_WITH_EXTRA_DEPS=OFF" ]
then
cmake -DCMAKE_INSTALL_PREFIX=~/bacio -DBUILD_SHARED_LIBS=ON ..
else
cmake -DCMAKE_INSTALL_PREFIX=~/bacio ..
fi
make -j2 VERBOSE=1
make install

Expand All @@ -59,14 +65,20 @@ jobs:
uses: actions/cache@v2
with:
path: ~/bufr
key: bufr-Linux_options_${{ runner.os }}-v11.7.1
key: bufr-Linux_options_${{ runner.os }}-v11.7.1-${{ matrix.options }}

- name: build-bufr
if: steps.cache-bufr.outputs.cache-hit != 'true'
run: |
set -x
cd bufr
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=~/bufr ..
if [ "${{ matrix.options }}" = "-DBUILD_SHARED_LIBS=ON -DBUILD_WITH_BUFR=OFF -DBUILD_WITH_EXTRA_DEPS=OFF" ]
then
cmake -DCMAKE_INSTALL_PREFIX=~/bufr -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON ..
else
cmake -DCMAKE_INSTALL_PREFIX=~/bufr -DBUILD_TESTING=OFF ..
fi
make -j2 VERBOSE=1
make install

Expand All @@ -77,6 +89,7 @@ jobs:

- name: build-w3emc
run: |
set -x
cd w3emc
mkdir build
cd build
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ endif()

# This is the C source code.
set(c_src summary.c)

add_library(c_obj_lib OBJECT ${c_src})
if(BUILD_SHARED_LIBS)
set_property(TARGET c_obj_lib PROPERTY POSITION_INDEPENDENT_CODE 1)
endif()

# We buld a _4 and a _d by default.
foreach(kind ${kinds})
Expand Down
Loading