mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
CMake: Add support for LIBRARY_PATHS to slint_target_sources
This makes it possible to use component libraries with C++.
This commit is contained in:
parent
b9052ecf8a
commit
6f2a6c3f09
8 changed files with 62 additions and 6 deletions
|
@ -53,6 +53,7 @@ endif()
|
|||
|
||||
if(SLINT_FEATURE_COMPILER OR SLINT_COMPILER)
|
||||
add_subdirectory(multiple-includes)
|
||||
add_subdirectory(libraries)
|
||||
endif()
|
||||
|
||||
slint_test(platform_eventloop)
|
||||
|
|
11
api/cpp/tests/libraries/CMakeLists.txt
Normal file
11
api/cpp/tests/libraries/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||
|
||||
add_executable(libraries main.cpp)
|
||||
target_link_libraries(libraries PRIVATE Slint::Slint)
|
||||
slint_target_sources(libraries appwindow.slint
|
||||
LIBRARY_PATHS
|
||||
helper_components=${CMAKE_CURRENT_SOURCE_DIR}/../../../../tests/helper_components/
|
||||
helper_buttons=${CMAKE_CURRENT_SOURCE_DIR}/../../../../tests/helper_components/test_button.slint
|
||||
)
|
||||
|
3
api/cpp/tests/libraries/README.md
Normal file
3
api/cpp/tests/libraries/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
<!-- Copyright © SixtyFPS GmbH <info@slint.dev> ; SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 -->
|
||||
|
||||
This is a test making sure that slint_target_sources accepts slint component library paths.
|
12
api/cpp/tests/libraries/appwindow.slint
Normal file
12
api/cpp/tests/libraries/appwindow.slint
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||
|
||||
import { TestButton } from "@helper_components/test_button.slint";
|
||||
import { ColorButton } from "@helper_buttons";
|
||||
|
||||
|
||||
export component App inherits Window {
|
||||
TestButton { }
|
||||
|
||||
ColorButton { }
|
||||
}
|
10
api/cpp/tests/libraries/main.cpp
Normal file
10
api/cpp/tests/libraries/main.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||
|
||||
#include "appwindow.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
auto my_ui = App::create();
|
||||
my_ui->run();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue