CMake build system

This commit is contained in:
Tim Angus committed 2025-08-03 17:36:01 +01:00
1 parent 4fed624cff
commit 4c6f3f81eb
40 files changed
+1641

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
include(compilers/appleclang)
include(compilers/clang)
include(compilers/gcc)
include(compilers/gnu)
include(compilers/msvc)
+5
View File
@@ -0,0 +1,5 @@
# Apple Clang compiler specific settings
if(NOT CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
return()
endif()
+5
View File
@@ -0,0 +1,5 @@
# Clang compiler specific settings
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
return()
endif()
+5
View File
@@ -0,0 +1,5 @@
# GCC compiler specific settings
if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
return()
endif()
+18
View File
@@ -0,0 +1,18 @@
# GNU style (GCC/Clang) compiler specific settings
if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_ID MATCHES "^(Apple)?Clang$")
return()
endif()
set(ASM_SOURCES
${SOURCE_DIR}/asm/snapvector.c
${SOURCE_DIR}/asm/ftola.c
)
add_compile_options(-Wall -Wimplicit
-Wstrict-prototypes -Wformat=2 -Wformat-security
-Wstrict-aliasing=2 -Wmissing-format-attribute
-Wdisabled-optimization -Werror-implicit-function-declaration)
add_compile_options(-Wno-strict-aliasing
-Wno-format-zero-length -Wno-format-nonliteral)
+37
View File
@@ -0,0 +1,37 @@
# MSVC compiler specific settings
if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
return()
endif()
include(utils/arch)
enable_language(ASM_MASM)
set(ASM_SOURCES
${SOURCE_DIR}/asm/snapvector.asm
${SOURCE_DIR}/asm/ftola.asm
)
if(ARCH MATCHES "x86_64")
list(APPEND ASM_SOURCES ${SOURCE_DIR}/asm/vm_x86_64.asm)
set_source_files_properties(
${ASM_SOURCES}
PROPERTIES COMPILE_DEFINITIONS "idx64")
endif()
# Baseline warnings
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/W4>")
# C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data
# There are way too many of these to realistically deal with them
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4267>")
# MSVC doesn't understand __inline__, which libjpeg uses
add_compile_definitions(__inline__=inline)
# It's unlikely that we'll move to the _s variants, so stop the warning
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
# The sockets platform abstraction layer necessarily uses deprecated APIs
add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS)