Skip to content

Commit

Permalink
Add CMake option to disable the use of WinToast(Lib), needed for ming…
Browse files Browse the repository at this point in the history
…w build
  • Loading branch information
maxmitti committed Mar 12, 2022
1 parent 0e5cb2d commit c8c25c4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ CMAKE_DEPENDENT_OPTION(WITH_DEVELOPER_MODE "Use GTK for the developer mode" OFF
"NOT USE_CONSOLE" OFF)
# USE_LIBNOTIFY
CMAKE_DEPENDENT_OPTION(USE_LIBNOTIFY "Use libnotify for desktop notifications" ON "WITH_DEVELOPER_MODE AND NOT USE_CONSOLE AND NOT WIN32" OFF)
# USE_WINTOAST
CMAKE_DEPENDENT_OPTION(USE_WINTOAST "Use WinToast for desktop notifications" ON "NOT USE_CONSOLE AND WIN32" OFF)

# Use Microsoft CryptoAPI instead of OpenSSL when compiling for Windows
if (WIN32)
Expand Down Expand Up @@ -191,6 +193,13 @@ if (USE_LIBNOTIFY)
src/C4ToastLibNotify.cpp src/C4ToastLibNotify.h)
endif ()

if (USE_WINTOAST)
target_include_directories(clonk PRIVATE src/WinToast/src)
list(APPEND CLONK_SOURCES
src/C4ToastWinToastLib.cpp src/C4ToastWinToastLib.h
src/WinToast/src/wintoastlib.cpp src/WinToast/src/wintoastlib.h)
endif ()

if (USE_CONSOLE)
add_executable(clonk ${CLONK_SOURCES})
else ()
Expand Down Expand Up @@ -319,7 +328,6 @@ endif ()

# Link Windows libraries
if (WIN32)
target_include_directories(clonk PRIVATE src/WinToast/src)
target_link_libraries(clonk dbghelp iphlpapi winmm ws2_32)

if (USE_SDL_MIXER)
Expand Down
5 changes: 0 additions & 5 deletions cmake/filelists/EngineWin32.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
src/C4CrashHandlerWin32.cpp
src/C4FileClasses.cpp
src/C4ToastWinToastLib.cpp
src/C4ToastWinToastLib.h
src/C4Windows.h
src/res/engine.rc
src/res/engine_resource.h
Expand All @@ -11,6 +9,3 @@ src/StdJoystick.h
src/StdStringEncodingConverter.cpp
src/StdStringEncodingConverter.h
src/StdWindow.cpp

src/WinToast/src/wintoastlib.cpp
src/WinToast/src/wintoastlib.h
1 change: 1 addition & 0 deletions config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#cmakedefine USE_SDL_FOR_GAMEPAD 1
#cmakedefine USE_STAT 1
#cmakedefine USE_X11 1
#cmakedefine USE_WINTOAST 1
#cmakedefine WITH_DEVELOPER_MODE 1
#cmakedefine WITH_GLIB 1

Expand Down
6 changes: 3 additions & 3 deletions src/C4Toast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#ifdef USE_LIBNOTIFY
#include "C4ToastLibNotify.h"
#elif defined(_WIN32)
#elif defined(USE_WINTOAST)
#include "C4ToastWinToastLib.h"
#endif

Expand All @@ -28,7 +28,7 @@ C4ToastSystem *C4ToastSystem::NewInstance()
{
#ifdef USE_LIBNOTIFY
return new C4ToastSystemLibNotify{};
#elif defined(_WIN32)
#elif defined(USE_WINTOAST)
return new C4ToastSystemWinToastLib{};
#else
return nullptr;
Expand All @@ -50,7 +50,7 @@ void C4ToastImpl::SetEventHandler(C4ToastEventHandler *const eventHandler)
C4Toast::C4Toast() : impl{
#ifdef USE_LIBNOTIFY
new C4ToastImplLibNotify{}
#elif defined(_WIN32)
#elif defined(USE_WINTOAST)
new C4ToastImplWinToastLib{}
#else
new C4ToastImpl{}
Expand Down

0 comments on commit c8c25c4

Please sign in to comment.