Browse Source

Add 64/32 bit message and a dumb check when 32 bit isn't properly enabled

caseclosed
Alibek Omarov 7 years ago
parent
commit
bc379e9234
  1. 13
      CMakeLists.txt

13
CMakeLists.txt

@ -39,6 +39,7 @@ option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
option(BUILD_CLIENT "Build client dll" ON) option(BUILD_CLIENT "Build client dll" ON)
option(BUILD_SERVER "Build server dll" ON) option(BUILD_SERVER "Build server dll" ON)
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF) option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
option(64BIT "Disable auto -m32 appending to compiler flags" OFF)
set(GAMEDIR "valve" CACHE STRING "Gamedir path") set(GAMEDIR "valve" CACHE STRING "Gamedir path")
set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll") set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll")
set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll") set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll")
@ -50,7 +51,6 @@ set(SERVER_LIBRARY_NAME "hl" CACHE STRING "Library name for Linux/MacOS/Windows"
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
# Build 32-bit Xash on 64-bit, because Xash3D not support this
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT) if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT)
if(MSVC) if(MSVC)
error("UNDONE: set 32 build flags") error("UNDONE: set 32 build flags")
@ -59,6 +59,17 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
endif() endif()
set(CMAKE_SIZEOF_VOID_P 4)
endif()
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()
if(64BIT)
message(STATUS "Building for 64 Bit")
else()
message(STATUS "Building for 32 Bit")
endif() endif()
# add_compile_options for older cmake versions # add_compile_options for older cmake versions

Loading…
Cancel
Save