Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
dsvensson committed Mar 20, 2024
1 parent 2c35f74 commit 54e49dd
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 28 deletions.
50 changes: 43 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,39 @@ endif ()

include (CheckCCompilerFlag)

# clang specific warning auto-enabled on macOS by Xcode
check_c_compiler_flag("-Wshorten-64-to-32" HAS_CFLAG_SHORTEN_64_TO_32)
if (HAS_CFLAG_SHORTEN_64_TO_32)
add_compile_options("-Wno-shorten-64-to-32")
if (MSVC)
add_compile_definitions(
WIN32
_WINDOWS
)
add_compile_options(
/W3
/nologo
/diagnostics:column
/sdl
/W3
/WX-
)
else()
add_compile_options(
$<$<CONFIG:DEBUG>:-g>
$<$<CONFIG:RELEASE>:-O2>

-Wall
-Wno-strict-aliasing
-fvisibility=hidden
-Wno-deprecated-declarations

$<$<COMPILE_LANGUAGE:C>:-Wno-pointer-to-int-cast>
$<$<COMPILE_LANGUAGE:C>:-Werror=strict-prototypes>
$<$<COMPILE_LANGUAGE:C>:-Werror=old-style-definition>
)

# clang specific warning auto-enabled on macOS by Xcode
check_c_compiler_flag("-Wshorten-64-to-32" HAS_CFLAG_SHORTEN_64_TO_32)
if (HAS_CFLAG_SHORTEN_64_TO_32)
add_compile_options(-Wno-shorten-64-to-32)
endif()
endif()

find_library(MATH m)
Expand Down Expand Up @@ -91,9 +120,16 @@ if (APPLE)
endif()

add_executable(resource_compiler "misc/vstudio/txt2c/txt2c.cpp")
set_target_properties(resource_compiler PROPERTIES
OSX_ARCHITECTURES "x86_64;arm64"
if (CMAKE_CROSSCOMPILING_EMULATOR)
# No way to build the resource compiler host native in one go
# so statically linking to let wine run without dll path issues.
target_link_options(resource_compiler PRIVATE -static-libgcc)
elseif (APPLE)
# Universal binary needed when cross-compiling.
set_target_properties(resource_compiler PROPERTIES
OSX_ARCHITECTURES "x86_64;arm64"
)
endif()

macro(add_resources target_var)
add_library(${target_var} OBJECT)
Expand Down Expand Up @@ -721,7 +757,6 @@ else()
set(sys_glue
${SOURCE_DIR}/localtime_win.c
)

endif()
source_group(TREE ${SOURCE_DIR} PREFIX "Source Files/sys_glue" FILES ${sys_glue})
source_group(TREE ${SOURCE_DIR} PREFIX "Header Files/sys_glue" FILES ${sys_headers})
Expand Down Expand Up @@ -881,6 +916,7 @@ if (APPLE)
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "${VERSION}"
XCODE_ATTRIBUTE_LLVM_LTO $<IF:$<CONFIG:Debug>,NO,YES>
XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL $<IF:$<CONFIG:Debug>,0,3>
XCODE_ATTRIBUTE_GCC_PREPROCESSOR_DEFINITIONS "GL_SILENCE_DEPRECATION"
XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE YES
XCODE_ATTRIBUTE_INFOPLIST_KEY_CFBundleDisplayName "ezQuake"
XCODE_ATTRIBUTE_INFOPLIST_KEY_LSApplicationCategoryType "public.app-category.games"
Expand Down
31 changes: 10 additions & 21 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@
"CMAKE_EXE_LINKER_FLAGS_RELEASE": ""
}
},
{
"name": "template-gcc",
"hidden": true,
"inherits": "template-vcpkg",
"cacheVariables": {
"CMAKE_C_FLAGS": "-Wall -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wno-strict-aliasing -Werror=strict-prototypes -Werror=old-style-definition -fvisibility=hidden",
"CMAKE_C_FLAGS_DEBUG": "-g",
"CMAKE_C_FLAGS_RELEASE": "-O2"
}
},
{
"name": "template-gcc-mingw-cross",
"hidden": true,
Expand All @@ -55,7 +45,7 @@
{
"name": "template-gcc-mingw-i686",
"hidden": true,
"inherits": "template-gcc",
"inherits": "template-vcpkg",
"cacheVariables": {
"CMAKE_C_COMPILER": "i686-w64-mingw32-gcc",
"CMAKE_CXX_COMPILER": "i686-w64-mingw32-g++",
Expand All @@ -65,7 +55,7 @@
{
"name": "template-gcc-mingw-x64",
"hidden": true,
"inherits": "template-gcc",
"inherits": "template-vcpkg",
"cacheVariables": {
"CMAKE_C_COMPILER": "x86_64-w64-mingw32-gcc",
"CMAKE_CXX_COMPILER": "x86_64-w64-mingw32-g++",
Expand All @@ -76,7 +66,7 @@
"name": "msbuild-x64",
"description": "Configure as Visual Studio project",
"generator": "Visual Studio 17 2022",
"inherits": "template-msvc",
"inherits": "template-vcpkg",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
},
Expand All @@ -90,7 +80,7 @@
"name": "ninja-msvc-x64",
"description": "Configure using Ninja to build with msvc",
"generator": "Ninja Multi-Config",
"inherits": "template-msvc",
"inherits": "template-vcpkg",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
},
Expand Down Expand Up @@ -160,8 +150,7 @@
"name": "ninja-mingw64-i686-cross",
"inherits": ["ninja-mingw64-i686-shared", "template-gcc-mingw-cross"],
"cacheVariables": {
"CMAKE_SYSTEM_PROCESSOR": "i686",
"CMAKE_EXE_LINKER_FLAGS": "-static-libgcc"
"CMAKE_SYSTEM_PROCESSOR": "i686"
},
"environment": {
"WINEARCH": "win32",
Expand All @@ -178,7 +167,7 @@
"hidden": true,
"description": "Configure XCode project file",
"generator": "Xcode",
"inherits": "template-gcc",
"inherits": "template-vcpkg",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
Expand All @@ -193,8 +182,8 @@
"VCPKG_TARGET_TRIPLET": "arm64-osx",
"CMAKE_OSX_ARCHITECTURES": "arm64",
"CMAKE_OSX_DEPLOYMENT_TARGET": "14.0",
"VCPKG_C_FLAGS": "-DGL_SILENCE_DEPRECATION -mmacosx-version-min=14.0",
"VCPKG_CXX_FLAGS": "-DGL_SILENCE_DEPRECATION -mmacosx-version-min=14.0"
"VCPKG_C_FLAGS": "-mmacosx-version-min=14.0",
"VCPKG_CXX_FLAGS": "-mmacosx-version-min=14.0"
}
},
{
Expand All @@ -212,8 +201,8 @@
"VCPKG_TARGET_TRIPLET": "x64-osx",
"CMAKE_OSX_ARCHITECTURES": "x86_64",
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.7",
"VCPKG_C_FLAGS": "-DGL_SILENCE_DEPRECATION -mmacosx-version-min=12.7",
"VCPKG_CXX_FLAGS": "-DGL_SILENCE_DEPRECATION -mmacosx-version-min=12.7"
"VCPKG_C_FLAGS": "-mmacosx-version-min=12.7",
"VCPKG_CXX_FLAGS": "-mmacosx-version-min=12.7"
}
},
{
Expand Down

0 comments on commit 54e49dd

Please sign in to comment.