Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 13, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Update power_grid_model_c/CMakeLists.txt to use the DEFAULT_SHARED variable for building the C library. The logic should be:

  • If BUILD_SHARED_LIBS is defined, DEFAULT_SHARED is empty.
  • If BUILD_SHARED_LIBS is not defined, DEFAULT_SHARED is set to 'SHARED'.
  • Use DEFAULT_SHARED in the add_library call for power_grid_model_c, directly in place of SHARED/STATIC, for concise code and minimal impact on parent/global build settings.

Implement this by changing only the minimum needed lines in the existing CMakeLists.txt. Do not introduce source lists if not needed. Do not set BUILD_SHARED_LIBS anywhere in the repo. Do not change logic outside power_grid_model_c/CMakeLists.txt.

Example:

if(DEFINED BUILD_SHARED_LIBS)
set(DEFAULT_SHARED "")
else()
set(DEFAULT_SHARED "SHARED")
endif()

add_library(power_grid_model_c ${DEFAULT_SHARED}
src/buffer.cpp
src/handle.cpp
src/meta_data.cpp
src/model.cpp
src/options.cpp
src/dataset_definitions.cpp
src/serialization.cpp
src/dataset.cpp
src/math_solver.cpp
)

... rest of your target setup ...

This pull request was created as a result of the following prompt from Copilot chat.

Update power_grid_model_c/CMakeLists.txt to use the DEFAULT_SHARED variable for building the C library. The logic should be:

  • If BUILD_SHARED_LIBS is defined, DEFAULT_SHARED is empty.
  • If BUILD_SHARED_LIBS is not defined, DEFAULT_SHARED is set to 'SHARED'.
  • Use DEFAULT_SHARED in the add_library call for power_grid_model_c, directly in place of SHARED/STATIC, for concise code and minimal impact on parent/global build settings.

Implement this by changing only the minimum needed lines in the existing CMakeLists.txt. Do not introduce source lists if not needed. Do not set BUILD_SHARED_LIBS anywhere in the repo. Do not change logic outside power_grid_model_c/CMakeLists.txt.

Example:

if(DEFINED BUILD_SHARED_LIBS)
set(DEFAULT_SHARED "")
else()
set(DEFAULT_SHARED "SHARED")
endif()

add_library(power_grid_model_c ${DEFAULT_SHARED}
src/buffer.cpp
src/handle.cpp
src/meta_data.cpp
src/model.cpp
src/options.cpp
src/dataset_definitions.cpp
src/serialization.cpp
src/dataset.cpp
src/math_solver.cpp
)

... rest of your target setup ...


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@TonyXiang8787 TonyXiang8787 deleted the copilot/update-cmake-default-shared branch October 13, 2025 07:45
Copilot finished work on behalf of TonyXiang8787 October 13, 2025 07:46
@Copilot Copilot AI requested a review from TonyXiang8787 October 13, 2025 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants