Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 95765c3

Browse files
committed
update
1 parent a931094 commit 95765c3

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(CMAKE_AUTOMOC ON)
66
set(CMAKE_AUTORCC ON)
77
set(CMAKE_AUTOUIC ON)
88

9+
910
set(PROJECT_NAME UniDeskCppExt)
1011
set(MODULE_VERSION_MAJOR 0)
1112
set(MODULE_VERSION_MINOR 0)
@@ -25,6 +26,7 @@ set(CMAKE_CXX_STANDARD 17)
2526
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2627
# if(MSVC)
2728
# add_compile_options(/Zc:__cplusplus)
29+
# add_compile_options(/permissive-)
2830
# endif()
2931

3032

@@ -100,12 +102,13 @@ message(STATUS "CMake Config install directory:" "${CMAKECONFIG_INSTALL_DIR}")
100102

101103

102104

103-
add_subdirectory(src)
104105

105106
add_subdirectory(pybind11)
106107
pybind11_add_module(UDFrameless src/UDFrameless.cpp)
108+
# target_link_libraries(UDFrameless PRIVATE Qt6::Core)
107109

108110

111+
add_subdirectory(src)
109112
# EXAMPLE_VERSION_INFO is defined by setup.py and passed into the C++ code as a
110113
# define (VERSION_INFO) here.
111114
target_compile_definitions(UDFrameless

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
5050
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}",
5151
f"-DPYTHON_EXECUTABLE={sys.executable}",
5252
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
53+
"-C "
5354
]
5455
build_args = []
5556
# Adding CMake arguments set as environment variable
@@ -59,7 +60,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
5960

6061
# In this example, we pass in the version to C++. You might not need to.
6162
cmake_args += [f"-DEXAMPLE_VERSION_INFO={self.distribution.get_version()}"]
62-
63+
6364
if self.compiler.compiler_type != "msvc":
6465
# Using Ninja-build since it a) is available as a wheel and b)
6566
# multithreads automatically. MSVC would require all variables be

src/singleton.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
/**
4+
* @brief The Singleton class
5+
*/
6+
template <typename T>
7+
class Singleton {
8+
public:
9+
static T* getInstance();
10+
};
11+
12+
template <typename T>
13+
T* Singleton<T>::getInstance()
14+
{
15+
static T* instance = new T();
16+
return instance;
17+
}
18+
19+
#define SINGLETON(Class) \
20+
private: \
21+
friend class Singleton<Class>; \
22+
\
23+
public: \
24+
static Class* getInstance() \
25+
{ \
26+
return Singleton<Class>::getInstance(); \
27+
}

0 commit comments

Comments
 (0)