cmake: add more options and show more diagnostic messages.

This commit is contained in:
Andrey Akhmichin 2022-06-17 03:59:39 +05:00
parent 2363a8ff21
commit 987ea07ce1
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
3 changed files with 58 additions and 4 deletions

View File

@ -57,15 +57,29 @@ else()
option(64BIT "Disable auto -m32 appending to compiler flags" ON)
endif()
option(BARNACLE_FIX_VISIBILITY "Enable barnacle tongue length fix" OFF)
option(CLIENT_WEAPONS "Enable client local weapons prediction" ON)
option(CROWBAR_IDLE_ANIM "Enable crowbar idle animation" OFF)
option(CROWBAR_DELAY_FIX "Enable crowbar attack delay fix" OFF)
option(CROWBAR_FIX_RAPID_CROWBAR "Enable rapid crowbar fix" OFF)
option(GAUSS_OVERCHARGE_FIX "Enable gauss overcharge fix" OFF)
option(OEM_BUILD "Enable OEM Build" OFF)
option(HLDEMO_BUILD "Enable Demo Build" OFF)
set(GAMEDIR "valve" CACHE STRING "Gamedir path")
set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll")
set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll")
set(SERVER_LIBRARY_NAME "hl" CACHE STRING "Library name for PC platforms")
message(STATUS "Half-Life")
#-----------------
# MAIN BUILD CODE \
###################\
if(HLDEMO_BUILD AND OEM_BUILD)
message(FATAL_ERROR "Don't mix Demo and OEM builds!")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT)
if(MSVC)
error("UNDONE: set 32 build flags")
@ -91,6 +105,46 @@ else()
message(STATUS "Building for 32 Bit")
endif()
if(CLIENT_WEAPONS)
message(STATUS "Client weapons enabled.")
add_definitions(-DCLIENT_WEAPONS)
endif()
if(BARNACLE_FIX_VISIBILITY)
message(STATUS "Barnacle tongue fix enabled")
add_definitions(-DBARNACLE_FIX_VISIBILITY)
endif()
if(CROWBAR_IDLE_ANIM)
message(STATUS "Crowbar idle animation enabled")
add_definitions(-DCROWBAR_IDLE_ANIM)
endif()
if(CROWBAR_DELAY_FIX)
message(STATUS "Crowbar attack delay fix enabled")
add_definitions(-DCROWBAR_DELAY_FIX)
endif()
if(CROWBAR_FIX_RAPID_CROWBAR)
message(STATUS "Rapid crowbar fix enabled")
add_definitions(-DCROWBAR_FIX_RAPID_CROWBAR)
endif()
if(GAUSS_OVERCHARGE_FIX)
message(STATUS "Gauss overcharge fix enabled")
add_definitions(-DGAUSS_OVERCHARGE_FIX)
endif()
if(OEM_BUILD)
message(STATUS "OEM build enabled")
add_definitions(-DOEM_BUILD)
endif()
if(HLDEMO_BUILD)
message(STATUS "Demo build enabled")
add_definitions(-DHLDEMO_BUILD)
endif()
if (MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--add-stdcall-alias")
@ -127,13 +181,15 @@ if(HAVE_TGMATH_H)
endif()
if(BUILD_CLIENT)
message(STATUS "Building client enabled")
add_subdirectory(cl_dll)
endif()
if(BUILD_SERVER)
message(STATUS "Building server enabled")
add_subdirectory(dlls)
endif()
if(NOT BUILD_SERVER AND NOT BUILD_CLIENT)
error("Nothing to build")
message(FATAL_ERROR "Nothing to build")
endif()

View File

@ -25,7 +25,7 @@ project (CLDLL)
set (CLDLL_LIBRARY client)
add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL)
add_definitions(-DCLIENT_DLL)
if(NOT MSVC)
add_compile_options(-fno-exceptions) # GCC/Clang flag

View File

@ -25,8 +25,6 @@ project (SVDLL)
set (SVDLL_LIBRARY server)
add_definitions(-DCLIENT_WEAPONS)
if(NOT MSVC)
add_compile_options(-fno-exceptions) # GCC/Clang flag
add_compile_options(-Wno-invalid-offsetof) # GCC/Clang flag