8005f31a95
commit97a36e728e
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Fri Apr 8 03:24:46 2022 -0600 Updated the unit test suites. commit56e2beb946
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Fri Apr 8 03:22:30 2022 -0600 Tied the lifetime of an `AMobjId` struct to its owning `AMdoc` struct. commite16c980b2e
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Fri Apr 8 03:21:26 2022 -0600 Reverted the `AMobjId` struct to being an opaque type. Added `AMobjId::new()`to fix a compilation error. Tied the lifetime of an `AMobjId` struct to its owning `AMdoc` struct. Added the `AMvalue::ChangeHash` variant. commit7c769b2cfe
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Fri Apr 8 03:12:15 2022 -0600 Renamed the `AMobj` struct to `AMobjId` for clarity. Reverted the `AMobjId` struct to being an opaque type. Tied the lifetime of an `AMobjId` struct to its owning `AMdoc` struct. Renamed `AMcreate()` to `AMallocDoc()` for consistency with C's standard library functions. Renamed `AMdestroy()` to `AMfreeDoc()` for consistency with C's standard library functions. Renamed the `obj` function arguments to `obj_id` for clarity. Replaced the "set" verb in function names with the "put" verb for consistency iwth recent API changes. Renamed `AMclear()` to `AMfreeResult()` for consistency with C's standard library functions. Added `AMfreeObjId()` to enable dropping a persisted `AMojbId` struct. commit8d1b3bfcf2
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Fri Apr 8 02:52:52 2022 -0600 Added a field for persisting `AMobjId` structs to the `AMdoc` struct. Renamed `AMdoc::create()` to `AMdoc::new()` to be more idiomatic. Added `AMdoc::insert_object()` and `AMdoc::set_object()` for persisting `AMobjId` structs. Added `AMdoc::drop_obj_id()` to enable dropping a persisted `AMobjId` struct. commitb9b0f96357
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Thu Mar 17 15:17:08 2022 -0700 Ensure CMake targets can be built after a clean. commitd565db1ea8
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Thu Mar 17 15:10:09 2022 -0700 Prevent unnecessary updating of the generated header file. commitd3647e75d3
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Mar 16 02:50:59 2022 -0700 Documented the `AMObj.ID` struct member. commitcc58cbf4bb
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Mar 16 02:03:37 2022 -0700 Normalize the formatting of the `AMobjType_tag()` function. commitc2954dd2c7
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Mar 16 02:02:03 2022 -0700 Remove superfluous backslashes. commitbcb6e759a4
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Mar 16 02:01:33 2022 -0700 Removed the `AMconfig()` function. Implemented the `AMgetActor()` function. Added the `AMgetActorHex()` function. Added the `AMsetActor()` function. Added the `AMsetActorHex()` function. commit9b2c566b9e
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Mar 16 01:50:31 2022 -0700 Added the "hex" and "smol_str" crate dependencies to the C API. commit99e06e1f73
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Mar 16 01:06:15 2022 -0700 Corrected a spelling error. commit629b19c71d
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 20:30:54 2022 -0700 Align backslashes. commit09d25a32b7
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 20:30:23 2022 -0700 Add EOF linefeed. commit4ed14ee748
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 20:05:30 2022 -0700 Fix "fmt" CI job violations. commitf53b40625d
Merge:7d5538d8
e1f8d769
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 16:34:11 2022 -0700 Merge branch 'c_api_exp' of https://github.com/automerge/automerge-rs into c_api_exp commit7d5538d8a4
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 16:31:22 2022 -0700 Updated the C API's unit test suite. commit335cd1c85f
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 16:27:39 2022 -0700 Removed superfluous `AMobj` traits. commit420f8cab64
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 16:25:48 2022 -0700 Moved the `AMobj` struct into the `result` module. Changed the `AMobj` struct into an enum. Added the `AMbyteSpan` struct. Added the `AMvalue` enum. Added the `AMresult::Nothing` variant. commit4eca88ff01
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 15:56:06 2022 -0700 Normalized all type name prefixes to "AM". Reduced the `AMstatus` enum's `<type>Ok` tags to a single `Ok` tag. Removed the `to_obj` macro. Added the `to_obj_id` macro. Moved the `AMobj` struct into the `result` module. Added the `AMresult::Nothing` variant. Added the `AMresultSize` function. Added the `AMresultValue` function. Added the `AMlistGet` function. Added the `AMmapGet` function. Removed the `AMgetObj` function. Added the `AMobjSize` function. commit2f94c6fd90
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 15:29:02 2022 -0700 Compensate for unconfigurable cbindgen behavior. Prevent Doxygen documentation regeneration. commit5de00b7998
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 13 15:24:45 2022 -0700 Alphabetized the cbindgen settings. commite1f8d769f4
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 10 08:53:07 2022 -0500 update authors commit3e5525f1a6
Merge:f4ba1770
1c21abc5
Author: Orion Henry <orionz@users.noreply.github.com> Date: Wed Mar 9 14:36:29 2022 -0500 Merge pull request #304 from jkankiewicz/c_api_exp Fix "fmt" workflow step violations commit1c21abc5a3
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Mar 9 11:13:01 2022 -0800 Fix CMake and Rust code formatting issues. commitf4ba1770a9
Merge:bf1ae609
f41b30d1
Author: Orion Henry <orionz@users.noreply.github.com> Date: Wed Mar 9 12:05:58 2022 -0500 Merge pull request #300 from jkankiewicz/c_api_exp Add unit test suites for the `AMlistSet*` and `AMmapSet*` functions commitf41b30d118
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 22:08:36 2022 -0800 Added a brief description of the `AmObjType` enum. Added the `AmStatus` enum to the enum docs page. commitaf7386a482
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 21:50:52 2022 -0800 Added a unit test suite for the `AMlistSet*` functions. commit1eb70c6eee
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 21:42:42 2022 -0800 Added the rest of the `AMlistSet*` functions. Started the enum tags at `1` so they won't be inherently false. Alphabetized enum tags for the docs. Improved the docs. commit6489cba13b
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 18:01:46 2022 -0800 Alphabetize functions in the docs. commit74c245b82d
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 07:54:25 2022 -0800 Fix a typo in `AMmapSetObject()`'s documentation. commitb2a879ba4e
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 06:24:22 2022 -0800 Append missing EOF linefeed. commitfbf0f29b66
Merge:c56d54b5
bf1ae609
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 01:08:12 2022 -0800 Merge branch 'c_api_exp' of https://github.com/automerge/automerge-rs into c_api_exp commitc56d54b565
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 01:07:11 2022 -0800 Added unit test cases for the new `AMmapSet*` functions by @orionz. Moved the unit test cases for the `AMmapSet*` functions into their own unit test suite. commit7e59b55760
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Tue Mar 8 01:01:47 2022 -0800 Edited the Doxygen documentation. commitbf1ae60913
Author: Orion Henry <orion.henry@gmail.com> Date: Mon Mar 7 11:59:22 2022 -0500 fmt commite82a7cc78e
Merge:a44e69d2
965c2d56
Author: Orion Henry <orionz@users.noreply.github.com> Date: Mon Mar 7 11:55:32 2022 -0500 Merge pull request #299 from jkankiewicz/c_api_exp Enable unit testing of the C API commit965c2d56c3
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Mon Mar 7 06:37:36 2022 -0800 Enable unit testing of the C API. commita44e69d2c7
Author: Orion Henry <orion.henry@gmail.com> Date: Sun Mar 6 14:00:46 2022 -0500 remove datatype mapset commit88153c44e7
Merge:41512e9c
c6194e97
Author: Orion Henry <orionz@users.noreply.github.com> Date: Sun Mar 6 10:32:39 2022 -0500 Merge pull request #298 from jkankiewicz/rebase_c_api_exp Rebase the "c_api_exp" branch on the "experiment" branch commitc6194e9732
Merge:a2d745c8
41512e9c
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 6 01:09:56 2022 -0800 Merge branch 'c_api_exp' into rebase_c_api_exp commita2d745c8d9
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Sun Mar 6 00:44:37 2022 -0800 Replace the `utils::import_value` function with the `utils::import_scalar` function. Exclude `# Safety` comments from the documentation. commit0681e28b40
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 16:04:17 2022 -0500 support new as_ref api commit916e23fcc2
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 15:56:27 2022 -0500 fmt commit71cd6a1f18
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 15:54:38 2022 -0500 lock data at 64 bit - no c_long commite00bd4c201
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 15:27:55 2022 -0500 verbose commit39d157c554
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 14:56:23 2022 -0500 clippy cleanup commit7f650fb8e0
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Feb 23 02:14:06 2022 -0800 Added Doxygen documentation generation. Renamed `AMDatatype` to `AmDataType`. Reorganized the `AmDataType` tags. Renamed `AMfree()` to `AMdestroy()`. Renamed `AMclone()` to `AMdup()`. commitb0b803eef8
Author: Orion Henry <orion.henry@gmail.com> Date: Tue Feb 22 11:30:42 2022 -0500 get simple test passing commitcab9017ffa
Author: Orion Henry <orion.henry@gmail.com> Date: Wed Feb 9 15:50:44 2022 -0500 rework to return a queriable result commita557e848f3
Author: Jason Kankiewicz <you@example.com> Date: Mon Feb 14 14:38:00 2022 -0800 Add a CI step to run the CMake build of the C bindings for @alexjg. commitc8c0c72f3b
Author: Jason Kankiewicz <you@example.com> Date: Mon Feb 14 14:09:58 2022 -0800 Add CMake instructions for @orionz. commitfb62c4b02a
Author: Jason Kankiewicz <you@example.com> Date: Thu Feb 10 23:28:54 2022 -0800 Add CMake support. commit7bc3bb6850
Author: Jason Kankiewicz <you@example.com> Date: Thu Feb 10 22:49:53 2022 -0800 Replace *intptr_t in C function signatures. commit60395a2db0
Author: Orion Henry <orion.henry@gmail.com> Date: Sun Feb 6 18:59:19 2022 -0500 am_pop and am_pop_value commitb1e88047d2
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Feb 3 19:43:36 2022 -0500 break the ground commit41512e9c78
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 16:04:17 2022 -0500 support new as_ref api commitbcee6a9623
Merge:cf98f78d
9a89db3f
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 15:58:19 2022 -0500 Merge remote-tracking branch 'origin/experiment' into c_api_exp commitcf98f78dd1
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 15:56:27 2022 -0500 fmt commit3c1f449c5c
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 15:54:38 2022 -0500 lock data at 64 bit - no c_long commit2c2ec0b0c5
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 15:27:55 2022 -0500 verbose commitb72b9c989a
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Mar 3 14:56:23 2022 -0500 clippy cleanup commit3ba28f91cc
Author: Jason Kankiewicz <jason.kankiewicz@gmail.com> Date: Wed Feb 23 02:14:06 2022 -0800 Added Doxygen documentation generation. Renamed `AMDatatype` to `AmDataType`. Reorganized the `AmDataType` tags. Renamed `AMfree()` to `AMdestroy()`. Renamed `AMclone()` to `AMdup()`. commit8564e5b753
Author: Orion Henry <orion.henry@gmail.com> Date: Tue Feb 22 11:30:42 2022 -0500 get simple test passing commit60835e6ae7
Author: Orion Henry <orion.henry@gmail.com> Date: Wed Feb 9 15:50:44 2022 -0500 rework to return a queriable result commit89466d9e8c
Author: Jason Kankiewicz <you@example.com> Date: Mon Feb 14 14:38:00 2022 -0800 Add a CI step to run the CMake build of the C bindings for @alexjg. commite2485bd5fd
Author: Jason Kankiewicz <you@example.com> Date: Mon Feb 14 14:09:58 2022 -0800 Add CMake instructions for @orionz. commitb5cc7dd63d
Author: Jason Kankiewicz <you@example.com> Date: Thu Feb 10 23:28:54 2022 -0800 Add CMake support. commit685536f0cf
Author: Jason Kankiewicz <you@example.com> Date: Thu Feb 10 22:49:53 2022 -0800 Replace *intptr_t in C function signatures. commitc1c6e7bb66
Author: Orion Henry <orion.henry@gmail.com> Date: Sun Feb 6 18:59:19 2022 -0500 am_pop and am_pop_value commite68c8d347e
Author: Orion Henry <orion.henry@gmail.com> Date: Thu Feb 3 19:43:36 2022 -0500 break the ground
220 lines
7.4 KiB
CMake
220 lines
7.4 KiB
CMake
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
|
|
|
find_program (
|
|
CARGO_CMD
|
|
"cargo"
|
|
PATHS "$ENV{CARGO_HOME}/bin"
|
|
DOC "The Cargo command"
|
|
)
|
|
|
|
if(NOT CARGO_CMD)
|
|
message(FATAL_ERROR "Cargo (Rust package manager) not found! Install it and/or set the CARGO_HOME environment variable.")
|
|
endif()
|
|
|
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER)
|
|
|
|
if(BUILD_TYPE_LOWER STREQUAL debug)
|
|
set(CARGO_BUILD_TYPE "debug")
|
|
|
|
set(CARGO_FLAG "")
|
|
else()
|
|
set(CARGO_BUILD_TYPE "release")
|
|
|
|
set(CARGO_FLAG "--release")
|
|
endif()
|
|
|
|
set(CARGO_CURRENT_BINARY_DIR "${CARGO_TARGET_DIR}/${CARGO_BUILD_TYPE}")
|
|
|
|
set(
|
|
CARGO_OUTPUT
|
|
${CARGO_TARGET_DIR}/${LIBRARY_NAME}.h
|
|
${CARGO_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
${CARGO_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
)
|
|
|
|
if(WIN32)
|
|
# \note The basename of an import library output by Cargo is the filename
|
|
# of its corresponding shared library.
|
|
list(APPEND CARGO_OUTPUT ${CARGO_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
endif()
|
|
|
|
add_custom_command(
|
|
OUTPUT ${CARGO_OUTPUT}
|
|
COMMAND
|
|
# \note cbindgen won't regenerate its output header file after it's
|
|
# been removed but it will after its configuration file has been
|
|
# updated.
|
|
${CMAKE_COMMAND} -DCONDITION=NOT_EXISTS -P ${CMAKE_SOURCE_DIR}/cmake/file_touch.cmake -- ${CARGO_TARGET_DIR}/${LIBRARY_NAME}.h ${CMAKE_SOURCE_DIR}/cbindgen.toml
|
|
COMMAND
|
|
${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} ${CARGO_CMD} build ${CARGO_FLAG}
|
|
MAIN_DEPENDENCY
|
|
lib.rs
|
|
DEPENDS
|
|
doc.rs
|
|
result.rs
|
|
utils.rs
|
|
${CMAKE_SOURCE_DIR}/build.rs
|
|
${CMAKE_SOURCE_DIR}/Cargo.toml
|
|
${CMAKE_SOURCE_DIR}/cbindgen.toml
|
|
WORKING_DIRECTORY
|
|
${CMAKE_SOURCE_DIR}
|
|
COMMENT
|
|
"Producing the library artifacts with Cargo..."
|
|
VERBATIM
|
|
)
|
|
|
|
add_custom_target(
|
|
${LIBRARY_NAME}_artifacts
|
|
DEPENDS ${CARGO_OUTPUT}
|
|
)
|
|
|
|
# \note cbindgen's naming behavior isn't fully configurable.
|
|
add_custom_command(
|
|
TARGET ${LIBRARY_NAME}_artifacts
|
|
POST_BUILD
|
|
COMMAND
|
|
# Compensate for cbindgen's variant struct naming.
|
|
${CMAKE_COMMAND} -DMATCH_REGEX=AM\([^_]+_[^_]+\)_Body -DREPLACE_EXPR=AM\\1 -P ${CMAKE_SOURCE_DIR}/cmake/file_regex_replace.cmake -- ${CARGO_TARGET_DIR}/${LIBRARY_NAME}.h
|
|
COMMAND
|
|
# Compensate for cbindgen's union tag enum type naming.
|
|
${CMAKE_COMMAND} -DMATCH_REGEX=AM\([^_]+\)_Tag -DREPLACE_EXPR=AM\\1Variant -P ${CMAKE_SOURCE_DIR}/cmake/file_regex_replace.cmake -- ${CARGO_TARGET_DIR}/${LIBRARY_NAME}.h
|
|
COMMAND
|
|
# Compensate for cbindgen's translation of consecutive uppercase letters to "ScreamingSnakeCase".
|
|
${CMAKE_COMMAND} -DMATCH_REGEX=A_M\([^_]+\)_ -DREPLACE_EXPR=AM_\\1_ -P ${CMAKE_SOURCE_DIR}/cmake/file_regex_replace.cmake -- ${CARGO_TARGET_DIR}/${LIBRARY_NAME}.h
|
|
WORKING_DIRECTORY
|
|
${CMAKE_SOURCE_DIR}
|
|
COMMENT
|
|
"Compensating for hard-coded cbindgen naming behaviors..."
|
|
VERBATIM
|
|
)
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
if(WIN32)
|
|
set(LIBRARY_DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
else()
|
|
set(LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
endif()
|
|
|
|
set(LIBRARY_DEFINE_SYMBOL "${SYMBOL_PREFIX}_EXPORTS")
|
|
|
|
# \note The basename of an import library output by Cargo is the filename
|
|
# of its corresponding shared library.
|
|
set(LIBRARY_IMPLIB "${CARGO_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
|
|
set(LIBRARY_LOCATION "${CARGO_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
|
|
|
set(LIBRARY_NO_SONAME "${WIN32}")
|
|
|
|
set(LIBRARY_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_${CMAKE_BUILD_TYPE}_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
|
|
|
set(LIBRARY_TYPE "SHARED")
|
|
else()
|
|
set(LIBRARY_DEFINE_SYMBOL "")
|
|
|
|
set(LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
|
|
set(LIBRARY_IMPLIB "")
|
|
|
|
set(LIBRARY_LOCATION "${CARGO_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
|
|
set(LIBRARY_NO_SONAME "TRUE")
|
|
|
|
set(LIBRARY_SONAME "")
|
|
|
|
set(LIBRARY_TYPE "STATIC")
|
|
endif()
|
|
|
|
add_library(${LIBRARY_NAME} ${LIBRARY_TYPE} IMPORTED GLOBAL)
|
|
|
|
set_target_properties(
|
|
${LIBRARY_NAME}
|
|
PROPERTIES
|
|
# \note Cargo writes a debug build into a nested directory instead of
|
|
# decorating its name.
|
|
DEBUG_POSTFIX ""
|
|
DEFINE_SYMBOL "${LIBRARY_DEFINE_SYMBOL}"
|
|
IMPORTED_IMPLIB "${LIBRARY_IMPLIB}"
|
|
IMPORTED_LOCATION "${LIBRARY_LOCATION}"
|
|
IMPORTED_NO_SONAME "${LIBRARY_NO_SONAME}"
|
|
IMPORTED_SONAME "${LIBRARY_SONAME}"
|
|
LINKER_LANGUAGE C
|
|
PUBLIC_HEADER "${CARGO_TARGET_DIR}/${LIBRARY_NAME}.h"
|
|
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
|
VERSION "${PROJECT_VERSION}"
|
|
# \note Cargo exports all of the symbols automatically.
|
|
WINDOWS_EXPORT_ALL_SYMBOLS "TRUE"
|
|
)
|
|
|
|
target_compile_definitions(${LIBRARY_NAME} INTERFACE $<TARGET_PROPERTY:${LIBRARY_NAME},DEFINE_SYMBOL>)
|
|
|
|
target_include_directories(
|
|
${LIBRARY_NAME}
|
|
INTERFACE
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>"
|
|
)
|
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
set(LIBRARY_DEPENDENCIES Threads::Threads ${CMAKE_DL_LIBS})
|
|
|
|
if(WIN32)
|
|
list(APPEND LIBRARY_DEPENDENCIES Bcrypt userenv ws2_32)
|
|
else()
|
|
list(APPEND LIBRARY_DEPENDENCIES m)
|
|
endif()
|
|
|
|
target_link_libraries(${LIBRARY_NAME} INTERFACE ${LIBRARY_DEPENDENCIES})
|
|
|
|
install(
|
|
FILES $<TARGET_PROPERTY:${LIBRARY_NAME},IMPORTED_IMPLIB>
|
|
TYPE LIB
|
|
# \note The basename of an import library output by Cargo is the filename
|
|
# of its corresponding shared library.
|
|
RENAME "${CMAKE_STATIC_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_${CMAKE_BUILD_TYPE}_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
|
OPTIONAL
|
|
)
|
|
|
|
set(LIBRARY_FILE_NAME "${CMAKE_${LIBRARY_TYPE}_LIBRARY_PREFIX}${LIBRARY_NAME}${CMAKE_${CMAKE_BUILD_TYPE}_POSTFIX}${CMAKE_${LIBRARY_TYPE}_LIBRARY_SUFFIX}")
|
|
|
|
install(
|
|
FILES $<TARGET_PROPERTY:${LIBRARY_NAME},IMPORTED_LOCATION>
|
|
RENAME "${LIBRARY_FILE_NAME}"
|
|
DESTINATION ${LIBRARY_DESTINATION}
|
|
)
|
|
|
|
install(
|
|
FILES $<TARGET_PROPERTY:${LIBRARY_NAME},PUBLIC_HEADER>
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
|
|
)
|
|
|
|
find_package(Doxygen OPTIONAL_COMPONENTS dot)
|
|
|
|
if(DOXYGEN_FOUND)
|
|
set(DOXYGEN_GENERATE_LATEX YES)
|
|
|
|
set(DOXYGEN_PDF_HYPERLINKS YES)
|
|
|
|
set(DOXYGEN_PROJECT_LOGO "${CMAKE_SOURCE_DIR}/img/brandmark.png")
|
|
|
|
set(DOXYGEN_SORT_BRIEF_DOCS YES)
|
|
|
|
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md")
|
|
|
|
doxygen_add_docs(
|
|
${LIBRARY_NAME}_docs
|
|
"${CARGO_TARGET_DIR}/${LIBRARY_NAME}.h"
|
|
"${CMAKE_SOURCE_DIR}/README.md"
|
|
USE_STAMP_FILE
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
COMMENT "Producing documentation with Doxygen..."
|
|
)
|
|
|
|
# \note A Doxygen input file isn't a file-level dependency so the Doxygen
|
|
# command must instead depend upon a target that outputs the file or
|
|
# it will just output an error message when it can't be found.
|
|
add_dependencies(${LIBRARY_NAME}_docs ${LIBRARY_NAME}_artifacts)
|
|
endif()
|