Skip to content

Commit 34657b8

Browse files
committed
SP_Link - add Erlang headers for Win/macOS
These need to be kept inline with headers for the specific version of Erlang the NIF is to be loaded into. Also, headers for macOS ARM64 chipset are included but are currently not used by CMakeLists.txt - this is in anticipation of future support for Apple Silicon. Note that the only major difference between headers on different platforms are the size declarations in erl_int_sizes_config.h
1 parent edf802c commit 34657b8

36 files changed

+10040
-12
lines changed

app/external/sp_link/CMakeLists.txt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ endif(NOT MSVC)
1313

1414

1515
# If we need to change something based on this running on CI, we can use if(DEFINED ENV{GITHUB_ACTION})
16-
if(APPLE)
17-
set(ERLANG_INCLUDE_PATH "/usr/local/lib/erlang/usr/include" CACHE PATH "Path to erlang includes")
18-
elseif(UNIX)
19-
set(ERLANG_INCLUDE_PATH "/usr/lib/erlang/usr/include" CACHE PATH "Path to erlang includes")
20-
elseif(MSVC)
21-
if(DEFINED ENV{GITHUB_ACTION})
22-
set(ERLANG_INCLUDE_PATH "C:/Program Files/erl10.7/usr/include" CACHE PATH "Path to erlang includes")
23-
else()
24-
set(ERLANG_INCLUDE_PATH "C:/Program Files/erl-24.0/usr/include" CACHE PATH "Path to erlang includes")
25-
endif()
26-
endif(APPLE)
27-
16+
if(WIN32)
17+
set(ERLANG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_libs/erlang_headers/win_x86_64 CACHE STRING "Path to the Erlang header files for 64 bit Windows")
18+
elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) # macOS
19+
set(ERLANG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_libs/erlang_headers/mac_x86_64 CACHE STRING "Path to the Erlang header files for 64 bit Intel Macs")
20+
else()
21+
execute_process(
22+
COMMAND erl -noshell -eval "io:format(\"~s~n\", [filename:join([lists:concat([code:root_dir(), \"/erts-\", erlang:system_info(version)]), \"include\"])]), init:stop(0)."
23+
OUTPUT_VARIABLE FOUND_ERLANG_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
24+
set(ERLANG_INCLUDE_PATH ${FOUND_ERLANG_INCLUDE_PATH} CACHE STRING "Path to the Erlang header files")
25+
endif()
2826

2927
# For Link
3028
include(${PROJECT_SOURCE_DIR}/external_libs/link/AbletonLinkConfig.cmake)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* %CopyrightBegin%
3+
*
4+
* Copyright Ericsson AB 1997-2016. All Rights Reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* %CopyrightEnd%
19+
*/
20+
/*
21+
* System dependant driver declarations
22+
*/
23+
24+
#ifndef __DRIVER_INT_H__
25+
#define __DRIVER_INT_H__
26+
27+
#ifdef HAVE_SYS_UIO_H
28+
#include <sys/types.h>
29+
#include <sys/uio.h>
30+
31+
typedef struct iovec SysIOVec;
32+
33+
#else
34+
35+
typedef struct {
36+
char* iov_base;
37+
int iov_len;
38+
} SysIOVec;
39+
40+
#endif
41+
42+
#endif

0 commit comments

Comments
 (0)