Skip to content

Commit

Permalink
chore: update CMakeLists for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
heywhy committed Jun 15, 2024
1 parent 79980c4 commit d2a2064
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dialyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
elixir-version: "1.15"

- name: Restore Cached Dependencies
uses: actions/cache@v3
uses: actions/cache@v4
id: mix-cache
with:
path: deps
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ hashFiles('mix.lock') }}

- name: Restore PLT cache
uses: actions/cache@v3
uses: actions/cache@v4
id: plt-cache
with:
key: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- run: sudo apt-get install -y inotify-tools

- name: Restore Cached Dependencies
uses: actions/cache@v3
uses: actions/cache@v4
id: mix-cache
with:
path: deps
Expand All @@ -38,7 +38,8 @@ jobs:
run: mix coveralls.json

- name: Upload Coverage Reports
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
directory: ./cover
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(LINK_OPTIONS -fPIC -O3)

if(NOT DEFINED ENV{MIX_APP_PATH})
set(MIX_APP_PATH ${PROJECT_SOURCE_DIR})
else()
Expand All @@ -24,7 +26,12 @@ cmake_path(APPEND PRIV_PATH ${MIX_COMPILE_PATH} "../priv")
add_library(nif SHARED c_src/atomic_int.cpp)

target_include_directories(nif SYSTEM PUBLIC ${ERTS_INCLUDE_DIR})
target_link_options(nif PUBLIC -undefined dynamic_lookup)

if(APPLE)
target_link_options(nif PUBLIC ${LINK_OPTIONS} -undefined dynamic_lookup -flat_namespace)
elseif(LINUX)
target_link_options(nif PUBLIC ${LINK_OPTIONS})
endif()

add_custom_command(
TARGET nif POST_BUILD
Expand Down

0 comments on commit d2a2064

Please sign in to comment.