Skip to content

Commit b51a6a4

Browse files
Changes for CLion:
- Add pseudo-bpf cmake target conditionalized on `-DSolana`, passed via CLion but not build scripts. - Enable static analysis on `program/` sources and resolves solana & criterion headers. - Restrict spelling and grammar checks to markdown files.
1 parent a815403 commit b51a6a4

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

.idea/cmake.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/scopes/markdown.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,33 @@ add_test( test_net test_net )
118118

119119
add_executable( fuzz pctest/fuzz.cpp )
120120
target_link_libraries( fuzz ${PC_DEP} )
121+
122+
123+
#
124+
# bpf static analysis (CLion)
125+
#
126+
127+
function( add_bpf_lib targ )
128+
if( SOLANA AND NOT BPF )
129+
set( BPF ${SOLANA}/sdk/bpf )
130+
endif()
131+
if( BPF )
132+
add_library( ${targ} STATIC ${ARGN} )
133+
if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21" )
134+
# bpf.mk uses --std=c17
135+
set_property( TARGET ${targ} PROPERTY C_STANDARD 17 )
136+
else()
137+
set_property( TARGET ${targ} PROPERTY C_STANDARD 11 )
138+
endif()
139+
set_property( TARGET ${targ} PROPERTY C_STANDARD_REQUIRED ON )
140+
set_property( TARGET ${targ} PROPERTY C_EXTENSIONS OFF )
141+
target_compile_definitions( ${targ} PRIVATE __bpf__=1 )
142+
target_include_directories( ${targ} SYSTEM PRIVATE
143+
${BPF}/c/inc
144+
${BPF}/dependencies/criterion/include
145+
)
146+
endif()
147+
endfunction()
148+
149+
# test_oracle.c includes oracle.c
150+
add_bpf_lib( test-oracle-bpf program/src/oracle/test_oracle.c )

0 commit comments

Comments
 (0)