mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-11 15:38:12 +00:00
Add mingw support to CMakeLists.txt. Add crosscompiling instructions to README.md
This commit is contained in:
parent
6e5062b39e
commit
71f55bb119
@ -72,6 +72,11 @@ else()
|
|||||||
message(STATUS "Building for 32 Bit")
|
message(STATUS "Building for 32 Bit")
|
||||||
endif()
|
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")
|
||||||
|
endif()
|
||||||
|
|
||||||
# add_compile_options for older cmake versions
|
# add_compile_options for older cmake versions
|
||||||
if(${CMAKE_VERSION} VERSION_LESS "3.0.2")
|
if(${CMAKE_VERSION} VERSION_LESS "3.0.2")
|
||||||
macro(add_compile_options)
|
macro(add_compile_options)
|
||||||
|
@ -10,6 +10,12 @@ Half-Life SDK for Xash3D & GoldSource with some fixes.
|
|||||||
cmake ../
|
cmake ../
|
||||||
make
|
make
|
||||||
|
|
||||||
|
Crosscompiling using mingw:
|
||||||
|
|
||||||
|
mkdir build-mingw && cd build-mingw
|
||||||
|
TOOLCHAIN_PREFIX=i686-w64-mingw32 # check up the actual mingw prefix of your mingw installation
|
||||||
|
cmake ../ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="$TOOLCHAIN_PREFIX-gcc" -DCMAKE_CXX_COMPILER="$TOOLCHAIN_PREFIX-g++"
|
||||||
|
|
||||||
You may enable or disable some build options by -Dkey=value. All available build options are defined in CMakeLists.txt at root directory.
|
You may enable or disable some build options by -Dkey=value. All available build options are defined in CMakeLists.txt at root directory.
|
||||||
See below if you want to build the GoldSource compatible libraries.
|
See below if you want to build the GoldSource compatible libraries.
|
||||||
|
|
||||||
@ -68,6 +74,8 @@ or when using make without cmake:
|
|||||||
|
|
||||||
Unlike original client by Valve the resulting client library will not depend on vgui or SDL2 just like the one that's used in FWGS Xash3d.
|
Unlike original client by Valve the resulting client library will not depend on vgui or SDL2 just like the one that's used in FWGS Xash3d.
|
||||||
|
|
||||||
|
Note for **Windows**: it's not possible to create GoldSource compatible libraries using mingw, only msvc builds will work.
|
||||||
|
|
||||||
Note for **Linux**: GoldSource requires libraries (both client and server) to be compiled with libstdc++ bundled with g++ of major version 4 (versions from 4.6 to 4.9 should work).
|
Note for **Linux**: GoldSource requires libraries (both client and server) to be compiled with libstdc++ bundled with g++ of major version 4 (versions from 4.6 to 4.9 should work).
|
||||||
If your Linux distribution does not provide compatible g++ version you have several options.
|
If your Linux distribution does not provide compatible g++ version you have several options.
|
||||||
|
|
||||||
|
@ -32,7 +32,10 @@ if(NOT MSVC)
|
|||||||
add_compile_options(-fno-exceptions) # GCC/Clang flag
|
add_compile_options(-fno-exceptions) # GCC/Clang flag
|
||||||
add_compile_options(-Wno-write-strings) # GCC/Clang flag
|
add_compile_options(-Wno-write-strings) # GCC/Clang flag
|
||||||
add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems
|
add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems
|
||||||
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf )
|
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp)
|
||||||
|
if(NOT MINGW)
|
||||||
|
add_definitions(-D_snprintf=snprintf -D_vsnprintf=vsnprintf)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user