mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	Merge branch 'windows-clang-fixes' into 'master'
Windows Clang 18 fixes See merge request KartKrew/RingRacers!59
This commit is contained in:
		
						commit
						508825df21
					
				
					 5 changed files with 37 additions and 20 deletions
				
			
		|  | @ -201,7 +201,7 @@ add_custom_target(_SRB2_reconf ALL | |||
| ) | ||||
| add_dependencies(SRB2SDL2 _SRB2_reconf) | ||||
| 
 | ||||
| if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows") | ||||
| if(("${CMAKE_COMPILER_IS_GNUCC}" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows") | ||||
| 	target_link_options(SRB2SDL2 PRIVATE "-Wl,--disable-dynamicbase") | ||||
| 	if("${SRB2_CONFIG_STATIC_STDLIB}") | ||||
| 		# On MinGW with internal libraries, link the standard library statically | ||||
|  | @ -609,16 +609,16 @@ endif() | |||
| add_subdirectory(hud) | ||||
| add_subdirectory(modp_b64) | ||||
| 
 | ||||
| # strip debug symbols into separate file when using gcc. | ||||
| # strip debug symbols into separate file when using gcc or clang. | ||||
| # to be consistent with Makefile, don't generate for OS X. | ||||
| if((CMAKE_COMPILER_IS_GNUCC) AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)) | ||||
| if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")  AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)) | ||||
| 	if(${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo OR SRB2_CONFIG_ALWAYS_MAKE_DEBUGLINK) | ||||
| 		message(STATUS "Will make separate debug symbols in *.debug") | ||||
| 		add_custom_command(TARGET SRB2SDL2 POST_BUILD | ||||
| 			COMMAND ${OBJCOPY} ${OBJCOPY_ONLY_KEEP_DEBUG} $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug | ||||
| 			COMMAND ${CMAKE_OBJCOPY} ${OBJCOPY_ONLY_KEEP_DEBUG} $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug | ||||
| 			# mold linker: .gnu_debuglink is present by default, so --add-gnu-debuglink would fail | ||||
| 			COMMAND ${OBJCOPY} --strip-debug --remove-section=.gnu_debuglink $<TARGET_FILE:SRB2SDL2> | ||||
| 			COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2> | ||||
| 			COMMAND ${CMAKE_OBJCOPY} --strip-debug --remove-section=.gnu_debuglink $<TARGET_FILE:SRB2SDL2> | ||||
| 			COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2> | ||||
| 		) | ||||
| 	endif() | ||||
| endif() | ||||
|  | @ -626,14 +626,22 @@ endif() | |||
| # copy DLLs to bin/ directory if building internal shared on windows | ||||
| if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows AND NOT "${SRB2_CONFIG_INTERNAL_LIBRARIES}" AND "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}") | ||||
| 	set(ADDITIONAL_DLLS "") | ||||
| 	if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU) | ||||
| 	if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||||
| 		# also copy implicitly linked system libraries | ||||
| 		get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH) | ||||
| 		list(APPEND ADDITIONAL_DLLS | ||||
| 			"libgcc_s_dw2-1.dll" | ||||
| 			"libstdc++-6.dll" | ||||
| 			"libwinpthread-1.dll" | ||||
| 		) | ||||
| 		if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU) | ||||
| 			list(APPEND ADDITIONAL_DLLS | ||||
| 				"libgcc_s_dw2-1.dll" | ||||
| 				"libstdc++-6.dll" | ||||
| 				"libwinpthread-1.dll" | ||||
| 			) | ||||
| 		else() | ||||
| 			list(APPEND ADDITIONAL_DLLS | ||||
| 				"libunwind.dll" | ||||
| 				"libc++.dll" | ||||
| 				"libwinpthread-1.dll" | ||||
| 			) | ||||
| 		endif() | ||||
| 		list(TRANSFORM ADDITIONAL_DLLS PREPEND "${MINGW_BIN_PATH}/") | ||||
| 	endif() | ||||
| 	add_custom_command(TARGET SRB2SDL2 POST_BUILD | ||||
|  |  | |||
|  | @ -238,11 +238,12 @@ bool operator!=(const srb2::StaticVec<T, L1>& lhs, const srb2::StaticVec<T, L2>& | |||
| template <typename T, size_t Limit> | ||||
| struct std::hash<srb2::StaticVec<T, Limit>> | ||||
| { | ||||
| 	uint64_t operator()(const srb2::StaticVec<T, Limit>& input) const | ||||
| 	size_t operator()(const srb2::StaticVec<T, Limit>& input) const | ||||
| 	{ | ||||
| 		constexpr const uint64_t prime {0x00000100000001B3}; | ||||
| 		std::size_t ret {0xcbf29ce484222325}; | ||||
| 		constexpr size_t prime = sizeof(size_t) == 8 ? 0x00000100000001B3 : 0x01000193; | ||||
| 		constexpr size_t basis = sizeof(size_t) == 8 ? 0xcbf29ce484222325 : 0x811c9dc5; | ||||
| 
 | ||||
| 		size_t ret = basis; | ||||
| 		for (auto itr = input.begin(); itr != input.end(); itr++) | ||||
| 		{ | ||||
| 			ret = (ret * prime) ^ std::hash<T>(*itr); | ||||
|  |  | |||
|  | @ -558,6 +558,9 @@ extern struct debugFlagNames_s const debug_flag_names[]; | |||
| // Misc stuff for later...
 | ||||
| // =======================
 | ||||
| 
 | ||||
| #ifndef M_PI | ||||
| #define M_PI 3.14159265358979323846 | ||||
| #endif | ||||
| #define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180) | ||||
| 
 | ||||
| // Modifier key variables, accessible anywhere
 | ||||
|  |  | |||
|  | @ -258,7 +258,7 @@ enum {false = 0, true = 1}; | |||
| 		#endif | ||||
| 	#endif | ||||
| 
 | ||||
| 	#if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) // MinGW, >= GCC 3.4
 | ||||
| 	#if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && !defined(__clang__) // MinGW, >= GCC 3.4, not Clang
 | ||||
| 		#define ATTRPACK __attribute__((packed, gcc_struct)) | ||||
| 	#else | ||||
| 		#define ATTRPACK __attribute__((packed)) | ||||
|  | @ -407,8 +407,12 @@ typedef UINT64 precise_t; | |||
| // that struct and it's fine...
 | ||||
| 
 | ||||
| // Cast function pointer to (void*)
 | ||||
| #define FUNCPTRCAST(p) ((union{void(*f)(void);void*v;})\ | ||||
| 		{(void(*)(void))p}).v | ||||
| typedef union { | ||||
|     void (*f)(void); | ||||
|     void *v; | ||||
| } func_ptr_cast_union; | ||||
| 
 | ||||
| #define FUNCPTRCAST(p) (((func_ptr_cast_union){(void(*)(void))(p)}).v) | ||||
| 
 | ||||
| #include "typedef.h" | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,18 +12,19 @@ | |||
| 
 | ||||
| /* https://tools.ietf.org/html/rfc5389 */ | ||||
| 
 | ||||
| #include <vector> | ||||
| 
 | ||||
| #if defined (__linux__) || defined (__FreeBSD__) | ||||
| #include <sys/random.h> | ||||
| #elif defined (_WIN32) | ||||
| #define _CRT_RAND_S | ||||
| #include <cstdlib> | ||||
| #elif defined (__APPLE__) | ||||
| #include <CommonCrypto/CommonRandom.h> | ||||
| #else | ||||
| #error "Need CSPRNG." | ||||
| #endif | ||||
| 
 | ||||
| #include <vector> | ||||
| 
 | ||||
| #include "doomdef.h" | ||||
| #include "d_clisrv.h" | ||||
| #include "command.h" | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Eidolon
						Eidolon