Browse Source

Merge pull request #108 from cloudwu/fixbuild

Fix mingw build
Michael R. P. Ragazzon 5 years ago
parent
commit
2981774de6

+ 4 - 0
CMakeLists.txt

@@ -514,6 +514,10 @@ endif(NOT BUILD_FRAMEWORK)
 		target_precompile_headers(shell PRIVATE ${PROJECT_SOURCE_DIR}/Samples/shell/src/precompiled.h)
 	endif()
 
+	if (WIN32)
+		target_link_libraries(shell PUBLIC shlwapi)
+	endif()
+
 	# Build and install the basic samples
 	foreach(sample ${samples})
 		bl_sample(${sample} ${sample_LIBRARIES})

+ 2 - 2
Samples/basic/treeview/src/FileSystem.cpp

@@ -32,7 +32,7 @@
 #include <cstdio>
 #include <string.h>
 
-#ifdef WIN32
+#ifdef RMLUI_PLATFORM_WIN32
 #include <io.h>
 #else
 #include <dirent.h>
@@ -72,7 +72,7 @@ struct FileSystemNode
 	// Build the list of files and directories within this directory.
 	void BuildTree(const Rml::String& root = "")
 	{
-#ifdef WIN32
+#ifdef RMLUI_PLATFORM_WIN32
 		_finddata_t find_data;
 		intptr_t find_handle = _findfirst((root + name + "/*.*").c_str(), &find_data);
 		if (find_handle != -1)

+ 2 - 0
Samples/shell/include/win32/IncludeWindows.h

@@ -36,7 +36,9 @@
 #define UNICODE
 #define _UNICODE
 #define WIN32_LEAN_AND_MEAN
+#ifndef NOMINMAX
 #define NOMINMAX
+#endif
 
 #include <windows.h>
 

+ 0 - 1
Samples/shell/src/win32/ShellWin32.cpp

@@ -34,7 +34,6 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <shlwapi.h>
-#pragma comment( lib  , "Shlwapi.lib"  )
 
 static LRESULT CALLBACK WindowProcedure(HWND window_handle, UINT message, WPARAM w_param, LPARAM l_param);