2023-09-02 07:13:41 +00:00
cmake_minimum_required( VERSION 3.16 )
2019-10-29 18:53:46 +00:00
2019-09-22 21:15:46 +00:00
if( COMMAND cmake_policy )
if( POLICY CMP0011 )
cmake_policy( SET CMP0011 NEW )
endif()
if( POLICY CMP0054 )
cmake_policy( SET CMP0054 NEW )
endif()
2023-09-02 07:13:41 +00:00
if ( POLICY CMP0067 )
cmake_policy( SET CMP0067 NEW )
endif()
if ( POLICY CMP0057 )
cmake_policy( SET CMP0057 NEW )
endif()
if ( POLICY CMP0091 )
cmake_policy( SET CMP0091 NEW )
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
if (LIBVPX_VCPKG)
list(APPEND VCPKG_MANIFEST_FEATURES "vcpkg-libvpx")
endif()
if (OPENAL_SOFT_VCPKG)
list(APPEND VCPKG_MANIFEST_FEATURES "vcpkg-openal-soft")
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows"))
# Force static triplet on Windows
set(VCPKG_TARGET_TRIPLET "x64-windows-static")
2019-09-22 21:15:46 +00:00
endif()
2023-09-02 07:13:41 +00:00
project(Raze)
if (WIN32 AND VCPKG_TOOLCHAIN)
option(LIBVPX_VCPKG "Use libvpx from vcpkg" OFF)
endif()
if (VCPKG_TOOLCHAIN)
option(OPENAL_SOFT_VCPKG "Use OpenAL from vcpkg" OFF)
endif()
if (NOT VCPKG_TOOLCHAIN)
set(VCPKG_MANIFEST_FEATURES)
endif()
set ( PROJECT_NAME "raze")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
2019-09-22 21:15:46 +00:00
list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
include( FindPackageHandleStandardArgs )
# Support cross compiling
option( FORCE_CROSSCOMPILE "Turn on cross compiling." NO )
if( FORCE_CROSSCOMPILE )
set( CMAKE_CROSSCOMPILING TRUE )
endif()
if(CMAKE_CROSSCOMPILING)
set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Export file from native build.")
include(${IMPORT_EXECUTABLES})
endif()
# Recursive function to place PK3 archive source files into a hierarchy of source file in the IDE
function( assort_pk3_source_folder FOLDER_NAME PK3_DIR )
# Assort source files into folders in the IDE
file(GLOB PK3_SRCS ${PK3_DIR}/*) # Create list of all files in this folder
foreach(PK3_SRC ${PK3_SRCS})
# If there are subfolders, recurse into them
if(IS_DIRECTORY ${PK3_SRC})
get_filename_component(DIRNAME ${PK3_SRC} NAME)
# Exclude folder from list of source files
list(REMOVE_ITEM PK3_SRCS ${PK3_SRC})
# Recurse deeper into the filesystem folder tree
assort_pk3_source_folder( ${FOLDER_NAME}\\${DIRNAME} ${PK3_SRC} )
endif()
# Assign IDE group for current top-level source files
source_group(${FOLDER_NAME} FILES ${PK3_SRCS})
endforeach()
endfunction()
option( PK3_QUIET_ZIPDIR "Do not list files processed by zipdir" NO )
if( PK3_QUIET_ZIPDIR )
set( PK3_ZIPDIR_OPTIONS "-q" )
endif()
# Simplify pk3 building, add_pk3(filename srcdirectory)
function( add_pk3 PK3_NAME PK3_DIR )
# Generate target name. Just use "pk3" for main pk3 target.
string( REPLACE "." "_" PK3_TARGET ${PK3_NAME} )
2019-12-27 12:37:39 +00:00
if( NOT COMPILE_OUTPUT_OLDSTYLE )
2020-09-22 12:00:13 +00:00
add_custom_command( OUTPUT ${COMPILE_OUTPUT_DIRECTORY}/${PK3_NAME}
COMMAND zipdir -udf ${PK3_ZIPDIR_OPTIONS} ${COMPILE_OUTPUT_DIRECTORY}/${PK3_NAME} ${PK3_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${COMPILE_OUTPUT_DIRECTORY}/${PK3_NAME} $<TARGET_FILE_DIR:${PROJECT_NAME}>/${PK3_NAME}
2019-09-22 21:15:46 +00:00
DEPENDS zipdir )
else()
2020-09-22 12:00:13 +00:00
add_custom_command( OUTPUT ${COMPILE_OUTPUT_DIRECTORY}/${PK3_NAME}
COMMAND zipdir -udf ${PK3_ZIPDIR_OPTIONS} ${COMPILE_OUTPUT_DIRECTORY}/${PK3_NAME} ${PK3_DIR}
2019-09-22 21:15:46 +00:00
DEPENDS zipdir )
endif()
# Create a list of source files for this PK3, for use in the IDE
# Phase 1: Create a list of all source files for this PK3 archive, except
# for a couple of strife image file names that confuse CMake.
file(GLOB_RECURSE PK3_SRCS ${PK3_DIR}/*)
2019-12-27 12:37:39 +00:00
# Exclude from the source list some files with brackets in the
2019-09-22 21:15:46 +00:00
# file names here, because they confuse CMake.
# This only affects the list of source files shown in the IDE.
# It does not actually remove the files from the PK3 archive.
# First replace that toxic bracket character with something we can handle
string(REPLACE "[" confusing_bracket PK3_SRCS "${PK3_SRCS}")
string(REPLACE "]" confusing_bracket PK3_SRCS "${PK3_SRCS}")
foreach(PK3_SRC ${PK3_SRCS}) # All source files at all levels
# Exclude those quarantined source file source file names that once had a bracket
if(${PK3_SRC} MATCHES confusing_bracket)
# message(STATUS "Ignoring PK3 file name containing brackets "${PK3_SRC})
list(REMOVE_ITEM PK3_SRCS ${PK3_SRC})
endif()
endforeach()
# Phase 2: Create the PK3 build rule, including the source file list for the IDE
# Touch the zipdir executable here so that the pk3s are forced to
# rebuild each time since their dependency has "changed."
add_custom_target( ${PK3_TARGET} ALL
COMMAND ${CMAKE_COMMAND} -E touch $<TARGET_FILE:zipdir>
2020-09-22 12:00:13 +00:00
DEPENDS ${COMPILE_OUTPUT_DIRECTORY}/${PK3_NAME}
2019-09-22 21:15:46 +00:00
SOURCES ${PK3_SRCS})
# Phase 3: Assign source files to a nice folder structure in the IDE
assort_pk3_source_folder("Source Files" ${PK3_DIR})
# Phase 4: Add the resulting PK3 to the install target.
if( WIN32 )
2019-12-26 13:16:00 +00:00
set( INSTALL_PK3_PATH . CACHE STRING "Directory where engine data will be placed during install." )
2019-09-22 21:15:46 +00:00
else()
2022-11-12 00:26:05 +00:00
set( INSTALL_PK3_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME} CACHE STRING "Directory where engine data will be placed during install." )
2019-09-22 21:15:46 +00:00
endif()
install(FILES "${PROJECT_BINARY_DIR}/${PK3_NAME}"
DESTINATION ${INSTALL_PK3_PATH}
COMPONENT "Game resources")
endfunction()
# Macro for building libraries without debugging information
macro( make_release_only )
set( CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_RELEASE} )
set( CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELEASE} )
string( REPLACE "/MT " "/MTd " CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_RELEASE} )
set( CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_RELEASE} )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELEASE} )
string( REPLACE "/MT " "/MTd " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_RELEASE} )
endmacro()
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE )
ENDIF()
2020-09-22 12:00:13 +00:00
set( COMPILE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} CACHE PATH "Directory where engine data and the executable will be created." )
2019-12-27 12:52:15 +00:00
set( COMPILE_EXE_NAME ${PROJECT_NAME} CACHE FILEPATH "Name of the executable to create" )
2019-09-22 21:15:46 +00:00
if( MSVC )
2020-09-22 12:00:13 +00:00
# Allow the user to use COMPILE_OUTPUT_DIRECTORY as a single release point.
2019-12-27 12:37:39 +00:00
# Use different names for the various compile targets.
option( COMPILE_OUTPUT_OLDSTYLE "Don't use Release/Debug directories." OFF )
2019-09-22 21:15:46 +00:00
else()
2019-12-27 12:37:39 +00:00
set( COMPILE_OUTPUT_OLDSTYLE OFF )
2019-09-22 21:15:46 +00:00
endif()
# Replacement variables for a possible long list of C/C++ compilers compatible with GCC
2020-12-28 11:45:40 +00:00
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" )
2019-09-22 23:28:18 +00:00
set( DEM_CMAKE_COMPILER_IS_GNUC_COMPATIBLE TRUE )
2019-09-22 21:15:46 +00:00
else()
2019-09-22 23:28:18 +00:00
set( DEM_CMAKE_COMPILER_IS_GNUC_COMPATIBLE FALSE )
2019-09-22 21:15:46 +00:00
endif()
2020-12-28 11:45:40 +00:00
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
2019-09-22 23:28:18 +00:00
set( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE TRUE )
2019-09-22 21:15:46 +00:00
else()
2019-09-22 23:28:18 +00:00
set( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE FALSE )
2019-09-22 21:15:46 +00:00
endif()
2019-09-22 23:28:18 +00:00
if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
2019-09-22 21:15:46 +00:00
set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." )
2022-12-11 17:30:01 +00:00
if( CMAKE_CXX_STANDARD )
# By default, try_compile() invocations ignore CXX_STANDARD value
# CMake 3.8 and newer have CMP0067 policy that fixes the issue, but it should be enabled explicitly
# Older versions require manual specification of the corresponding command line option
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++${CMAKE_CXX_STANDARD}" )
endif()
2019-09-22 21:15:46 +00:00
endif()
2020-05-31 08:53:11 +00:00
# Fast math flags, required by some subprojects
set( ZD_FASTMATH_FLAG "" )
2021-05-21 23:06:33 +00:00
if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
2020-05-31 08:53:11 +00:00
set( ZD_FASTMATH_FLAG "-ffast-math -ffp-contract=fast" )
elseif( MSVC )
set( ZD_FASTMATH_FLAG "/fp:fast" )
endif()
macro( use_fast_math )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" )
endmacro()
macro( require_stricmp )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif()
endmacro()
macro( require_strnicmp )
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif()
endmacro()
2019-09-22 21:15:46 +00:00
option( NO_OPENAL "Disable OpenAL sound support" OFF )
find_package( BZip2 )
2020-01-28 09:04:48 +00:00
find_package( VPX )
2023-09-07 10:13:25 +00:00
2019-09-22 21:15:46 +00:00
include( TargetArch )
2020-04-06 19:10:07 +00:00
target_architecture(TARGET_ARCHITECTURE)
if( ${TARGET_ARCHITECTURE} MATCHES "x86_64" )
set( HAVE_VM_JIT ON )
endif()
2019-09-22 21:15:46 +00:00
2021-05-09 03:37:57 +00:00
option (HAVE_VULKAN "Enable Vulkan support" ON)
2021-09-18 11:03:36 +00:00
option (HAVE_GLES2 "Enable GLES2 support" ON)
2021-05-09 03:37:57 +00:00
2019-09-22 21:15:46 +00:00
# no, we're not using external asmjit for now, we made too many modifications to our's.
# if the asmjit author uses our changes then we'll update this.
#if( ${HAVE_VM_JIT} )
# find_package( asmjit )
#endif()
if( MSVC )
# Eliminate unreferenced functions and data
# Perform identical COMDAT folding
2019-11-19 20:35:35 +00:00
set( REL_LINKER_FLAGS "/opt:ref /opt:icf /nodefaultlib:msvcrt /TSAWARE /LARGEADDRESSAWARE /SAFESEH:NO" )
2019-09-22 21:15:46 +00:00
# String pooling
# Function-level linking
# Disable run-time type information
2024-01-04 17:24:00 +00:00
set( ALL_C_FLAGS "/GF /Gy /permissive- /utf-8" )
2021-09-18 11:03:36 +00:00
2019-09-22 21:15:46 +00:00
if ( HAVE_VULKAN )
2021-09-18 11:03:36 +00:00
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DHAVE_VULKAN" )
endif()
if ( HAVE_GLES2 )
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DHAVE_GLES2" )
2019-09-22 21:15:46 +00:00
endif()
# Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall
#set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2") # This is already the default
# Avoid CRT DLL dependancies in release builds, optionally generate assembly output for checking crash locations.
2019-12-27 12:37:39 +00:00
option( COMPILE_GENERATE_ASM "Generate assembly output." OFF )
if( COMPILE_GENERATE_ASM )
2019-09-22 21:15:46 +00:00
set( REL_C_FLAGS "/MT /Oy /Oi /FAcs /GS-" )
else()
set( REL_C_FLAGS "/MT /Oy /Oi /GS-" )
endif()
# Debug allocations in debug builds
set( DEB_C_FLAGS "/D _CRTDBG_MAP_ALLOC /MTd" )
# Disable warnings for unsecure CRT functions from VC8+
2021-11-06 15:48:31 +00:00
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUNICODE /D_UNICODE /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS" )
2021-12-30 09:30:21 +00:00
2019-09-22 21:15:46 +00:00
# These must be silenced because the code is full of them. Expect some of undefined behavior hidden in this mess. :(
2021-05-11 22:48:41 +00:00
#set( ALL_C_FLAGS "${ALL_C_FLAGS} /wd4244 /wd4018 /wd4267" )
2021-12-30 09:30:21 +00:00
2024-01-06 11:25:16 +00:00
# annoying intellisense warnings that are virtually always false positives and mostly happen in third party code.
#6297: overflow when shifting
#6386: Buffer overrun when writing (i.e. missing range check for array writes)
#6385: Reading invalid data (i.e. missing range check for array reads)
#6308: missing null check on realloc
set( ALL_C_FLAGS "${ALL_C_FLAGS} /wd6297 /wd6386 /wd6385 /wd6308" )
2021-12-30 09:30:21 +00:00
2019-09-22 21:15:46 +00:00
# Most of these need to be cleaned out. The source is currently infested with far too much conditional compilation which is a constant source of problems.
2020-01-28 09:04:48 +00:00
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUSE_OPENGL=1 /DNOASM=1 /DWIN32" )
2019-09-22 21:15:46 +00:00
# The CMake configurations set /GR and /MD by default, which conflict with our settings.
string(REPLACE "/MD " " " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} )
string(REPLACE "/MD " " " CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL} )
string(REPLACE "/MD " " " CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} )
string(REPLACE "/Ob1 " "/Ob2 " CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} )
string(REPLACE "/MDd " " " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} )
string(REPLACE "/MD " " " CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} )
string(REPLACE "/MD " " " CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL} )
string(REPLACE "/MD " " " CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO} )
string(REPLACE "/MDd " " " CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} )
string(REPLACE " /GR" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
else()
set( REL_LINKER_FLAGS "" )
2021-09-18 14:00:28 +00:00
set( ALL_C_FLAGS "-ffp-contract=off -DUSE_OPENGL=1 -DNOASM=1" )
2021-09-18 11:03:36 +00:00
2019-09-22 21:15:46 +00:00
if ( HAVE_VULKAN )
2021-09-18 11:03:36 +00:00
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DHAVE_VULKAN" )
endif()
if ( HAVE_GLES2 )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DHAVE_GLES2" )
2019-09-22 21:15:46 +00:00
endif()
if ( UNIX )
include(CheckSymbolExists)
check_symbol_exists( "fts_set" "fts.h" HAVE_FTS )
if ( NOT HAVE_FTS )
include ( FindPkgConfig )
pkg_check_modules( MUSL_FTS musl-fts )
if ( MUSL_FTS_FOUND )
set ( ALL_C_FLAGS "${ALL_C_FLAGS} ${MUSL_FTS_LDFLAGS}" )
else ( MUSL_FTS_FOUND )
message (ERROR "fts_* functions not found in the system" )
endif ( MUSL_FTS_FOUND )
endif ( NOT HAVE_FTS )
endif ( UNIX )
set( REL_C_FLAGS "" )
set( DEB_C_FLAGS "" )
if( APPLE )
2023-10-24 07:32:02 +00:00
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
2020-12-28 11:45:40 +00:00
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
2019-09-22 21:15:46 +00:00
# If we're compiling with a custom GCC on the Mac (which we know since g++-4.2 doesn't support C++11) statically link libgcc.
set( ALL_C_FLAGS "-static-libgcc" )
endif()
elseif( NOT MINGW )
# Generic GCC/Clang requires position independent executable to be enabled explicitly
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fPIE" )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie" )
endif( APPLE )
endif()
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${REL_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} ${REL_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} ${REL_LINKER_FLAGS}" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ALL_C_FLAGS}" )
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${REL_C_FLAGS}" )
set( CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${REL_C_FLAGS}" )
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${REL_C_FLAGS}" )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEB_C_FLAGS} -D_DEBUG" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ALL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${REL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${REL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${REL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEB_C_FLAGS} -D_DEBUG" )
option(FORCE_INTERNAL_BZIP2 "Use internal bzip2")
2020-04-06 19:10:07 +00:00
option(FORCE_INTERNAL_ASMJIT "Use internal asmjit" ON)
mark_as_advanced( FORCE_INTERNAL_ASMJIT )
2019-09-22 21:15:46 +00:00
if (HAVE_VULKAN)
2022-12-11 17:30:01 +00:00
add_subdirectory( libraries/ZVulkan )
2019-09-22 21:15:46 +00:00
endif()
2024-01-04 19:37:57 +00:00
add_subdirectory( libraries/ZWidget )
2024-04-11 18:58:07 +00:00
add_subdirectory( libraries/webp )
2024-01-04 19:37:57 +00:00
2023-09-23 07:56:27 +00:00
add_subdirectory( libraries/discordrpc EXCLUDE_FROM_ALL )
2022-03-18 08:17:46 +00:00
set( DRPC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/discordrpc/include" )
set( DRPC_LIBRARIES discord-rpc )
set( DRPC_LIBRARY discord-rpc )
2020-04-06 19:10:07 +00:00
if( HAVE_VM_JIT AND UNIX )
check_symbol_exists( "backtrace" "execinfo.h" HAVE_BACKTRACE )
if( NOT HAVE_BACKTRACE )
set( CMAKE_REQUIRED_FLAGS "-lexecinfo" )
check_symbol_exists( "backtrace" "execinfo.h" HAVE_LIBEXECINFO )
if( HAVE_LIBEXECINFO )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -lexecinfo" )
else( HAVE_LIBEXECINFO )
set( HAVE_VM_JIT NO )
endif( HAVE_LIBEXECINFO )
2021-05-10 06:50:05 +00:00
set( CMAKE_REQUIRED_FLAGS )
2020-04-06 19:10:07 +00:00
endif( NOT HAVE_BACKTRACE )
endif( HAVE_VM_JIT AND UNIX )
if( ${HAVE_VM_JIT} )
if( ASMJIT_FOUND AND NOT FORCE_INTERNAL_ASMJIT )
message( STATUS "Using system asmjit, includes found at ${ASMJIT_INCLUDE_DIR}" )
else()
message( STATUS "Using internal asmjit" )
set( SKIP_INSTALL_ALL TRUE ) # Avoid installing asmjit alongside zdoom
add_subdirectory( libraries/asmjit )
set( ASMJIT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libraries/asmjit )
set( ASMJIT_LIBRARIES asmjit )
set( ASMJIT_LIBRARY asmjit )
endif()
endif()
2021-12-11 16:08:40 +00:00
add_subdirectory( libraries/libtess )
set( TESS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libraries/libtess/Include )
set( TESS_LIBRARIES tess2 )
set( TESS_LIBRARY tess2 )
2019-09-22 21:15:46 +00:00
if( BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2 )
message( STATUS "Using system bzip2 library, includes found at ${BZIP2_INCLUDE_DIR}" )
else()
message( STATUS "Using internal bzip2 library" )
add_subdirectory( libraries/bzip2 )
set( BZIP2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/bzip2" )
set( BZIP2_LIBRARIES bz2 )
set( BZIP2_LIBRARY bz2 )
endif()
set( LZMA_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/lzma/C" )
if( NOT CMAKE_CROSSCOMPILING )
if( NOT CROSS_EXPORTS )
set( CROSS_EXPORTS "" )
endif()
endif()
# Install the entire docs directory in the distributed zip package
#if( WIN32 )
# set( INSTALL_DOCS_PATH docs CACHE STRING "Directory where the documentation will be placed during install." )
#else()
2019-12-27 12:37:39 +00:00
# set( INSTALL_DOCS_PATH share/doc/${COMPILE_EXE_NAME} CACHE STRING "Directory where the documentation will be placed during install." )
2019-09-22 21:15:46 +00:00
#endif()
#install(DIRECTORY docs/
# DESTINATION ${INSTALL_DOCS_PATH}
# COMPONENT "Documentation")
add_subdirectory( libraries/lzma )
2023-09-23 07:56:27 +00:00
add_subdirectory( libraries/miniz )
2019-09-22 21:15:46 +00:00
add_subdirectory( tools )
2019-10-04 21:29:00 +00:00
add_subdirectory( wadsrc )
2019-09-22 21:15:46 +00:00
add_subdirectory( source )
if( NOT CMAKE_CROSSCOMPILING )
export(TARGETS ${CROSS_EXPORTS} FILE "${CMAKE_BINARY_DIR}/ImportExecutables.cmake" )
endif()