8de2fa9bd4
The AMvalue union, AMlistItem struct, AMmapItem struct, and AMobjItem struct are gone, replaced by the AMitem struct. The AMchangeHashes, AMchanges, AMlistItems, AMmapItems, AMobjItems, AMstrs, and AMsyncHaves iterators are gone, replaced by the AMitems iterator. The AMitem struct is opaque, getting and setting values is now achieved exclusively through function calls. The AMitemsNext(), AMitemsPrev(), and AMresultItem() functions return a pointer to an AMitem struct so you ultimately get the same thing whether you're iterating over a sequence or calling AMmapGet() or AMlistGet(). Calling AMitemResult() on an AMitem struct will produce a new AMresult struct referencing its storage so now the AMresult struct for an iterator can be subsequently freed without affecting the AMitem structs that were filtered out of it. The storage for a set of AMitem structs can be recombined into a single AMresult struct by passing pointers to their corresponding AMresult structs to AMresultCat(). For C/C++ programmers, I've added AMstrCmp(), AMstrdup(), AM{idxType,objType,status,valType}ToString() and AM{idxType,objType,status,valType}FromString(). It's also now possible to pass arbitrary parameters through AMstack{Item,Items,Result}() to a callback function.
40 lines
1.3 KiB
CMake
40 lines
1.3 KiB
CMake
add_executable(
|
|
${LIBRARY_NAME}_quickstart
|
|
quickstart.c
|
|
)
|
|
|
|
set_target_properties(${LIBRARY_NAME}_quickstart PROPERTIES LINKER_LANGUAGE C)
|
|
|
|
# \note An imported library's INTERFACE_INCLUDE_DIRECTORIES property can't
|
|
# contain a non-existent path so its build-time include directory
|
|
# must be specified for all of its dependent targets instead.
|
|
target_include_directories(
|
|
${LIBRARY_NAME}_quickstart
|
|
PRIVATE "$<BUILD_INTERFACE:${CBINDGEN_INCLUDEDIR}>"
|
|
)
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_quickstart PRIVATE ${LIBRARY_NAME})
|
|
|
|
add_dependencies(${LIBRARY_NAME}_quickstart ${BINDINGS_NAME}_artifacts)
|
|
|
|
if(BUILD_SHARED_LIBS AND WIN32)
|
|
add_custom_command(
|
|
TARGET ${LIBRARY_NAME}_quickstart
|
|
POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CARGO_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_${CMAKE_BUILD_TYPE}_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
${CMAKE_BINARY_DIR}
|
|
COMMENT "Copying the DLL built by Cargo into the examples directory..."
|
|
VERBATIM
|
|
)
|
|
endif()
|
|
|
|
add_custom_command(
|
|
TARGET ${LIBRARY_NAME}_quickstart
|
|
POST_BUILD
|
|
COMMAND
|
|
${LIBRARY_NAME}_quickstart
|
|
COMMENT
|
|
"Running the example quickstart..."
|
|
VERBATIM
|
|
)
|