mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-23 04:52:07 +00:00
Merge pull request #868 from devnexen/cmake_build_fix2
Cmake build fix2
This commit is contained in:
commit
e29d37956a
3 changed files with 18 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||||
|
|
||||||
# Print a message that using the Makefiles is recommended.
|
# Print a message that using the Makefiles is recommended.
|
||||||
message(NOTICE: " The CMakeLists.txt is unmaintained. Use the Makefile if possible.")
|
message(NOTICE: " The CMakeLists.txt is unmaintained. Use the Makefile if possible.")
|
||||||
|
@ -13,6 +13,8 @@ project(yquake2 C)
|
||||||
|
|
||||||
# Cmake module search path.
|
# Cmake module search path.
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/stuff/cmake/modules ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/stuff/cmake/modules ${CMAKE_MODULE_PATH})
|
||||||
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED OFF)
|
||||||
|
|
||||||
if(YQUAKE2LIBS)
|
if(YQUAKE2LIBS)
|
||||||
if(CMAKE_CROSSCOMPILING)
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
@ -43,7 +45,7 @@ else() # GCC/clang/mingw
|
||||||
# -fno-strict-aliasing -> Quake 2 is far away from strict aliasing
|
# -fno-strict-aliasing -> Quake 2 is far away from strict aliasing
|
||||||
# -fwrapv -> Make signed integer overflows defined
|
# -fwrapv -> Make signed integer overflows defined
|
||||||
# -fvisibility=hidden -> Force defaultsymbol visibility to hidden
|
# -fvisibility=hidden -> Force defaultsymbol visibility to hidden
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -fno-strict-aliasing -fwrapv -fvisibility=hidden")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing -fwrapv -fvisibility=hidden")
|
||||||
|
|
||||||
# Use -O2 as maximum optimization level. -O3 has it's problems with yquake2.
|
# Use -O2 as maximum optimization level. -O3 has it's problems with yquake2.
|
||||||
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||||
|
@ -682,7 +684,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
${Backends-Generic-Source})
|
${Backends-Generic-Source})
|
||||||
set_target_properties(yquake2 PROPERTIES
|
set_target_properties(yquake2 PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
C_STANDARD 11
|
|
||||||
)
|
)
|
||||||
target_link_libraries(yquake2 ${yquake2LinkerFlags} ${yquake2ClientLinkerFlags}
|
target_link_libraries(yquake2 ${yquake2LinkerFlags} ${yquake2ClientLinkerFlags}
|
||||||
${yquake2SDLLinkerFlags} ${yquake2ZLibLinkerFlags} ws2_32 winmm)
|
${yquake2SDLLinkerFlags} ${yquake2ZLibLinkerFlags} ws2_32 winmm)
|
||||||
|
@ -716,7 +717,6 @@ add_executable(q2ded ${Server-Source} ${Server-Header} ${Platform-Specific-Sourc
|
||||||
set_target_properties(q2ded PROPERTIES
|
set_target_properties(q2ded PROPERTIES
|
||||||
COMPILE_DEFINITIONS "DEDICATED_ONLY"
|
COMPILE_DEFINITIONS "DEDICATED_ONLY"
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
C_STANDARD 11
|
|
||||||
)
|
)
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
target_link_libraries(q2ded ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags} ${yquake2ZLibLinkerFlags} ws2_32 winmm)
|
target_link_libraries(q2ded ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags} ${yquake2ZLibLinkerFlags} ws2_32 winmm)
|
||||||
|
@ -730,7 +730,6 @@ add_library(game MODULE ${Game-Source} ${Game-Header})
|
||||||
set_target_properties(game PROPERTIES
|
set_target_properties(game PROPERTIES
|
||||||
PREFIX ""
|
PREFIX ""
|
||||||
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
C_STANDARD 11
|
|
||||||
)
|
)
|
||||||
|
|
||||||
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
@ -755,7 +754,6 @@ set_target_properties(ref_gl1 PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
C_STANDARD 11
|
|
||||||
)
|
)
|
||||||
target_link_libraries(ref_gl1 ${yquake2LinkerFlags} ${yquake2OpenGLLinkerFlags} ${yquake2SDLLinkerFlags})
|
target_link_libraries(ref_gl1 ${yquake2LinkerFlags} ${yquake2OpenGLLinkerFlags} ${yquake2SDLLinkerFlags})
|
||||||
|
|
||||||
|
@ -766,7 +764,6 @@ set_target_properties(ref_gl3 PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
C_STANDARD 11
|
|
||||||
)
|
)
|
||||||
target_include_directories(ref_gl3 PRIVATE ${CMAKE_SOURCE_DIR}/src/client/refresh/gl3/glad/include)
|
target_include_directories(ref_gl3 PRIVATE ${CMAKE_SOURCE_DIR}/src/client/refresh/gl3/glad/include)
|
||||||
target_link_libraries(ref_gl3 ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
|
target_link_libraries(ref_gl3 ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
|
||||||
|
@ -779,7 +776,6 @@ set_target_properties(ref_gles3 PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
C_STANDARD 11
|
|
||||||
)
|
)
|
||||||
target_include_directories(ref_gles3 PRIVATE ${CMAKE_SOURCE_DIR}/src/client/refresh/gl3/glad-gles3/include)
|
target_include_directories(ref_gles3 PRIVATE ${CMAKE_SOURCE_DIR}/src/client/refresh/gl3/glad-gles3/include)
|
||||||
target_compile_definitions(ref_gles3 PRIVATE YQ2_GL3_GLES3=1 YQ2_GL3_GLES=1)
|
target_compile_definitions(ref_gles3 PRIVATE YQ2_GL3_GLES3=1 YQ2_GL3_GLES=1)
|
||||||
|
@ -792,6 +788,5 @@ set_target_properties(ref_soft PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
C_STANDARD 11
|
|
||||||
)
|
)
|
||||||
target_link_libraries(ref_soft ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
|
target_link_libraries(ref_soft ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
|
||||||
|
|
|
@ -82,7 +82,7 @@ char userGivenGame[MAX_QPATH];
|
||||||
qboolean quitnextframe;
|
qboolean quitnextframe;
|
||||||
|
|
||||||
#ifndef DEDICATED_ONLY
|
#ifndef DEDICATED_ONLY
|
||||||
static inline void Sys_CpuPause(void)
|
static YQ2_ATTR_INLINE void Sys_CpuPause(void)
|
||||||
{
|
{
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#if (__i386 || __x86_64__)
|
#if (__i386 || __x86_64__)
|
||||||
|
|
|
@ -59,12 +59,23 @@ typedef unsigned char byte;
|
||||||
#define YQ2_ALIGNAS_TYPE(TYPE) _Alignas(TYPE)
|
#define YQ2_ALIGNAS_TYPE(TYPE) _Alignas(TYPE)
|
||||||
// must be used as prefix (YQ2_ATTR_NORETURN void bla();)!
|
// must be used as prefix (YQ2_ATTR_NORETURN void bla();)!
|
||||||
#define YQ2_ATTR_NORETURN _Noreturn
|
#define YQ2_ATTR_NORETURN _Noreturn
|
||||||
|
# if defined(__GNUC__)
|
||||||
|
#define YQ2_ATTR_MALLOC __attribute__ ((__malloc__))
|
||||||
|
#define YQ2_ATTR_INLINE __attribute__((always_inline))
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
#define YQ2_ATTR_MALLOC __declspec(restrict)
|
||||||
|
# else
|
||||||
|
// no equivalent per see
|
||||||
|
#define YQ2_ATTR_MALLOC
|
||||||
|
#define YQ2_ATTR_INLINE inline
|
||||||
|
# endif
|
||||||
#elif defined(__GNUC__) // GCC and clang should support this attribute
|
#elif defined(__GNUC__) // GCC and clang should support this attribute
|
||||||
#define YQ2_ALIGNAS_SIZE(SIZE) __attribute__(( __aligned__(SIZE) ))
|
#define YQ2_ALIGNAS_SIZE(SIZE) __attribute__(( __aligned__(SIZE) ))
|
||||||
#define YQ2_ALIGNAS_TYPE(TYPE) __attribute__(( __aligned__(__alignof__(TYPE)) ))
|
#define YQ2_ALIGNAS_TYPE(TYPE) __attribute__(( __aligned__(__alignof__(TYPE)) ))
|
||||||
// must be used as prefix (YQ2_ATTR_NORETURN void bla();)!
|
// must be used as prefix (YQ2_ATTR_NORETURN void bla();)!
|
||||||
#define YQ2_ATTR_NORETURN __attribute__ ((noreturn))
|
#define YQ2_ATTR_NORETURN __attribute__ ((noreturn))
|
||||||
#define YQ2_ATTR_MALLOC __attribute__ ((__malloc__))
|
#define YQ2_ATTR_MALLOC __attribute__ ((__malloc__))
|
||||||
|
#define YQ2_ATTR_INLINE __attribute__((always_inline))
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
// Note: We prefer VS2019 16.8 or newer in C11 mode (/std:c11),
|
// Note: We prefer VS2019 16.8 or newer in C11 mode (/std:c11),
|
||||||
// then the __STDC_VERSION__ >= 201112L case above is used
|
// then the __STDC_VERSION__ >= 201112L case above is used
|
||||||
|
@ -82,12 +93,14 @@ typedef unsigned char byte;
|
||||||
// must be used as prefix (YQ2_ATTR_NORETURN void bla();)!
|
// must be used as prefix (YQ2_ATTR_NORETURN void bla();)!
|
||||||
#define YQ2_ATTR_NORETURN __declspec(noreturn)
|
#define YQ2_ATTR_NORETURN __declspec(noreturn)
|
||||||
#define YQ2_ATTR_MALLOC __declspec(restrict)
|
#define YQ2_ATTR_MALLOC __declspec(restrict)
|
||||||
|
#define YQ2_ATTR_INLINE __forceinline
|
||||||
#else
|
#else
|
||||||
#warning "Please add a case for your compiler here to align correctly"
|
#warning "Please add a case for your compiler here to align correctly"
|
||||||
#define YQ2_ALIGNAS_SIZE(SIZE)
|
#define YQ2_ALIGNAS_SIZE(SIZE)
|
||||||
#define YQ2_ALIGNAS_TYPE(TYPE)
|
#define YQ2_ALIGNAS_TYPE(TYPE)
|
||||||
#define YQ2_ATTR_NORETURN
|
#define YQ2_ATTR_NORETURN
|
||||||
#define YQ2_ATTR_MALLOC
|
#define YQ2_ATTR_MALLOC
|
||||||
|
#define YQ2_ATTR_INLINE inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
|
Loading…
Reference in a new issue