From 65cb1f54f467b225949fab42b75a10a4bd202466 Mon Sep 17 00:00:00 2001 From: Jonathan Poncelet Date: Tue, 7 Aug 2018 08:24:04 +0100 Subject: [PATCH 1/2] Made library functions hidden by default on Mac/Linux This resolves an issue where the server library was calling client library functions in error. --- cl_dll/CMakeLists.txt | 1 + dlls/CMakeLists.txt | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 323d156f..1143eefe 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -31,6 +31,7 @@ add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL) if(NOT MSVC) add_compile_options(-fno-exceptions) # GCC/Clang flag add_compile_options(-Wno-write-strings) # GCC/Clang flag + add_compile_options(-fvisibility=hidden) # GCC/Clang flag add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp) if(NOT MINGW) diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 55370eeb..ccaa0279 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -30,13 +30,14 @@ add_definitions(-DCLIENT_WEAPONS) if(NOT MSVC) add_compile_options(-fno-exceptions) # GCC/Clang flag add_compile_options(-Wno-invalid-offsetof) # GCC/Clang flag + add_compile_options(-fvisibility=hidden) # GCC/Clang flag add_definitions(-D_LINUX) # It seems enough for all non-Win32 systems add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf ) else() add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) endif() -set (SVDLL_SOURCES +set (SVDLL_SOURCES agrunt.cpp airtank.cpp aflock.cpp @@ -140,7 +141,7 @@ set (SVDLL_SOURCES ../pm_shared/pm_math.c ../pm_shared/pm_shared.c ) - + include_directories (. wpn_shared ../common ../engine ../pm_shared ../game_shared ../public) if(USE_VOICEMGR) From b423cac3de4336e47c7379d04652275c5a0bd7c8 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Wed, 12 Sep 2018 05:05:55 +0500 Subject: [PATCH 2/2] Use CMAKE_C_FLAGS value for C++ compilers. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64c48928..918449e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,8 +55,8 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT) if(MSVC) error("UNDONE: set 32 build flags") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32") endif() set(CMAKE_SIZEOF_VOID_P 4)