forked from wpilibsuite/allwpilib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ntcore] Add ntcoreffi binary (wpilibsuite#4471)
Co-authored-by: Peter Johnson <[email protected]>
- Loading branch information
1 parent
1f45732
commit 3961430
Showing
5 changed files
with
356 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
plugins { | ||
id 'c' | ||
id 'maven-publish' | ||
} | ||
|
||
apply plugin: 'edu.wpi.first.NativeUtils' | ||
|
||
apply from: '../shared/config.gradle' | ||
|
||
def symbolFile = project.file("src/main/native/symbols.txt") | ||
|
||
nativeUtils { | ||
privateExportsConfigs { | ||
ntcoreffi { | ||
exportsFile = symbolFile | ||
performStripAllSymbols = true | ||
} | ||
} | ||
} | ||
|
||
def generatedHeaders = file("$buildDir/generated/headers") | ||
def generatedFile = file("$buildDir/generated/headers/ExportedSymbols.h") | ||
|
||
def generateSymbols = tasks.register('generateFfiSymbols') { | ||
inputs.file(symbolFile) | ||
outputs.file(generatedFile) | ||
|
||
doLast { | ||
def symbolText = symbolFile as String[] | ||
symbolText = symbolText.collect { | ||
"AddFunctionToLink(${it});" | ||
}.join('\n') | ||
symbolText += '\n' | ||
generatedFile.text = symbolText | ||
} | ||
} | ||
|
||
model { | ||
components { | ||
ntcoreffi(NativeLibrarySpec) { | ||
sources { | ||
c { | ||
source { | ||
srcDirs = ['src/main/native/c'] | ||
includes = ['**/*.c'] | ||
} | ||
exportedHeaders { | ||
srcDir 'src/main/native/include' | ||
srcDir generatedHeaders | ||
} | ||
} | ||
} | ||
binaries.all { binary -> | ||
if (binary instanceof StaticLibraryBinarySpec) { | ||
binary.buildable = false | ||
return | ||
} | ||
binary.tasks.withType(AbstractNativeSourceCompileTask) { | ||
it.dependsOn generateSymbols | ||
} | ||
project(':ntcore').addNtcoreDependency(binary, 'static') | ||
lib project: ':wpinet', library: 'wpinet', linkage: 'static' | ||
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' | ||
} | ||
} | ||
} | ||
} | ||
|
||
def nativeName = 'ntcoreffi' | ||
def baseArtifactId = nativeName | ||
def artifactGroupId = "edu.wpi.first.${nativeName}" | ||
def zipBaseName = "_GROUP_edu_wpi_first_${nativeName}_ID_${nativeName}-cpp_CLS" | ||
|
||
model { | ||
publishing { | ||
def taskList = createComponentZipTasks($.components, [nativeName], zipBaseName, Zip, project, includeStandardZipFormat) | ||
|
||
publications { | ||
cpp(MavenPublication) { | ||
taskList.each { | ||
artifact it | ||
} | ||
|
||
artifactId = "${baseArtifactId}-cpp" | ||
groupId artifactGroupId | ||
version wpilibVersioning.version.get() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
#define AddFunctionToLink(FuncName) \ | ||
extern void FuncName(void); \ | ||
FuncName() | ||
|
||
void DoNotCallMeImOnlyForLinking(void) { | ||
#include "ExportedSymbols.h" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
NT_AddConnectionListener | ||
NT_AddLogger | ||
NT_AddPolledConnectionListener | ||
NT_AddPolledLogger | ||
NT_AddPolledTopicListener | ||
NT_AddPolledTopicListenerMultiple | ||
NT_AddPolledTopicListenerSingle | ||
NT_AddPolledValueListener | ||
NT_AddTopicListener | ||
NT_AddTopicListenerMultiple | ||
NT_AddTopicListenerSingle | ||
NT_AddValueListener | ||
NT_AllocateBooleanArray | ||
NT_AllocateCharArray | ||
NT_AllocateDoubleArray | ||
NT_AllocateFloatArray | ||
NT_AllocateIntegerArray | ||
NT_AllocateStringArray | ||
NT_CreateConnectionListenerPoller | ||
NT_CreateInstance | ||
NT_CreateLoggerPoller | ||
NT_CreateTopicListenerPoller | ||
NT_CreateValueListenerPoller | ||
NT_DeleteTopicProperty | ||
NT_DestroyConnectionListenerPoller | ||
NT_DestroyInstance | ||
NT_DestroyLoggerPoller | ||
NT_DestroyTopicListenerPoller | ||
NT_DestroyValueListenerPoller | ||
NT_DisposeConnectionInfoArray | ||
NT_DisposeConnectionNotification | ||
NT_DisposeConnectionNotificationArray | ||
NT_DisposeLogMessage | ||
NT_DisposeLogMessageArray | ||
NT_DisposeString | ||
NT_DisposeTimestampedBoolean | ||
NT_DisposeTimestampedBooleanArray | ||
NT_DisposeTimestampedDouble | ||
NT_DisposeTimestampedDoubleArray | ||
NT_DisposeTimestampedFloat | ||
NT_DisposeTimestampedFloatArray | ||
NT_DisposeTimestampedInteger | ||
NT_DisposeTimestampedIntegerArray | ||
NT_DisposeTimestampedRaw | ||
NT_DisposeTimestampedString | ||
NT_DisposeTimestampedStringArray | ||
NT_DisposeTopicInfo | ||
NT_DisposeTopicInfoArray | ||
NT_DisposeTopicNotification | ||
NT_DisposeTopicNotificationArray | ||
NT_DisposeValue | ||
NT_DisposeValueArray | ||
NT_DisposeValueNotification | ||
NT_DisposeValueNotificationArray | ||
NT_Flush | ||
NT_FlushLocal | ||
NT_FreeBooleanArray | ||
NT_FreeCharArray | ||
NT_FreeConnectionInfoForTesting | ||
NT_FreeDoubleArray | ||
NT_FreeFloatArray | ||
NT_FreeIntegerArray | ||
NT_FreeQueueBoolean | ||
NT_FreeQueueBooleanArray | ||
NT_FreeQueueDouble | ||
NT_FreeQueueDoubleArray | ||
NT_FreeQueueFloat | ||
NT_FreeQueueFloatArray | ||
NT_FreeQueueInteger | ||
NT_FreeQueueIntegerArray | ||
NT_FreeQueueRaw | ||
NT_FreeQueueString | ||
NT_FreeQueueStringArray | ||
NT_FreeStringArray | ||
NT_FreeTopicInfoForTesting | ||
NT_GetAtomicBoolean | ||
NT_GetAtomicBooleanArray | ||
NT_GetAtomicDouble | ||
NT_GetAtomicDoubleArray | ||
NT_GetAtomicFloat | ||
NT_GetAtomicFloatArray | ||
NT_GetAtomicInteger | ||
NT_GetAtomicIntegerArray | ||
NT_GetAtomicRaw | ||
NT_GetAtomicString | ||
NT_GetAtomicStringArray | ||
NT_GetBoolean | ||
NT_GetBooleanArray | ||
NT_GetConnectionInfoForTesting | ||
NT_GetConnections | ||
NT_GetDefaultInstance | ||
NT_GetDouble | ||
NT_GetDoubleArray | ||
NT_GetEntry | ||
NT_GetEntryEx | ||
NT_GetEntryFlags | ||
NT_GetEntryLastChange | ||
NT_GetEntryName | ||
NT_GetEntryType | ||
NT_GetEntryValue | ||
NT_GetFloat | ||
NT_GetFloatArray | ||
NT_GetInstanceFromHandle | ||
NT_GetInteger | ||
NT_GetIntegerArray | ||
NT_GetNetworkMode | ||
NT_GetRaw | ||
NT_GetString | ||
NT_GetStringArray | ||
NT_GetStringForTesting | ||
NT_GetTopic | ||
NT_GetTopicExists | ||
NT_GetTopicFromHandle | ||
NT_GetTopicInfo | ||
NT_GetTopicInfoForTesting | ||
NT_GetTopicInfos | ||
NT_GetTopicInfosStr | ||
NT_GetTopicName | ||
NT_GetTopicPersistent | ||
NT_GetTopicProperties | ||
NT_GetTopicProperty | ||
NT_GetTopicRetained | ||
NT_GetTopics | ||
NT_GetTopicsStr | ||
NT_GetTopicType | ||
NT_GetTopicTypeString | ||
NT_GetValueBoolean | ||
NT_GetValueBooleanArray | ||
NT_GetValueBooleanArrayForTesting | ||
NT_GetValueBooleanForTesting | ||
NT_GetValueDouble | ||
NT_GetValueDoubleArray | ||
NT_GetValueDoubleArrayForTesting | ||
NT_GetValueDoubleForTesting | ||
NT_GetValueFloat | ||
NT_GetValueFloatArray | ||
NT_GetValueInteger | ||
NT_GetValueIntegerArray | ||
NT_GetValueRaw | ||
NT_GetValueRawForTesting | ||
NT_GetValueString | ||
NT_GetValueStringArray | ||
NT_GetValueStringArrayForTesting | ||
NT_GetValueStringForTesting | ||
NT_GetValueType | ||
NT_InitString | ||
NT_InitValue | ||
NT_IsConnected | ||
NT_Now | ||
NT_Publish | ||
NT_PublishEx | ||
NT_ReadConnectionListenerQueue | ||
NT_ReadLoggerQueue | ||
NT_ReadQueueBoolean | ||
NT_ReadQueueBooleanArray | ||
NT_ReadQueueDouble | ||
NT_ReadQueueDoubleArray | ||
NT_ReadQueueFloat | ||
NT_ReadQueueFloatArray | ||
NT_ReadQueueInteger | ||
NT_ReadQueueIntegerArray | ||
NT_ReadQueueRaw | ||
NT_ReadQueueString | ||
NT_ReadQueueStringArray | ||
NT_ReadQueueValue | ||
NT_ReadQueueValuesBoolean | ||
NT_ReadQueueValuesDouble | ||
NT_ReadQueueValuesFloat | ||
NT_ReadQueueValuesInteger | ||
NT_ReadTopicListenerQueue | ||
NT_ReadValueListenerQueue | ||
NT_Release | ||
NT_ReleaseEntry | ||
NT_RemoveConnectionListener | ||
NT_RemoveLogger | ||
NT_RemoveTopicListener | ||
NT_RemoveValueListener | ||
NT_SetBoolean | ||
NT_SetBooleanArray | ||
NT_SetDefaultBoolean | ||
NT_SetDefaultBooleanArray | ||
NT_SetDefaultDouble | ||
NT_SetDefaultDoubleArray | ||
NT_SetDefaultEntryValue | ||
NT_SetDefaultFloat | ||
NT_SetDefaultFloatArray | ||
NT_SetDefaultInteger | ||
NT_SetDefaultIntegerArray | ||
NT_SetDefaultRaw | ||
NT_SetDefaultString | ||
NT_SetDefaultStringArray | ||
NT_SetDouble | ||
NT_SetDoubleArray | ||
NT_SetEntryFlags | ||
NT_SetEntryValue | ||
NT_SetFloat | ||
NT_SetFloatArray | ||
NT_SetInteger | ||
NT_SetIntegerArray | ||
NT_SetNetworkIdentity | ||
NT_SetNow | ||
NT_SetRaw | ||
NT_SetServer | ||
NT_SetServerMulti | ||
NT_SetServerTeam | ||
NT_SetString | ||
NT_SetStringArray | ||
NT_SetTopicPersistent | ||
NT_SetTopicProperties | ||
NT_SetTopicProperty | ||
NT_SetTopicRetained | ||
NT_StartClient3 | ||
NT_StartClient4 | ||
NT_StartDSClient | ||
NT_StartLocal | ||
NT_StartServer | ||
NT_StopClient | ||
NT_StopDSClient | ||
NT_StopLocal | ||
NT_StopServer | ||
NT_Subscribe | ||
NT_Unpublish | ||
NT_Unsubscribe | ||
WPI_CreateEvent | ||
WPI_CreateSemaphore | ||
WPI_CreateSignalObject | ||
WPI_DestroyEvent | ||
WPI_DestroySemaphore | ||
WPI_DestroySignalObject | ||
WPI_GetSystemTime | ||
WPI_Now | ||
WPI_NowDefault | ||
WPI_ReleaseSemaphore | ||
WPI_ResetEvent | ||
WPI_ResetSignalObject | ||
WPI_SetEvent | ||
WPI_SetNowImpl | ||
WPI_SetSignalObject | ||
WPI_WaitForObject | ||
WPI_WaitForObjectTimeout | ||
WPI_WaitForObjects | ||
WPI_WaitForObjectsTimeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters