Browse Source

Move target_link_libraries to shell, and rename WIN32 to RMLUI_PLATFORM_WIN32

Cloud Wu 5 years ago
parent
commit
21ca508f51

+ 4 - 8
CMakeLists.txt

@@ -171,10 +171,6 @@ if(NO_FONT_INTERFACE_DEFAULT)
 	add_definitions(-DRMLUI_NO_FONT_INTERFACE_DEFAULT)
 endif()
 
-if (WIN32)
-	add_definitions(-DWIN32)
-endif(WIN32)
-
 if(NOT BUILD_SHARED_LIBS)
 	add_definitions(-DRMLUI_STATIC_LIB)
 	message("-- Building static libraries. Make sure to #define RMLUI_STATIC_LIB before including RmlUi in your project.")
@@ -451,10 +447,6 @@ macro(bl_sample NAME)
 	endif()
 
 	target_link_libraries(${NAME} ${ARGN})
-
-	if (WIN32)
-		target_link_libraries(${NAME} shlwapi)
-	endif()
 endmacro()
 
 if(BUILD_SAMPLES)
@@ -522,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)

+ 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);