Skip to content

Commit

Permalink
Merge pull request #176 from openmopac/static-test
Browse files Browse the repository at this point in the history
Test the static build
  • Loading branch information
godotalgorithm authored Sep 17, 2023
2 parents a5ae07b + 58a196f commit bb30bd6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,47 @@ env:
MKL_WINDOWS_VERSION: 2022.0.2

jobs:
linux-static:
runs-on: ubuntu-latest

steps:
- name: Check number of cores
run: |
lscpu
lscpu | grep "CPU(s): " | awk '{print $2}' > num_cores
echo "NUM_CORES=$(cat num_cores)" >> $GITHUB_ENV
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies with PyPI
run: pip install numpy

- name: Configure MOPAC with CMake
run: |
cmake -B build \
-DTHREADS_KEYWORD=OFF \
-DSTATIC_BUILD=ON
- name: Build MOPAC with Make
run: |
cmake --build build -- -j$NUM_CORES
- name: Test MOPAC with CTest
run: |
cd build
ctest -V -j $NUM_CORES
- name: Save test results as an artifact (on failure)
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: coverage-test-output
path: build/tests

code-coverage:
runs-on: ubuntu-latest

Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ option(STATIC_BUILD "Build a static executable" OFF)
if (STATIC_BUILD)
message(STATUS "Static executables")
message(WARNING "CMake cannot verify the ability to link static executables in the pre-build phase. "
"Please verify that you are able to link static executables with a \"-static\" linker flag.")
"Please verify that you are able to link static executables with a \"-static\" linker flag. "
"OpenMP does not support static builds by default, so try THREADS_KEYWORD=OFF if the static build fails to turn off OpenMP.")
else()
message(STATUS "Shared library and dynamic executables")
endif()
Expand Down

0 comments on commit bb30bd6

Please sign in to comment.