2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-29 05:21:01 +01:00
hlsdk-xash3d/cl_dll/CMakeLists.txt

233 lines
6.3 KiB
CMake
Raw Normal View History

2016-08-08 09:27:59 +02:00
#
# Copyright (c) 2016 Alibek Omarov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
cmake_minimum_required(VERSION 3.9)
2016-08-08 09:27:59 +02:00
project (CLDLL)
set (CLDLL_LIBRARY client)
add_definitions(-DCLIENT_DLL)
2017-12-28 00:02:23 +01:00
if(NOT MSVC)
2017-12-28 00:02:23 +01:00
add_compile_options(-fno-exceptions) # GCC/Clang flag
2024-01-15 03:40:06 +01:00
add_compile_options(-fno-rtti) # GCC/Clang flag
add_compile_options(-fvisibility=hidden) # GCC/Clang flag
2017-12-28 00:02:23 +01:00
add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp)
if(NOT MINGW)
add_definitions(-D_snprintf=snprintf -D_vsnprintf=vsnprintf)
endif()
if(CMAKE_BUILD_TYPE MATCHES "Release"
OR (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo"
AND CMAKE_SYSTEM_NAME STREQUAL "Android"))
add_compile_options(-fno-unwind-tables -fno-asynchronous-unwind-tables) # GCC/Clang flag
add_compile_options(-fomit-frame-pointer) # GCC/Clang flag
add_compile_options(-ftree-vectorize) # GCC/Clang flag
add_compile_options(-funsafe-math-optimizations) # GCC/Clang flag
endif()
2017-12-28 00:02:23 +01:00
else()
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
endif()
2016-11-17 23:05:05 +01:00
if (GOLDSOURCE_SUPPORT)
2017-12-28 00:02:23 +01:00
add_definitions(-DGOLDSOURCE_SUPPORT)
2016-11-17 23:05:05 +01:00
endif()
2017-12-28 00:02:23 +01:00
if (USE_VGUI)
add_definitions(-DUSE_VGUI)
if (USE_NOVGUI_MOTD)
add_definitions(-DUSE_NOVGUI_MOTD)
endif()
if (USE_NOVGUI_SCOREBOARD)
add_definitions(-DUSE_NOVGUI_SCOREBOARD)
endif()
endif()
2016-08-08 09:27:59 +02:00
2016-11-17 23:05:05 +01:00
set (CLDLL_SOURCES
../dlls/crossbow.cpp
../dlls/crowbar.cpp
../dlls/egon.cpp
../dlls/gauss.cpp
../dlls/handgrenade.cpp
../dlls/hornetgun.cpp
../dlls/mp5.cpp
../dlls/python.cpp
../dlls/rpg.cpp
../dlls/satchel.cpp
../dlls/shotgun.cpp
../dlls/squeakgrenade.cpp
../dlls/tripmine.cpp
2016-08-08 09:27:59 +02:00
../dlls/glock.cpp
2016-11-17 23:05:05 +01:00
ev_hldm.cpp
2016-08-08 09:27:59 +02:00
hl/hl_baseentity.cpp
hl/hl_events.cpp
hl/hl_objects.cpp
hl/hl_weapons.cpp
ammo.cpp
ammo_secondary.cpp
ammohistory.cpp
battery.cpp
cdll_int.cpp
com_weapons.cpp
death.cpp
demo.cpp
entity.cpp
ev_common.cpp
events.cpp
flashlight.cpp
GameStudioModelRenderer.cpp
geiger.cpp
health.cpp
hud.cpp
hud_msg.cpp
hud_redraw.cpp
hud_spectator.cpp
hud_update.cpp
in_camera.cpp
input.cpp
input_goldsource.cpp
input_mouse.cpp
input_xash3d.cpp
2024-02-12 23:41:13 +01:00
interpolation.cpp
2016-08-08 09:27:59 +02:00
menu.cpp
message.cpp
parsemsg.cpp
../pm_shared/pm_debug.c
../pm_shared/pm_math.c
../pm_shared/pm_shared.c
saytext.cpp
status_icons.cpp
statusbar.cpp
studio_util.cpp
StudioModelRenderer.cpp
text_message.cpp
train.cpp
tri.cpp
util.cpp
view.cpp)
if (USE_VGUI)
list(APPEND CLDLL_SOURCES
vgui_int.cpp
vgui_ClassMenu.cpp
vgui_ConsolePanel.cpp
vgui_ControlConfigPanel.cpp
vgui_CustomObjects.cpp
vgui_MOTDWindow.cpp
vgui_SchemeManager.cpp
vgui_ScorePanel.cpp
vgui_TeamFortressViewport.cpp
vgui_SpectatorPanel.cpp
vgui_teammenu.cpp
voice_status.cpp
../game_shared/vgui_checkbutton2.cpp
../game_shared/vgui_grid.cpp
../game_shared/vgui_helpers.cpp
../game_shared/vgui_listbox.cpp
../game_shared/vgui_loadtga.cpp
../game_shared/vgui_scrollbar2.cpp
../game_shared/vgui_slider2.cpp
../game_shared/voice_banmgr.cpp
)
if (USE_NOVGUI_MOTD)
list(APPEND CLDLL_SOURCES MOTD.cpp)
endif()
if (USE_NOVGUI_SCOREBOARD)
list(APPEND CLDLL_SOURCES scoreboard.cpp)
endif()
else()
list(APPEND CLDLL_SOURCES
MOTD.cpp
scoreboard.cpp)
endif()
2016-11-17 23:05:05 +01:00
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public)
if (USE_VGUI)
SET(CMAKE_SKIP_RPATH TRUE)
2022-06-18 03:42:42 +02:00
link_directories(${CMAKE_SOURCE_DIR}/vgui_support/vgui-dev/lib)
include_directories(../vgui_support/vgui-dev/include)
else()
2022-07-20 07:23:52 +02:00
include_directories(../utils/fake_vgui/include)
endif()
2016-08-08 09:27:59 +02:00
if(USE_VOICEMGR)
#set(CLDLL_SOURCES
# ${CLDLL_SOURCES}
# ../game_shared/voice_banmgr.cpp
# ../game_shared/voice_status.cpp)
endif()
add_library (${CLDLL_LIBRARY} SHARED ${CLDLL_SOURCES})
if (GOLDSOURCE_SUPPORT)
target_link_libraries( ${CLDLL_LIBRARY} ${CMAKE_DL_LIBS} )
endif()
2016-08-08 09:27:59 +02:00
if (USE_VGUI)
if (WIN32)
add_library(vgui SHARED IMPORTED)
2022-06-18 03:42:42 +02:00
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)
2022-06-18 03:42:42 +02:00
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)
target_link_libraries( ${CLDLL_LIBRARY} user32.lib )
if (GOLDSOURCE_SUPPORT)
target_link_libraries( ${CLDLL_LIBRARY} winmm.lib )
endif()
endif()
2017-12-18 22:27:56 +01:00
set_target_properties (${CLDLL_LIBRARY} PROPERTIES
2016-08-08 09:27:59 +02:00
POSITION_INDEPENDENT_CODE 1)
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android")
2018-03-22 13:23:34 +01:00
set(CLDLL_NAME "client")
2017-12-18 22:27:56 +01:00
set_target_properties(${CLDLL_LIBRARY} PROPERTIES
2018-03-22 13:23:34 +01:00
OUTPUT_NAME ${CLDLL_NAME}
2017-12-18 22:27:56 +01:00
PREFIX "")
endif()
if(MSVC)
set_property(TARGET ${CLDLL_LIBRARY} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
2024-01-15 03:16:49 +01:00
if(HAVE_LTO)
set_property(TARGET ${CLDLL_LIBRARY} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
2017-12-18 22:27:56 +01:00
install( TARGETS ${CLDLL_LIBRARY}
DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE )
2024-01-15 06:00:46 +01:00
add_custom_command(TARGET ${CLDLL_LIBRARY}
POST_BUILD DEPENDS ${CLDLL_LIBRARY}
COMMAND $<$<CONFIG:release>:${CMAKE_STRIP}> -s $<TARGET_FILE:${CLDLL_LIBRARY}>)