From b89ce4c52703fc5b9e13683ecd1919b98694a9a2 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:42:26 +0500 Subject: [PATCH] cmake: force to use library naming scheme. --- CMakeLists.txt | 18 +++++++----------- cl_dll/CMakeLists.txt | 8 ++++---- dlls/CMakeLists.txt | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb335861..0d89a04a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,10 @@ include(VSForceXPToolchain) # Force XP toolchain for Visual Studio project (HLSDK-PORTABLE) +# Xash3D FWGS Library Naming Scheme compliance +# see documentation: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md +include(LibraryNaming) + #-------------- # USER DEFINES \ ################\ @@ -47,17 +51,13 @@ option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) option(BUILD_CLIENT "Build client dll" ON) option(BUILD_SERVER "Build server dll" ON) -if (CMAKE_SIZEOF_VOID_P EQUAL 4 OR - ((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "x64" - OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" - OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"))) +if (CMAKE_SIZEOF_VOID_P EQUAL 4 OR ((XASH_WIN32 OR XASH_LINUX) AND XASH_AMD64)) option(64BIT "Disable auto -m32 appending to compiler flags" OFF) else() option(64BIT "Disable auto -m32 appending to compiler flags" ON) endif() -if ((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR APPLE) AND NOT 64BIT) +if ((XASH_WIN32 OR XASH_LINUX OR XASH_APPLE) AND ((XASH_AMD64 AND NOT 64BIT) OR XASH_X86)) option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" ON) else() option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF) @@ -109,10 +109,6 @@ if(64BIT AND CMAKE_SIZEOF_VOID_P EQUAL 4) message(FATAL_ERROR "You enabled XASH_64BIT, but compiler can't create 64 bit code!") endif() -# Xash3D FWGS Library Naming Scheme compliance -# see documentation: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/extensions/library-naming.md -include(LibraryNaming) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "Building for 64 Bit") else() @@ -131,7 +127,7 @@ else() add_definitions(-D_CRT_SILENCE_NONCONFORMING_TGMATH_H) endif() -if(VITA) +if(XASH_PSVITA) add_compile_options(-fno-use-cxa-atexit) endif() diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index b88821a2..98e8e37b 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -175,19 +175,19 @@ if (GOLDSOURCE_SUPPORT) endif() if (USE_VGUI) - if (WIN32) + if (XASH_WIN32) add_library(vgui SHARED IMPORTED) set_property(TARGET vgui PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/vgui_support/vgui-dev/lib/win32_vc6/vgui.dll") set_property(TARGET vgui PROPERTY IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/vgui_support/vgui-dev/lib/win32_vc6/vgui.lib") target_link_libraries(${CLDLL_LIBRARY} vgui) - elseif(APPLE) + elseif(XASH_APPLE) target_link_libraries(${CLDLL_LIBRARY} "-Wl,--no-undefined -L${CMAKE_SOURCE_DIR}/vgui_support/vgui-dev/lib vgui.dylib") else() target_link_libraries(${CLDLL_LIBRARY} :vgui.so) endif() endif() -if(WIN32) +if(XASH_WIN32) target_link_libraries( ${CLDLL_LIBRARY} user32.lib ) if (GOLDSOURCE_SUPPORT) target_link_libraries( ${CLDLL_LIBRARY} winmm.lib ) @@ -197,7 +197,7 @@ endif() set_target_properties (${CLDLL_LIBRARY} PROPERTIES POSITION_INDEPENDENT_CODE 1) -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android") +if(NOT XASH_ANDROID) set(CLDLL_NAME "client") set_target_properties(${CLDLL_LIBRARY} PROPERTIES OUTPUT_NAME ${CLDLL_NAME} diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 638f1a73..4dc95ffc 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -161,7 +161,7 @@ add_library (${SVDLL_LIBRARY} SHARED ${SVDLL_SOURCES}) set_target_properties (${SVDLL_LIBRARY} PROPERTIES POSITION_INDEPENDENT_CODE 1) -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android") +if(NOT XASH_ANDROID) set(SVDLL_NAME "${SERVER_LIBRARY_NAME}") set_target_properties(${SVDLL_LIBRARY} PROPERTIES