Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support data list in .cmake file #1442

Merged
merged 1 commit into from
Mar 21, 2024
Merged

Support data list in .cmake file #1442

merged 1 commit into from
Mar 21, 2024

Conversation

Randalphwa
Copy link
Collaborator

See PR description for more details

This PR adds the list of data files in any gen_Data node to an additional macro in any generated .cmake file. It takes the variable name the dev specified for the main source file list, appends _data and generates the list from that.

Sample usage:

# Custom command to generate UI code
add_custom_command(
    OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/ui/wxue_data.cc
    COMMAND wxUiEditor --gen_cpp ../src/ui/MyProject.wxui
    COMMAND type ..\\src\\ui\\MyProject.log
    DEPENDS ${wxue_generated_code_data}
    COMMENT "Generating UI code..."
)

# Add a custom target to ensure the command is run before the main target
add_custom_target(GenerateUiCode DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/ui/wxue_data.cc)

add_executable(MyProgram
    ${srcfile_list}
    ${wxue_generated_code}
)

add_dependencies(MyProgram GenerateUiCode)

The above will result in wxUiEditor being called to regenerate wxue_data.cc if any of the data files have changed since the last time the code was generated.

See PR description for more details
@Randalphwa Randalphwa merged commit 20b80ab into main Mar 21, 2024
@Randalphwa Randalphwa deleted the cmake branch March 21, 2024 22:41
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant