From 24f3d9147bfe222a6bfcfc0845b44ae8fde33cdf Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 22 May 2025 18:45:20 +0200 Subject: lib: generate compiled typelib --- cmake/Modules/GlibIntrospection.cmake | 18 ++++- lib/src/turns-participant.h | 129 ++++++++++++++++------------------ 2 files changed, 74 insertions(+), 73 deletions(-) diff --git a/cmake/Modules/GlibIntrospection.cmake b/cmake/Modules/GlibIntrospection.cmake index c6b0752..db4434d 100644 --- a/cmake/Modules/GlibIntrospection.cmake +++ b/cmake/Modules/GlibIntrospection.cmake @@ -5,6 +5,11 @@ find_program(G_IR_SCANNER_BIN REQUIRED ) +find_program(G_IR_COMPILER_BIN + NAMES "g-ir-compiler" + REQUIRED +) + function(target_glib_generate_gir TARGET) if(NOT BUILD_SHARED_LIBS) message(STATUS "GlibIntrospection: skipping GIR generation for static library target '${TARGET}'") @@ -57,15 +62,18 @@ function(target_glib_generate_gir TARGET) endif() get_target_property(TARGET_OUTPUT_NAME "${TARGET}" OUTPUT_NAME) - set(_OUTPUT_FILE "${_OUTPUT_DIR}/$/${TARGET_OUTPUT_NAME}.gir") + set(_OUTPUT_FILE "${_OUTPUT_DIR}/$/${_NAMESPACE}") add_custom_command(TARGET "${TARGET}" POST_BUILD - BYPRODUCTS "${_OUTPUT_FILE}" + BYPRODUCTS + "${_OUTPUT_FILE}.gir" + "${_OUTPUT_FILE}.typelib" COMMENT "Generating GIR file for ${TARGET}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMAND "${G_IR_SCANNER_BIN}" ARGS + "--quiet" "--warn-all" "--namespace=${_NAMESPACE}" "--nsversion=${_VERSION}" @@ -74,9 +82,13 @@ function(target_glib_generate_gir TARGET) "$,PREPEND,-I>" "$,PREPEND,--pkg=>" "$" - "--output=${_OUTPUT_FILE}" + "--output=${_OUTPUT_FILE}.gir" ${_SOURCES} + COMMAND "${G_IR_COMPILER_BIN}" + "--output=${_OUTPUT_FILE}.typelib" + "${_OUTPUT_FILE}.gir" COMMAND_EXPAND_LISTS + VERBATIM ) endfunction() \ No newline at end of file diff --git a/lib/src/turns-participant.h b/lib/src/turns-participant.h index 1d9950b..28588a7 100644 --- a/lib/src/turns-participant.h +++ b/lib/src/turns-participant.h @@ -11,30 +11,23 @@ G_BEGIN_DECLS +/** + * TurnsParticipantDisposition: + * @TURNS_PARTICIPANT_DISPOSITION_NEUTRAL: The participant is neutral towards the player characters + * @TURNS_PARTICIPANT_DISPOSITION_FRIENDLY: The participant is friendly towards the player characters + * @TURNS_PARTICIPANT_DISPOSITION_HOSTILE: The participant is hostile towards the player characters + * @TURNS_PARTICIPANT_DISPOSITION_SECRET: The participants disposition towards the player characters is unknown to the players + * + * Orderings that can be applied to the turn order. + * + * See [property@Turns.TurnOrder.sort-mode] + */ + typedef enum { - /** - * @brief The participant is neutral towards the player characters. - * @since 1.0.0 - */ TURNS_PARTICIPANT_DISPOSITION_NEUTRAL, - - /** - * @brief The participant is friendly towards the player characters. - * @since 1.0.0 - */ TURNS_PARTICIPANT_DISPOSITION_FRIENDLY, - - /** - * @brief The participant is hostile towards the player characters. - * @since 1.0.0 - */ TURNS_PARTICIPANT_DISPOSITION_HOSTILE, - - /** - * @brief The participants disposition towards the player characters is unknown to the players. - * @since 1.0.0 - */ TURNS_PARTICIPANT_DISPOSITION_SECRET, } TurnsParticipantDisposition; @@ -45,132 +38,128 @@ GType turns_participant_disposition_get_type(void) G_GNUC_CONST; G_DECLARE_FINAL_TYPE(TurnsParticipant, turns_participant, TURNS, PARTICIPANT, GObject) /** - * @class TurnsParticipant turns-participant.h "turns-participant.h" - * @since 1.0.0 - * @brief Represents an actor or participant in a turn order. + * TurnsParticipant: + * + * Represents an actor or participant in a turn order. */ /** - * @brief Creates a new participant. - * @since 1.0.0 + * turns_participant_new: * - * This functions constructs a default initialized instance, meaning: - * - @p name is the empty string - * - @p priority is 0.0f - * - @p disposition is Disposition.Neutral. + * Creates a new participant. * - * @return A new @p Turns.Participant + * Returns: a new `TurnsParticipant` */ G_GNUC_WARN_UNUSED_RESULT TurnsParticipant * turns_participant_new(void); /** - * @brief Creates a new participant with the given property values. - * @since 1.0.0 + * turns_participant_new_with: + * @name: The name of the new instance. + * @priority: The priority of the new instance. + * @disposition: The disposition of the new instance. + * + * Creates a new participant with the given name, priority, and disposition. * - * @param name The name of the new instance. - (transfer none) - The data is owned by the caller of the function. - The value is a NUL terminated UTF-8 string. - * @param priority The priority of the new instance. - * @param disposition The disposition of the new instance. + * Returns: a new `TurnsParticipant` */ G_GNUC_WARN_UNUSED_RESULT TurnsParticipant * turns_participant_new_with(gchar const * name, gfloat priority, TurnsParticipantDisposition disposition); /** - * @brief Gets whether the participant is currently active in a turn order. - * @since 1.0.0 + * turns_participant_get_active: (get-property active) + * @self: a participant * - * @return The current value of the @p Turns.Participant:active property. + * Gets whether the participant is currently active in a turn order. */ G_GNUC_WARN_UNUSED_RESULT gboolean turns_participant_get_active(TurnsParticipant const * self); /** - * @brief Gets whether the participant has been defeated. - * @since 1.0.0 + * turns_participant_get_defeated: (get-property defeated) + * @self: a participant * - * @return The current value of the @p Turns.Participant:defeated property. + * Gets whether the participant has been defeated. */ G_GNUC_WARN_UNUSED_RESULT gboolean turns_participant_get_defeated(TurnsParticipant const * self); /** - * @brief Gets the disposition of the participant. - * @since 1.0.0 + * turns_participant_get_disposition: (get-property disposition) + * @self: a participant * - * @return The current value of the @p Turns.Participant:disposition property. + * Gets the disposition of the participant towards the players. */ G_GNUC_WARN_UNUSED_RESULT TurnsParticipantDisposition turns_participant_get_disposition(TurnsParticipant const * self); /** - * @brief Gets the id of the participant. - * @since 1.0.0 + * turns_participant_get_id: + * @self: a participant * - * @return (transfer none) - The id of the participant. + * Gets the unique id of the participant. */ G_GNUC_WARN_UNUSED_RESULT gchar const * turns_participant_get_id(TurnsParticipant const * self); /** - * @brief Gets the name of the participant. - * @since 1.0.0 + * turns_participant_get_name: (get-property name) + * @self: a participant * - * @return (transfer none) - The current value of the @p Turns.Participant:name property. + * Gets the name of the participant. */ G_GNUC_WARN_UNUSED_RESULT gchar const * turns_participant_get_name(TurnsParticipant const * self); /** - * @brief Get the priority of the participant. - * @since 1.0.0 + * turns_participant_get_priority: (get-property priority) + * @self: a participant * - * @return The current value of the @p Turns.Participant:priority property. + * Gets the priority of the participant. */ G_GNUC_WARN_UNUSED_RESULT gfloat turns_participant_get_priority(TurnsParticipant const * self); /** - * @brief Sets whether the participant is currently active in a turn order. - * @since 1.0.0 + * turns_participant_set_active: (set-property active) + * @self: a participant * - * @param value The new value of the @p Turns.Participant:active property. + * Sets whether the participant is currently active in a turn order. */ void turns_participant_set_active(TurnsParticipant * self, gboolean value); /** - * @brief Set whether the participant has been defeated. - * @since 1.0.0 + * turns_participant_set_defeated: (set-property defeated) + * @self: a participant * - * @param value The new value of the @p Turns.Participant:defeated property. + * Sets whether the participant has been defeated. */ void turns_participant_set_defeated(TurnsParticipant * self, gboolean value); /** - * @brief Sets the disposition of the participant. - * @since 1.0.0 + * turns_participant_set_disposition: (set-property disposition) + * @self: a participant * - * @param value The new value of the @p Turns.Participant:disposition property. + * Sets the disposition of the participant towards the players. */ void turns_participant_set_disposition(TurnsParticipant * self, TurnsParticipantDisposition value); /** - * @brief Sets the name of the participant. - * @since 1.0.0 + * turns_participant_set_name: (set-property name) + * @self: a participant * - * @param value (transfer none) - The new value of the @p Turns.Participant:active property. + * Sets the name of the participant. */ void turns_participant_set_name(TurnsParticipant * self, gchar const * value); /** - * @brief Sets the priority of the participant. - * @since 1.0.0 + * turns_participant_set_priority: (set-property priority) + * @self: a participant * - * @param value The new value of the @p Turns.Participant:priority property. + * Sets the priority of the participant. */ void turns_participant_set_priority(TurnsParticipant * self, gfloat value); G_END_DECLS -#endif \ No newline at end of file +#endif -- cgit v1.2.3