mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
C++: Enable /bigobj by default when building with MSVC
Large C++ files generated from .slint files can cause link problems with MSVC. When that happens, MSVC itself suggests /bigobj as remedy. It's not apparent that there's a downside to using this option, apart from backwaords binary compatibility - which is not a concern for us. The discussion at https://developercommunity.visualstudio.com/t/Enable-bigobj-by-default/1031214 suggests that perhaps this will become the default one day. To simplify our examples and avoid users running into this, let's enable it by default.
This commit is contained in:
parent
79f19b5750
commit
7e08231650
6 changed files with 5 additions and 12 deletions
|
@ -21,6 +21,8 @@ All notable changes to this project are documented in this file.
|
|||
- Fixed memory corruption when embedding images in generated C++ code.
|
||||
- Add support for dispatching key press and key release events to `slint::Window` via `dispatch_key_*_event`. This replaces
|
||||
the experimental `slint::experimental::platform::WindowAdapter::dispatch_key_event`.
|
||||
- MSVC: /bigobj is enabled by default as compile option when linking against the Slint CMake target, removing the need
|
||||
for users who run into linking issues to add that to their build.
|
||||
|
||||
### LSP
|
||||
|
||||
|
|
|
@ -59,6 +59,9 @@ add_library(Slint INTERFACE)
|
|||
add_library(Slint::Slint ALIAS Slint)
|
||||
target_link_libraries(Slint INTERFACE slint-cpp)
|
||||
target_compile_features(Slint INTERFACE cxx_std_20)
|
||||
if (MSVC)
|
||||
target_compile_options(Slint INTERFACE /bigobj)
|
||||
endif()
|
||||
|
||||
function(define_cargo_feature cargo-feature description default)
|
||||
# turn foo-bar into SLINT_FEATURE_FOO_BAR
|
||||
|
|
|
@ -9,8 +9,5 @@ if (NOT TARGET Slint::Slint)
|
|||
endif()
|
||||
|
||||
add_executable(gallery main.cpp)
|
||||
if (MSVC)
|
||||
target_compile_options(gallery PRIVATE /bigobj)
|
||||
endif()
|
||||
target_link_libraries(gallery PRIVATE Slint::Slint)
|
||||
slint_target_sources(gallery gallery.slint)
|
||||
|
|
|
@ -9,8 +9,5 @@ if (NOT TARGET Slint::Slint)
|
|||
endif()
|
||||
|
||||
add_executable(printerdemo main.cpp)
|
||||
if (MSVC)
|
||||
target_compile_options(printerdemo PRIVATE /bigobj)
|
||||
endif()
|
||||
target_link_libraries(printerdemo PRIVATE Slint::Slint)
|
||||
slint_target_sources(printerdemo ../ui/printerdemo.slint)
|
||||
|
|
|
@ -12,7 +12,4 @@ add_executable(printerdemo_interpreted main.cpp)
|
|||
target_compile_definitions(printerdemo_interpreted PRIVATE
|
||||
SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"
|
||||
)
|
||||
if (MSVC)
|
||||
target_compile_options(printerdemo_interpreted PRIVATE /bigobj)
|
||||
endif()
|
||||
target_link_libraries(printerdemo_interpreted PRIVATE Slint::Slint)
|
||||
|
|
|
@ -9,8 +9,5 @@ if (NOT TARGET Slint::Slint)
|
|||
endif()
|
||||
|
||||
add_executable(virtual_keyboard main.cpp)
|
||||
if (MSVC)
|
||||
target_compile_options(virtual_keyboard PRIVATE /bigobj)
|
||||
endif()
|
||||
target_link_libraries(virtual_keyboard PRIVATE Slint::Slint)
|
||||
slint_target_sources(virtual_keyboard ../ui/main_window.slint)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue