mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
CMake support
This commit is contained in:
parent
70d07d91d6
commit
8660ced102
51 changed files with 7694 additions and 0 deletions
269
CMakeLists.txt
Normal file
269
CMakeLists.txt
Normal file
|
@ -0,0 +1,269 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
|
||||
set(command_help "cmake [<options>] -S <path-to-source> -B <path-to-build>\n")
|
||||
else()
|
||||
set(command_help "mkdir build; cd build; cmake ..\n")
|
||||
endif()
|
||||
message(FATAL_ERROR "Building in the source directory gets prevented!\n"
|
||||
"Please create a build directory and run cmake there.\n"
|
||||
${command_help})
|
||||
endif()
|
||||
|
||||
#set default build type for single configuration generators
|
||||
get_property(gen_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(NOT gen_multi AND NOT (CMAKE_BUILD_TYPE OR DEFINED ENV{CMAKE_BUILD_TYPE}))
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
||||
message("Setting CMAKE_BUILD_TYPE to: ${CMAKE_BUILD_TYPE}")
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||
"Release" "Debug" "MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
project("ioquake3")
|
||||
|
||||
set(SOURCE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/git_rev.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
include("${CMAKELIST_DIR}/include/vm_sources.cmake")
|
||||
|
||||
|
||||
if(DEFINED BUILD_GAME_SO)
|
||||
message(DEPRECATION "BUILD_GAME_SO is deprecated, please use BUILD_GAME_VM.")
|
||||
set(BUILD_GAME_VM ${BUILD_GAME_SO})
|
||||
unset(BUILD_GAME_SO CACHE)
|
||||
endif()
|
||||
option(BUILD_AUTOUPDATER "Build Autoupdater" ${DEFAULT_BUILD_AUTOUPDATER})
|
||||
option(BUILD_BASEGAME "Build basegame (baseq3)" ${DEFAULT_BUILD_BASEGAME})
|
||||
option(BUILD_CLIENT "Build clientserver" ${DEFAULT_BUILD_CLIENT})
|
||||
option(BUILD_GAME_QVM "Build quake virtual machine (qvm)" ${DEFAULT_BUILD_GAME_QVM})
|
||||
option(BUILD_GAME_VM "Build native VM (so/dll)" ${DEFAULT_BUILD_GAME_VM})
|
||||
option(BUILD_MISSIONPACK "Build missionpack" ${DEFAULT_BUILD_MISSIONPACK})
|
||||
option(BUILD_RENDERER_OPENGL2 "Build renderer opengl2" ${DEFAULT_BUILD_RENDERER_OPENGL2})
|
||||
option(BUILD_SERVER "Build dedicated server" ${DEFAULT_BUILD_SERVER})
|
||||
|
||||
option(USE_INTERNAL_LIBS "Use internal libraries (Ogg,Vorbis,Opus,zlib,JPEG,...)" ${DEFAULT_USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_JPEG "Use internal JPEG library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_ZLIB "Use internal zlib" ${USE_INTERNAL_LIBS})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
set(PRODUCT_VERSION "${DEFAULT_VERSION}" CACHE STRING "Product version")
|
||||
|
||||
set(BASEGAME "${DEFAULT_BASEGAME}" CACHE STRING "Directory for the base game")
|
||||
set(MISSIONPACK "${DEFAULT_MISSIONPACK}" CACHE STRING "Directory for the missionpack")
|
||||
|
||||
#relocate build files for easier access
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
#.lib .a files
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
|
||||
if(USE_INTERNAL_ZLIB AND (BUILD_CLIENT OR BUILD_SERVER))
|
||||
add_subdirectory("${CMAKELIST_DIR}/internal_zlib")
|
||||
endif()
|
||||
|
||||
if(BUILD_AUTOUPDATER)
|
||||
add_subdirectory("${CMAKELIST_DIR}/autoupdater")
|
||||
endif(BUILD_AUTOUPDATER)
|
||||
|
||||
if(BUILD_CLIENT)
|
||||
if(USE_INTERNAL_JPEG)
|
||||
add_subdirectory("${CMAKELIST_DIR}/internal_jpeg")
|
||||
endif()
|
||||
|
||||
add_subdirectory("${CMAKELIST_DIR}/client")
|
||||
|
||||
if(USE_RENDERER_DLOPEN)
|
||||
add_subdirectory("${CMAKELIST_DIR}/renderergl1")
|
||||
endif(USE_RENDERER_DLOPEN)
|
||||
if(BUILD_RENDERER_OPENGL2)
|
||||
add_subdirectory("${CMAKELIST_DIR}/renderergl2")
|
||||
endif(BUILD_RENDERER_OPENGL2)
|
||||
endif(BUILD_CLIENT)
|
||||
|
||||
if(BUILD_SERVER)
|
||||
add_subdirectory("${CMAKELIST_DIR}/server")
|
||||
endif(BUILD_SERVER)
|
||||
|
||||
if(BUILD_GAME_VM)
|
||||
if(BUILD_BASEGAME)
|
||||
add_subdirectory("${CMAKELIST_DIR}/vm/${BASEGAME}")
|
||||
endif(BUILD_BASEGAME)
|
||||
|
||||
if(BUILD_MISSIONPACK)
|
||||
add_subdirectory("${CMAKELIST_DIR}/vm/${MISSIONPACK}")
|
||||
endif(BUILD_MISSIONPACK)
|
||||
endif(BUILD_GAME_VM)
|
||||
|
||||
GET_VM_SUPPORT(HAVE_VM_COMPILED)
|
||||
if(BUILD_GAME_QVM AND HAVE_VM_COMPILED)
|
||||
add_subdirectory("${CMAKELIST_DIR}/tools")
|
||||
|
||||
if(BUILD_BASEGAME)
|
||||
add_subdirectory("${CMAKELIST_DIR}/qvm/${BASEGAME}")
|
||||
endif(BUILD_BASEGAME)
|
||||
|
||||
if(BUILD_MISSIONPACK)
|
||||
add_subdirectory("${CMAKELIST_DIR}/qvm/${MISSIONPACK}")
|
||||
endif(BUILD_MISSIONPACK)
|
||||
endif()
|
||||
|
||||
|
||||
if(GIT_REV)
|
||||
set(git_rev_string "${GIT_REV}")
|
||||
else()
|
||||
set(git_rev_string "<none>")
|
||||
endif(GIT_REV)
|
||||
if(gen_multi)
|
||||
set(build_type_string "<unused>")
|
||||
elseif(CMAKE_BUILD_TYPE)
|
||||
set(build_type_string "${CMAKE_BUILD_TYPE}")
|
||||
else()
|
||||
set(build_type_string "<none>")
|
||||
endif()
|
||||
#CMAKE_C_FLAGS is initialized by the CFLAGS environment variable
|
||||
if(CMAKE_C_FLAGS)
|
||||
set(c_flags_string "${CMAKE_C_FLAGS}")
|
||||
else()
|
||||
set(c_flags_string "<none>")
|
||||
endif()
|
||||
if(CMAKE_C_FLAGS_RELEASE)
|
||||
set(c_flags_release_string "${CMAKE_C_FLAGS_RELEASE}")
|
||||
else()
|
||||
set(c_flags_release_string "<none>")
|
||||
endif()
|
||||
if(MSVC)
|
||||
if(BUILD_STATIC_CRT)
|
||||
set(static_crt_string "yes (/MT)")
|
||||
else()
|
||||
set(static_crt_string "no")
|
||||
endif()
|
||||
else()
|
||||
set(static_crt_string "<unused>")
|
||||
endif()
|
||||
if(DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
set(source_date_epoch_string "$ENV{SOURCE_DATE_EPOCH}")
|
||||
else()
|
||||
set(source_date_epoch_string "<requires cmake 3.8 or later>")
|
||||
endif()
|
||||
else()
|
||||
set(source_date_epoch_string "<not set>")
|
||||
endif()
|
||||
|
||||
set(INTERNAL_LIBS "")
|
||||
if(USE_INTERNAL_CURL)
|
||||
list(APPEND INTERNAL_LIBS "cURL")
|
||||
endif()
|
||||
if(USE_INTERNAL_JPEG)
|
||||
list(APPEND INTERNAL_LIBS "JPEG")
|
||||
endif()
|
||||
if(USE_INTERNAL_OGG)
|
||||
list(APPEND INTERNAL_LIBS "Ogg")
|
||||
endif()
|
||||
if(USE_INTERNAL_OPENAL)
|
||||
list(APPEND INTERNAL_LIBS "OpenAL")
|
||||
endif()
|
||||
if(USE_INTERNAL_OPUS)
|
||||
list(APPEND INTERNAL_LIBS "Opus")
|
||||
endif()
|
||||
if(USE_INTERNAL_SDL)
|
||||
list(APPEND INTERNAL_LIBS "SDL")
|
||||
endif()
|
||||
if(USE_INTERNAL_VORBIS)
|
||||
list(APPEND INTERNAL_LIBS "Vorbis")
|
||||
endif()
|
||||
if(USE_INTERNAL_ZLIB)
|
||||
list(APPEND INTERNAL_LIBS "zlib")
|
||||
endif()
|
||||
string(REPLACE ";" ", " internal_libs_string "${INTERNAL_LIBS}")
|
||||
|
||||
message("Building in ${CMAKE_BINARY_DIR}:")
|
||||
message(" Project: ${CMAKE_PROJECT_NAME}")
|
||||
message(" Project version: ${PRODUCT_VERSION}")
|
||||
message(" Git revision: ${git_rev_string}")
|
||||
message(" Platform: ${CMAKE_HOST_SYSTEM_NAME}")
|
||||
message(" Platform version: ${CMAKE_HOST_SYSTEM_VERSION}")
|
||||
message(" Architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||
message(" Compile platform: ${COMPILE_PLATFORM}")
|
||||
message(" Compile architecture: ${COMPILE_ARCH}")
|
||||
message(" CMake generator: ${CMAKE_GENERATOR}")
|
||||
message(" C compiler ID: ${CMAKE_C_COMPILER_ID}")
|
||||
message(" C compiler version: ${CMAKE_C_COMPILER_VERSION}")
|
||||
message(" SOURCE_DATE_EPOCH: ${source_date_epoch_string}")
|
||||
message(" CMAKE_BUILD_TYPE: ${build_type_string}")
|
||||
message(" CMAKE_C_FLAGS: ${c_flags_string}")
|
||||
message(" CMAKE_C_FLAGS_RELEASE:${c_flags_release_string}")
|
||||
message(" BUILD_STATIC_CRT: ${static_crt_string}")
|
||||
message(" Internal libraries: ${internal_libs_string}")
|
||||
|
||||
|
||||
# dist target
|
||||
find_package(Git)
|
||||
|
||||
if(NOT GIT_FOUND)
|
||||
set(GIT_EXECUTABLE "git")
|
||||
endif()
|
||||
|
||||
if(USE_GIT_REV AND GIT_REV)
|
||||
set(DIST_VERSION "${PRODUCT_VERSION}_GIT_${GIT_REV}")
|
||||
else()
|
||||
set(DIST_VERSION "${PRODUCT_VERSION}")
|
||||
endif()
|
||||
|
||||
add_custom_target(dist
|
||||
COMMAND "${GIT_EXECUTABLE}" archive --format zip --output "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${DIST_VERSION}.zip" HEAD
|
||||
COMMENT "git archive --format zip --output ${CMAKE_PROJECT_NAME}-${DIST_VERSION}.zip HEAD"
|
||||
WORKING_DIRECTORY ${SOURCE_DIR})
|
||||
|
||||
include(CPack)
|
||||
|
||||
if(NOT hide_build_notice AND CMAKE_GENERATOR STREQUAL "Visual Studio 16 2019")
|
||||
message("For a Visual Studio 16 2019 32-bit build use these components:\n"
|
||||
" C++ core features\n"
|
||||
" Windows Universal C Runtime\n"
|
||||
" MSVC v142 - VS 2019 C++ x64/x86 build tools (latest)\n"
|
||||
" Python 3 32-bit (3.9.7)\n"
|
||||
" C++ CMake tools for Windows\n"
|
||||
" Windows 11 SDK (10.0.22000.0)\n"
|
||||
" Windows Universal CRT SDK\n"
|
||||
" C++ Windows XP Support for VS 2017 (v141) tools\n"
|
||||
" MSVC v142 - VS 2019 C++ x64/x86 build tools (14.29-16.10)\n"
|
||||
" Windows 10 SDK (10.0.20348.0)")
|
||||
message("MSVC -> Tools -> Command Line -> Developer Command Prompt")
|
||||
endif()
|
||||
if(NOT hide_build_notice AND CMAKE_GENERATOR STREQUAL "MSYS Makefiles")
|
||||
message("For a MSYS build install these packages:\n"
|
||||
" (a CMake version that supports the MSYS generator)\n"
|
||||
" 64-bit: mingw-w64-x86_64-toolchain (gcc, make and binutils [strip, ld, ...])\n"
|
||||
" 32-bit: mingw-w64-i686-toolchain\n"
|
||||
" Optional libraries:\n"
|
||||
" libcurl-devel, libcurl, libjpeg, libogg, openal, opus, opusfile, SDL2, libvorbis, zlib-devel, zlib\n")
|
||||
endif()
|
||||
set(hide_build_notice 1 CACHE INTERNAL "Only show build requirements once")
|
131
misc/CMakeLists/autoupdater/CMakeLists.txt
Normal file
131
misc/CMakeLists/autoupdater/CMakeLists.txt
Normal file
|
@ -0,0 +1,131 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("autoupdater")
|
||||
|
||||
set(AUTOUPDATER_TARGET "autoupdater")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
set(MOUNT_DIR "${SOURCE_DIR}/code" CACHE PATH "path to the code directory")
|
||||
|
||||
set(AUTOUPDATER_SRC_DIR "${MOUNT_DIR}/autoupdater")
|
||||
set(LIBTOMCRYPT_SRC_DIR "${AUTOUPDATER_SRC_DIR}/rsa_tools/libtomcrypt-1.17")
|
||||
set(TOMSFASTMATH_SRC_DIR "${AUTOUPDATER_SRC_DIR}/rsa_tools/tomsfastmath-0.13.1")
|
||||
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
set(AUTOUPDATER_SOURCES
|
||||
"${AUTOUPDATER_SRC_DIR}/autoupdater.c"
|
||||
|
||||
)
|
||||
set(AUTOUPDATER_HEADERS
|
||||
|
||||
)
|
||||
|
||||
find_package(TOMCRYPT 1.17 QUIET)
|
||||
if(TOMCRYPT_FOUND)
|
||||
list(APPEND AUTOUPDATER_DEFINITIONS ${TOMCRYPT_DEFINITIONS})
|
||||
if(TOMCRYPT_INCLUDE_DIR)
|
||||
list(APPEND AUTOUPDATER_INCLUDE_DIRS "${TOMCRYPT_INCLUDE_DIR}")
|
||||
endif(TOMCRYPT_INCLUDE_DIR)
|
||||
list(APPEND AUTOUPDATER_INCLUDE_DIRS ${TOMCRYPT_INCLUDE_DIRS})
|
||||
list(APPEND AUTOUPDATER_LIBRARIES "${TOMCRYPT_LIBRARY}")
|
||||
list(APPEND AUTOUPDATER_LIBRARIES ${TOMCRYPT_LIBRARIES})
|
||||
else(TOMCRYPT_FOUND)
|
||||
list(APPEND AUTOUPDATER_LIBRARIES "tomcrypt")
|
||||
link_directories("${LIBTOMCRYPT_SRC_DIR}")
|
||||
list(APPEND AUTOUPDATER_INCLUDE_DIRS "${LIBTOMCRYPT_SRC_DIR}/src/headers")
|
||||
endif(TOMCRYPT_FOUND)
|
||||
|
||||
find_package(TOMSFASTMATH 0.13.1 QUIET)
|
||||
if(TOMSFASTMATH_FOUND)
|
||||
list(APPEND AUTOUPDATER_DEFINITIONS ${TOMSFASTMATH_DEFINITIONS})
|
||||
if(TOMSFASTMATH_INCLUDE_DIR)
|
||||
list(APPEND AUTOUPDATER_INCLUDE_DIRS "${TOMSFASTMATH_INCLUDE_DIR}")
|
||||
endif(TOMSFASTMATH_INCLUDE_DIR)
|
||||
list(APPEND AUTOUPDATER_INCLUDE_DIRS ${TOMSFASTMATH_INCLUDE_DIRS})
|
||||
list(APPEND AUTOUPDATER_LIBRARIES "${TOMSFASTMATH_LIBRARY}")
|
||||
list(APPEND AUTOUPDATER_LIBRARIES ${TOMSFASTMATH_LIBRARIES})
|
||||
else(TOMSFASTMATH_FOUND)
|
||||
list(APPEND AUTOUPDATER_LIBRARIES "tfm")
|
||||
link_directories("${TOMSFASTMATH_SRC_DIR}")
|
||||
list(APPEND AUTOUPDATER_INCLUDE_DIRS "${TOMSFASTMATH_SRC_DIR}/src/headers")
|
||||
endif(TOMSFASTMATH_FOUND)
|
||||
|
||||
if(MINGW AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
#InternetOpen, HttpQueryInfo, InternetOpenUrl,
|
||||
#InternetCloseHandle, InternetReadFile functions
|
||||
list(APPEND AUTOUPDATER_LIBRARIES "wininet")
|
||||
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
||||
#disable deprecation warnings about old functions like strcmp
|
||||
list(APPEND AUTOUPDATER_DEFINITIONS "-D_CRT_SECURE_NO_WARNINGS")
|
||||
|
||||
if(BUILD_STATIC_CRT)
|
||||
list(APPEND AUTOUPDATER_CFLAGS "/MT")
|
||||
endif()
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
# list(APPEND AUTOUPDATER_CFLAGS_OPTIMIZE "-g")
|
||||
# list(APPEND AUTOUPDATER_CFLAGS_OPTIMIZE "-Wall")
|
||||
# list(APPEND AUTOUPDATER_CFLAGS_OPTIMIZE "-fno-strict-aliasing")
|
||||
|
||||
CHECK_C_COMPILER_FLAG("-MMD" COMPILER_SUPPORTS_-MMD)
|
||||
if(GENERATE_DEPENDENCIES AND COMPILER_SUPPORTS_-MMD)
|
||||
list(APPEND AUTOUPDATER_CFLAGS "-MMD")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
#source_group("Source Files" FILES ${AUTOUPDATER_SOURCES})
|
||||
#source_group("Header Files" FILES ${AUTOUPDATER_HEADERS})
|
||||
|
||||
add_executable(${AUTOUPDATER_TARGET} ${AUTOUPDATER_SOURCES} ${AUTOUPDATER_HEADERS})
|
||||
|
||||
target_compile_definitions(${AUTOUPDATER_TARGET} PRIVATE ${AUTOUPDATER_DEFINITIONS})
|
||||
|
||||
target_include_directories(${AUTOUPDATER_TARGET} PRIVATE ${AUTOUPDATER_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${AUTOUPDATER_TARGET} PRIVATE ${AUTOUPDATER_CFLAGS})
|
||||
|
||||
target_link_libraries(${AUTOUPDATER_TARGET} ${AUTOUPDATER_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${AUTOUPDATER_TARGET} PRIVATE ${AUTOUPDATER_LDFLAGS})
|
964
misc/CMakeLists/client/CMakeLists.txt
Normal file
964
misc/CMakeLists/client/CMakeLists.txt
Normal file
|
@ -0,0 +1,964 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("client")
|
||||
|
||||
set(CLIENT_TARGET "client")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/git_rev.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
include("${CMAKELIST_DIR}/include/vm_sources.cmake")
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
|
||||
#cmake does append any extensions
|
||||
set(CLIENT_BIN "${DEFAULT_CLIENT_BIN}" CACHE STRING "binary/executable name")
|
||||
|
||||
option(BUILD_STANDALONE "Standalone" ${DEFAULT_BUILD_STANDALONE})
|
||||
|
||||
#Note: options and build directories get cached
|
||||
option(USE_INTERNAL_LIBS "Use internal libraries (Ogg,Vorbis,Opus,zlib,JPEG,...)" ${DEFAULT_USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_CURL "Use internal cURL library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_OGG "Use internal Ogg" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_OPENAL "Use internal OpenAL library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_OPUS "Use internal Opus" ${USE_INTERNAL_LIBS})
|
||||
#option(USE_INTERNAL_SPEEX "Use internal Speex library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_SDL "Use internal SDL library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_VORBIS "Use internal Vorbis" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_ZLIB "Use internal zlib" ${USE_INTERNAL_LIBS})
|
||||
option(USE_LOCAL_HEADERS "Use local headers" ${USE_INTERNAL_LIBS})
|
||||
|
||||
option(USE_CURL "Use cURL" ${DEFAULT_USE_CURL})
|
||||
option(USE_CURL_DLOPEN "Use cURL dynamic library opening" ${DEFAULT_USE_CURL_DLOPEN})
|
||||
#on Apple/MacOS the icon of the AppBundle is used
|
||||
if(NOT PLATFORM STREQUAL "darwin")
|
||||
option(USE_ICON "Use window icon" ${DEFAULT_USE_ICON})
|
||||
endif()
|
||||
option(USE_OPENAL "Use OpenAL" ${DEFAULT_USE_OPENAL})
|
||||
option(USE_OPENAL_DLOPEN "Use OpenAL dynamic library opening" ${DEFAULT_USE_OPENAL_DLOPEN})
|
||||
option(USE_RENDERER_DLOPEN "Use renderer dynamic library opening" ${DEFAULT_USE_RENDERER_DLOPEN})
|
||||
option(USE_VOIP "Use VOIP" ${DEFAULT_USE_VOIP})
|
||||
option(USE_MUMBLE "Use Mumble support" ${DEFAULT_USE_MUMBLE})
|
||||
option(USE_CODEC_OPUS "Use Opus support" ${DEFAULT_USE_CODEC_OPUS})
|
||||
option(USE_CODEC_VORBIS "Use Vorbis support" ${DEFAULT_USE_CODEC_VORBIS})
|
||||
option(USE_FREETYPE "Use Freetype2 support" ${DEFAULT_USE_FREETYPE})
|
||||
option(USE_AUTOUPDATER "Use Autoupdater" ${DEFAULT_USE_AUTOUPDATER})
|
||||
|
||||
option(USE_RENDERER_DLOPEN "Use renderer dynamic library opening" ${DEFAULT_USE_RENDERER_DLOPEN})
|
||||
set(PRODUCT_VERSION "${DEFAULT_VERSION}" CACHE STRING "Product version")
|
||||
option(USE_GIT_REV "Use Git revision for version" ${DEFAULT_USE_GIT_REV})
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(BIN_EXT "${DEFAULT_BIN_EXT}" CACHE STRING "Binary/executable extension")
|
||||
|
||||
set(REL_INSTALL_DEST "${DEFAULT_REL_INSTALL_DEST}" CACHE PATH "Relative installation destination")
|
||||
set(INSTALL_DIR "${DEFAULT_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
set(BOTLIB_SOURCES
|
||||
"${BOTLIB_DIR}/be_aas_bspq3.c"
|
||||
"${BOTLIB_DIR}/be_aas_cluster.c"
|
||||
"${BOTLIB_DIR}/be_aas_debug.c"
|
||||
"${BOTLIB_DIR}/be_aas_entity.c"
|
||||
"${BOTLIB_DIR}/be_aas_file.c"
|
||||
"${BOTLIB_DIR}/be_aas_main.c"
|
||||
"${BOTLIB_DIR}/be_aas_move.c"
|
||||
"${BOTLIB_DIR}/be_aas_optimize.c"
|
||||
"${BOTLIB_DIR}/be_aas_reach.c"
|
||||
"${BOTLIB_DIR}/be_aas_route.c"
|
||||
"${BOTLIB_DIR}/be_aas_routealt.c"
|
||||
"${BOTLIB_DIR}/be_aas_sample.c"
|
||||
"${BOTLIB_DIR}/be_ai_char.c"
|
||||
"${BOTLIB_DIR}/be_ai_chat.c"
|
||||
"${BOTLIB_DIR}/be_ai_gen.c"
|
||||
"${BOTLIB_DIR}/be_ai_goal.c"
|
||||
"${BOTLIB_DIR}/be_ai_move.c"
|
||||
"${BOTLIB_DIR}/be_ai_weap.c"
|
||||
"${BOTLIB_DIR}/be_ai_weight.c"
|
||||
"${BOTLIB_DIR}/be_ea.c"
|
||||
"${BOTLIB_DIR}/be_interface.c"
|
||||
"${BOTLIB_DIR}/l_crc.c"
|
||||
"${BOTLIB_DIR}/l_libvar.c"
|
||||
"${BOTLIB_DIR}/l_log.c"
|
||||
"${BOTLIB_DIR}/l_memory.c"
|
||||
"${BOTLIB_DIR}/l_precomp.c"
|
||||
"${BOTLIB_DIR}/l_script.c"
|
||||
"${BOTLIB_DIR}/l_struct.c"
|
||||
)
|
||||
set(BOTLIB_HEADERS
|
||||
"${BOTLIB_DIR}/aasfile.h"
|
||||
"${BOTLIB_DIR}/be_aas.h"
|
||||
"${BOTLIB_DIR}/be_aas_bsp.h"
|
||||
"${BOTLIB_DIR}/be_aas_cluster.h"
|
||||
"${BOTLIB_DIR}/be_aas_debug.h"
|
||||
"${BOTLIB_DIR}/be_aas_def.h"
|
||||
"${BOTLIB_DIR}/be_aas_entity.h"
|
||||
"${BOTLIB_DIR}/be_aas_file.h"
|
||||
"${BOTLIB_DIR}/be_aas_funcs.h"
|
||||
"${BOTLIB_DIR}/be_aas_main.h"
|
||||
"${BOTLIB_DIR}/be_aas_move.h"
|
||||
"${BOTLIB_DIR}/be_aas_optimize.h"
|
||||
"${BOTLIB_DIR}/be_aas_reach.h"
|
||||
"${BOTLIB_DIR}/be_aas_route.h"
|
||||
"${BOTLIB_DIR}/be_aas_routealt.h"
|
||||
"${BOTLIB_DIR}/be_aas_sample.h"
|
||||
"${BOTLIB_DIR}/be_ai_char.h"
|
||||
"${BOTLIB_DIR}/be_ai_chat.h"
|
||||
"${BOTLIB_DIR}/be_ai_gen.h"
|
||||
"${BOTLIB_DIR}/be_ai_goal.h"
|
||||
"${BOTLIB_DIR}/be_ai_move.h"
|
||||
"${BOTLIB_DIR}/be_ai_weap.h"
|
||||
"${BOTLIB_DIR}/be_ai_weight.h"
|
||||
"${BOTLIB_DIR}/be_ea.h"
|
||||
"${BOTLIB_DIR}/be_interface.h"
|
||||
"${BOTLIB_DIR}/botlib.h"
|
||||
"${BOTLIB_DIR}/l_crc.h"
|
||||
"${BOTLIB_DIR}/l_libvar.h"
|
||||
"${BOTLIB_DIR}/l_log.h"
|
||||
"${BOTLIB_DIR}/l_memory.h"
|
||||
"${BOTLIB_DIR}/l_precomp.h"
|
||||
"${BOTLIB_DIR}/l_script.h"
|
||||
"${BOTLIB_DIR}/l_struct.h"
|
||||
"${BOTLIB_DIR}/l_utils.h"
|
||||
)
|
||||
set(CLIENT_SOURCES
|
||||
"${CLIENT_DIR}/cl_avi.c"
|
||||
"${CLIENT_DIR}/cl_cgame.c"
|
||||
"${CLIENT_DIR}/cl_cin.c"
|
||||
"${CLIENT_DIR}/cl_console.c"
|
||||
"${CLIENT_DIR}/cl_curl.c"
|
||||
"${CLIENT_DIR}/cl_input.c"
|
||||
"${CLIENT_DIR}/cl_keys.c"
|
||||
"${CLIENT_DIR}/cl_main.c"
|
||||
"${CLIENT_DIR}/cl_net_chan.c"
|
||||
"${CLIENT_DIR}/cl_parse.c"
|
||||
"${CLIENT_DIR}/cl_scrn.c"
|
||||
"${CLIENT_DIR}/cl_ui.c"
|
||||
# "${CLIENT_DIR}/libmumblelink.c"
|
||||
"${CLIENT_DIR}/qal.c"
|
||||
"${CLIENT_DIR}/snd_adpcm.c"
|
||||
"${CLIENT_DIR}/snd_codec.c"
|
||||
"${CLIENT_DIR}/snd_codec_ogg.c"
|
||||
"${CLIENT_DIR}/snd_codec_opus.c"
|
||||
"${CLIENT_DIR}/snd_codec_wav.c"
|
||||
"${CLIENT_DIR}/snd_dma.c"
|
||||
"${CLIENT_DIR}/snd_main.c"
|
||||
"${CLIENT_DIR}/snd_mem.c"
|
||||
"${CLIENT_DIR}/snd_mix.c"
|
||||
"${CLIENT_DIR}/snd_openal.c"
|
||||
"${CLIENT_DIR}/snd_wavelet.c"
|
||||
)
|
||||
set(CLIENT_HEADERS
|
||||
"${CLIENT_DIR}/cl_curl.h"
|
||||
"${CLIENT_DIR}/client.h"
|
||||
"${CLIENT_DIR}/keycodes.h"
|
||||
"${CLIENT_DIR}/keys.h"
|
||||
"${CLIENT_DIR}/libmumblelink.h"
|
||||
"${CLIENT_DIR}/qal.h"
|
||||
"${CLIENT_DIR}/snd_codec.h"
|
||||
"${CLIENT_DIR}/snd_local.h"
|
||||
"${CLIENT_DIR}/snd_public.h"
|
||||
)
|
||||
set(CLIENT_MUMBLE_SOURCES
|
||||
"${CLIENT_DIR}/libmumblelink.c"
|
||||
)
|
||||
|
||||
include("${CMAKELIST_DIR}/include/libsdl_headers.cmake")
|
||||
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/cm_load.c"
|
||||
"${QCOMMON_DIR}/cm_patch.c"
|
||||
"${QCOMMON_DIR}/cm_polylib.c"
|
||||
"${QCOMMON_DIR}/cm_test.c"
|
||||
"${QCOMMON_DIR}/cm_trace.c"
|
||||
"${QCOMMON_DIR}/cmd.c"
|
||||
"${QCOMMON_DIR}/common.c"
|
||||
"${QCOMMON_DIR}/cvar.c"
|
||||
"${QCOMMON_DIR}/files.c"
|
||||
"${QCOMMON_DIR}/huffman.c"
|
||||
"${QCOMMON_DIR}/ioapi.c"
|
||||
"${QCOMMON_DIR}/md4.c"
|
||||
"${QCOMMON_DIR}/md5.c"
|
||||
"${QCOMMON_DIR}/msg.c"
|
||||
"${QCOMMON_DIR}/net_chan.c"
|
||||
"${QCOMMON_DIR}/net_ip.c"
|
||||
"${QCOMMON_DIR}/puff.c"
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
"${QCOMMON_DIR}/unzip.c"
|
||||
"${QCOMMON_DIR}/vm.c"
|
||||
"${QCOMMON_DIR}/vm_interpreted.c"
|
||||
# "${QCOMMON_DIR}/vm_none.c"
|
||||
# "${QCOMMON_DIR}/vm_armv7l.c"
|
||||
# "${QCOMMON_DIR}/vm_powerpc.c"
|
||||
# "${QCOMMON_DIR}/vm_powerpc_asm.c"
|
||||
# "${QCOMMON_DIR}/vm_sparc.c"
|
||||
# "${QCOMMON_DIR}/vm_x86.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/cm_local.h"
|
||||
"${QCOMMON_DIR}/cm_patch.h"
|
||||
"${QCOMMON_DIR}/cm_polylib.h"
|
||||
"${QCOMMON_DIR}/cm_public.h"
|
||||
"${QCOMMON_DIR}/ioapi.h"
|
||||
"${QCOMMON_DIR}/puff.h"
|
||||
"${QCOMMON_DIR}/q_platform.h"
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
"${QCOMMON_DIR}/qcommon.h"
|
||||
"${QCOMMON_DIR}/qfiles.h"
|
||||
"${QCOMMON_DIR}/surfaceflags.h"
|
||||
"${QCOMMON_DIR}/unzip.h"
|
||||
"${QCOMMON_DIR}/vm_local.h"
|
||||
# "${QCOMMON_DIR}/vm_powerpc_asm.h"
|
||||
# "${QCOMMON_DIR}/vm_sparc.h"
|
||||
)
|
||||
|
||||
set(SDL_SOURCES
|
||||
# "${SDL_DIR}/sdl_gamma.c"
|
||||
# "${SDL_DIR}/sdl_glimp.c"
|
||||
"${SDL_DIR}/sdl_input.c"
|
||||
"${SDL_DIR}/sdl_snd.c"
|
||||
)
|
||||
set(SDL_HEADERS
|
||||
"${SDL_DIR}/sdl_icon.h"
|
||||
)
|
||||
|
||||
|
||||
set(SERVER_SOURCES
|
||||
"${SERVER_DIR}/sv_bot.c"
|
||||
"${SERVER_DIR}/sv_ccmds.c"
|
||||
"${SERVER_DIR}/sv_client.c"
|
||||
"${SERVER_DIR}/sv_game.c"
|
||||
"${SERVER_DIR}/sv_init.c"
|
||||
"${SERVER_DIR}/sv_main.c"
|
||||
"${SERVER_DIR}/sv_net_chan.c"
|
||||
# "${SERVER_DIR}/sv_rankings.c"
|
||||
"${SERVER_DIR}/sv_snapshot.c"
|
||||
"${SERVER_DIR}/sv_world.c"
|
||||
)
|
||||
set(SERVER_HEADERS
|
||||
"${SERVER_DIR}/server.h"
|
||||
)
|
||||
|
||||
set(SYS_SOURCES
|
||||
"${SYS_DIR}/con_log.c"
|
||||
# "${SYS_DIR}/con_passive.c"
|
||||
# "${SYS_DIR}/con_tty.c"
|
||||
# "${SYS_DIR}/con_win32.c"
|
||||
"${SYS_DIR}/sys_autoupdater.c"
|
||||
"${SYS_DIR}/sys_main.c"
|
||||
# "${SYS_DIR}/sys_unix.c"
|
||||
# "${SYS_DIR}/sys_win32.c"
|
||||
)
|
||||
set(SYS_HEADERS
|
||||
"${SYS_DIR}/sys_loadlib.h"
|
||||
"${SYS_DIR}/sys_local.h"
|
||||
"${SYS_DIR}/win_resource.h"
|
||||
)
|
||||
list(APPEND SYS_RC_SOURCES
|
||||
"${SYS_DIR}/win_manifest.xml"
|
||||
"${SYS_DIR}/win_resource.rc"
|
||||
)
|
||||
list(APPEND SYS_WIN_SOURCES
|
||||
"${SYS_DIR}/con_passive.c"
|
||||
"${SYS_DIR}/sys_win32.c"
|
||||
# "${SYS_DIR}/con_win32.c"
|
||||
)
|
||||
list(APPEND SYS_UNIX_SOURCES
|
||||
# "${SYS_DIR}/con_unix.c"
|
||||
"${SYS_DIR}/con_tty.c"
|
||||
"${SYS_DIR}/sys_unix.c"
|
||||
)
|
||||
list(APPEND SYS_OSX_SOURCES
|
||||
# "${SYS_DIR}/sys_osx.c"
|
||||
"${SYS_DIR}/sys_osx.m"
|
||||
)
|
||||
|
||||
|
||||
if(WIN32)
|
||||
#requires parent directory for misc/quake3.ico in win_resource.rc
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${SOURCE_DIR}")
|
||||
endif(WIN32)
|
||||
|
||||
if(MSVC)
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win64/SDL2main.lib"
|
||||
"${LIBS_DIR}/win64/SDL2.lib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
elseif(ARCH STREQUAL "x86")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win32/SDL2main.lib"
|
||||
"${LIBS_DIR}/win32/SDL2.lib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
|
||||
endif()
|
||||
|
||||
if(SDL_FOUND)
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MSVC: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
endif(SDL_FOUND)
|
||||
endif()
|
||||
|
||||
if(USE_CURL AND NOT USE_CURL_DLOPEN AND USE_INTERNAL_CURL)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND CURL_LIBRARIES "${LIBS_DIR}/win64/curl.lib")
|
||||
set(CURL_FOUND TRUE)
|
||||
elseif(ARCH STREQUAL "x86")
|
||||
list(APPEND CURL_LIBRARIES "${LIBS_DIR}/win32/curl.lib")
|
||||
set(CURL_FOUND TRUE)
|
||||
|
||||
endif()
|
||||
if(CURL_FOUND)
|
||||
list(APPEND CURL_DEFINITIONS "-DCURL_STATICLIB")
|
||||
foreach(FILEPATH ${CURL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MSVC: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
endif(CURL_FOUND)
|
||||
endif()
|
||||
|
||||
include(CheckLanguage)
|
||||
check_language(ASM_MASM)
|
||||
if(CMAKE_ASM_MASM_COMPILER)
|
||||
enable_language(ASM_MASM)
|
||||
set(HAVE_MASM_COMPILER TRUE)
|
||||
endif(CMAKE_ASM_MASM_COMPILER)
|
||||
|
||||
if(NOT HAVE_MASM_COMPILER)
|
||||
message(WARNING "Microsoft ASM compiler is required!")
|
||||
else()
|
||||
if(NOT (ARCH STREQUAL "x86" OR ARCH STREQUAL "x86_64"))
|
||||
message(WARNING "Only architecture x86 and x86_64 are supported for MSVC!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(USE_MASM_SOURCES TRUE)
|
||||
|
||||
list(APPEND SYS_SOURCES ${SYS_WIN_SOURCES})
|
||||
|
||||
#Character Set, CharacterSet="0", Not Set, ASCII/SBCS (Single Byte Character Set)
|
||||
list(APPEND CLIENT_DEFINITIONS "-D_SBCS")
|
||||
|
||||
#disable deprecation warnings about old functions like strcmp
|
||||
list(APPEND CLIENT_DEFINITIONS "-D_CRT_SECURE_NO_WARNINGS")
|
||||
|
||||
#fix msvc 2019 not setting __i386__
|
||||
if(ARCH STREQUAL "x86")
|
||||
list(APPEND CLIENT_DEFINITIONS "-D__i386__")
|
||||
endif()
|
||||
|
||||
#Whole program optimization, no /GL-
|
||||
list(APPEND CLIENT_CFLAGS "/GL-")
|
||||
|
||||
#Warning Level /W4
|
||||
list(APPEND CLIENT_CFLAGS "/W4")
|
||||
|
||||
#Enable String Pooling /GF
|
||||
list(APPEND CLIENT_CFLAGS "/GF")
|
||||
#Enable C++ Exceptions, No /EHa-
|
||||
list(APPEND CLIENT_CFLAGS "/EHa-")
|
||||
#Enable Function-Level Linking /Gy
|
||||
list(APPEND CLIENT_CFLAGS "/Gy")
|
||||
#Floating Point Model /fp:fast
|
||||
list(APPEND CLIENT_CFLAGS "/fp:fast")
|
||||
|
||||
#Compile as, C Code /TC
|
||||
list(APPEND CLIENT_CFLAGS "/TC")
|
||||
|
||||
#Disable specific warnings
|
||||
#warning C4706: assignment within conditional expression
|
||||
list(APPEND CLIENT_CFLAGS "/wd4706")
|
||||
#warning C4389: '!=' : signed/unsigned mismatch
|
||||
list(APPEND CLIENT_CFLAGS "/wd4389")
|
||||
#warning C4100: 'opaque' : unreferenced formal parameter
|
||||
list(APPEND CLIENT_CFLAGS "/wd4100")
|
||||
#warning C4131: 'fill_fopen_filefunc' : uses old-style declarator
|
||||
list(APPEND CLIENT_CFLAGS "/wd4131")
|
||||
#warning C4245: 'return' : conversion from 'int' to 'uLong', signed/unsigned mismatch
|
||||
list(APPEND CLIENT_CFLAGS "/wd4245")
|
||||
|
||||
#Subsystem /SUBSYSTEM:WINDOWS
|
||||
list(APPEND CLIENT_LDFLAGS "/SUBSYSTEM:WINDOWS")
|
||||
#Stack Reserve Size /STACK:8388608
|
||||
list(APPEND CLIENT_LDFLAGS "/STACK:8388608")
|
||||
#Randomized Base Address /DYNAMICBASE:NO
|
||||
list(APPEND CLIENT_LDFLAGS "/DYNAMICBASE:NO")
|
||||
#Data Execution Prevenbtion (DEP) /NXCOMPAT:NO
|
||||
list(APPEND CLIENT_LDFLAGS "/NXCOMPAT:NO")
|
||||
#Image Has Safe Exception Handlers, is no longer default no in msvc 2013, /SAFESEH:NO
|
||||
list(APPEND CLIENT_LDFLAGS "/SAFESEH:NO")
|
||||
|
||||
#not generating manifest, using win_manifest.xml
|
||||
list(APPEND CLIENT_LDFLAGS "/MANIFEST:NO")
|
||||
|
||||
#time functions winmm.lib
|
||||
#EnumProcesses function psapi.lib
|
||||
#windows socket functions ws2_32.lib
|
||||
list(APPEND CLIENT_LIBRARIES "winmm" "psapi" "ws2_32")
|
||||
|
||||
#requires directory misc/msvc for ../quake3.ico in win_resource.rc
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${SOURCE_DIR}/misc/msvc")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(MINGW AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win64/libSDL264main.a"
|
||||
"${LIBS_DIR}/win64/libSDL264.dll.a"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
elseif(ARCH STREQUAL "x86")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win32/libSDL2main.a"
|
||||
"${LIBS_DIR}/win32/libSDL2.dll.a"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
|
||||
endif()
|
||||
if(SDL_FOUND)
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MinGW: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
endif(SDL_FOUND)
|
||||
endif()
|
||||
|
||||
if(USE_CURL AND NOT USE_CURL_DLOPEN AND USE_INTERNAL_CURL)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND CURL_LIBRARIES "${LIBS_DIR}/win64/libcurl.a")
|
||||
set(CURL_FOUND TRUE)
|
||||
elseif(ARCH STREQUAL "x86")
|
||||
list(APPEND CURL_LIBRARIES "${LIBS_DIR}/win32/libcurl.a")
|
||||
set(CURL_FOUND TRUE)
|
||||
|
||||
endif()
|
||||
if(CURL_FOUND)
|
||||
list(APPEND CURL_DEFINITIONS "-DCURL_STATICLIB")
|
||||
|
||||
foreach(FILEPATH ${CURL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MinGW: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
#MinGW: These libs need to be after libcurl
|
||||
list(APPEND CURL_LIBRARIES "Ws2_32" "Crypt32")
|
||||
endif(CURL_FOUND)
|
||||
endif()
|
||||
|
||||
list(APPEND SYS_SOURCES ${SYS_WIN_SOURCES})
|
||||
|
||||
#link the MinGW library first and especially before SDL
|
||||
#32-bit and 64-bit link to mingw32
|
||||
list(INSERT CLIENT_LIBRARIES 0 "mingw32")
|
||||
|
||||
#time functions winmm.lib
|
||||
#EnumProcesses function psapi.lib
|
||||
#socket functions Ws2_32.lib
|
||||
#ImmGetIMEFileName imm32.lib
|
||||
#GetFileVersionInfoSize Version.lib
|
||||
#Certificate functions Crypt32.lib
|
||||
list(APPEND CLIENT_LIBRARIES "imm32" "Version" "winmm" "psapi" "Ws2_32")
|
||||
|
||||
#WINVER is the minimum operating system version the code supports for the Windows SDK.
|
||||
# 0x0501 for Windows XP, 0x0502 for Windows Server 2003,
|
||||
# 0x0600 for Windows Vista, 0x0601 for Windows 7,
|
||||
# 0x0602 for Windows 8, 0x603 for Windows 8.1 and 0x0A00 for Windows 10.
|
||||
list(APPEND CLIENT_DEFINITIONS "-DWINVER=0x0501")
|
||||
|
||||
endif()
|
||||
|
||||
if(PLATFORM STREQUAL "darwin" AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/macosx/libSDL2main.a"
|
||||
"${LIBS_DIR}/macosx/libSDL2-2.0.0.dylib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MacOS: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
|
||||
endif()
|
||||
|
||||
if(ENV{MACOSX_VERSION_MIN})
|
||||
set(MACOSX_VERSION_MIN "$ENV{MACOSX_VERSION_MIN}")
|
||||
elseif(NOT MACOSX_VERSION_MIN)
|
||||
set(MACOSX_VERSION_MIN "10.7")
|
||||
endif()
|
||||
|
||||
string(REPLACE "." ";" VERSION_LIST ${MACOSX_VERSION_MIN})
|
||||
list(GET VERSION_LIST 0 MACOSX_MAJOR)
|
||||
list(GET VERSION_LIST 1 MACOSX_MINOR)
|
||||
# list(GET VERSION_LIST 2 MACOSX_PATCH)
|
||||
|
||||
if(${MACOSX_MINOR} GREATER 9)
|
||||
# Multiply and then remove decimal. 10.10 -> 101000.0 -> 101000
|
||||
math(EXPR MAC_OS_X_VERSION_MIN_REQUIRED "${MACOSX_MAJOR} * 10000 + ${MACOSX_MINOR} * 100")
|
||||
else()
|
||||
# Multiply by 100 and then remove decimal. 10.7 -> 1070.0 -> 1070
|
||||
math(EXPR MAC_OS_X_VERSION_MIN_REQUIRED "${MACOSX_MAJOR} * 100 + ${MACOSX_MINOR} * 10")
|
||||
endif()
|
||||
|
||||
list(APPEND CLIENT_DEFINITIONS "-DMAC_OS_X_VERSION_MIN_REQUIRED=${MAC_OS_X_VERSION_MIN_REQUIRED}")
|
||||
list(APPEND CLIENT_CFLAGS "-mmacosx-version-min=${MACOSX_VERSION_MIN}")
|
||||
list(APPEND CLIENT_LDFLAGS "-mmacosx-version-min=${MACOSX_VERSION_MIN}")
|
||||
|
||||
|
||||
list(APPEND SYS_SOURCES ${SYS_OSX_SOURCES})
|
||||
set_source_files_properties("${SYS_DIR}/sys_osx.m" PROPERTIES LANGUAGE C)
|
||||
|
||||
list(APPEND CLIENT_DEFINITIONS "-DMACOS_X")
|
||||
#NSConstantString NSString
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
if(COCOA_LIBRARY)
|
||||
list(APPEND CLIENT_LIBRARIES "${COCOA_LIBRARY}")
|
||||
else()
|
||||
list(APPEND CLIENT_LDFLAGS "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
if(ARCH STREQUAL "x86") #not for x86_64
|
||||
set(USE_ASM_SOURCES TRUE)
|
||||
endif()
|
||||
if(ARCH STREQUAL "x86" OR ARCH STREQUAL "x86_64")
|
||||
set(USE_INLINE_ASM_SOURCES TRUE)
|
||||
endif()
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2))); int main() {return 0;}" HAVE_GCC_FORMAT)
|
||||
if(HAVE_GCC_FORMAT)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DHAVE_GCC_FORMAT")
|
||||
endif(HAVE_GCC_FORMAT)
|
||||
|
||||
if(NOT MINGW)
|
||||
list(APPEND SYS_SOURCES ${SYS_UNIX_SOURCES})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(USE_INLINE_ASM_SOURCES)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_inline_asm")
|
||||
list(APPEND CLIENT_LIBRARIES ${INTERNAL_INLINE_ASM_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(USE_MASM_SOURCES)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_masm")
|
||||
list(APPEND CLIENT_LIBRARIES ${INTERNAL_MASM_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(USE_ASM_SOURCES)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_asm")
|
||||
list(APPEND CLIENT_LIBRARIES ${INTERNAL_ASM_LIBRARIES})
|
||||
endif()
|
||||
|
||||
ADD_CLIENT_DEFINITIONS(CLIENT_DEFINITIONS)
|
||||
ADD_CLIENT_CFLAGS(CLIENT_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(CLIENT_LDFLAGS)
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND CLIENT_CFLAGS "-Qunused-arguments")
|
||||
endif()
|
||||
|
||||
GET_VM_SOURCES(VM_SOURCES)
|
||||
if(VM_SOURCES)
|
||||
list(APPEND QCOMMON_SOURCES ${VM_SOURCES})
|
||||
else()
|
||||
set(NO_VM_COMPILED TRUE)
|
||||
endif()
|
||||
if(NO_VM_COMPILED)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DNO_VM_COMPILED")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
if(USE_GIT_REV AND GIT_REV)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DPRODUCT_VERSION=\"${PRODUCT_VERSION}_GIT_${GIT_REV}\"")
|
||||
else()
|
||||
list(APPEND CLIENT_DEFINITIONS "-DPRODUCT_VERSION=\"${PRODUCT_VERSION}\"")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
string(TIMESTAMP PRODUCT_DATE "%b %d %Y" UTC) #Nov 28 2021
|
||||
list(APPEND CLIENT_DEFINITIONS "-DPRODUCT_DATE=\"${PRODUCT_DATE}\"")
|
||||
else()
|
||||
message(WARNING "Update CMake to version 3.8 or later for SOURCE_DATE_EPOCH support!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_INTERNAL_SDL)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_INTERNAL_SDL")
|
||||
if(ARCH STREQUAL "ppc" OR ARCH STREQUAL "ppc64")
|
||||
list(APPEND SDL_INCLUDE_DIRS "${LIBSDL_DIR}/include-macppc")
|
||||
else()
|
||||
list(APPEND SDL_INCLUDE_DIRS "${LIBSDL_DIR}/include")
|
||||
endif()
|
||||
list(APPEND CLIENT_C_HEADERS ${LIBSDL_HEADERS})
|
||||
|
||||
elseif(NOT SDL_FOUND)
|
||||
#find_package sets *_FOUND *_INCLUDE_DIRS *_LIBRARIES (*_INCLUDE_DIR *_LIBRARY)
|
||||
find_package(SDL REQUIRED)
|
||||
if(DEFINED SDL_VERSION AND NOT SDL_VERSION STREQUAL "")
|
||||
if(${SDL_VERSION} VERSION_LESS 2)
|
||||
message(FATAL_ERROR "The SDL library version is ${SDL_VERSION} but required is at least version 2.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif(USE_INTERNAL_SDL)
|
||||
|
||||
list(APPEND CLIENT_DEFINITIONS ${SDL_DEFINITIONS})
|
||||
if(SDL_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${SDL_INCLUDE_DIR}")
|
||||
endif(SDL_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${SDL_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES "${SDL_LIBRARY}")
|
||||
list(APPEND CLIENT_LIBRARIES ${SDL_LIBRARIES})
|
||||
|
||||
if(USE_INTERNAL_ZLIB)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_INTERNAL_ZLIB")
|
||||
if(NOT DEFINED INTERNAL_ZLIB_LIBRARIES)
|
||||
add_subdirectory("${CMAKELIST_DIR}/internal_zlib" "internal_zlib")
|
||||
endif()
|
||||
list(APPEND CLIENT_DEFINITIONS ${INTERNAL_ZLIB_DEFINITIONS})
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${INTERNAL_ZLIB_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES ${INTERNAL_ZLIB_LIBRARIES})
|
||||
else()
|
||||
find_package(ZLIB REQUIRED)
|
||||
list(APPEND CLIENT_DEFINITIONS ${ZLIB_DEFINITIONS})
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
endif(USE_INTERNAL_ZLIB)
|
||||
|
||||
if(USE_CODEC_OPUS)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_CODEC_OPUS")
|
||||
set(NEED_OGG TRUE)
|
||||
|
||||
if(USE_INTERNAL_OPUS)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_opusfile")
|
||||
# list(APPEND CLIENT_DEFINITIONS "-DUSE_INTERNAL_OPUS")
|
||||
list(APPEND CLIENT_DEFINITIONS ${INTERNAL_OPUSFILE_DEFINITIONS})
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${INTERNAL_OPUSFILE_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES ${INTERNAL_OPUSFILE_LIBRARIES})
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_opus")
|
||||
# list(APPEND CLIENT_DEFINITIONS "-DUSE_INTERNAL_OPUSFILE")
|
||||
list(APPEND CLIENT_DEFINITIONS ${INTERNAL_OPUS_DEFINITIONS})
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${INTERNAL_OPUS_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES ${INTERNAL_OPUS_LIBRARIES})
|
||||
else()
|
||||
find_package(OPUSFILE REQUIRED)
|
||||
find_package(OPUS REQUIRED)
|
||||
list(APPEND CLIENT_DEFINITIONS ${OPUSFILE_DEFINITIONS})
|
||||
if(OPUSFILE_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${OPUSFILE_INCLUDE_DIR}")
|
||||
endif(OPUSFILE_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${OPUSFILE_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES "${OPUSFILE_LIBRARY}")
|
||||
list(APPEND CLIENT_LIBRARIES ${OPUSFILE_LIBRARIES})
|
||||
|
||||
list(APPEND CLIENT_DEFINITIONS ${OPUS_DEFINITIONS})
|
||||
if(OPUS_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${OPUS_INCLUDE_DIR}")
|
||||
endif(OPUS_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${OPUS_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES "${OPUS_LIBRARY}")
|
||||
list(APPEND CLIENT_LIBRARIES ${OPUS_LIBRARIES})
|
||||
|
||||
endif(USE_INTERNAL_OPUS)
|
||||
|
||||
endif(USE_CODEC_OPUS)
|
||||
|
||||
if(USE_CODEC_VORBIS)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_CODEC_VORBIS")
|
||||
set(NEED_OGG TRUE)
|
||||
|
||||
if(USE_INTERNAL_VORBIS)
|
||||
# list(APPEND CLIENT_DEFINITIONS "-DUSE_INTERNAL_VORBIS")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_vorbis")
|
||||
list(APPEND CLIENT_DEFINITIONS ${INTERNAL_VORBIS_DEFINITIONS})
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${INTERNAL_VORBIS_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES ${INTERNAL_VORBIS_LIBRARIES})
|
||||
else()
|
||||
find_package(VORBIS REQUIRED)
|
||||
list(APPEND CLIENT_DEFINITIONS ${VORBIS_DEFINITIONS})
|
||||
if(VORBIS_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${VORBIS_INCLUDE_DIR}")
|
||||
endif(VORBIS_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES "${VORBIS_LIBRARY}")
|
||||
list(APPEND CLIENT_LIBRARIES ${VORBIS_LIBRARIES})
|
||||
endif(USE_INTERNAL_VORBIS)
|
||||
|
||||
endif(USE_CODEC_VORBIS)
|
||||
|
||||
if(NEED_OGG)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_CODEC_OGG")
|
||||
|
||||
if(USE_INTERNAL_OGG)
|
||||
# list(APPEND CLIENT_DEFINITIONS "-DUSE_INTERNAL_OGG")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_ogg")
|
||||
list(APPEND CLIENT_DEFINITIONS ${INTERNAL_OGG_DEFINITIONS})
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${INTERNAL_OGG_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES ${INTERNAL_OGG_LIBRARIES})
|
||||
else()
|
||||
find_package(OGG REQUIRED)
|
||||
list(APPEND CLIENT_DEFINITIONS ${OGG_DEFINITIONS})
|
||||
if(OGG_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${OGG_INCLUDE_DIR}")
|
||||
endif(OGG_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${OGG_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES "${OGG_LIBRARY}")
|
||||
list(APPEND CLIENT_LIBRARIES ${OGG_LIBRARIES})
|
||||
endif(USE_INTERNAL_OGG)
|
||||
|
||||
endif(NEED_OGG)
|
||||
|
||||
if(USE_MUMBLE)
|
||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
if(HAVE_UNISTD_H)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DHAVE_UNISTD_H")
|
||||
endif(HAVE_UNISTD_H)
|
||||
|
||||
CHECK_INCLUDE_FILE("sys/mman.h" HAVE_SYS_MMAN_H)
|
||||
if(HAVE_SYS_MMAN_H)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DHAVE_SYS_MMAN_H")
|
||||
endif(HAVE_SYS_MMAN_H)
|
||||
|
||||
#For mode constants
|
||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
if(HAVE_SYS_STAT_H)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DHAVE_SYS_STAT_H")
|
||||
endif(HAVE_SYS_STAT_H)
|
||||
|
||||
#For O_* constants
|
||||
CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
|
||||
if(HAVE_FCNTL_H)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DHAVE_FCNTL_H")
|
||||
endif(HAVE_FCNTL_H)
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/mman.h>\n int main () {int shmfd;shmfd = shm_open(\"\", 0, 0);return 0;}" HAVE_SHM_OPEN)
|
||||
if(HAVE_SHM_OPEN)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DHAVE_SHM_OPEN")
|
||||
endif(HAVE_SHM_OPEN)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES "rt")
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/mman.h>\n int main () {int shmfd;shmfd = shm_open(\"\", 0, 0);return 0;}" HAVE_SHM_OPEN_IN_RT)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
if(HAVE_SHM_OPEN_IN_RT)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DHAVE_SHM_OPEN")
|
||||
list(APPEND CLIENT_LIBRARIES "rt")
|
||||
endif(HAVE_SHM_OPEN_IN_RT)
|
||||
|
||||
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
||||
if(HAVE_STDINT_H)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DHAVE_STDINT_H")
|
||||
endif(HAVE_STDINT_H)
|
||||
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_MUMBLE")
|
||||
list(APPEND CLIENT_C_SOURCES ${CLIENT_MUMBLE_SOURCES})
|
||||
|
||||
endif(USE_MUMBLE)
|
||||
|
||||
if(USE_VOIP)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_VOIP")
|
||||
endif(USE_VOIP)
|
||||
|
||||
if(USE_FREETYPE)
|
||||
find_package(Freetype REQUIRED)
|
||||
if(DEFINED FREETYPE_VERSION AND NOT FREETYPE_VERSION STREQUAL "")
|
||||
if(${FREETYPE_VERSION} VERSION_LESS 2)
|
||||
message(FATAL_ERROR "The freetype library version is ${FREETYPE_VERSION} but required is at least version 2.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND CLIENT_DEFINITIONS "-DBUILD_FREETYPE")
|
||||
|
||||
list(APPEND CLIENT_DEFINITIONS ${FREETYPE_DEFINITIONS})
|
||||
if(FREETYPE_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR}")
|
||||
endif(FREETYPE_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES "${FREETYPE_LIBRARY}")
|
||||
list(APPEND CLIENT_LIBRARIES ${FREETYPE_LIBRARIES})
|
||||
|
||||
endif(USE_FREETYPE)
|
||||
|
||||
#required for l_precomp.c and l_script.c
|
||||
list(APPEND CLIENT_DEFINITIONS "-DBOTLIB")
|
||||
|
||||
if(USE_CURL)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_CURL")
|
||||
if(USE_CURL_DLOPEN)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_CURL_DLOPEN")
|
||||
endif(USE_CURL_DLOPEN)
|
||||
|
||||
if(USE_INTERNAL_CURL)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_INTERNAL_CURL")
|
||||
list(APPEND CURL_INCLUDE_DIRS "${CURL_DIR}")
|
||||
|
||||
elseif(NOT CURL_FOUND)
|
||||
#CURLOPT_PROTOCOLS was added in 7.19.4
|
||||
find_package(CURL REQUIRED)
|
||||
endif(USE_INTERNAL_CURL)
|
||||
|
||||
list(APPEND CLIENT_DEFINITIONS ${CURL_DEFINITIONS})
|
||||
if(CURL_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS "${CURL_INCLUDE_DIR}")
|
||||
endif(CURL_INCLUDE_DIR)
|
||||
list(APPEND CLIENT_INCLUDE_DIRS ${CURL_INCLUDE_DIRS})
|
||||
list(APPEND CLIENT_LIBRARIES "${CURL_LIBRARY}")
|
||||
list(APPEND CLIENT_LIBRARIES ${CURL_LIBRARIES})
|
||||
|
||||
endif(USE_CURL)
|
||||
|
||||
if(USE_ICON)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_ICON")
|
||||
endif()
|
||||
|
||||
if(USE_LOCAL_HEADERS)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_LOCAL_HEADERS")
|
||||
endif(USE_LOCAL_HEADERS)
|
||||
|
||||
if(USE_OPENAL)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_OPENAL")
|
||||
if(USE_OPENAL_DLOPEN)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_OPENAL_DLOPEN")
|
||||
endif(USE_OPENAL_DLOPEN)
|
||||
if(USE_INTERNAL_OPENAL)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_INTERNAL_OPENAL")
|
||||
endif(USE_INTERNAL_OPENAL)
|
||||
endif(USE_OPENAL)
|
||||
|
||||
if(USE_RENDERER_DLOPEN)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_RENDERER_DLOPEN")
|
||||
endif(USE_RENDERER_DLOPEN)
|
||||
|
||||
if(BUILD_STANDALONE)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DSTANDALONE")
|
||||
endif(BUILD_STANDALONE)
|
||||
|
||||
if(DEFAULT_BASEDIR)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DDEFAULT_BASEDIR=\"${DEFAULT_BASEDIR}\"")
|
||||
endif(DEFAULT_BASEDIR)
|
||||
|
||||
if(USE_AUTOUPDATER)
|
||||
list(APPEND CLIENT_DEFINITIONS "-DUSE_AUTOUPDATER")
|
||||
if(NOT DEFINED AUTOUPDATER_BIN)
|
||||
set(AUTOUPDATER_BIN ${DEFAULT_AUTOUPDATER_BIN})
|
||||
endif()
|
||||
list(APPEND CLIENT_DEFINITIONS "-DAUTOUPDATER_BIN=\"${AUTOUPDATER_BIN}\"")
|
||||
endif(USE_AUTOUPDATER)
|
||||
|
||||
list(APPEND CLIENT_C_SOURCES ${SDL_SOURCES} ${SERVER_SOURCES} ${BOTLIB_SOURCES} ${QCOMMON_SOURCES} ${CLIENT_SOURCES} ${SYS_SOURCES})
|
||||
list(APPEND CLIENT_C_HEADERS ${SDL_HEADERS} ${SERVER_HEADERS} ${BOTLIB_HEADERS} ${QCOMMON_HEADERS} ${CLIENT_HEADERS} ${SYS_HEADERS})
|
||||
|
||||
#IDE grouping
|
||||
source_group("botlib\\Source Files" FILES ${BOTLIB_SOURCES})
|
||||
source_group("botlib\\Header Files" FILES ${BOTLIB_HEADERS})
|
||||
source_group("client\\Source Files" FILES ${CLIENT_SOURCES})
|
||||
source_group("client\\Header Files" FILES ${CLIENT_HEADERS})
|
||||
source_group("libsdl\\Header Files" FILES ${LIBSDL_HEADERS})
|
||||
source_group("mumble" FILES ${CLIENT_MUMBLE_SOURCES})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
source_group("server\\Source Files" FILES ${SERVER_SOURCES})
|
||||
source_group("server\\Header Files" FILES ${SERVER_HEADERS})
|
||||
source_group("sys\\Source Files" FILES ${SYS_SOURCES})
|
||||
source_group("sys\\Header Files" FILES ${SYS_HEADERS})
|
||||
source_group("sys" FILES ${SYS_RC_SOURCES})
|
||||
source_group("sdl\\Source Files" FILES ${SDL_SOURCES})
|
||||
source_group("sdl\\Header Files" FILES ${SDL_HEADERS})
|
||||
|
||||
add_executable(${CLIENT_TARGET} ${CLIENT_C_SOURCES} ${CLIENT_C_HEADERS} ${SYS_RC_SOURCES})
|
||||
|
||||
target_compile_definitions(${CLIENT_TARGET} PRIVATE ${CLIENT_DEFINITIONS})
|
||||
|
||||
target_include_directories(${CLIENT_TARGET} PRIVATE ${CLIENT_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${CLIENT_TARGET} PRIVATE ${CLIENT_CFLAGS})
|
||||
|
||||
target_link_libraries(${CLIENT_TARGET} ${CLIENT_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${CLIENT_TARGET} PRIVATE ${CLIENT_LDFLAGS})
|
||||
|
||||
set_target_properties(${CLIENT_TARGET} PROPERTIES RUNTIME_OUTPUT_NAME "${CLIENT_BIN}${BIN_EXT}")
|
||||
|
||||
set(RENDERERGL1_SUBDIR "${CMAKELIST_DIR}/renderergl1")
|
||||
if(NOT EXISTS "${RENDERERGL1_SUBDIR}/CMakeLists.txt")
|
||||
message(WARNING "Could not find renderergl1 in: ${RENDERERGL1_SUBDIR}")
|
||||
endif()
|
||||
if(NOT USE_RENDERER_DLOPEN)
|
||||
add_subdirectory("${RENDERERGL1_SUBDIR}" "${CMAKE_CURRENT_BINARY_DIR}/renderergl1")
|
||||
endif()
|
||||
|
||||
STRIP_TARGET(${CLIENT_TARGET})
|
||||
|
||||
set(DESTINATION_DIR "${REL_INSTALL_DEST}")
|
||||
if(INSTALL_DIR)
|
||||
set(DESTINATION_DIR "${INSTALL_DIR}")
|
||||
endif(INSTALL_DIR)
|
||||
|
||||
install(TARGETS ${CLIENT_TARGET}
|
||||
RUNTIME
|
||||
DESTINATION "${DESTINATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT client
|
||||
)
|
||||
include(CPack)
|
68
misc/CMakeLists/client/internal_asm/CMakeLists.txt
Normal file
68
misc/CMakeLists/client/internal_asm/CMakeLists.txt
Normal file
|
@ -0,0 +1,68 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal asm")
|
||||
|
||||
set(ASM_TARGET "internal_client_asm")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
set(ASM_SOURCES
|
||||
"${ASM_DIR}/matha.s"
|
||||
"${ASM_DIR}/snd_mixa.s"
|
||||
)
|
||||
set(ASM_HEADERS
|
||||
"${ASM_DIR}/qasm.h"
|
||||
"${ASM_DIR}/qasm-inline.h"
|
||||
)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
list(APPEND ASM_CFLAGS "-x assembler-with-cpp")
|
||||
endif()
|
||||
|
||||
source_group("asm" FILES ${ASM_SOURCES} ${ASM_HEADERS})
|
||||
#source_group("asm\\Source Files" FILES ${ASM_SOURCES})
|
||||
#source_group("asm\\Header Files" FILES ${ASM_HEADERS})
|
||||
|
||||
enable_language(ASM)
|
||||
|
||||
add_library(${ASM_TARGET} STATIC ${ASM_SOURCES} ${ASM_HEADERS})
|
||||
|
||||
target_compile_definitions(${ASM_TARGET} PRIVATE ${ASM_DEFINITIONS})
|
||||
|
||||
compat_target_compile_options(${ASM_TARGET} PRIVATE ${ASM_CFLAGS})
|
||||
|
||||
set_target_properties(${ASM_TARGET} PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
set(INTERNAL_ASM_INCLUDE_DIRS "" PARENT_SCOPE)
|
||||
set(INTERNAL_ASM_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_ASM_LIBRARIES "${ASM_TARGET}" PARENT_SCOPE)
|
74
misc/CMakeLists/client/internal_inline_asm/CMakeLists.txt
Normal file
74
misc/CMakeLists/client/internal_inline_asm/CMakeLists.txt
Normal file
|
@ -0,0 +1,74 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal inline asm")
|
||||
|
||||
set(INLINE_ASM_TARGET "internal_client_inline_asm")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
set(INLINE_ASM_SOURCES
|
||||
"${ASM_DIR}/ftola.c"
|
||||
"${ASM_DIR}/snapvector.c"
|
||||
)
|
||||
set(INLINE_ASM_HEADERS
|
||||
"${ASM_DIR}/qasm.h"
|
||||
"${ASM_DIR}/qasm-inline.h"
|
||||
)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# set(FLAGS "-msse4.1" "-msse4" "-msse3" "-msse2" "-msse" "-march=k8" "-march=pentium-m" "-march=pentium3")
|
||||
# k8 so inline assembler knows about SSE
|
||||
set(FLAGS "-march=k8" "-W")
|
||||
|
||||
ADD_SUPPORTED_CFLAGS(FLAGS INLINE_ASM_CFLAGS)
|
||||
|
||||
endif()
|
||||
|
||||
#source_group("asm" FILES ${INLINE_ASM_SOURCES} ${INLINE_ASM_HEADERS})
|
||||
#source_group("asm\\Source Files" FILES ${INLINE_ASM_SOURCES})
|
||||
#source_group("asm\\Header Files" FILES ${INLINE_ASM_HEADERS})
|
||||
|
||||
add_library(${INLINE_ASM_TARGET} STATIC ${INLINE_ASM_SOURCES} ${INLINE_ASM_HEADERS})
|
||||
|
||||
target_compile_definitions(${INLINE_ASM_TARGET} PRIVATE ${INLINE_ASM_DEFINITIONS})
|
||||
|
||||
compat_target_compile_options(${INLINE_ASM_TARGET} PRIVATE ${INLINE_ASM_CFLAGS})
|
||||
|
||||
set(INTERNAL_INLINE_ASM_INCLUDE_DIRS "" PARENT_SCOPE)
|
||||
set(INTERNAL_INLINE_ASM_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_INLINE_ASM_LIBRARIES "${INLINE_ASM_TARGET}" PARENT_SCOPE)
|
68
misc/CMakeLists/client/internal_masm/CMakeLists.txt
Normal file
68
misc/CMakeLists/client/internal_masm/CMakeLists.txt
Normal file
|
@ -0,0 +1,68 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal masm")
|
||||
|
||||
set(MASM_TARGET "internal_client_masm")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
#microsoft macro assembler files
|
||||
set(MASM_SOURCES
|
||||
"${ASM_DIR}/ftola.asm"
|
||||
"${ASM_DIR}/snapvector.asm"
|
||||
# "${ASM_DIR}/vm_x86_64.asm"
|
||||
)
|
||||
set(MASM_x86_64_SOURCES
|
||||
"${ASM_DIR}/vm_x86_64.asm"
|
||||
)
|
||||
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND MASM_SOURCES ${MASM_x86_64_SOURCES})
|
||||
endif()
|
||||
|
||||
#source_group("asm" FILES ${MASM_SOURCES})
|
||||
#source_group("asm\\Source Files" FILES ${MASM_SOURCES})
|
||||
#source_group("asm\\Header Files" FILES ${MASM_HEADERS})
|
||||
|
||||
enable_language(ASM_MASM)
|
||||
|
||||
add_library(${MASM_TARGET} STATIC ${MASM_SOURCES})
|
||||
|
||||
target_compile_definitions(${MASM_TARGET} PRIVATE ${MASM_DEFINITIONS})
|
||||
|
||||
target_compile_options(${MASM_TARGET} PRIVATE ${MASM_CFLAGS})
|
||||
|
||||
set_target_properties(${MASM_TARGET} PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
set(INTERNAL_MASM_INCLUDE_DIRS "" PARENT_SCOPE)
|
||||
set(INTERNAL_MASM_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_MASM_LIBRARIES "${MASM_TARGET}" PARENT_SCOPE)
|
123
misc/CMakeLists/client/internal_ogg/CMakeLists.txt
Normal file
123
misc/CMakeLists/client/internal_ogg/CMakeLists.txt
Normal file
|
@ -0,0 +1,123 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal ogg")
|
||||
|
||||
set(OGG_TARGET "internal_ogg")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(OGG_SOURCES
|
||||
"${OGG_DIR}/src/bitwise.c"
|
||||
"${OGG_DIR}/src/framing.c"
|
||||
)
|
||||
set(OGG_HEADERS
|
||||
"${OGG_DIR}/include/ogg/config_types.h"
|
||||
"${OGG_DIR}/include/ogg/ogg.h"
|
||||
"${OGG_DIR}/include/ogg/os_types.h"
|
||||
)
|
||||
|
||||
|
||||
if(MSVC)
|
||||
#Optimization, Maximum Speed /O2
|
||||
list(APPEND OGG_CFLAGS $<$<CONFIG:Release>:/O2>)
|
||||
#Inline Function Expansion, only Suitable /Ob2
|
||||
list(APPEND OGG_CFLAGS $<$<CONFIG:Release>:/Ob2>)
|
||||
#Enable Intrinsic Functions /Oi
|
||||
list(APPEND OGG_CFLAGS $<$<CONFIG:Release>:/Oi>)
|
||||
#Favor Size of Speed, Favor Fast Code /Ot
|
||||
list(APPEND OGG_CFLAGS $<$<CONFIG:Release>:/Ot>)
|
||||
|
||||
#Enable String Pooling /GF
|
||||
list(APPEND OGG_CFLAGS "/GF")
|
||||
#Buffer Security Check, No /GS-
|
||||
list(APPEND OGG_CFLAGS "/GS-")
|
||||
|
||||
#Calling Convention, __cdecl /Gd
|
||||
list(APPEND OGG_CFLAGS "/Gd")
|
||||
#Compile as, C Code /TC
|
||||
list(APPEND OGG_CFLAGS "/TC")
|
||||
#Disable specific warnings
|
||||
list(APPEND OGG_CFLAGS "/wd4244")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
if(PLATFORM MATCHES "linux")
|
||||
list(APPEND OGG_RELEASE_CFLAGS "-Wall" "-fsigned-char" "-O20" "-ffast-math")
|
||||
list(APPEND OGG_DEBUG_CFLAGS "-Wall" "-fsigned-char" "-g")
|
||||
elseif(PLATFORM MATCHES "darwin")
|
||||
list(APPEND OGG_RELEASE_CFLAGS "-Wall" "-fno-common" "-fsigned-char" "-ffast-math" "-O4")
|
||||
list(APPEND OGG_DEBUG_CFLAGS "-Wall" "-fno-common" "-fsigned-char" "-g")
|
||||
elseif(ARCH STREQUAL "sparc")
|
||||
list(APPEND OGG_RELEASE_CFLAGS "-fsigned-char" "-O20")
|
||||
list(APPEND OGG_DEBUG_CFLAGS "-fsigned-char" "-g" "-Wall")
|
||||
else()
|
||||
list(APPEND OGG_RELEASE_CFLAGS "-fsigned-char" "-O20")
|
||||
list(APPEND OGG_DEBUG_CFLAGS "-fsigned-char" "-g" "-Wall")
|
||||
endif()
|
||||
|
||||
list(APPEND VORBIS_DEFINITIONS $<$<CONFIG:Release>:${OGG_RELEASE_DEFINITIONS}>)
|
||||
list(APPEND OGG_CFLAGS $<$<CONFIG:Release>:${OGG_RELEASE_CFLAGS}>)
|
||||
list(APPEND VORBIS_DEFINITIONS $<$<CONFIG:Debug>:${OGG_DEBUG_DEFINITIONS}>)
|
||||
list(APPEND OGG_CFLAGS $<$<CONFIG:Debug>:${OGG_DEBUG_CFLAGS}>)
|
||||
|
||||
endif()
|
||||
|
||||
ADD_INTERNAL_DEFINITIONS(OGG_DEFINITIONS)
|
||||
ADD_INTERNAL_CFLAGS(OGG_CFLAGS)
|
||||
|
||||
list(APPEND OGG_INCLUDE_DIRS "${OGG_DIR}/include")
|
||||
|
||||
#source_group("Source Files" FILES ${OGG_SOURCES} ${OGG_HEADERS})
|
||||
#source_group("Source Files" FILES ${OGG_SOURCES})
|
||||
#source_group("Header Files" FILES ${OGG_HEADERS})
|
||||
|
||||
add_library(${OGG_TARGET} STATIC ${OGG_SOURCES} ${OGG_HEADERS})
|
||||
|
||||
target_compile_definitions(${OGG_TARGET} PRIVATE ${OGG_DEFINITIONS})
|
||||
|
||||
target_include_directories(${OGG_TARGET} PRIVATE ${OGG_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${OGG_TARGET} PRIVATE ${OGG_CFLAGS})
|
||||
|
||||
set(INTERNAL_OGG_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_OGG_INCLUDE_DIRS "${OGG_DIR}/include" PARENT_SCOPE)
|
||||
set(INTERNAL_OGG_LIBRARIES "${OGG_TARGET}" PARENT_SCOPE)
|
340
misc/CMakeLists/client/internal_opus/CMakeLists.txt
Normal file
340
misc/CMakeLists/client/internal_opus/CMakeLists.txt
Normal file
|
@ -0,0 +1,340 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal opus")
|
||||
|
||||
set(OPUS_TARGET "internal_opus")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(OPUS_SOURCES
|
||||
"${OPUS_DIR}/src/analysis.c"
|
||||
"${OPUS_DIR}/src/mlp.c"
|
||||
"${OPUS_DIR}/src/mlp_data.c"
|
||||
"${OPUS_DIR}/src/opus.c"
|
||||
"${OPUS_DIR}/src/opus_decoder.c"
|
||||
"${OPUS_DIR}/src/opus_encoder.c"
|
||||
"${OPUS_DIR}/src/opus_multistream.c"
|
||||
"${OPUS_DIR}/src/opus_multistream_encoder.c"
|
||||
"${OPUS_DIR}/src/opus_multistream_decoder.c"
|
||||
"${OPUS_DIR}/src/repacketizer.c"
|
||||
|
||||
"${OPUS_DIR}/celt/bands.c"
|
||||
"${OPUS_DIR}/celt/celt.c"
|
||||
"${OPUS_DIR}/celt/cwrs.c"
|
||||
"${OPUS_DIR}/celt/entcode.c"
|
||||
"${OPUS_DIR}/celt/entdec.c"
|
||||
"${OPUS_DIR}/celt/entenc.c"
|
||||
"${OPUS_DIR}/celt/kiss_fft.c"
|
||||
"${OPUS_DIR}/celt/laplace.c"
|
||||
"${OPUS_DIR}/celt/mathops.c"
|
||||
"${OPUS_DIR}/celt/mdct.c"
|
||||
"${OPUS_DIR}/celt/modes.c"
|
||||
"${OPUS_DIR}/celt/pitch.c"
|
||||
"${OPUS_DIR}/celt/celt_encoder.c"
|
||||
"${OPUS_DIR}/celt/celt_decoder.c"
|
||||
"${OPUS_DIR}/celt/celt_lpc.c"
|
||||
"${OPUS_DIR}/celt/quant_bands.c"
|
||||
"${OPUS_DIR}/celt/rate.c"
|
||||
"${OPUS_DIR}/celt/vq.c"
|
||||
|
||||
"${OPUS_DIR}/silk/CNG.c"
|
||||
"${OPUS_DIR}/silk/code_signs.c"
|
||||
"${OPUS_DIR}/silk/init_decoder.c"
|
||||
"${OPUS_DIR}/silk/decode_core.c"
|
||||
"${OPUS_DIR}/silk/decode_frame.c"
|
||||
"${OPUS_DIR}/silk/decode_parameters.c"
|
||||
"${OPUS_DIR}/silk/decode_indices.c"
|
||||
"${OPUS_DIR}/silk/decode_pulses.c"
|
||||
"${OPUS_DIR}/silk/decoder_set_fs.c"
|
||||
"${OPUS_DIR}/silk/dec_API.c"
|
||||
"${OPUS_DIR}/silk/enc_API.c"
|
||||
"${OPUS_DIR}/silk/encode_indices.c"
|
||||
"${OPUS_DIR}/silk/encode_pulses.c"
|
||||
"${OPUS_DIR}/silk/gain_quant.c"
|
||||
"${OPUS_DIR}/silk/interpolate.c"
|
||||
"${OPUS_DIR}/silk/LP_variable_cutoff.c"
|
||||
"${OPUS_DIR}/silk/NLSF_decode.c"
|
||||
"${OPUS_DIR}/silk/NSQ.c"
|
||||
"${OPUS_DIR}/silk/NSQ_del_dec.c"
|
||||
"${OPUS_DIR}/silk/PLC.c"
|
||||
"${OPUS_DIR}/silk/shell_coder.c"
|
||||
"${OPUS_DIR}/silk/tables_gain.c"
|
||||
"${OPUS_DIR}/silk/tables_LTP.c"
|
||||
"${OPUS_DIR}/silk/tables_NLSF_CB_NB_MB.c"
|
||||
"${OPUS_DIR}/silk/tables_NLSF_CB_WB.c"
|
||||
"${OPUS_DIR}/silk/tables_other.c"
|
||||
"${OPUS_DIR}/silk/tables_pitch_lag.c"
|
||||
"${OPUS_DIR}/silk/tables_pulses_per_block.c"
|
||||
"${OPUS_DIR}/silk/VAD.c"
|
||||
"${OPUS_DIR}/silk/control_audio_bandwidth.c"
|
||||
"${OPUS_DIR}/silk/quant_LTP_gains.c"
|
||||
"${OPUS_DIR}/silk/VQ_WMat_EC.c"
|
||||
|
||||
"${OPUS_DIR}/silk/HP_variable_cutoff.c"
|
||||
"${OPUS_DIR}/silk/NLSF_encode.c"
|
||||
"${OPUS_DIR}/silk/NLSF_VQ.c"
|
||||
"${OPUS_DIR}/silk/NLSF_unpack.c"
|
||||
"${OPUS_DIR}/silk/NLSF_del_dec_quant.c"
|
||||
"${OPUS_DIR}/silk/process_NLSFs.c"
|
||||
"${OPUS_DIR}/silk/stereo_LR_to_MS.c"
|
||||
"${OPUS_DIR}/silk/stereo_MS_to_LR.c"
|
||||
"${OPUS_DIR}/silk/check_control_input.c"
|
||||
"${OPUS_DIR}/silk/control_SNR.c"
|
||||
"${OPUS_DIR}/silk/init_encoder.c"
|
||||
"${OPUS_DIR}/silk/control_codec.c"
|
||||
"${OPUS_DIR}/silk/A2NLSF.c"
|
||||
"${OPUS_DIR}/silk/ana_filt_bank_1.c"
|
||||
"${OPUS_DIR}/silk/biquad_alt.c"
|
||||
"${OPUS_DIR}/silk/bwexpander_32.c"
|
||||
"${OPUS_DIR}/silk/bwexpander.c"
|
||||
"${OPUS_DIR}/silk/debug.c"
|
||||
"${OPUS_DIR}/silk/decode_pitch.c"
|
||||
"${OPUS_DIR}/silk/inner_prod_aligned.c"
|
||||
"${OPUS_DIR}/silk/lin2log.c"
|
||||
"${OPUS_DIR}/silk/log2lin.c"
|
||||
"${OPUS_DIR}/silk/LPC_analysis_filter.c"
|
||||
"${OPUS_DIR}/silk/LPC_fit.c"
|
||||
"${OPUS_DIR}/silk/LPC_inv_pred_gain.c"
|
||||
"${OPUS_DIR}/silk/table_LSF_cos.c"
|
||||
"${OPUS_DIR}/silk/NLSF2A.c"
|
||||
"${OPUS_DIR}/silk/NLSF_stabilize.c"
|
||||
"${OPUS_DIR}/silk/NLSF_VQ_weights_laroia.c"
|
||||
"${OPUS_DIR}/silk/pitch_est_tables.c"
|
||||
"${OPUS_DIR}/silk/resampler.c"
|
||||
"${OPUS_DIR}/silk/resampler_down2_3.c"
|
||||
"${OPUS_DIR}/silk/resampler_down2.c"
|
||||
"${OPUS_DIR}/silk/resampler_private_AR2.c"
|
||||
"${OPUS_DIR}/silk/resampler_private_down_FIR.c"
|
||||
"${OPUS_DIR}/silk/resampler_private_IIR_FIR.c"
|
||||
"${OPUS_DIR}/silk/resampler_private_up2_HQ.c"
|
||||
"${OPUS_DIR}/silk/resampler_rom.c"
|
||||
"${OPUS_DIR}/silk/sigm_Q15.c"
|
||||
"${OPUS_DIR}/silk/sort.c"
|
||||
"${OPUS_DIR}/silk/sum_sqr_shift.c"
|
||||
"${OPUS_DIR}/silk/stereo_decode_pred.c"
|
||||
"${OPUS_DIR}/silk/stereo_encode_pred.c"
|
||||
"${OPUS_DIR}/silk/stereo_find_predictor.c"
|
||||
"${OPUS_DIR}/silk/stereo_quant_pred.c"
|
||||
|
||||
"${OPUS_DIR}/silk/float/apply_sine_window_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/autocorrelation_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/burg_modified_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/bwexpander_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/corrMatrix_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/encode_frame_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/energy_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/find_LPC_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/find_LTP_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/find_pitch_lags_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/find_pred_coefs_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/inner_product_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/k2a_FLP.c"
|
||||
# "${OPUS_DIR}/silk/float/levinsondurbin_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/LPC_analysis_filter_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/LPC_inv_pred_gain_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/LTP_analysis_filter_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/LTP_scale_ctrl_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/noise_shape_analysis_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/pitch_analysis_core_FLP.c"
|
||||
# "${OPUS_DIR}/silk/float/prefilter_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/process_gains_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/regularize_correlations_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/residual_energy_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/scale_copy_vector_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/scale_vector_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/schur_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/sort_FLP.c"
|
||||
# "${OPUS_DIR}/silk/float/solve_LS_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/warped_autocorrelation_FLP.c"
|
||||
"${OPUS_DIR}/silk/float/wrappers_FLP.c"
|
||||
)
|
||||
set(OPUS_HEADERS
|
||||
"${OPUS_DIR}/include/opus.h"
|
||||
"${OPUS_DIR}/include/opus_custom.h"
|
||||
"${OPUS_DIR}/include/opus_defines.h"
|
||||
"${OPUS_DIR}/include/opus_multistream.h"
|
||||
"${OPUS_DIR}/include/opus_types.h"
|
||||
|
||||
"${OPUS_DIR}/src/analysis.h"
|
||||
"${OPUS_DIR}/src/mlp.h"
|
||||
"${OPUS_DIR}/src/opus_private.h"
|
||||
"${OPUS_DIR}/src/tansig_table.h"
|
||||
|
||||
"${OPUS_DIR}/celt/_kiss_fft_guts.h"
|
||||
"${OPUS_DIR}/celt/arch.h"
|
||||
"${OPUS_DIR}/celt/bands.h"
|
||||
"${OPUS_DIR}/celt/celt.h"
|
||||
"${OPUS_DIR}/celt/celt_lpc.h"
|
||||
"${OPUS_DIR}/celt/cpu_support.h"
|
||||
"${OPUS_DIR}/celt/cwrs.h"
|
||||
"${OPUS_DIR}/celt/ecintrin.h"
|
||||
"${OPUS_DIR}/celt/entcode.h"
|
||||
"${OPUS_DIR}/celt/entdec.h"
|
||||
"${OPUS_DIR}/celt/entenc.h"
|
||||
"${OPUS_DIR}/celt/fixed_debug.h"
|
||||
"${OPUS_DIR}/celt/fixed_generic.h"
|
||||
"${OPUS_DIR}/celt/float_cast.h"
|
||||
"${OPUS_DIR}/celt/kiss_fft.h"
|
||||
"${OPUS_DIR}/celt/laplace.h"
|
||||
"${OPUS_DIR}/celt/mathops.h"
|
||||
"${OPUS_DIR}/celt/mdct.h"
|
||||
"${OPUS_DIR}/celt/mfrngcod.h"
|
||||
"${OPUS_DIR}/celt/modes.h"
|
||||
"${OPUS_DIR}/celt/os_support.h"
|
||||
"${OPUS_DIR}/celt/pitch.h"
|
||||
"${OPUS_DIR}/celt/quant_bands.h"
|
||||
"${OPUS_DIR}/celt/rate.h"
|
||||
"${OPUS_DIR}/celt/stack_alloc.h"
|
||||
"${OPUS_DIR}/celt/static_modes_fixed.h"
|
||||
"${OPUS_DIR}/celt/static_modes_float.h"
|
||||
"${OPUS_DIR}/celt/vq.h"
|
||||
|
||||
"${OPUS_DIR}/silk/API.h"
|
||||
"${OPUS_DIR}/silk/control.h"
|
||||
"${OPUS_DIR}/silk/debug.h"
|
||||
"${OPUS_DIR}/silk/define.h"
|
||||
"${OPUS_DIR}/silk/errors.h"
|
||||
"${OPUS_DIR}/silk/Inlines.h"
|
||||
"${OPUS_DIR}/silk/MacroCount.h"
|
||||
"${OPUS_DIR}/silk/MacroDebug.h"
|
||||
"${OPUS_DIR}/silk/macros.h"
|
||||
"${OPUS_DIR}/silk/main.h"
|
||||
"${OPUS_DIR}/silk/pitch_est_defines.h"
|
||||
"${OPUS_DIR}/silk/PLC.h"
|
||||
"${OPUS_DIR}/silk/resampler_private.h"
|
||||
"${OPUS_DIR}/silk/resampler_rom.h"
|
||||
"${OPUS_DIR}/silk/resampler_structs.h"
|
||||
"${OPUS_DIR}/silk/SigProc_FIX.h"
|
||||
"${OPUS_DIR}/silk/structs.h"
|
||||
"${OPUS_DIR}/silk/tables.h"
|
||||
"${OPUS_DIR}/silk/tuning_parameters.h"
|
||||
"${OPUS_DIR}/silk/typedef.h"
|
||||
|
||||
"${OPUS_DIR}/silk/float/main_FLP.h"
|
||||
"${OPUS_DIR}/silk/float/SigProc_FLP.h"
|
||||
"${OPUS_DIR}/silk/float/structs_FLP.h"
|
||||
|
||||
)
|
||||
|
||||
CHECK_INCLUDE_FILE("malloc.h" HAVE_MALLOC_H)
|
||||
if(HAVE_MALLOC_H)
|
||||
list(APPEND OPUS_DEFINITIONS "-DHAVE_MALLOC_H")
|
||||
endif(HAVE_MALLOC_H)
|
||||
CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA_H)
|
||||
if(HAVE_ALLOCA_H)
|
||||
list(APPEND OPUS_DEFINITIONS "-DHAVE_ALLOCA_H")
|
||||
endif(HAVE_ALLOCA_H)
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("#include <alloca.h>\n int main () {int foo=10;int *array = alloca(foo);return 0;}" HAVE_ALLOCA_IN_ALLOCA_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <stdlib.h>\n int main () {int foo=10;int *array = alloca(foo);return 0;}" HAVE_ALLOCA_IN_STDLIB_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <malloc.h>\n int main () {int foo=10;int *array = alloca(foo);return 0;}" HAVE_ALLOCA_IN_MALLOC_H)
|
||||
if(USE_ALLOCA OR HAVE_ALLOCA_IN_ALLOCA_H OR HAVE_ALLOCA_IN_STDLIB_H OR HAVE_ALLOCA_IN_MALLOC_H)
|
||||
list(APPEND OPUS_DEFINITIONS "-DUSE_ALLOCA")
|
||||
endif()
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("#include <math.h>\n int main () {int value = lrintf (3.1415);return 0;}" HAVE_LRINTF)
|
||||
if(HAVE_LRINTF)
|
||||
list(APPEND OPUS_DEFINITIONS "-DHAVE_LRINTF")
|
||||
endif(HAVE_LRINTF)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "m")
|
||||
CHECK_C_SOURCE_COMPILES("#include <math.h>\n int main () {int value = lrintf (3.1415);return 0;}" HAVE_LRINTF_IN_M)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
if(HAVE_LRINTF_IN_M)
|
||||
list(APPEND OPUS_DEFINITIONS "-DHAVE_LRINTF")
|
||||
list(APPEND OPUS_LIBRARIES "m")
|
||||
endif(HAVE_LRINTF_IN_M)
|
||||
|
||||
if(MSVC)
|
||||
#Enable Intrinsic Functions /Oi
|
||||
list(APPEND OPUS_CFLAGS $<$<CONFIG:Release>:/Oi>)
|
||||
|
||||
#Disable specific warnings
|
||||
#list(APPEND OPUS_CFLAGS "/wd4996")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
set(WARNING_CFLAGS "-Wall" "-W" "-Wstrict-prototypes" "-Wextra" "-Wcast-align" "-Wnested-externs" "-Wshadow")
|
||||
ADD_SUPPORTED_CFLAGS(WARNING_CFLAGS OPUS_CFLAGS)
|
||||
|
||||
set(OFLAGS "-O4" "-O3" "-O2" "-O")
|
||||
set(OFLAGS_SUPPORTED)
|
||||
ADD_FIRST_SUPPORTED_CFLAG(OFLAGS OFLAGS_SUPPORTED)
|
||||
list(APPEND OPUS_CFLAGS $<$<CONFIG:Release>:${OFLAGS_SUPPORTED}>)
|
||||
|
||||
set(DFLAGS "-g")
|
||||
set(DFLAGS_SUPPORTED)
|
||||
ADD_SUPPORTED_CFLAGS(DFLAGS DFLAGS_SUPPORTED)
|
||||
list(APPEND OPUS_CFLAGS $<$<CONFIG:Debug>:${DFLAGS_SUPPORTED}>)
|
||||
|
||||
endif()
|
||||
|
||||
ADD_INTERNAL_DEFINITIONS(OPUS_DEFINITIONS)
|
||||
ADD_INTERNAL_CFLAGS(OPUS_CFLAGS)
|
||||
|
||||
list(APPEND OPUS_INCLUDE_DIRS "${OPUS_DIR}/include")
|
||||
list(APPEND OPUS_INCLUDE_DIRS "${OPUS_DIR}/celt")
|
||||
list(APPEND OPUS_INCLUDE_DIRS "${OPUS_DIR}/silk")
|
||||
list(APPEND OPUS_INCLUDE_DIRS "${OPUS_DIR}/silk/float")
|
||||
list(APPEND OPUS_INCLUDE_DIRS "${OPUS_DIR}/src")
|
||||
|
||||
list(APPEND OPUS_DEFINITIONS "-DOPUS_BUILD")
|
||||
list(APPEND OPUS_DEFINITIONS "-DFLOAT_APPROX")
|
||||
|
||||
source_group("Source Files" FILES ${OPUS_SOURCES})
|
||||
source_group("Header Files" FILES ${OPUS_HEADERS})
|
||||
|
||||
add_library(${OPUS_TARGET} STATIC ${OPUS_SOURCES} ${OPUS_HEADERS})
|
||||
|
||||
target_compile_definitions(${OPUS_TARGET} PRIVATE ${OPUS_DEFINITIONS})
|
||||
|
||||
target_include_directories(${OPUS_TARGET} PRIVATE ${OPUS_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${OPUS_TARGET} PRIVATE ${OPUS_CFLAGS})
|
||||
|
||||
list(APPEND OPUS_LIBRARIES ${OPUS_TARGET})
|
||||
|
||||
set(INTERNAL_OPUS_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_OPUS_INCLUDE_DIRS "" PARENT_SCOPE)
|
||||
set(INTERNAL_OPUS_LIBRARIES "${OPUS_LIBRARIES}" PARENT_SCOPE)
|
130
misc/CMakeLists/client/internal_opusfile/CMakeLists.txt
Normal file
130
misc/CMakeLists/client/internal_opusfile/CMakeLists.txt
Normal file
|
@ -0,0 +1,130 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal opusfile")
|
||||
|
||||
set(OPUSFILE_TARGET "internal_opusfile")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(OPUSFILE_SOURCES
|
||||
"${OPUSFILE_DIR}/src/http.c"
|
||||
"${OPUSFILE_DIR}/src/info.c"
|
||||
"${OPUSFILE_DIR}/src/internal.c"
|
||||
"${OPUSFILE_DIR}/src/opusfile.c"
|
||||
"${OPUSFILE_DIR}/src/stream.c"
|
||||
"${OPUSFILE_DIR}/src/wincerts.c"
|
||||
)
|
||||
set(OPUSFILE_HEADERS
|
||||
"${OPUSFILE_DIR}/include/opusfile.h"
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
#disable deprecation warnings about old functions like strcmp
|
||||
list(APPEND OPUSFILE_DEFINITIONS "-D_CRT_SECURE_NO_WARNINGS")
|
||||
|
||||
#Optimization, Maximum Speed /O2
|
||||
list(APPEND OPUSFILE_CFLAGS "$<$<CONFIG:Release>:/O2>")
|
||||
#Inline Function Expansion, only Suitable /Ob2
|
||||
list(APPEND OPUSFILE_CFLAGS "$<$<CONFIG:Release>:/Ob2>")
|
||||
#Enable Intrinsic Functions /Oi
|
||||
list(APPEND OPUSFILE_CFLAGS "$<$<CONFIG:Release>:/Oi>")
|
||||
#Favor Size of Speed, Favor Fast Code /Ot
|
||||
list(APPEND OPUSFILE_CFLAGS "$<$<CONFIG:Release>:/Ot>")
|
||||
#Omit Frame Pointers, Yes /Oy
|
||||
list(APPEND OPUSFILE_CFLAGS "$<$<CONFIG:Release>:/Oy>")
|
||||
|
||||
#Enable String Pooling /GF
|
||||
list(APPEND OPUSFILE_CFLAGS "/GF")
|
||||
#Buffer Security Check, No /GS-
|
||||
list(APPEND OPUSFILE_CFLAGS "/GS-")
|
||||
#Enable Function-Level Linking /Gy
|
||||
list(APPEND OPUSFILE_CFLAGS "/Gy")
|
||||
#Floating Point Model /fp:fast
|
||||
list(APPEND OPUSFILE_CFLAGS "/fp:fast")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
set(OFLAGS "-O4" "-O3" "-O2" "-O")
|
||||
set(OFLAGS_SUPPORTED)
|
||||
ADD_FIRST_SUPPORTED_CFLAG("${OFLAGS}" OFLAGS_SUPPORTED)
|
||||
list(APPEND OPUSFILE_CFLAGS $<$<CONFIG:Release>:${OFLAGS_SUPPORTED}>)
|
||||
|
||||
set(FLAGS "-std=c89" "-pedantic" "-Wall" "-Wextra" "-Wno-parentheses" "-Wno-long-long")
|
||||
|
||||
if(MINGW)
|
||||
list(APPEND FLAGS "-U__STRICT_ANSI__")
|
||||
endif(MINGW)
|
||||
|
||||
ADD_SUPPORTED_CFLAGS(FLAGS OPUSFILE_CFLAGS)
|
||||
|
||||
set(DFLAGS "-O0" "-ggdb")
|
||||
set(DFLAGS_SUPPORTED)
|
||||
ADD_SUPPORTED_CFLAGS(DFLAGS DFLAGS_SUPPORTED)
|
||||
list(APPEND OPUSFILE_CFLAGS $<$<CONFIG:Debug>:${DFLAGS_SUPPORTED}>)
|
||||
|
||||
endif()
|
||||
|
||||
ADD_INTERNAL_DEFINITIONS(OPUSFILE_DEFINITIONS)
|
||||
ADD_INTERNAL_CFLAGS(OPUSFILE_CFLAGS)
|
||||
|
||||
list(APPEND OPUSFILE_DEFINITIONS $<$<CONFIG:Debug>:-DOP_ENABLE_ASSERTIONS>)
|
||||
|
||||
list(APPEND OPUSFILE_INCLUDE_DIRS "${OGG_DIR}/include")
|
||||
list(APPEND OPUSFILE_INCLUDE_DIRS "${OPUS_DIR}/include")
|
||||
list(APPEND OPUSFILE_INCLUDE_DIRS "${OPUSFILE_DIR}/include")
|
||||
|
||||
#source_group("Source Files" FILES ${OPUSFILE_SOURCES})
|
||||
#source_group("Header Files" FILES ${OPUSFILE_HEADERS})
|
||||
|
||||
add_library(${OPUSFILE_TARGET} STATIC ${OPUSFILE_SOURCES} ${OPUSFILE_HEADERS})
|
||||
|
||||
target_compile_definitions(${OPUSFILE_TARGET} PRIVATE ${OPUSFILE_DEFINITIONS})
|
||||
|
||||
target_include_directories(${OPUSFILE_TARGET} PRIVATE ${OPUSFILE_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${OPUSFILE_TARGET} PRIVATE ${OPUSFILE_CFLAGS})
|
||||
|
||||
list(APPEND OPUSFILE_LIBRARIES ${OPUSFILE_TARGET})
|
||||
|
||||
set(INTERNAL_OPUSFILE_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_OPUSFILE_INCLUDE_DIRS "${OPUSFILE_INCLUDE_DIRS}" PARENT_SCOPE)
|
||||
set(INTERNAL_OPUSFILE_LIBRARIES "${OPUSFILE_LIBRARIES}" PARENT_SCOPE)
|
202
misc/CMakeLists/client/internal_vorbis/CMakeLists.txt
Normal file
202
misc/CMakeLists/client/internal_vorbis/CMakeLists.txt
Normal file
|
@ -0,0 +1,202 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
set(VORBIS_TARGET "internal_vorbis")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(VORBIS_SOURCES
|
||||
"${VORBIS_DIR}/lib/analysis.c"
|
||||
"${VORBIS_DIR}/lib/bitrate.c"
|
||||
"${VORBIS_DIR}/lib/block.c"
|
||||
"${VORBIS_DIR}/lib/codebook.c"
|
||||
"${VORBIS_DIR}/lib/envelope.c"
|
||||
"${VORBIS_DIR}/lib/floor0.c"
|
||||
"${VORBIS_DIR}/lib/floor1.c"
|
||||
"${VORBIS_DIR}/lib/info.c"
|
||||
"${VORBIS_DIR}/lib/lookup.c"
|
||||
"${VORBIS_DIR}/lib/lpc.c"
|
||||
"${VORBIS_DIR}/lib/lsp.c"
|
||||
"${VORBIS_DIR}/lib/mapping0.c"
|
||||
"${VORBIS_DIR}/lib/mdct.c"
|
||||
"${VORBIS_DIR}/lib/psy.c"
|
||||
"${VORBIS_DIR}/lib/registry.c"
|
||||
"${VORBIS_DIR}/lib/res0.c"
|
||||
"${VORBIS_DIR}/lib/smallft.c"
|
||||
"${VORBIS_DIR}/lib/sharedbook.c"
|
||||
"${VORBIS_DIR}/lib/synthesis.c"
|
||||
"${VORBIS_DIR}/lib/vorbisfile.c"
|
||||
"${VORBIS_DIR}/lib/window.c"
|
||||
)
|
||||
set(VORBIS_HEADERS
|
||||
"${VORBIS_DIR}/include/vorbis/codec.h"
|
||||
"${VORBIS_DIR}/include/vorbis/vorbisenc.h"
|
||||
"${VORBIS_DIR}/include/vorbis/vorbisfile.h"
|
||||
|
||||
"${VORBIS_DIR}/lib/backends.h"
|
||||
"${VORBIS_DIR}/lib/bitrate.h"
|
||||
"${VORBIS_DIR}/lib/codebook.h"
|
||||
"${VORBIS_DIR}/lib/codec_internal.h"
|
||||
"${VORBIS_DIR}/lib/envelope.h"
|
||||
"${VORBIS_DIR}/lib/highlevel.h"
|
||||
"${VORBIS_DIR}/lib/lookup.h"
|
||||
"${VORBIS_DIR}/lib/lookup_data.h"
|
||||
"${VORBIS_DIR}/lib/lpc.h"
|
||||
"${VORBIS_DIR}/lib/lsp.h"
|
||||
"${VORBIS_DIR}/lib/masking.h"
|
||||
"${VORBIS_DIR}/lib/mdct.h"
|
||||
"${VORBIS_DIR}/lib/misc.h"
|
||||
"${VORBIS_DIR}/lib/os.h"
|
||||
"${VORBIS_DIR}/lib/psy.h"
|
||||
"${VORBIS_DIR}/lib/registry.h"
|
||||
"${VORBIS_DIR}/lib/scales.h"
|
||||
"${VORBIS_DIR}/lib/smallft.h"
|
||||
"${VORBIS_DIR}/lib/window.h"
|
||||
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
#Optimization, Full /Ox
|
||||
list(APPEND VORBIS_CFLAGS $<$<CONFIG:Release>:/Ox>)
|
||||
#Inline Function Expansion, only Suitable /Ob2
|
||||
list(APPEND VORBIS_CFLAGS $<$<CONFIG:Release>:/Ob2>)
|
||||
#Enable Intrinsic Functions /Oi
|
||||
list(APPEND VORBIS_CFLAGS $<$<CONFIG:Release>:/Oi>)
|
||||
#Favor Size of Speed, Favor Fast Code /Ot
|
||||
list(APPEND VORBIS_CFLAGS $<$<CONFIG:Release>:/Ot>)
|
||||
|
||||
#Enable String Pooling /GF
|
||||
list(APPEND VORBIS_CFLAGS "/GF")
|
||||
#Buffer Security Check, No /GS-
|
||||
list(APPEND VORBIS_CFLAGS "/GS-")
|
||||
|
||||
#Calling Convention, __cdecl /Gd
|
||||
list(APPEND VORBIS_CFLAGS "/Gd")
|
||||
#Compile as, C Code /TC
|
||||
list(APPEND VORBIS_CFLAGS "/TC")
|
||||
#Disable specific warnings
|
||||
list(APPEND VORBIS_CFLAGS "/wd4244")
|
||||
list(APPEND VORBIS_CFLAGS "/wd4100")
|
||||
list(APPEND VORBIS_CFLAGS "/wd4267")
|
||||
list(APPEND VORBIS_CFLAGS "/wd4189")
|
||||
|
||||
list(APPEND VORBIS_CFLAGS "/wd4189")
|
||||
list(APPEND VORBIS_CFLAGS "/wd4305")
|
||||
list(APPEND VORBIS_CFLAGS "/wd4127")
|
||||
list(APPEND VORBIS_CFLAGS "/wd4706")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
if(PLATFORM MATCHES "linux*spe")
|
||||
list(APPEND VORBIS_RELEASE_DEFINITIONS "-D_REENTRANT")
|
||||
list(APPEND VORBIS_RELEASE_CFLAGS "-Wall" "-Wextra" "-ffast-math" "-O3" "-mfused-madd")
|
||||
list(APPEND VORBIS_DEBUG_DEFINITIONS "-D_REENTRANT" "-D__NO_MATH_INLINES")
|
||||
list(APPEND VORBIS_DEBUG_CFLAGS "-Wall" "-Wextra" "-g")
|
||||
elseif(PLATFORM MATCHES "linux")
|
||||
if(ARCH MATCHES "ppc")
|
||||
list(APPEND VORBIS_RELEASE_DEFINITIONS "-D_REENTRANT")
|
||||
list(APPEND VORBIS_RELEASE_CFLAGS "-Wall" "-Wextra" "-ffast-math" "-O3" "-mfused-madd" "-mcpu=750")
|
||||
list(APPEND VORBIS_DEBUG_DEFINITIONS "-D_REENTRANT" "-D__NO_MATH_INLINES")
|
||||
list(APPEND VORBIS_DEBUG_CFLAGS "-Wall" "-Wextra" "-g")
|
||||
elsef(ARCH STREQUAL "x86")
|
||||
list(APPEND VORBIS_RELEASE_DEFINITIONS "-D_REENTRANT")
|
||||
list(APPEND VORBIS_RELEASE_CFLAGS "-fsigned-char" "-O20" "-ffast-math" "-mno-ieee-fp")
|
||||
list(APPEND VORBIS_DEBUG_DEFINITIONS "-D_REENTRANT" "-D__NO_MATH_INLINES")
|
||||
list(APPEND VORBIS_DEBUG_CFLAGS "-fsigned-char" "-g" "-Wall" "-Wextra")
|
||||
else()
|
||||
list(APPEND VORBIS_RELEASE_DEFINITIONS "-D_REENTRANT")
|
||||
list(APPEND VORBIS_RELEASE_CFLAGS "-fsigned-char" "-Wall" "-Wextra" "-O20" "-ffast-math")
|
||||
list(APPEND VORBIS_DEBUG_DEFINITIONS "-D_REENTRANT" "-D__NO_MATH_INLINES")
|
||||
list(APPEND VORBIS_DEBUG_CFLAGS "-fsigned-char" "-Wall" "-Wextra" "-g")
|
||||
endif()
|
||||
elseif(PLATFORM MATCHES "darwin")
|
||||
list(APPEND VORBIS_DEFINITIONS "-DDARWIN")
|
||||
|
||||
list(APPEND VORBIS_RELEASE_CFLAGS "-fno-common" "-force_cpusubtype_ALL" "-g" "-Wall" "-fsigned-char" "-ffast-math" "-O4")
|
||||
list(APPEND VORBIS_DEBUG_CFLAGS "-fno-common" "-force_cpusubtype_ALL" "-g" "-Wall" "-fsigned-char" "-O0")
|
||||
elseif(PLATFORM MATCHES "os2")
|
||||
list(APPEND VORBIS_RELEASE_DEFINITIONS "-D_REENTRANT")
|
||||
# Use -W instead of -Wextra because gcc on OS/2 is an old version.
|
||||
list(APPEND VORBIS_RELEASE_CFLAGS "-Wall" "-W" "-fsigned-char" "-ffast-math" "-O20")
|
||||
list(APPEND VORBIS_DEBUG_DEFINITIONS "-D_REENTRANT" "-D__NO_MATH_INLINES")
|
||||
list(APPEND VORBIS_DEBUG_CFLAGS "-Wall" "-W" "-fsigned-char" "-g")
|
||||
elseif(ARCH STREQUAL "sparc")
|
||||
list(APPEND VORBIS_RELEASE_CFLAGS "-Wall" "-Wextra" "-fsigned-char" "-ffast-math" "-O20")
|
||||
list(APPEND VORBIS_DEBUG_DEFINITIONS "-D__NO_MATH_INLINES")
|
||||
list(APPEND VORBIS_DEBUG_CFLAGS "-Wall" "-Wextra" "-fsigned-char" "-g")
|
||||
else()
|
||||
list(APPEND VORBIS_DEFINITIONS "-D__NO_MATH_INLINES")
|
||||
|
||||
list(APPEND VORBIS_RELEASE_CFLAGS "-Wall" "-Wextra" "-fsigned-char" "-O20")
|
||||
list(APPEND VORBIS_DEBUG_CFLAGS "-Wall" "-Wextra" "-fsigned-char" "-g")
|
||||
endif()
|
||||
|
||||
list(APPEND VORBIS_DEFINITIONS $<$<CONFIG:Release>:${VORBIS_RELEASE_DEFINITIONS}>)
|
||||
list(APPEND VORBIS_CFLAGS $<$<CONFIG:Release>:${VORBIS_RELEASE_CFLAGS}>)
|
||||
|
||||
list(APPEND VORBIS_DEFINITIONS $<$<CONFIG:Debug>:${VORBIS_DEBUG_DEFINITIONS}>)
|
||||
list(APPEND VORBIS_CFLAGS $<$<CONFIG:Debug>:${VORBIS_DEBUG_CFLAGS}>)
|
||||
|
||||
endif()
|
||||
|
||||
ADD_INTERNAL_DEFINITIONS(VORBIS_DEFINITIONS)
|
||||
ADD_INTERNAL_CFLAGS(VORBIS_CFLAGS)
|
||||
|
||||
list(APPEND VORBIS_INCLUDE_DIRS "${OGG_DIR}/include")
|
||||
list(APPEND VORBIS_INCLUDE_DIRS "${VORBIS_DIR}/include")
|
||||
list(APPEND VORBIS_INCLUDE_DIRS "${VORBIS_DIR}/lib")
|
||||
|
||||
source_group("Source Files" FILES ${VORBIS_SOURCES})
|
||||
source_group("Header Files" FILES ${VORBIS_HEADERS})
|
||||
|
||||
add_library(${VORBIS_TARGET} STATIC ${VORBIS_SOURCES} ${VORBIS_HEADERS})
|
||||
|
||||
target_compile_definitions(${VORBIS_TARGET} PRIVATE ${VORBIS_DEFINITIONS})
|
||||
|
||||
target_include_directories(${VORBIS_TARGET} PRIVATE ${VORBIS_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${VORBIS_TARGET} PRIVATE ${VORBIS_CFLAGS})
|
||||
|
||||
list(APPEND VORBIS_LIBRARIES ${VORBIS_TARGET})
|
||||
|
||||
set(INTERNAL_VORBIS_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_VORBIS_INCLUDE_DIRS "${VORBIS_INCLUDE_DIRS}" PARENT_SCOPE)
|
||||
set(INTERNAL_VORBIS_LIBRARIES "${VORBIS_LIBRARIES}" PARENT_SCOPE)
|
259
misc/CMakeLists/include/cflags.cmake
Normal file
259
misc/CMakeLists/include/cflags.cmake
Normal file
|
@ -0,0 +1,259 @@
|
|||
include(CheckCCompilerFlag)
|
||||
|
||||
macro(ADD_SUPPORTED_CFLAG IN_CFLAG OUT_LIST_CFLAGS)
|
||||
string(REGEX REPLACE "[^A-Za-z0-9_-]" "_" CURRENT_VAR_FLAG ${IN_CFLAG})
|
||||
CHECK_C_COMPILER_FLAG("${IN_CFLAG}" COMPILER_SUPPORTS_${CURRENT_VAR_FLAG})
|
||||
if(COMPILER_SUPPORTS_${CURRENT_VAR_FLAG})
|
||||
list(APPEND ${OUT_LIST_CFLAGS} ${IN_CFLAG})
|
||||
endif(COMPILER_SUPPORTS_${CURRENT_VAR_FLAG})
|
||||
endmacro()
|
||||
|
||||
macro(ADD_SUPPORTED_CFLAGS LIST_CFLAGS OUT_LIST_CFLAGS)
|
||||
foreach(CURRENT_FLAG IN LISTS ${LIST_CFLAGS})
|
||||
ADD_SUPPORTED_CFLAG("${CURRENT_FLAG}" ${OUT_LIST_CFLAGS})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(ADD_FIRST_SUPPORTED_CFLAG LIST_CFLAGS OUT_LIST_CFLAGS)
|
||||
foreach(CURRENT_FLAG IN LISTS ${LIST_CFLAGS})
|
||||
string(REGEX REPLACE "[^A-Za-z0-9_-]" "_" CURRENT_VAR_FLAG "${CURRENT_FLAG}")
|
||||
CHECK_C_COMPILER_FLAG("${CURRENT_FLAG}" COMPILER_SUPPORTS_${CURRENT_VAR_FLAG})
|
||||
if(COMPILER_SUPPORTS_${CURRENT_VAR_FLAG})
|
||||
list(APPEND ${OUT_LIST_CFLAGS} "${CURRENT_FLAG}")
|
||||
break()
|
||||
endif(COMPILER_SUPPORTS_${CURRENT_VAR_FLAG})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(ADD_SUPPORTED_RELEASE_CFLAGS LIST_CFLAGS OUT_LIST_CFLAGS)
|
||||
set(SUPPORTED_CFLAGS)
|
||||
ADD_SUPPORTED_CFLAGS(${LIST_CFLAGS} SUPPORTED_CFLAGS)
|
||||
foreach(CURRENT_FLAG IN LISTS SUPPORTED_CFLAGS)
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
|
||||
list(APPEND ${OUT_LIST_CFLAGS} $<$<CONFIG:Release>:${CURRENT_FLAG}>)
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES "Release|release")
|
||||
list(APPEND ${OUT_LIST_CFLAGS} ${CURRENT_FLAG})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(ADD_BASE_DEFINITIONS BASE_DEFINITIONS)
|
||||
if(MSVC)
|
||||
#Character Set, CharacterSet="0", Not Set, ASCII/SBCS (Single Byte Character Set)
|
||||
list(APPEND ${BASE_DEFINITIONS} "-D_SBCS")
|
||||
|
||||
#disable deprecation warnings about old functions like strcmp
|
||||
list(APPEND ${BASE_DEFINITIONS} "-D_CRT_SECURE_NO_WARNINGS")
|
||||
list(APPEND ${BASE_DEFINITIONS} "-D_CRT_NONSTDC_NO_DEPRECATE")
|
||||
endif()
|
||||
if(PLATFORM STREQUAL "openbsd"
|
||||
OR PLATFORM STREQUAL "freebsd"
|
||||
OR PLATFORM STREQUAL "openbsd")
|
||||
|
||||
list(APPEND ${BASE_DEFINITIONS} "-DMAP_ANONYMOUS=MAP_ANON")
|
||||
endif()
|
||||
|
||||
if(ARCH STREQUAL "darwin")
|
||||
list(APPEND ${BASE_DEFINITIONS} "-D_THREAD_SAFE=1")
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_GNUCC_BASE_CFLAGS BASE_CFLAGS)
|
||||
set(DEBUG_CFLAGS "-ggdb" "-O0")
|
||||
set(SUPPORTED_DEBUG_CFLAGS)
|
||||
ADD_SUPPORTED_CFLAGS(DEBUG_CFLAGS SUPPORTED_DEBUG_CFLAGS)
|
||||
list(APPEND ${BASE_CFLAGS} $<$<CONFIG:Debug>:${SUPPORTED_DEBUG_CFLAGS}>)
|
||||
|
||||
if(GENERATE_DEPENDENCIES)
|
||||
ADD_SUPPORTED_CFLAG("-MMD" ${BASE_CFLAGS})
|
||||
endif()
|
||||
|
||||
set(OPTIMIZEVM)
|
||||
list(APPEND OPTIMIZEVM "-O3")
|
||||
ADD_SUPPORTED_CFLAG("-fno-common" ${BASE_CFLAGS})
|
||||
ADD_SUPPORTED_CFLAG("-fno-strict-aliasing" ${BASE_CFLAGS})
|
||||
ADD_SUPPORTED_CFLAG("-pipe" ${BASE_CFLAGS})
|
||||
|
||||
if(ARCH STREQUAL "x86")
|
||||
list(APPEND OPTIMIZEVM "-march=i586")
|
||||
endif()
|
||||
|
||||
if(PLATFORM STREQUAL "sunos")
|
||||
if(ARCH STREQUAL "sparc")
|
||||
list(APPEND OPTIMIZEVM "-mno-faster-structs")
|
||||
list(APPEND OPTIMIZEVM "-mtune=ultrasparc3")
|
||||
list(APPEND OPTIMIZEVM "-mv8plus")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PLATFORM STREQUAL "darwin")
|
||||
if(ARCH STREQUAL "ppc")
|
||||
ADD_SUPPORTED_CFLAG("-arch ppc" ${BASE_CFLAGS})
|
||||
# ADD_SUPPORTED_CFLAG("-maltivec" ${BASE_CFLAGS})
|
||||
endif()
|
||||
if(ARCH STREQUAL "ppc64")
|
||||
ADD_SUPPORTED_CFLAG("-arch ppc64" ${BASE_CFLAGS})
|
||||
# ADD_SUPPORTED_CFLAG("-maltivec" ${BASE_CFLAGS})
|
||||
endif()
|
||||
if(ARCH STREQUAL "x86")
|
||||
list(APPEND OPTIMIZEVM "-march=prescott")
|
||||
list(APPEND OPTIMIZEVM "-mfpmath=sse")
|
||||
ADD_SUPPORTED_CFLAG("-arch i386" ${BASE_CFLAGS})
|
||||
# x86 vm will crash without -mstackrealign since MMX instructions will be
|
||||
# used no matter what and they corrupt the frame pointer in VM calls
|
||||
ADD_SUPPORTED_CFLAG("-mstackrealign" ${BASE_CFLAGS})
|
||||
endif()
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND OPTIMIZEVM "-mfpmath=sse")
|
||||
ADD_SUPPORTED_CFLAG("-arch x86_64" ${BASE_CFLAGS})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
ADD_SUPPORTED_RELEASE_CFLAGS(OPTIMIZEVM ${BASE_CFLAGS})
|
||||
|
||||
|
||||
set(WARNING_CFLAGS)
|
||||
list(APPEND WARNING_CFLAGS "-Wall")
|
||||
list(APPEND WARNING_CFLAGS "-Wimplicit")
|
||||
list(APPEND WARNING_CFLAGS "-Wstrict-prototypes")
|
||||
|
||||
list(APPEND WARNING_CFLAGS "-Wformat=2")
|
||||
list(APPEND WARNING_CFLAGS "-Wno-format-zero-length")
|
||||
list(APPEND WARNING_CFLAGS "-Wformat-security")
|
||||
list(APPEND WARNING_CFLAGS "-Wno-format-nonliteral")
|
||||
list(APPEND WARNING_CFLAGS "-Wstrict-aliasing=2")
|
||||
list(APPEND WARNING_CFLAGS "-Wmissing-format-attribute")
|
||||
list(APPEND WARNING_CFLAGS "-Wdisabled-optimization")
|
||||
list(APPEND WARNING_CFLAGS "-Werror-implicit-function-declaration")
|
||||
|
||||
ADD_SUPPORTED_CFLAGS(WARNING_CFLAGS ${BASE_CFLAGS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_BASE_CFLAGS BASE_CFLAGS)
|
||||
if(MSVC)
|
||||
if(BUILD_STATIC_CRT)
|
||||
list(APPEND ${BASE_CFLAGS} "/MT")
|
||||
endif()
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
ADD_GNUCC_BASE_CFLAGS(${BASE_CFLAGS})
|
||||
else()
|
||||
#other compilers like open64 support gcc cflags
|
||||
ADD_SUPPORTED_CFLAG("-O3" ${BASE_CFLAGS})
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
#compiler definitions for renderer and vm libraries
|
||||
macro(ADD_LIB_DEFINITIONS LIB_DEFINITIONS)
|
||||
|
||||
endmacro()
|
||||
|
||||
#compiler flags for renderer and vm libraries
|
||||
macro(ADD_LIB_CFLAGS LIB_CFLAGS)
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
ADD_SUPPORTED_CFLAGS("-fvisibility=hidden" ${LIB_CFLAGS})
|
||||
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_VM_DEFINITIONS VM_DEFINITIONS)
|
||||
ADD_BASE_DEFINITIONS(${VM_DEFINITIONS})
|
||||
ADD_LIB_DEFINITIONS(${VM_DEFINITIONS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_VM_CFLAGS BASE_CFLAGS)
|
||||
ADD_BASE_CFLAGS(${BASE_CFLAGS})
|
||||
ADD_LIB_CFLAGS(${BASE_CFLAGS})
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555
|
||||
# -ffast-math will cause the client to die with SIGFPE on Alpha
|
||||
if(NOT ARCH STREQUAL "alpha")
|
||||
ADD_SUPPORTED_CFLAG("-ffast-math" ${BASE_CFLAGS})
|
||||
else()
|
||||
message(WARNING "Backwards compatibility might break without the -ffast-math compiler flag.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(DEBUG "${BASE_CFLAGS}=${${BASE_CFLAGS}}")
|
||||
endmacro()
|
||||
|
||||
macro(ADD_TOOLS_DEFINITIONS TOOLS_DEFINITIONS)
|
||||
ADD_BASE_DEFINITIONS(${TOOLS_DEFINITIONS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_TOOLS_CFLAGS TOOLS_CFLAGS)
|
||||
if(MSVC)
|
||||
if(BUILD_STATIC_CRT)
|
||||
list(APPEND ${TOOLS_CFLAGS} "/MT")
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(TOOLS_OPTIMIZE)
|
||||
#Produce debugging information
|
||||
list(APPEND TOOLS_OPTIMIZE "-g")
|
||||
#enable all compiler warning messages
|
||||
list(APPEND TOOLS_OPTIMIZE "-Wall")
|
||||
#Causes the compiler to avoid assumptions regarding non-aliasing of objects of different types
|
||||
list(APPEND TOOLS_OPTIMIZE "-fno-strict-aliasing")
|
||||
|
||||
ADD_SUPPORTED_RELEASE_CFLAGS(TOOLS_OPTIMIZE ${TOOLS_CFLAGS})
|
||||
|
||||
if(GENERATE_DEPENDENCIES)
|
||||
ADD_SUPPORTED_CFLAG("-MMD" ${TOOLS_CFLAGS})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_RENDER_DEFINITIONS RENDER_DEFINITIONS)
|
||||
ADD_BASE_DEFINITIONS(${RENDER_DEFINITIONS})
|
||||
ADD_LIB_DEFINITIONS(${RENDER_DEFINITIONS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_RENDER_CFLAGS RENDER_CFLAGS)
|
||||
ADD_BASE_CFLAGS(${RENDER_CFLAGS})
|
||||
ADD_LIB_CFLAGS(${RENDER_CFLAGS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_SERVER_DEFINITIONS SERVER_DEFINITIONS)
|
||||
ADD_BASE_DEFINITIONS(${SERVER_DEFINITIONS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_SERVER_CFLAGS SERVER_CFLAGS)
|
||||
ADD_BASE_CFLAGS(${SERVER_CFLAGS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_CLIENT_DEFINITIONS CLIENT_DEFINITIONS)
|
||||
ADD_SERVER_DEFINITIONS(${CLIENT_DEFINITIONS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_CLIENT_CFLAGS CLIENT_CFLAGS)
|
||||
ADD_SERVER_CFLAGS(${CLIENT_CFLAGS})
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_INTERNAL_DEFINITIONS INTERNAL_DEFINITIONS)
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(ADD_INTERNAL_CFLAGS INTERNAL_CFLAGS)
|
||||
if(MSVC)
|
||||
if(BUILD_STATIC_CRT)
|
||||
list(APPEND ${INTERNAL_CFLAGS} "/MT")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
88
misc/CMakeLists/include/compat.cmake
Normal file
88
misc/CMakeLists/include/compat.cmake
Normal file
|
@ -0,0 +1,88 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
macro(compat_target_compile_options TARGET SCOPE)
|
||||
#Problem: cmake does not handle list entrys with a space properly
|
||||
#because a list is just a string with semicolon separator
|
||||
#therefor flags with a parameter (option groups) require a prefix "SHELL:-arch ppc"
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
|
||||
set(sflags)
|
||||
set(oflags)
|
||||
set(list_var "${ARGN}")
|
||||
foreach(SOURCE IN LISTS list_var)
|
||||
string(FIND "${SOURCE}" " " POS)
|
||||
if(${POS} LESS 0)
|
||||
list(APPEND oflags ${SOURCE})
|
||||
else()
|
||||
list(APPEND sflags SHELL:${SOURCE})
|
||||
endif()
|
||||
endforeach()
|
||||
target_compile_options("${TARGET}" PRIVATE ${oflags} ${sflags})
|
||||
else()
|
||||
set(sflags)
|
||||
set(oflags)
|
||||
set(list_var "${ARGN}")
|
||||
foreach(SOURCE IN LISTS list_var)
|
||||
string(FIND "${SOURCE}" " " POS)
|
||||
if(${POS} LESS 0)
|
||||
list(APPEND oflags ${SOURCE})
|
||||
else()
|
||||
list(APPEND sflags ${SOURCE})
|
||||
endif()
|
||||
endforeach()
|
||||
string(REPLACE ";" " " CFLAGS_STRING "${sflags}")
|
||||
set_target_properties("${TARGET}" PROPERTIES COMPILE_FLAGS "${CFLAGS_STRING}")
|
||||
target_compile_options("${TARGET}" PRIVATE ${oflags})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(compat_target_link_options TARGET SCOPE)
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
|
||||
set(sflags)
|
||||
set(oflags)
|
||||
set(list_var "${ARGN}")
|
||||
foreach(SOURCE IN LISTS list_var)
|
||||
string(FIND "${SOURCE}" " " POS)
|
||||
if(${POS} LESS 0)
|
||||
list(APPEND oflags ${SOURCE})
|
||||
else()
|
||||
list(APPEND sflags SHELL:${SOURCE})
|
||||
endif()
|
||||
endforeach()
|
||||
target_link_options("${TARGET}" PRIVATE ${oflags} ${sflags})
|
||||
else()
|
||||
set(list_var "${ARGN}")
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Release|release")
|
||||
string(REGEX REPLACE "\\$<\\$<CONFIG:Release>:(.*)>" "\\1" list_var "${list_var}")
|
||||
else()
|
||||
string(REGEX REPLACE "\\$<\\$<CONFIG:Release>:(.*)>" "" list_var "${list_var}")
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Debug|debug")
|
||||
string(REGEX REPLACE "\\$<\\$<CONFIG:Debug>:(.*)>" "\\1" list_var "${list_var}")
|
||||
else()
|
||||
string(REGEX REPLACE "\\$<\\$<CONFIG:Debug>:(.*)>" "" list_var "${list_var}")
|
||||
endif()
|
||||
string(REPLACE ";" " " LDFLAGS_STRING "${list_var}")
|
||||
set_target_properties("${TARGET}" PROPERTIES LINK_FLAGS "${LDFLAGS_STRING}")
|
||||
endif()
|
||||
endmacro()
|
60
misc/CMakeLists/include/default_options.cmake
Normal file
60
misc/CMakeLists/include/default_options.cmake
Normal file
|
@ -0,0 +1,60 @@
|
|||
|
||||
set(DEFAULT_BASEGAME "baseq3")
|
||||
set(DEFAULT_MISSIONPACK "missionpack")
|
||||
|
||||
set(DEFAULT_USE_INTERNAL_LIBS TRUE)
|
||||
set(DEFAULT_USE_RENDERER_DLOPEN TRUE)
|
||||
|
||||
set(DEFAULT_BUILD_STANDALONE FALSE)
|
||||
|
||||
#cmake is using CMAKE_INSTALL_PREFIX/DEFAULT_REL_INSTALL_DEST
|
||||
set(DEFAULT_REL_INSTALL_DEST "games/quake3")
|
||||
#install directories (COPYDIR) overwrite the relative installation destination
|
||||
#set(DEFAULT_INSTALL_DIR "/usr/local/games/quake3")
|
||||
#set(DEFAULT_BASEGAME_VM_INSTALL_DIR "/path/to/vm")
|
||||
#set(DEFAULT_MISSIONPACK_VM_INSTALL_DIR "/path/to/vm")
|
||||
#set(DEFAULT_BASEGAME_QVM_INSTALL_DIR "/path/to/vm")
|
||||
#set(DEFAULT_MISSIONPACK_QVM_INSTALL_DIR "/path/to/vm")
|
||||
|
||||
set(DEFAULT_GENERATE_DEPENDENCIES TRUE)
|
||||
set(DEFAULT_USE_AUTOUPDATER FALSE)
|
||||
set(DEFAULT_AUTOUPDATER_BIN "autosyncerator")
|
||||
|
||||
#set(DEFAULT_BIN_EXT "")
|
||||
|
||||
#client and server
|
||||
set(DEFAULT_VERSION "1.36")
|
||||
set(DEFAULT_USE_GIT_REV TRUE)
|
||||
#set(DEFAULT_BASEDIR "")
|
||||
|
||||
#client only
|
||||
set(DEFAULT_CLIENT_BIN "ioquake3")
|
||||
set(DEFAULT_USE_CODEC_OPUS TRUE)
|
||||
set(DEFAULT_USE_CODEC_VORBIS FALSE)
|
||||
set(DEFAULT_USE_CURL TRUE)
|
||||
set(DEFAULT_USE_CURL_DLOPEN TRUE)
|
||||
set(DEFAULT_USE_FREETYPE FALSE)
|
||||
set(DEFAULT_USE_ICON TRUE)
|
||||
set(DEFAULT_USE_MUMBLE TRUE)
|
||||
set(DEFAULT_USE_OPENAL TRUE)
|
||||
set(DEFAULT_USE_OPENAL_DLOPEN TRUE)
|
||||
set(DEFAULT_USE_VOIP TRUE)
|
||||
|
||||
#server only
|
||||
set(DEFAULT_SERVER_BIN "ioq3ded")
|
||||
|
||||
#main cmakelist only
|
||||
set(DEFAULT_BUILD_BASEGAME TRUE)
|
||||
set(DEFAULT_BUILD_CLIENT TRUE)
|
||||
set(DEFAULT_BUILD_GAME_QVM TRUE)
|
||||
set(DEFAULT_BUILD_GAME_VM TRUE) #native vm (so/dll)
|
||||
set(DEFAULT_BUILD_MISSIONPACK TRUE)
|
||||
set(DEFAULT_BUILD_RENDERER_OPENGL2 TRUE)
|
||||
set(DEFAULT_BUILD_SERVER TRUE)
|
||||
|
||||
#cgame, game, ui
|
||||
#Produce a qvm file compatible with Q3 1.32b
|
||||
set(DEFAULT_VQ3_COMPATIBLE_QVM TRUE)
|
||||
|
||||
set(DEFAULT_NO_STRIP FALSE)
|
||||
set(DEFAULT_BUILD_STATIC_CRT TRUE)
|
39
misc/CMakeLists/include/directory_constants.cmake
Normal file
39
misc/CMakeLists/include/directory_constants.cmake
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
set(MOUNT_DIR "${SOURCE_DIR}/code" CACHE PATH "path to the code directory")
|
||||
|
||||
set(ASM_DIR "${MOUNT_DIR}/asm")
|
||||
set(BOTLIB_DIR "${MOUNT_DIR}/botlib")
|
||||
set(CGAME_DIR "${MOUNT_DIR}/cgame")
|
||||
set(GAME_DIR "${MOUNT_DIR}/game")
|
||||
set(LIBS_DIR "${MOUNT_DIR}/libs")
|
||||
set(Q3_UI_DIR "${MOUNT_DIR}/q3_ui")
|
||||
set(QCOMMON_DIR "${MOUNT_DIR}/qcommon")
|
||||
set(SERVER_DIR "${MOUNT_DIR}/server")
|
||||
set(SYS_DIR "${MOUNT_DIR}/sys")
|
||||
set(UI_DIR "${MOUNT_DIR}/ui")
|
||||
|
||||
#client and renderer
|
||||
set(LIBSDL_DIR "${MOUNT_DIR}/SDL2")
|
||||
set(SDL_DIR "${MOUNT_DIR}/sdl")
|
||||
|
||||
#client only
|
||||
set(CLIENT_DIR "${MOUNT_DIR}/client")
|
||||
set(CURL_DIR "${MOUNT_DIR}/curl-7.54.0")
|
||||
|
||||
#server only
|
||||
set(NULL_DIR "${MOUNT_DIR}/null")
|
||||
|
||||
#renderer
|
||||
set(RENDERERCOMMON_DIR "${MOUNT_DIR}/renderercommon")
|
||||
set(RENDERERGL1_DIR "${MOUNT_DIR}/renderergl1")
|
||||
set(RENDERERGL2_DIR "${MOUNT_DIR}/renderergl2")
|
||||
set(GLSL_DIR "${RENDERERGL2_DIR}/glsl")
|
||||
|
||||
#internal libs
|
||||
set(JPEG_DIR "${MOUNT_DIR}/jpeg-8c")
|
||||
set(OGG_DIR "${MOUNT_DIR}/libogg-1.3.3")
|
||||
set(OPUS_DIR "${MOUNT_DIR}/opus-1.2.1")
|
||||
set(OPUSFILE_DIR "${MOUNT_DIR}/opusfile-0.9")
|
||||
set(SPEEX_DIR "${MOUNT_DIR}/libspeex")
|
||||
set(VORBIS_DIR "${MOUNT_DIR}/libvorbis-1.3.6")
|
||||
set(ZLIB_DIR "${MOUNT_DIR}/zlib")
|
21
misc/CMakeLists/include/git_rev.cmake
Normal file
21
misc/CMakeLists/include/git_rev.cmake
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
if(USE_GIT_REV AND IS_DIRECTORY "${SOURCE_DIR}/.git")
|
||||
find_package(Git)
|
||||
|
||||
if(NOT GIT_FOUND)
|
||||
set(GIT_EXECUTABLE "git")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" show -s --pretty=format:%h-%ad --date=short
|
||||
WORKING_DIRECTORY "${SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_REV
|
||||
RESULT_VARIABLE GIT_REV_RESULT
|
||||
ERROR_VARIABLE GIT_REV_ERROR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if(NOT GIT_REV)
|
||||
message(WARNING "Could not execute Git. ${GIT_REV_ERROR} ${GIT_REV_RESULT}")
|
||||
endif(NOT GIT_REV)
|
||||
endif()
|
53
misc/CMakeLists/include/glsl_to_c.cmake
Normal file
53
misc/CMakeLists/include/glsl_to_c.cmake
Normal file
|
@ -0,0 +1,53 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
#i.e.: cmake -DSHADERNAME="bokeh_fp" -DINPUT="bokeh_fp.glsl" -DOUTPUT="bokeh_fp.c" -P glsl_to_c.cmake
|
||||
|
||||
if(NOT DEFINED INPUT OR INPUT STREQUAL "")
|
||||
message("glsl_to_c.cmake: No INPUT defined.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED OUTPUT OR OUTPUT STREQUAL "")
|
||||
message("glsl_to_c.cmake: No OUTPUT defined.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED SHADERNAME OR SHADERNAME STREQUAL "")
|
||||
message("glsl_to_c.cmake: No SHADERNAME defined.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(HEADER "const char *fallbackShader_${SHADERNAME}=\n")
|
||||
set(FOOTER ";\n")
|
||||
|
||||
#message("glsl_to_c.cmake ${INPUT} ${OUTPUT}")
|
||||
|
||||
file(READ "${INPUT}" GLSL_SHADER)
|
||||
|
||||
string(REGEX REPLACE "([^\n]*)\r?\n" "\"\\1\\\\n\"\n" GLSL_C "${GLSL_SHADER}")
|
||||
|
||||
#set(GLSL_C "${HEADER}${GLSL_C}")
|
||||
|
||||
file(WRITE "${OUTPUT}" "${HEADER}${GLSL_C}${FOOTER}")
|
78
misc/CMakeLists/include/libsdl_headers.cmake
Normal file
78
misc/CMakeLists/include/libsdl_headers.cmake
Normal file
|
@ -0,0 +1,78 @@
|
|||
|
||||
set(LIBSDL_HEADERS
|
||||
"${LIBSDL_DIR}/include/begin_code.h"
|
||||
"${LIBSDL_DIR}/include/close_code.h"
|
||||
"${LIBSDL_DIR}/include/SDL.h"
|
||||
"${LIBSDL_DIR}/include/SDL_assert.h"
|
||||
"${LIBSDL_DIR}/include/SDL_atomic.h"
|
||||
"${LIBSDL_DIR}/include/SDL_audio.h"
|
||||
"${LIBSDL_DIR}/include/SDL_bits.h"
|
||||
"${LIBSDL_DIR}/include/SDL_blendmode.h"
|
||||
"${LIBSDL_DIR}/include/SDL_clipboard.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_android.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_iphoneos.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_macosx.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_minimal.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_pandora.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_psp.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_windows.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_winrt.h"
|
||||
"${LIBSDL_DIR}/include/SDL_config_wiz.h"
|
||||
"${LIBSDL_DIR}/include/SDL_copying.h"
|
||||
"${LIBSDL_DIR}/include/SDL_cpuinfo.h"
|
||||
"${LIBSDL_DIR}/include/SDL_egl.h"
|
||||
"${LIBSDL_DIR}/include/SDL_endian.h"
|
||||
"${LIBSDL_DIR}/include/SDL_error.h"
|
||||
"${LIBSDL_DIR}/include/SDL_events.h"
|
||||
"${LIBSDL_DIR}/include/SDL_filesystem.h"
|
||||
"${LIBSDL_DIR}/include/SDL_gamecontroller.h"
|
||||
"${LIBSDL_DIR}/include/SDL_gesture.h"
|
||||
"${LIBSDL_DIR}/include/SDL_haptic.h"
|
||||
"${LIBSDL_DIR}/include/SDL_hints.h"
|
||||
"${LIBSDL_DIR}/include/SDL_joystick.h"
|
||||
"${LIBSDL_DIR}/include/SDL_keyboard.h"
|
||||
"${LIBSDL_DIR}/include/SDL_keycode.h"
|
||||
"${LIBSDL_DIR}/include/SDL_loadso.h"
|
||||
"${LIBSDL_DIR}/include/SDL_log.h"
|
||||
"${LIBSDL_DIR}/include/SDL_main.h"
|
||||
"${LIBSDL_DIR}/include/SDL_messagebox.h"
|
||||
"${LIBSDL_DIR}/include/SDL_mouse.h"
|
||||
"${LIBSDL_DIR}/include/SDL_mutex.h"
|
||||
"${LIBSDL_DIR}/include/SDL_name.h"
|
||||
"${LIBSDL_DIR}/include/SDL_opengl.h"
|
||||
"${LIBSDL_DIR}/include/SDL_opengles.h"
|
||||
"${LIBSDL_DIR}/include/SDL_opengles2.h"
|
||||
"${LIBSDL_DIR}/include/SDL_pixels.h"
|
||||
"${LIBSDL_DIR}/include/SDL_platform.h"
|
||||
"${LIBSDL_DIR}/include/SDL_power.h"
|
||||
"${LIBSDL_DIR}/include/SDL_quit.h"
|
||||
"${LIBSDL_DIR}/include/SDL_rect.h"
|
||||
"${LIBSDL_DIR}/include/SDL_render.h"
|
||||
"${LIBSDL_DIR}/include/SDL_revision.h"
|
||||
"${LIBSDL_DIR}/include/SDL_rwops.h"
|
||||
"${LIBSDL_DIR}/include/SDL_scancode.h"
|
||||
"${LIBSDL_DIR}/include/SDL_shape.h"
|
||||
"${LIBSDL_DIR}/include/SDL_stdinc.h"
|
||||
"${LIBSDL_DIR}/include/SDL_surface.h"
|
||||
"${LIBSDL_DIR}/include/SDL_system.h"
|
||||
"${LIBSDL_DIR}/include/SDL_syswm.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_assert.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_common.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_compare.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_crc32.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_font.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_fuzzer.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_harness.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_images.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_log.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_md5.h"
|
||||
"${LIBSDL_DIR}/include/SDL_test_random.h"
|
||||
"${LIBSDL_DIR}/include/SDL_thread.h"
|
||||
"${LIBSDL_DIR}/include/SDL_timer.h"
|
||||
"${LIBSDL_DIR}/include/SDL_touch.h"
|
||||
"${LIBSDL_DIR}/include/SDL_types.h"
|
||||
"${LIBSDL_DIR}/include/SDL_version.h"
|
||||
"${LIBSDL_DIR}/include/SDL_video.h"
|
||||
)
|
56
misc/CMakeLists/include/platform.cmake
Normal file
56
misc/CMakeLists/include/platform.cmake
Normal file
|
@ -0,0 +1,56 @@
|
|||
|
||||
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSTEM_PROCESSOR)
|
||||
|
||||
if(NOT DEFINED COMPILE_ARCH)
|
||||
if(SYSTEM_PROCESSOR STREQUAL "unknown")
|
||||
message(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR is unknown! Check your CMake generator or toolchain.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#converting arch types to gcc -march types (also -arch on Darwin)
|
||||
#https://stackoverflow.com/questions/70475665/what-are-the-possible-values-of-cmake-system-processor
|
||||
if(SYSTEM_PROCESSOR MATCHES "powerpc")
|
||||
set(COMPILE_ARCH "ppc")
|
||||
elseif(SYSTEM_PROCESSOR MATCHES "powerpc64|ppc64le")
|
||||
set(COMPILE_ARCH "ppc64")
|
||||
elseif(SYSTEM_PROCESSOR MATCHES "axp")
|
||||
set(COMPILE_ARCH "alpha")
|
||||
elseif(SYSTEM_PROCESSOR MATCHES "i386|i686|(i.86)|i86pc|x86pc|x86at")
|
||||
set(COMPILE_ARCH "x86")
|
||||
elseif(SYSTEM_PROCESSOR MATCHES "x86-64|ia64|em64t|amd64|x64")
|
||||
set(COMPILE_ARCH "x86_64")
|
||||
elseif(SYSTEM_PROCESSOR MATCHES "armv8b|armv8l|aarch64_be|aarch64")
|
||||
set(COMPILE_ARCH "arm64")
|
||||
elseif(SYSTEM_PROCESSOR MATCHES "armv7l|armv6l")
|
||||
set(COMPILE_ARCH "arm")
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT DEFINED COMPILE_ARCH)
|
||||
set(COMPILE_ARCH "${SYSTEM_PROCESSOR}")
|
||||
endif()
|
||||
if(NOT DEFINED ARCH)
|
||||
string(TOLOWER "${COMPILE_ARCH}" ARCH)
|
||||
endif()
|
||||
|
||||
set(COMPILE_PLATFORM "${CMAKE_SYSTEM_NAME}")
|
||||
if(NOT DEFINED PLATFORM)
|
||||
string(TOLOWER "${COMPILE_PLATFORM}" PLATFORM)
|
||||
endif()
|
||||
|
||||
if(NOT PLATFORM STREQUAL COMPILE_PLATFORM)
|
||||
set(CROSS_COMPILING TRUE)
|
||||
else()
|
||||
set(CROSS_COMPILING FALSE)
|
||||
if(NOT ARCH STREQUAL COMPILE_ARCH)
|
||||
set(CROSS_COMPILING TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
if(NOT DEFINED DEFAULT_BIN_EXT)
|
||||
if(ARCH)
|
||||
set(DEFAULT_BIN_EXT ".${ARCH}")
|
||||
endif(ARCH)
|
||||
endif()
|
28
misc/CMakeLists/include/strip.cmake
Normal file
28
misc/CMakeLists/include/strip.cmake
Normal file
|
@ -0,0 +1,28 @@
|
|||
include(CheckCCompilerFlag)
|
||||
|
||||
macro(ADD_STRIP_LDFLAG LDFLAGS_VAR)
|
||||
if(NOT NO_STRIP)
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(STRIP_FLAG)
|
||||
CHECK_C_COMPILER_FLAG("-s" COMPILER_SUPPORTS_-s)
|
||||
if(COMPILER_SUPPORTS_-s)
|
||||
set(STRIP_FLAG "-s")
|
||||
endif()
|
||||
list(APPEND ${LDFLAGS_VAR} $<$<CONFIG:Release>:${STRIP_FLAG}>)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(STRIP_TARGET STRIP_TARGET_NAME)
|
||||
|
||||
if(CMAKE_STRIP)
|
||||
set(STRIP_EXECUTABLE "${CMAKE_STRIP}")
|
||||
else()
|
||||
find_program(STRIP_EXECUTABLE "strip")
|
||||
endif()
|
||||
if(STRIP_EXECUTABLE AND NOT NO_STRIP)
|
||||
add_custom_command(TARGET "${STRIP_TARGET_NAME}" POST_BUILD
|
||||
COMMAND $<$<CONFIG:Release>:${STRIP_EXECUTABLE}> ARGS $<TARGET_FILE:${STRIP_TARGET_NAME}>)
|
||||
endif()
|
||||
|
||||
endmacro()
|
33
misc/CMakeLists/include/vm_sources.cmake
Normal file
33
misc/CMakeLists/include/vm_sources.cmake
Normal file
|
@ -0,0 +1,33 @@
|
|||
set(QCOMMON_SOURCES_armv7l
|
||||
"${QCOMMON_DIR}/vm_armv7l.c"
|
||||
)
|
||||
set(QCOMMON_SOURCES_arm ${QCOMMON_SOURCES_armv7l})
|
||||
set(QCOMMON_SOURCES_arm64 ${QCOMMON_SOURCES_armv7l})
|
||||
set(QCOMMON_SOURCES_x86
|
||||
"${QCOMMON_DIR}/vm_x86.c"
|
||||
)
|
||||
set(QCOMMON_SOURCES_x86_64 ${QCOMMON_SOURCES_x86})
|
||||
set(QCOMMON_SOURCES_ppc
|
||||
"${QCOMMON_DIR}/vm_powerpc.c"
|
||||
"${QCOMMON_DIR}/vm_powerpc_asm.c"
|
||||
)
|
||||
set(QCOMMON_SOURCES_ppc64 ${QCOMMON_SOURCES_ppc})
|
||||
set(QCOMMON_SOURCES_sparc
|
||||
"${QCOMMON_DIR}/vm_sparc.c"
|
||||
)
|
||||
set(QCOMMON_SOURCES_sparc64 ${QCOMMON_SOURCES_sparc})
|
||||
|
||||
|
||||
macro(GET_VM_SUPPORT ARG_VAR)
|
||||
if(DEFINED QCOMMON_SOURCES_${ARCH})
|
||||
set(${ARG_VAR} TRUE)
|
||||
else()
|
||||
set(${ARG_VAR} FALSE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(GET_VM_SOURCES ARG_VAR)
|
||||
if(DEFINED QCOMMON_SOURCES_${ARCH})
|
||||
set(${ARG_VAR} ${QCOMMON_SOURCES_${ARCH}})
|
||||
endif()
|
||||
endmacro()
|
142
misc/CMakeLists/internal_jpeg/CMakeLists.txt
Normal file
142
misc/CMakeLists/internal_jpeg/CMakeLists.txt
Normal file
|
@ -0,0 +1,142 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal jpeg")
|
||||
|
||||
set(JPEG_TARGET "internal_jpeg")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(JPEG_SOURCES
|
||||
"${JPEG_DIR}/jaricom.c"
|
||||
"${JPEG_DIR}/jcapimin.c"
|
||||
"${JPEG_DIR}/jcapistd.c"
|
||||
"${JPEG_DIR}/jcarith.c"
|
||||
"${JPEG_DIR}/jccoefct.c"
|
||||
"${JPEG_DIR}/jccolor.c"
|
||||
"${JPEG_DIR}/jcdctmgr.c"
|
||||
"${JPEG_DIR}/jchuff.c"
|
||||
"${JPEG_DIR}/jcinit.c"
|
||||
"${JPEG_DIR}/jcmainct.c"
|
||||
"${JPEG_DIR}/jcmarker.c"
|
||||
"${JPEG_DIR}/jcmaster.c"
|
||||
"${JPEG_DIR}/jcomapi.c"
|
||||
"${JPEG_DIR}/jcparam.c"
|
||||
"${JPEG_DIR}/jcprepct.c"
|
||||
"${JPEG_DIR}/jcsample.c"
|
||||
"${JPEG_DIR}/jctrans.c"
|
||||
"${JPEG_DIR}/jdapimin.c"
|
||||
"${JPEG_DIR}/jdapistd.c"
|
||||
"${JPEG_DIR}/jdarith.c"
|
||||
"${JPEG_DIR}/jdatadst.c"
|
||||
"${JPEG_DIR}/jdatasrc.c"
|
||||
"${JPEG_DIR}/jdcoefct.c"
|
||||
"${JPEG_DIR}/jdcolor.c"
|
||||
"${JPEG_DIR}/jddctmgr.c"
|
||||
"${JPEG_DIR}/jdhuff.c"
|
||||
"${JPEG_DIR}/jdinput.c"
|
||||
"${JPEG_DIR}/jdmainct.c"
|
||||
"${JPEG_DIR}/jdmarker.c"
|
||||
"${JPEG_DIR}/jdmaster.c"
|
||||
"${JPEG_DIR}/jdmerge.c"
|
||||
"${JPEG_DIR}/jdpostct.c"
|
||||
"${JPEG_DIR}/jdsample.c"
|
||||
"${JPEG_DIR}/jdtrans.c"
|
||||
"${JPEG_DIR}/jerror.c"
|
||||
"${JPEG_DIR}/jfdctflt.c"
|
||||
"${JPEG_DIR}/jfdctfst.c"
|
||||
"${JPEG_DIR}/jfdctint.c"
|
||||
"${JPEG_DIR}/jidctflt.c"
|
||||
"${JPEG_DIR}/jidctfst.c"
|
||||
"${JPEG_DIR}/jidctint.c"
|
||||
"${JPEG_DIR}/jmemmgr.c"
|
||||
"${JPEG_DIR}/jmemnobs.c"
|
||||
"${JPEG_DIR}/jquant1.c"
|
||||
"${JPEG_DIR}/jquant2.c"
|
||||
"${JPEG_DIR}/jutils.c"
|
||||
)
|
||||
set(JPEG_HEADERS
|
||||
"${JPEG_DIR}/jconfig.h"
|
||||
"${JPEG_DIR}/jdct.h"
|
||||
"${JPEG_DIR}/jerror.h"
|
||||
"${JPEG_DIR}/jinclude.h"
|
||||
"${JPEG_DIR}/jmemsys.h"
|
||||
"${JPEG_DIR}/jmorecfg.h"
|
||||
"${JPEG_DIR}/jpegint.h"
|
||||
"${JPEG_DIR}/jpeglib.h"
|
||||
"${JPEG_DIR}/jversion.h"
|
||||
)
|
||||
|
||||
|
||||
if(MSVC)
|
||||
#disable deprecation warnings about old functions like strcmp
|
||||
list(APPEND JPEG_DEFINITIONS "-D_CRT_SECURE_NO_WARNINGS")
|
||||
|
||||
#Optimization, Full /Ox
|
||||
list(APPEND JPEG_CFLAGS "/Ox")
|
||||
#Enable Intrinsic Functions, No /Oi-
|
||||
list(APPEND JPEG_CFLAGS "/Oi-")
|
||||
#Omit Frame Pointers, Yes /Oy
|
||||
list(APPEND JPEG_CFLAGS "/Oy")
|
||||
#Enable Fiber-Safe Optimizations /GT
|
||||
list(APPEND JPEG_CFLAGS "/GT")
|
||||
#Enable Function-Level Linking /Gy
|
||||
list(APPEND JPEG_CFLAGS "/Gy")
|
||||
#Disable specific warnings
|
||||
list(APPEND JPEG_CFLAGS "/wd4996")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
ADD_INTERNAL_DEFINITIONS(JPEG_DEFINITIONS)
|
||||
ADD_INTERNAL_CFLAGS(JPEG_CFLAGS)
|
||||
|
||||
source_group("Source Files" FILES ${JPEG_SOURCES})
|
||||
source_group("Header Files" FILES ${JPEG_HEADERS})
|
||||
|
||||
add_library(${JPEG_TARGET} STATIC ${JPEG_SOURCES} ${JPEG_HEADERS})
|
||||
|
||||
target_compile_definitions(${JPEG_TARGET} PRIVATE ${JPEG_DEFINITIONS})
|
||||
|
||||
target_include_directories(${JPEG_TARGET} PRIVATE ${JPEG_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${JPEG_TARGET} PRIVATE ${JPEG_CFLAGS})
|
||||
|
||||
set(INTERNAL_JPEG_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_JPEG_INCLUDE_DIRS "${JPEG_DIR}" PARENT_SCOPE)
|
||||
set(INTERNAL_JPEG_LIBRARIES "${JPEG_TARGET}" PARENT_SCOPE)
|
131
misc/CMakeLists/internal_zlib/CMakeLists.txt
Normal file
131
misc/CMakeLists/internal_zlib/CMakeLists.txt
Normal file
|
@ -0,0 +1,131 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal zlib")
|
||||
|
||||
set(ZLIB_TARGET "internal_zlib")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(ZLIB_SOURCES
|
||||
"${ZLIB_DIR}/adler32.c"
|
||||
"${ZLIB_DIR}/crc32.c"
|
||||
"${ZLIB_DIR}/inffast.c"
|
||||
"${ZLIB_DIR}/inflate.c"
|
||||
"${ZLIB_DIR}/inftrees.c"
|
||||
"${ZLIB_DIR}/zutil.c"
|
||||
)
|
||||
set(ZLIB_HEADERS
|
||||
"${ZLIB_DIR}/crc32.h"
|
||||
"${ZLIB_DIR}/inffast.h"
|
||||
"${ZLIB_DIR}/inffixed.h"
|
||||
"${ZLIB_DIR}/inflate.h"
|
||||
"${ZLIB_DIR}/inftrees.h"
|
||||
"${ZLIB_DIR}/zconf.h"
|
||||
"${ZLIB_DIR}/zlib.h"
|
||||
"${ZLIB_DIR}/zutil.h"
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
#no crt warnings
|
||||
list(APPEND ZLIB_DEFINITIONS "-D_CRT_NONSTDC_NO_DEPRECATE")
|
||||
list(APPEND ZLIB_DEFINITIONS "-D_CRT_SECURE_NO_DEPRECATE")
|
||||
list(APPEND ZLIB_DEFINITIONS "-D_CRT_NONSTDC_NO_WARNINGS")
|
||||
|
||||
#Character Set, CharacterSet="0", Not Set, ASCII/SBCS (Single Byte Character Set)
|
||||
list(APPEND ZLIB_DEFINITIONS "-D_SBCS")
|
||||
|
||||
#switch on the WINAPI (STDCALL) convention
|
||||
#list(APPEND ZLIB_DEFINITIONS "-DZLIB_WINAPI")
|
||||
#unused
|
||||
#list(APPEND ZLIB_DEFINITIONS "-DASMV")
|
||||
#machine dependent optimization
|
||||
#list(APPEND ZLIB_DEFINITIONS "-DASMINF")
|
||||
|
||||
#Inline Function Expansion, only __inline /Ob1
|
||||
list(APPEND ZLIB_CFLAGS $<$<CONFIG:Release>:/Ob1>)
|
||||
#Omit Frame Pointers, Yes /Oy
|
||||
list(APPEND ZLIB_CFLAGS $<$<CONFIG:Release>:/Oy>)
|
||||
|
||||
#Enable String Pooling /GF
|
||||
list(APPEND ZLIB_CFLAGS "/GF")
|
||||
#Buffer Security Check, No /GS-
|
||||
list(APPEND ZLIB_CFLAGS "/GS-")
|
||||
#Enable Function-Level Linking /Gy
|
||||
list(APPEND ZLIB_CFLAGS "/Gy")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
set(OFLAGS "-O4" "-O3" "-O2" "-O")
|
||||
set(OFLAGS_SUPPORTED)
|
||||
ADD_FIRST_SUPPORTED_CFLAG(OFLAGS OFLAGS_SUPPORTED)
|
||||
list(APPEND ZLIB_CFLAGS $<$<CONFIG:Release>:${OFLAGS_SUPPORTED}>)
|
||||
|
||||
set(DFLAGS "-Wall" "-Wextra" "-Wcast-qual" "-pedantic")
|
||||
set(DFLAGS_SUPPORTED)
|
||||
ADD_SUPPORTED_CFLAGS(DFLAGS DFLAGS_SUPPORTED)
|
||||
list(APPEND ZLIB_CFLAGS $<$<CONFIG:Debug>:${DFLAGS_SUPPORTED}>)
|
||||
|
||||
endif()
|
||||
|
||||
ADD_INTERNAL_DEFINITIONS(ZLIB_DEFINITIONS)
|
||||
ADD_INTERNAL_CFLAGS(ZLIB_CFLAGS)
|
||||
|
||||
#unused
|
||||
#list(APPEND ZLIB_DEFINITIONS "-DZLIB_CONST")
|
||||
|
||||
list(APPEND ZLIB_DEFINITIONS "-DNO_GZIP")
|
||||
#list(APPEND ZLIB_INCLUDE_DIRS "${ZLIB_DIR}")
|
||||
|
||||
source_group("Source Files" FILES ${ZLIB_SOURCES})
|
||||
source_group("Header Files" FILES ${ZLIB_HEADERS})
|
||||
|
||||
add_library(${ZLIB_TARGET} STATIC ${ZLIB_SOURCES} ${ZLIB_HEADERS})
|
||||
|
||||
target_compile_definitions(${ZLIB_TARGET} PRIVATE ${ZLIB_DEFINITIONS})
|
||||
|
||||
target_include_directories(${ZLIB_TARGET} PRIVATE ${ZLIB_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${ZLIB_TARGET} PRIVATE ${ZLIB_CFLAGS})
|
||||
|
||||
set(INTERNAL_ZLIB_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_ZLIB_INCLUDE_DIRS "${ZLIB_DIR}" PARENT_SCOPE)
|
||||
set(INTERNAL_ZLIB_LIBRARIES "${ZLIB_TARGET}" PARENT_SCOPE)
|
14
misc/CMakeLists/qvm/CMakeLists.txt
Normal file
14
misc/CMakeLists/qvm/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
project("qvm")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
|
||||
set(BASEGAME "${DEFAULT_BASEGAME}" CACHE STRING "")
|
||||
set(MISSIONPACK "${DEFAULT_MISSIONPACK}" CACHE STRING "")
|
||||
|
||||
add_subdirectory("${BASEGAME}")
|
||||
add_subdirectory("${MISSIONPACK}")
|
29
misc/CMakeLists/qvm/baseq3/CMakeLists.txt
Normal file
29
misc/CMakeLists/qvm/baseq3/CMakeLists.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
project("basegame qvm")
|
||||
|
||||
add_subdirectory("cgame")
|
||||
add_subdirectory("game")
|
||||
add_subdirectory("ui")
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.3.0")
|
||||
|
||||
get_target_property(CGAME_FILENAME ${BASE_CGAME_QVM_TARGET} QVM_FILENAME)
|
||||
get_target_property(GAME_FILENAME ${BASE_GAME_QVM_TARGET} QVM_FILENAME)
|
||||
get_target_property(UI_FILENAME ${BASE_UI_QVM_TARGET} QVM_FILENAME)
|
||||
|
||||
set(BASE_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/basegame")
|
||||
set(PK3_FILENAME "basegame_qvm.pk3")
|
||||
set(PK3_FILE "${BASE_DIR}/${PK3_FILENAME}")
|
||||
|
||||
add_custom_target(dist_basegame_qvm
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir "${BASE_DIR}"
|
||||
tar "cfv" "${PK3_FILE}" --format=zip
|
||||
"vm/${CGAME_FILENAME}"
|
||||
"vm/${GAME_FILENAME}"
|
||||
"vm/${UI_FILENAME}"
|
||||
DEPENDS "${BASE_DIR}/vm/${CGAME_FILENAME}"
|
||||
"${BASE_DIR}/vm/${GAME_FILENAME}"
|
||||
"${BASE_DIR}/vm/${UI_FILENAME}"
|
||||
COMMENT ${PK3_FILE}
|
||||
)
|
||||
|
||||
endif()
|
164
misc/CMakeLists/qvm/baseq3/cgame/CMakeLists.txt
Normal file
164
misc/CMakeLists/qvm/baseq3/cgame/CMakeLists.txt
Normal file
|
@ -0,0 +1,164 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("basegame cgame qvm")
|
||||
|
||||
set(BASE_CGAME_QVM_TARGET "basegame_cgame_qvm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
option(VQ3_COMPATIBLE_QVM "Produce a qvm file compatible with Q3 1.32b" ${DEFAULT_VQ3_COMPATIBLE_QVM})
|
||||
|
||||
set(BASEGAME_QVM_INSTALL_DIR "${DEFAULT_BASEGAME_QVM_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
#*_main.c has to be the first for vmMain in qvms
|
||||
set(CGAME_SOURCES
|
||||
"${CGAME_DIR}/cg_main.c"
|
||||
|
||||
"${CGAME_DIR}/cg_consolecmds.c"
|
||||
"${CGAME_DIR}/cg_draw.c"
|
||||
"${CGAME_DIR}/cg_drawtools.c"
|
||||
"${CGAME_DIR}/cg_effects.c"
|
||||
"${CGAME_DIR}/cg_ents.c"
|
||||
"${CGAME_DIR}/cg_event.c"
|
||||
"${CGAME_DIR}/cg_info.c"
|
||||
"${CGAME_DIR}/cg_localents.c"
|
||||
|
||||
"${CGAME_DIR}/cg_marks.c"
|
||||
"${CGAME_DIR}/cg_particles.c"
|
||||
"${CGAME_DIR}/cg_players.c"
|
||||
"${CGAME_DIR}/cg_playerstate.c"
|
||||
"${CGAME_DIR}/cg_predict.c"
|
||||
"${CGAME_DIR}/cg_scoreboard.c"
|
||||
"${CGAME_DIR}/cg_servercmds.c"
|
||||
"${CGAME_DIR}/cg_snapshot.c"
|
||||
"${CGAME_DIR}/cg_view.c"
|
||||
"${CGAME_DIR}/cg_weapons.c"
|
||||
|
||||
# "${CGAME_DIR}/cg_syscalls.c"
|
||||
)
|
||||
set(CGAME_HEADERS
|
||||
"${CGAME_DIR}/cg_local.h"
|
||||
"${CGAME_DIR}/cg_public.h"
|
||||
)
|
||||
set(CGAME_ASM_SOURCES
|
||||
"${CGAME_DIR}/cg_syscalls.asm"
|
||||
)
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_pmove.c"
|
||||
"${GAME_DIR}/bg_slidemove.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
list(APPEND CGAME_DEFINITIONS "-DCGAME")
|
||||
list(APPEND CGAME_DEFINITIONS "-DQ3_VM")
|
||||
|
||||
list(APPEND CGAME_C_SOURCES ${CGAME_SOURCES} ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND CGAME_C_HEADERS ${CGAME_HEADERS} ${GAME_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("cgame\\Source Files" FILES ${CGAME_SOURCES})
|
||||
source_group("cgame\\Header Files" FILES ${CGAME_HEADERS})
|
||||
source_group("cgame" FILES ${CGAME_ASM_SOURCES})
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
set(QVM_FILENAME "cgame.qvm")
|
||||
set(QVM_FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/basegame/vm/${QVM_FILENAME}")
|
||||
|
||||
set(ASM_BDIR "${CMAKE_CURRENT_BINARY_DIR}/asm")
|
||||
file(MAKE_DIRECTORY "${ASM_BDIR}")
|
||||
|
||||
set(CGAME_ASM_FILES)
|
||||
|
||||
set(Q3CPP_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
set(Q3LCC_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
|
||||
foreach(SOURCE ${CGAME_C_SOURCES})
|
||||
get_filename_component(BASE_FILENAME "${SOURCE}" NAME_WE)
|
||||
set(ASM_FILENAME "${ASM_BDIR}/${BASE_FILENAME}.asm")
|
||||
|
||||
add_custom_command(OUTPUT "${ASM_FILENAME}"
|
||||
COMMAND "$<TARGET_FILE:${Q3LCC_TARGET}>" ARGS ${Q3LCC_OPTIIONS} ${Q3LCC_VERBOSE_OPTION} ${CGAME_DEFINITIONS} -o "${ASM_FILENAME}" "${SOURCE}" -Wo-lrccdir=$<TARGET_FILE_DIR:${Q3RCC_TARGET}> -Wo-lcppdir=$<TARGET_FILE_DIR:${Q3CPP_TARGET}> -I${CGAME_DIR} -I${GAME_DIR} -I${QCOMMON_DIR}
|
||||
DEPENDS ${Q3LCC_TARGET} ${Q3RCC_TARGET} ${Q3CPP_TARGET} ${SOURCE}
|
||||
)
|
||||
list(APPEND CGAME_ASM_FILES "${ASM_FILENAME}")
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE ${CGAME_ASM_SOURCES})
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
set(SOURCES ${CGAME_ASM_FILES} ${CGAME_ASM_SOURCES})
|
||||
|
||||
if(VQ3_COMPATIBLE_QVM)
|
||||
set(VQ3_OPTION "-vq3")
|
||||
endif(VQ3_COMPATIBLE_QVM)
|
||||
|
||||
add_custom_command(OUTPUT "${QVM_FILE}"
|
||||
COMMAND "$<TARGET_FILE:${Q3ASM_TARGET}>" ${Q3CPP_OPTIIONS} ${Q3CPP_VERBOSE_OPTION} ${VQ3_OPTION} -o "${QVM_FILE}" ${SOURCES}
|
||||
DEPENDS ${Q3ASM_TARGET} ${SOURCES}
|
||||
)
|
||||
|
||||
add_custom_target(${BASE_CGAME_QVM_TARGET} ALL
|
||||
DEPENDS "${QVM_FILE}"
|
||||
SOURCES ${CGAME_C_SOURCES} ${CGAME_C_HEADERS}
|
||||
)
|
||||
set_target_properties(${BASE_CGAME_QVM_TARGET} PROPERTIES QVM_FILENAME "${QVM_FILENAME}")
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(BASEGAME_QVM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${BASEGAME_QVM_INSTALL_DIR}")
|
||||
endif(BASEGAME_QVM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(FILES "${QVM_FILE}"
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT basegame_qvm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
231
misc/CMakeLists/qvm/baseq3/game/CMakeLists.txt
Normal file
231
misc/CMakeLists/qvm/baseq3/game/CMakeLists.txt
Normal file
|
@ -0,0 +1,231 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("basegame game qvm")
|
||||
|
||||
set(BASE_GAME_QVM_TARGET "basegame_game_qvm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
option(VQ3_COMPATIBLE_QVM "Produce a qvm file compatible with Q3 1.32b" ${DEFAULT_VQ3_COMPATIBLE_QVM})
|
||||
|
||||
set(BASEGAME_QVM_INSTALL_DIR "${DEFAULT_BASEGAME_QVM_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
set(BOTLIB_HEADERS
|
||||
"${BOTLIB_DIR}/aasfile.h"
|
||||
"${BOTLIB_DIR}/be_aas.h"
|
||||
"${BOTLIB_DIR}/be_aas_bsp.h"
|
||||
"${BOTLIB_DIR}/be_aas_cluster.h"
|
||||
"${BOTLIB_DIR}/be_aas_debug.h"
|
||||
"${BOTLIB_DIR}/be_aas_def.h"
|
||||
"${BOTLIB_DIR}/be_aas_entity.h"
|
||||
"${BOTLIB_DIR}/be_aas_file.h"
|
||||
"${BOTLIB_DIR}/be_aas_funcs.h"
|
||||
"${BOTLIB_DIR}/be_aas_main.h"
|
||||
"${BOTLIB_DIR}/be_aas_move.h"
|
||||
"${BOTLIB_DIR}/be_aas_optimize.h"
|
||||
"${BOTLIB_DIR}/be_aas_reach.h"
|
||||
"${BOTLIB_DIR}/be_aas_route.h"
|
||||
"${BOTLIB_DIR}/be_aas_routealt.h"
|
||||
"${BOTLIB_DIR}/be_aas_sample.h"
|
||||
"${BOTLIB_DIR}/be_ai_char.h"
|
||||
"${BOTLIB_DIR}/be_ai_chat.h"
|
||||
"${BOTLIB_DIR}/be_ai_gen.h"
|
||||
"${BOTLIB_DIR}/be_ai_goal.h"
|
||||
"${BOTLIB_DIR}/be_ai_move.h"
|
||||
"${BOTLIB_DIR}/be_ai_weap.h"
|
||||
"${BOTLIB_DIR}/be_ai_weight.h"
|
||||
"${BOTLIB_DIR}/be_ea.h"
|
||||
"${BOTLIB_DIR}/be_interface.h"
|
||||
"${BOTLIB_DIR}/botlib.h"
|
||||
"${BOTLIB_DIR}/l_crc.h"
|
||||
"${BOTLIB_DIR}/l_libvar.h"
|
||||
"${BOTLIB_DIR}/l_log.h"
|
||||
"${BOTLIB_DIR}/l_memory.h"
|
||||
"${BOTLIB_DIR}/l_precomp.h"
|
||||
"${BOTLIB_DIR}/l_script.h"
|
||||
"${BOTLIB_DIR}/l_struct.h"
|
||||
"${BOTLIB_DIR}/l_utils.h"
|
||||
)
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/g_main.c"
|
||||
|
||||
"${GAME_DIR}/ai_chat.c"
|
||||
"${GAME_DIR}/ai_cmd.c"
|
||||
"${GAME_DIR}/ai_dmnet.c"
|
||||
"${GAME_DIR}/ai_dmq3.c"
|
||||
"${GAME_DIR}/ai_main.c"
|
||||
"${GAME_DIR}/ai_team.c"
|
||||
"${GAME_DIR}/ai_vcmd.c"
|
||||
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_pmove.c"
|
||||
"${GAME_DIR}/bg_slidemove.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
|
||||
"${GAME_DIR}/g_active.c"
|
||||
"${GAME_DIR}/g_arenas.c"
|
||||
"${GAME_DIR}/g_bot.c"
|
||||
"${GAME_DIR}/g_client.c"
|
||||
"${GAME_DIR}/g_cmds.c"
|
||||
"${GAME_DIR}/g_combat.c"
|
||||
"${GAME_DIR}/g_items.c"
|
||||
|
||||
"${GAME_DIR}/g_mem.c"
|
||||
"${GAME_DIR}/g_misc.c"
|
||||
"${GAME_DIR}/g_missile.c"
|
||||
"${GAME_DIR}/g_mover.c"
|
||||
"${GAME_DIR}/g_session.c"
|
||||
"${GAME_DIR}/g_spawn.c"
|
||||
"${GAME_DIR}/g_svcmds.c"
|
||||
"${GAME_DIR}/g_target.c"
|
||||
"${GAME_DIR}/g_team.c"
|
||||
"${GAME_DIR}/g_trigger.c"
|
||||
"${GAME_DIR}/g_utils.c"
|
||||
"${GAME_DIR}/g_weapon.c"
|
||||
|
||||
# "${GAME_DIR}/g_syscalls.c"
|
||||
)
|
||||
set(GAME_ASM_SOURCES
|
||||
"${GAME_DIR}/g_syscalls.asm"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/ai_chat.h"
|
||||
"${GAME_DIR}/ai_cmd.h"
|
||||
"${GAME_DIR}/ai_dmnet.h"
|
||||
"${GAME_DIR}/ai_dmq3.h"
|
||||
"${GAME_DIR}/ai_main.h"
|
||||
"${GAME_DIR}/ai_team.h"
|
||||
"${GAME_DIR}/ai_vcmd.h"
|
||||
"${GAME_DIR}/chars.h"
|
||||
"${GAME_DIR}/inv.h"
|
||||
"${GAME_DIR}/match.h"
|
||||
"${GAME_DIR}/syn.h"
|
||||
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
|
||||
"${GAME_DIR}/g_local.h"
|
||||
"${GAME_DIR}/g_public.h"
|
||||
|
||||
"${GAME_DIR}/g_team.h"
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
list(APPEND GAME_DEFINITIONS "-DQAGAME")
|
||||
list(APPEND GAME_DEFINITIONS "-DQ3_VM")
|
||||
|
||||
#todo use add_custom_command with VERBATIM to get quotation marks working?
|
||||
#-DPRODUCT_DATE="Nov 28 2021" still creates a q3lcc error cause of the blank char
|
||||
if(FALSE AND DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
string(TIMESTAMP PRODUCT_DATE "%b %d %Y" UTC) #Nov 28 2021
|
||||
list(APPEND GAME_DEFINITIONS "-DPRODUCT_DATE=\"${PRODUCT_DATE}\"")
|
||||
else()
|
||||
message(WARNING "Update CMake to version 3.8 or later for SOURCE_DATE_EPOCH support!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND GAME_C_SOURCES ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND GAME_C_HEADERS ${GAME_HEADERS} ${QCOMMON_HEADERS} ${BOTLIB_HEADERS})
|
||||
|
||||
source_group("botlib\\Header Files" FILES ${BOTLIB_HEADERS})
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("game" FILES ${GAME_ASM_SOURCES})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
set(QVM_FILENAME "qagame.qvm")
|
||||
set(QVM_FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/basegame/vm/${QVM_FILENAME}")
|
||||
|
||||
set(ASM_BDIR "${CMAKE_CURRENT_BINARY_DIR}/asm")
|
||||
file(MAKE_DIRECTORY "${ASM_BDIR}")
|
||||
|
||||
set(GAME_ASM_FILES)
|
||||
|
||||
set(Q3CPP_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
set(Q3LCC_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
|
||||
foreach(SOURCE ${GAME_C_SOURCES})
|
||||
get_filename_component(BASE_FILENAME "${SOURCE}" NAME_WE)
|
||||
set(ASM_FILENAME "${ASM_BDIR}/${BASE_FILENAME}.asm")
|
||||
|
||||
add_custom_command(OUTPUT "${ASM_FILENAME}"
|
||||
COMMAND "$<TARGET_FILE:${Q3LCC_TARGET}>" ARGS ${Q3LCC_OPTIIONS} ${Q3LCC_VERBOSE_OPTION} ${GAME_DEFINITIONS} -o "${ASM_FILENAME}" "${SOURCE}" -Wo-lrccdir=$<TARGET_FILE_DIR:${Q3RCC_TARGET}> -Wo-lcppdir=$<TARGET_FILE_DIR:${Q3CPP_TARGET}> -I${BOTLIB_DIR} -I${GAME_DIR} -I${QCOMMON_DIR}
|
||||
DEPENDS ${Q3LCC_TARGET} ${Q3RCC_TARGET} ${Q3CPP_TARGET} ${SOURCE}
|
||||
)
|
||||
list(APPEND GAME_ASM_FILES "${ASM_FILENAME}")
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE ${GAME_ASM_SOURCES})
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
set(SOURCES ${GAME_ASM_FILES} ${GAME_ASM_SOURCES})
|
||||
|
||||
if(VQ3_COMPATIBLE_QVM)
|
||||
set(VQ3_OPTION "-vq3")
|
||||
endif(VQ3_COMPATIBLE_QVM)
|
||||
|
||||
add_custom_command(OUTPUT "${QVM_FILE}"
|
||||
COMMAND "$<TARGET_FILE:${Q3ASM_TARGET}>" ${Q3CPP_OPTIIONS} ${Q3CPP_VERBOSE_OPTION} ${VQ3_OPTION} -o "${QVM_FILE}" ${SOURCES}
|
||||
DEPENDS ${Q3ASM_TARGET} ${SOURCES}
|
||||
)
|
||||
|
||||
add_custom_target(${BASE_GAME_QVM_TARGET} ALL
|
||||
DEPENDS "${QVM_FILE}"
|
||||
SOURCES ${GAME_C_SOURCES} ${GAME_C_HEADERS}
|
||||
)
|
||||
set_target_properties(${BASE_GAME_QVM_TARGET} PROPERTIES QVM_FILENAME "${QVM_FILENAME}")
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(BASEGAME_QVM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${BASEGAME_QVM_INSTALL_DIR}")
|
||||
endif(BASEGAME_QVM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(FILES "${QVM_FILE}"
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT basegame_qvm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
189
misc/CMakeLists/qvm/baseq3/ui/CMakeLists.txt
Normal file
189
misc/CMakeLists/qvm/baseq3/ui/CMakeLists.txt
Normal file
|
@ -0,0 +1,189 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("basegame ui qvm")
|
||||
|
||||
set(BASE_UI_QVM_TARGET "basegame_ui_qvm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
option(VQ3_COMPATIBLE_QVM "Produce a qvm file compatible with Q3 1.32b" ${DEFAULT_VQ3_COMPATIBLE_QVM})
|
||||
|
||||
set(BASEGAME_QVM_INSTALL_DIR "${DEFAULT_BASEGAME_QVM_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
)
|
||||
set(Q3_UI_SOURCES
|
||||
"${Q3_UI_DIR}/ui_main.c"
|
||||
|
||||
"${Q3_UI_DIR}/ui_addbots.c"
|
||||
"${Q3_UI_DIR}/ui_atoms.c"
|
||||
"${Q3_UI_DIR}/ui_cdkey.c"
|
||||
"${Q3_UI_DIR}/ui_cinematics.c"
|
||||
"${Q3_UI_DIR}/ui_confirm.c"
|
||||
"${Q3_UI_DIR}/ui_connect.c"
|
||||
"${Q3_UI_DIR}/ui_controls2.c"
|
||||
"${Q3_UI_DIR}/ui_credits.c"
|
||||
"${Q3_UI_DIR}/ui_demo2.c"
|
||||
"${Q3_UI_DIR}/ui_display.c"
|
||||
"${Q3_UI_DIR}/ui_gameinfo.c"
|
||||
"${Q3_UI_DIR}/ui_ingame.c"
|
||||
"${Q3_UI_DIR}/ui_loadconfig.c"
|
||||
|
||||
"${Q3_UI_DIR}/ui_menu.c"
|
||||
"${Q3_UI_DIR}/ui_mfield.c"
|
||||
"${Q3_UI_DIR}/ui_mods.c"
|
||||
"${Q3_UI_DIR}/ui_network.c"
|
||||
"${Q3_UI_DIR}/ui_options.c"
|
||||
"${Q3_UI_DIR}/ui_playermodel.c"
|
||||
"${Q3_UI_DIR}/ui_players.c"
|
||||
"${Q3_UI_DIR}/ui_playersettings.c"
|
||||
"${Q3_UI_DIR}/ui_preferences.c"
|
||||
"${Q3_UI_DIR}/ui_qmenu.c"
|
||||
"${Q3_UI_DIR}/ui_removebots.c"
|
||||
"${Q3_UI_DIR}/ui_saveconfig.c"
|
||||
"${Q3_UI_DIR}/ui_serverinfo.c"
|
||||
"${Q3_UI_DIR}/ui_servers2.c"
|
||||
"${Q3_UI_DIR}/ui_setup.c"
|
||||
"${Q3_UI_DIR}/ui_sound.c"
|
||||
"${Q3_UI_DIR}/ui_sparena.c"
|
||||
"${Q3_UI_DIR}/ui_specifyserver.c"
|
||||
"${Q3_UI_DIR}/ui_splevel.c"
|
||||
"${Q3_UI_DIR}/ui_sppostgame.c"
|
||||
"${Q3_UI_DIR}/ui_spskill.c"
|
||||
"${Q3_UI_DIR}/ui_startserver.c"
|
||||
"${Q3_UI_DIR}/ui_team.c"
|
||||
"${Q3_UI_DIR}/ui_teamorders.c"
|
||||
"${Q3_UI_DIR}/ui_video.c"
|
||||
|
||||
)
|
||||
set(UI_ASM_SOURCES
|
||||
"${UI_DIR}/ui_syscalls.asm"
|
||||
)
|
||||
|
||||
set(Q3_UI_HEADERS
|
||||
"${Q3_UI_DIR}/ui_local.h"
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
set(UI_SOURCES
|
||||
|
||||
)
|
||||
set(UI_HEADERS
|
||||
|
||||
)
|
||||
|
||||
list(APPEND UI_DEFINITIONS "-DUI")
|
||||
list(APPEND UI_DEFINITIONS "-DQ3_VM")
|
||||
|
||||
list(APPEND UI_C_SOURCES ${Q3_UI_SOURCES} ${UI_SOURCES} ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND UI_C_HEADERS ${Q3_UI_HEADERS} ${UI_HEADERS} ${GAME_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("q3_ui\\Source Files" FILES ${Q3_UI_SOURCES})
|
||||
source_group("q3_ui\\Header Files" FILES ${Q3_UI_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
source_group("ui\\Source Files" FILES ${UI_SOURCES})
|
||||
source_group("ui\\Header Files" FILES ${UI_HEADERS})
|
||||
source_group("ui" FILES ${UI_ASM_SOURCES})
|
||||
|
||||
set(QVM_FILENAME "ui.qvm")
|
||||
set(QVM_FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/basegame/vm/${QVM_FILENAME}")
|
||||
|
||||
set(ASM_BDIR "${CMAKE_CURRENT_BINARY_DIR}/asm")
|
||||
file(MAKE_DIRECTORY "${ASM_BDIR}")
|
||||
|
||||
set(UI_ASM_FILES)
|
||||
|
||||
set(Q3CPP_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
set(Q3LCC_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
|
||||
foreach(SOURCE ${UI_C_SOURCES})
|
||||
get_filename_component(BASE_FILENAME "${SOURCE}" NAME_WE)
|
||||
set(ASM_FILENAME "${ASM_BDIR}/${BASE_FILENAME}.asm")
|
||||
|
||||
add_custom_command(OUTPUT "${ASM_FILENAME}"
|
||||
COMMAND "$<TARGET_FILE:${Q3LCC_TARGET}>" ARGS ${Q3LCC_OPTIIONS} ${Q3LCC_VERBOSE_OPTION} ${UI_DEFINITIONS} -o "${ASM_FILENAME}" "${SOURCE}" -Wo-lrccdir=$<TARGET_FILE_DIR:${Q3RCC_TARGET}> -Wo-lcppdir=$<TARGET_FILE_DIR:${Q3CPP_TARGET}> -I${UI_DIR} -I${GAME_DIR} -I${QCOMMON_DIR}
|
||||
DEPENDS ${Q3LCC_TARGET} ${Q3RCC_TARGET} ${Q3CPP_TARGET} ${SOURCE}
|
||||
)
|
||||
list(APPEND UI_ASM_FILES "${ASM_FILENAME}")
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE ${UI_ASM_SOURCES})
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
set(SOURCES ${UI_ASM_FILES} ${UI_ASM_SOURCES})
|
||||
|
||||
if(VQ3_COMPATIBLE_QVM)
|
||||
set(VQ3_OPTION "-vq3")
|
||||
endif(VQ3_COMPATIBLE_QVM)
|
||||
|
||||
add_custom_command(OUTPUT "${QVM_FILE}"
|
||||
COMMAND "$<TARGET_FILE:${Q3ASM_TARGET}>" ${Q3CPP_OPTIIONS} ${Q3CPP_VERBOSE_OPTION} ${VQ3_OPTION} -o "${QVM_FILE}" ${SOURCES}
|
||||
DEPENDS ${Q3ASM_TARGET} ${SOURCES}
|
||||
)
|
||||
|
||||
add_custom_target(${BASE_UI_QVM_TARGET} ALL
|
||||
DEPENDS "${QVM_FILE}"
|
||||
SOURCES ${UI_C_SOURCES} ${UI_C_HEADERS}
|
||||
)
|
||||
set_target_properties(${BASE_UI_QVM_TARGET} PROPERTIES QVM_FILENAME "${QVM_FILENAME}")
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(BASEGAME_QVM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${BASEGAME_QVM_INSTALL_DIR}")
|
||||
endif(BASEGAME_QVM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(FILES "${QVM_FILE}"
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT basegame_qvm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
29
misc/CMakeLists/qvm/missionpack/CMakeLists.txt
Normal file
29
misc/CMakeLists/qvm/missionpack/CMakeLists.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
project("missionpack qvm")
|
||||
|
||||
add_subdirectory("cgame")
|
||||
add_subdirectory("game")
|
||||
add_subdirectory("ui")
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.3.0")
|
||||
|
||||
get_target_property(CGAME_FILENAME ${MISSION_CGAME_QVM_TARGET} QVM_FILENAME)
|
||||
get_target_property(GAME_FILENAME ${MISSION_GAME_QVM_TARGET} QVM_FILENAME)
|
||||
get_target_property(UI_FILENAME ${MISSION_UI_QVM_TARGET} QVM_FILENAME)
|
||||
|
||||
set(MISSION_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/missionpack")
|
||||
set(PK3_FILENAME "missionpack_qvm.pk3")
|
||||
set(PK3_FILE "${MISSION_DIR}/${PK3_FILENAME}")
|
||||
|
||||
add_custom_target(dist_missionpack_qvm
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir "${MISSION_DIR}"
|
||||
tar "cfv" "${PK3_FILE}" --format=zip
|
||||
"vm/${CGAME_FILENAME}"
|
||||
"vm/${GAME_FILENAME}"
|
||||
"vm/${UI_FILENAME}"
|
||||
DEPENDS "${MISSION_DIR}/vm/${CGAME_FILENAME}"
|
||||
"${MISSION_DIR}/vm/${GAME_FILENAME}"
|
||||
"${MISSION_DIR}/vm/${UI_FILENAME}"
|
||||
COMMENT ${PK3_FILE}
|
||||
)
|
||||
|
||||
endif()
|
173
misc/CMakeLists/qvm/missionpack/cgame/CMakeLists.txt
Normal file
173
misc/CMakeLists/qvm/missionpack/cgame/CMakeLists.txt
Normal file
|
@ -0,0 +1,173 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("missionpack cgame qvm")
|
||||
|
||||
set(MISSION_CGAME_QVM_TARGET "missionpack_cgame_qvm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
option(VQ3_COMPATIBLE_QVM "Produce a qvm file compatible with Q3 1.32b" ${DEFAULT_VQ3_COMPATIBLE_QVM})
|
||||
|
||||
set(MISSIONPACK_QVM_INSTALL_DIR "${DEFAULT_MISSIONPACK_QVM_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
set(CGAME_SOURCES
|
||||
"${CGAME_DIR}/cg_main.c"
|
||||
|
||||
"${CGAME_DIR}/cg_consolecmds.c"
|
||||
"${CGAME_DIR}/cg_draw.c"
|
||||
"${CGAME_DIR}/cg_drawtools.c"
|
||||
"${CGAME_DIR}/cg_effects.c"
|
||||
"${CGAME_DIR}/cg_ents.c"
|
||||
"${CGAME_DIR}/cg_event.c"
|
||||
"${CGAME_DIR}/cg_info.c"
|
||||
"${CGAME_DIR}/cg_localents.c"
|
||||
|
||||
"${CGAME_DIR}/cg_marks.c"
|
||||
"${CGAME_DIR}/cg_newdraw.c"
|
||||
"${CGAME_DIR}/cg_particles.c"
|
||||
"${CGAME_DIR}/cg_players.c"
|
||||
"${CGAME_DIR}/cg_playerstate.c"
|
||||
"${CGAME_DIR}/cg_predict.c"
|
||||
"${CGAME_DIR}/cg_scoreboard.c"
|
||||
"${CGAME_DIR}/cg_servercmds.c"
|
||||
"${CGAME_DIR}/cg_snapshot.c"
|
||||
"${CGAME_DIR}/cg_view.c"
|
||||
"${CGAME_DIR}/cg_weapons.c"
|
||||
|
||||
# "${CGAME_DIR}/cg_syscalls.c"
|
||||
)
|
||||
set(CGAME_ASM_SOURCES
|
||||
"${CGAME_DIR}/cg_syscalls.asm"
|
||||
)
|
||||
set(CGAME_HEADERS
|
||||
"${CGAME_DIR}/cg_local.h"
|
||||
"${CGAME_DIR}/cg_public.h"
|
||||
)
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_pmove.c"
|
||||
"${GAME_DIR}/bg_slidemove.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
)
|
||||
set(UI_SOURCES
|
||||
"${UI_DIR}/ui_shared.c"
|
||||
)
|
||||
set(UI_HEADERS
|
||||
"${UI_DIR}/ui_shared.h"
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
list(APPEND CGAME_DEFINITIONS "-DCGAME")
|
||||
list(APPEND CGAME_DEFINITIONS "-DQ3_VM")
|
||||
list(APPEND CGAME_DEFINITIONS "-DMISSIONPACK")
|
||||
|
||||
list(APPEND CGAME_C_SOURCES ${CGAME_SOURCES} ${GAME_SOURCES} ${UI_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND CGAME_C_HEADERS ${CGAME_HEADERS} ${GAME_HEADERS} ${UI_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("cgame\\Source Files" FILES ${CGAME_SOURCES})
|
||||
source_group("cgame\\Header Files" FILES ${CGAME_HEADERS})
|
||||
source_group("cgame" FILES ${CGAME_ASM_SOURCES})
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("ui\\Source Files" FILES ${UI_SOURCES})
|
||||
source_group("ui\\Header Files" FILES ${UI_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
set(QVM_FILENAME "cgame.qvm")
|
||||
set(QVM_FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/missionpack/vm/${QVM_FILENAME}")
|
||||
|
||||
set(ASM_BDIR "${CMAKE_CURRENT_BINARY_DIR}/asm")
|
||||
file(MAKE_DIRECTORY "${ASM_BDIR}")
|
||||
|
||||
set(CGAME_ASM_FILES)
|
||||
|
||||
set(Q3CPP_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
set(Q3LCC_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
|
||||
foreach(SOURCE ${CGAME_C_SOURCES})
|
||||
get_filename_component(BASE_FILENAME "${SOURCE}" NAME_WE)
|
||||
set(ASM_FILENAME "${ASM_BDIR}/${BASE_FILENAME}.asm")
|
||||
|
||||
add_custom_command(OUTPUT "${ASM_FILENAME}"
|
||||
COMMAND "$<TARGET_FILE:${Q3LCC_TARGET}>" ARGS ${Q3LCC_OPTIIONS} ${Q3LCC_VERBOSE_OPTION} ${CGAME_DEFINITIONS} -o "${ASM_FILENAME}" "${SOURCE}" -Wo-lrccdir=$<TARGET_FILE_DIR:${Q3RCC_TARGET}> -Wo-lcppdir=$<TARGET_FILE_DIR:${Q3CPP_TARGET}> -I${CGAME_DIR} -I${GAME_DIR} -I${QCOMMON_DIR}
|
||||
DEPENDS ${Q3LCC_TARGET} ${Q3RCC_TARGET} ${Q3CPP_TARGET} ${SOURCE}
|
||||
)
|
||||
list(APPEND CGAME_ASM_FILES "${ASM_FILENAME}")
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE ${CGAME_ASM_SOURCES})
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
set(SOURCES ${CGAME_ASM_FILES} ${CGAME_ASM_SOURCES})
|
||||
|
||||
if(VQ3_COMPATIBLE_QVM)
|
||||
set(VQ3_OPTION "-vq3")
|
||||
endif(VQ3_COMPATIBLE_QVM)
|
||||
|
||||
add_custom_command(OUTPUT "${QVM_FILE}"
|
||||
COMMAND "$<TARGET_FILE:${Q3ASM_TARGET}>" ${Q3CPP_OPTIIONS} ${Q3CPP_VERBOSE_OPTION} ${VQ3_OPTION} -o "${QVM_FILE}" ${SOURCES}
|
||||
DEPENDS ${Q3ASM_TARGET} ${SOURCES}
|
||||
)
|
||||
|
||||
add_custom_target(${MISSION_CGAME_QVM_TARGET} ALL
|
||||
DEPENDS "${QVM_FILE}"
|
||||
SOURCES ${CGAME_C_SOURCES} ${CGAME_C_HEADERS}
|
||||
)
|
||||
set_target_properties(${MISSION_CGAME_QVM_TARGET} PROPERTIES QVM_FILENAME "${QVM_FILENAME}")
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(MISSIONPACK_QVM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${MISSIONPACK_QVM_INSTALL_DIR}")
|
||||
endif(MISSIONPACK_QVM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(FILES "${QVM_FILE}"
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_qvm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
232
misc/CMakeLists/qvm/missionpack/game/CMakeLists.txt
Normal file
232
misc/CMakeLists/qvm/missionpack/game/CMakeLists.txt
Normal file
|
@ -0,0 +1,232 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("missionpack game qvm")
|
||||
|
||||
set(MISSION_GAME_QVM_TARGET "missionpack_game_qvm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
option(VQ3_COMPATIBLE_QVM "Produce a qvm file compatible with Q3 1.32b" ${DEFAULT_VQ3_COMPATIBLE_QVM})
|
||||
|
||||
set(MISSIONPACK_QVM_INSTALL_DIR "${DEFAULT_MISSIONPACK_QVM_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
set(BOTLIB_HEADERS
|
||||
"${BOTLIB_DIR}/aasfile.h"
|
||||
"${BOTLIB_DIR}/be_aas.h"
|
||||
"${BOTLIB_DIR}/be_aas_bsp.h"
|
||||
"${BOTLIB_DIR}/be_aas_cluster.h"
|
||||
"${BOTLIB_DIR}/be_aas_debug.h"
|
||||
"${BOTLIB_DIR}/be_aas_def.h"
|
||||
"${BOTLIB_DIR}/be_aas_entity.h"
|
||||
"${BOTLIB_DIR}/be_aas_file.h"
|
||||
"${BOTLIB_DIR}/be_aas_funcs.h"
|
||||
"${BOTLIB_DIR}/be_aas_main.h"
|
||||
"${BOTLIB_DIR}/be_aas_move.h"
|
||||
"${BOTLIB_DIR}/be_aas_optimize.h"
|
||||
"${BOTLIB_DIR}/be_aas_reach.h"
|
||||
"${BOTLIB_DIR}/be_aas_route.h"
|
||||
"${BOTLIB_DIR}/be_aas_routealt.h"
|
||||
"${BOTLIB_DIR}/be_aas_sample.h"
|
||||
"${BOTLIB_DIR}/be_ai_char.h"
|
||||
"${BOTLIB_DIR}/be_ai_chat.h"
|
||||
"${BOTLIB_DIR}/be_ai_gen.h"
|
||||
"${BOTLIB_DIR}/be_ai_goal.h"
|
||||
"${BOTLIB_DIR}/be_ai_move.h"
|
||||
"${BOTLIB_DIR}/be_ai_weap.h"
|
||||
"${BOTLIB_DIR}/be_ai_weight.h"
|
||||
"${BOTLIB_DIR}/be_ea.h"
|
||||
"${BOTLIB_DIR}/be_interface.h"
|
||||
"${BOTLIB_DIR}/botlib.h"
|
||||
"${BOTLIB_DIR}/l_crc.h"
|
||||
"${BOTLIB_DIR}/l_libvar.h"
|
||||
"${BOTLIB_DIR}/l_log.h"
|
||||
"${BOTLIB_DIR}/l_memory.h"
|
||||
"${BOTLIB_DIR}/l_precomp.h"
|
||||
"${BOTLIB_DIR}/l_script.h"
|
||||
"${BOTLIB_DIR}/l_struct.h"
|
||||
"${BOTLIB_DIR}/l_utils.h"
|
||||
)
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/g_main.c"
|
||||
|
||||
"${GAME_DIR}/ai_chat.c"
|
||||
"${GAME_DIR}/ai_cmd.c"
|
||||
"${GAME_DIR}/ai_dmnet.c"
|
||||
"${GAME_DIR}/ai_dmq3.c"
|
||||
"${GAME_DIR}/ai_main.c"
|
||||
"${GAME_DIR}/ai_team.c"
|
||||
"${GAME_DIR}/ai_vcmd.c"
|
||||
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_pmove.c"
|
||||
"${GAME_DIR}/bg_slidemove.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
|
||||
"${GAME_DIR}/g_active.c"
|
||||
"${GAME_DIR}/g_arenas.c"
|
||||
"${GAME_DIR}/g_bot.c"
|
||||
"${GAME_DIR}/g_client.c"
|
||||
"${GAME_DIR}/g_cmds.c"
|
||||
"${GAME_DIR}/g_combat.c"
|
||||
"${GAME_DIR}/g_items.c"
|
||||
|
||||
"${GAME_DIR}/g_mem.c"
|
||||
"${GAME_DIR}/g_misc.c"
|
||||
"${GAME_DIR}/g_missile.c"
|
||||
"${GAME_DIR}/g_mover.c"
|
||||
"${GAME_DIR}/g_session.c"
|
||||
"${GAME_DIR}/g_spawn.c"
|
||||
"${GAME_DIR}/g_svcmds.c"
|
||||
"${GAME_DIR}/g_target.c"
|
||||
"${GAME_DIR}/g_team.c"
|
||||
"${GAME_DIR}/g_trigger.c"
|
||||
"${GAME_DIR}/g_utils.c"
|
||||
"${GAME_DIR}/g_weapon.c"
|
||||
|
||||
# "${GAME_DIR}/g_syscalls.c"
|
||||
)
|
||||
set(GAME_ASM_SOURCES
|
||||
"${GAME_DIR}/g_syscalls.asm"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/ai_chat.h"
|
||||
"${GAME_DIR}/ai_cmd.h"
|
||||
"${GAME_DIR}/ai_dmnet.h"
|
||||
"${GAME_DIR}/ai_dmq3.h"
|
||||
"${GAME_DIR}/ai_main.h"
|
||||
"${GAME_DIR}/ai_team.h"
|
||||
"${GAME_DIR}/ai_vcmd.h"
|
||||
"${GAME_DIR}/chars.h"
|
||||
"${GAME_DIR}/inv.h"
|
||||
"${GAME_DIR}/match.h"
|
||||
"${GAME_DIR}/syn.h"
|
||||
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
|
||||
"${GAME_DIR}/g_local.h"
|
||||
"${GAME_DIR}/g_public.h"
|
||||
|
||||
"${GAME_DIR}/g_team.h"
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
list(APPEND GAME_DEFINITIONS "-DQAGAME")
|
||||
list(APPEND GAME_DEFINITIONS "-DQ3_VM")
|
||||
list(APPEND GAME_DEFINITIONS "-DMISSIONPACK")
|
||||
|
||||
#todo use add_custom_command with VERBATIM to get quotation marks working?
|
||||
#-DPRODUCT_DATE="Nov 28 2021" still creates a q3lcc error cause of the blank char
|
||||
if(FALSE AND DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
string(TIMESTAMP PRODUCT_DATE "%b %d %Y" UTC) #Nov 28 2021
|
||||
list(APPEND GAME_DEFINITIONS "-DPRODUCT_DATE=\"${PRODUCT_DATE}\"")
|
||||
else()
|
||||
message(WARNING "Update CMake to version 3.8 or later for SOURCE_DATE_EPOCH support!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND GAME_C_SOURCES ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND GAME_C_HEADERS ${GAME_HEADERS} ${QCOMMON_HEADERS} ${BOTLIB_HEADERS})
|
||||
|
||||
source_group("botlib\\Header Files" FILES ${BOTLIB_HEADERS})
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("game" FILES ${GAME_ASM_SOURCES})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
set(QVM_FILENAME "qagame.qvm")
|
||||
set(QVM_FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/missionpack/vm/${QVM_FILENAME}")
|
||||
|
||||
set(ASM_BDIR "${CMAKE_CURRENT_BINARY_DIR}/asm")
|
||||
file(MAKE_DIRECTORY "${ASM_BDIR}")
|
||||
|
||||
set(GAME_ASM_FILES)
|
||||
|
||||
set(Q3CPP_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
set(Q3LCC_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
|
||||
foreach(SOURCE ${GAME_C_SOURCES})
|
||||
get_filename_component(BASE_FILENAME "${SOURCE}" NAME_WE)
|
||||
set(ASM_FILENAME "${ASM_BDIR}/${BASE_FILENAME}.asm")
|
||||
|
||||
add_custom_command(OUTPUT "${ASM_FILENAME}"
|
||||
COMMAND "$<TARGET_FILE:${Q3LCC_TARGET}>" ARGS ${Q3LCC_OPTIIONS} ${Q3LCC_VERBOSE_OPTION} ${GAME_DEFINITIONS} -o "${ASM_FILENAME}" "${SOURCE}" -Wo-lrccdir=$<TARGET_FILE_DIR:${Q3RCC_TARGET}> -Wo-lcppdir=$<TARGET_FILE_DIR:${Q3CPP_TARGET}> -I${BOTLIB_DIR} -I${GAME_DIR} -I${QCOMMON_DIR}
|
||||
DEPENDS ${Q3LCC_TARGET} ${Q3RCC_TARGET} ${Q3CPP_TARGET} ${SOURCE}
|
||||
)
|
||||
list(APPEND GAME_ASM_FILES "${ASM_FILENAME}")
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE ${GAME_ASM_SOURCES})
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
set(SOURCES ${GAME_ASM_FILES} ${GAME_ASM_SOURCES})
|
||||
|
||||
if(VQ3_COMPATIBLE_QVM)
|
||||
set(VQ3_OPTION "-vq3")
|
||||
endif(VQ3_COMPATIBLE_QVM)
|
||||
|
||||
add_custom_command(OUTPUT "${QVM_FILE}"
|
||||
COMMAND "$<TARGET_FILE:${Q3ASM_TARGET}>" ${Q3CPP_OPTIIONS} ${Q3CPP_VERBOSE_OPTION} ${VQ3_OPTION} -o "${QVM_FILE}" ${SOURCES}
|
||||
DEPENDS ${Q3ASM_TARGET} ${SOURCES}
|
||||
)
|
||||
|
||||
add_custom_target(${MISSION_GAME_QVM_TARGET} ALL
|
||||
DEPENDS "${QVM_FILE}"
|
||||
SOURCES ${GAME_C_SOURCES} ${GAME_C_HEADERS}
|
||||
)
|
||||
set_target_properties(${MISSION_GAME_QVM_TARGET} PROPERTIES QVM_FILENAME "${QVM_FILENAME}")
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(MISSIONPACK_QVM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${MISSIONPACK_QVM_INSTALL_DIR}")
|
||||
endif(MISSIONPACK_QVM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(FILES "${QVM_FILE}"
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_qvm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
151
misc/CMakeLists/qvm/missionpack/ui/CMakeLists.txt
Normal file
151
misc/CMakeLists/qvm/missionpack/ui/CMakeLists.txt
Normal file
|
@ -0,0 +1,151 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("missionpack ui qvm")
|
||||
|
||||
set(MISSION_UI_QVM_TARGET "missionpack_ui_qvm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
|
||||
option(VQ3_COMPATIBLE_QVM "Produce a qvm file compatible with Q3 1.32b" ${DEFAULT_VQ3_COMPATIBLE_QVM})
|
||||
|
||||
set(MISSIONPACK_QVM_INSTALL_DIR "${DEFAULT_MISSIONPACK_QVM_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
)
|
||||
set(UI_SOURCES
|
||||
"${UI_DIR}/ui_main.c"
|
||||
|
||||
"${UI_DIR}/ui_atoms.c"
|
||||
|
||||
"${UI_DIR}/ui_gameinfo.c"
|
||||
"${UI_DIR}/ui_players.c"
|
||||
"${UI_DIR}/ui_shared.c"
|
||||
|
||||
# "${UI_DIR}/ui_syscalls.c"
|
||||
)
|
||||
set(UI_ASM_SOURCES
|
||||
"${UI_DIR}/ui_syscalls.asm"
|
||||
)
|
||||
set(UI_HEADERS
|
||||
"${UI_DIR}/ui_local.h"
|
||||
"${UI_DIR}/ui_public.h"
|
||||
|
||||
"${UI_DIR}/ui_shared.h"
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
list(APPEND UI_DEFINITIONS "-DUI")
|
||||
list(APPEND UI_DEFINITIONS "-DQ3_VM")
|
||||
list(APPEND UI_DEFINITIONS "-DMISSIONPACK")
|
||||
|
||||
list(APPEND UI_C_SOURCES ${UI_SOURCES} ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND UI_C_HEADERS ${UI_HEADERS} ${GAME_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
source_group("ui\\Source Files" FILES ${UI_SOURCES})
|
||||
source_group("ui\\Header Files" FILES ${UI_HEADERS})
|
||||
source_group("ui" FILES ${UI_ASM_SOURCES})
|
||||
|
||||
set(QVM_FILENAME "ui.qvm")
|
||||
set(QVM_FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/missionpack/vm/${QVM_FILENAME}")
|
||||
|
||||
set(ASM_BDIR "${CMAKE_CURRENT_BINARY_DIR}/asm")
|
||||
file(MAKE_DIRECTORY "${ASM_BDIR}")
|
||||
|
||||
set(UI_ASM_FILES)
|
||||
|
||||
set(Q3CPP_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
set(Q3LCC_VERBOSE_OPTION $<$<CONFIG:Debug>:-v>)
|
||||
|
||||
foreach(SOURCE ${UI_C_SOURCES})
|
||||
get_filename_component(BASE_FILENAME "${SOURCE}" NAME_WE)
|
||||
set(ASM_FILENAME "${ASM_BDIR}/${BASE_FILENAME}.asm")
|
||||
|
||||
add_custom_command(OUTPUT "${ASM_FILENAME}"
|
||||
COMMAND "$<TARGET_FILE:${Q3LCC_TARGET}>" ARGS ${Q3LCC_OPTIIONS} ${Q3LCC_VERBOSE_OPTION} ${UI_DEFINITIONS} -o "${ASM_FILENAME}" "${SOURCE}" -Wo-lrccdir=$<TARGET_FILE_DIR:${Q3RCC_TARGET}> -Wo-lcppdir=$<TARGET_FILE_DIR:${Q3CPP_TARGET}> -I${UI_DIR} -I${GAME_DIR} -I${QCOMMON_DIR}
|
||||
DEPENDS ${Q3LCC_TARGET} ${Q3RCC_TARGET} ${Q3CPP_TARGET} ${SOURCE}
|
||||
)
|
||||
list(APPEND UI_ASM_FILES "${ASM_FILENAME}")
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE ${UI_ASM_SOURCES})
|
||||
set_source_files_properties("${SOURCE}" PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
|
||||
set(SOURCES ${UI_ASM_FILES} ${UI_ASM_SOURCES})
|
||||
|
||||
if(VQ3_COMPATIBLE_QVM)
|
||||
set(VQ3_OPTION "-vq3")
|
||||
endif(VQ3_COMPATIBLE_QVM)
|
||||
|
||||
add_custom_command(OUTPUT "${QVM_FILE}"
|
||||
COMMAND "$<TARGET_FILE:${Q3ASM_TARGET}>" ${Q3CPP_OPTIIONS} ${Q3CPP_VERBOSE_OPTION} ${VQ3_OPTION} -o "${QVM_FILE}" ${SOURCES}
|
||||
DEPENDS ${Q3ASM_TARGET} ${SOURCES}
|
||||
)
|
||||
|
||||
add_custom_target(${MISSION_UI_QVM_TARGET} ALL
|
||||
DEPENDS "${QVM_FILE}"
|
||||
SOURCES ${UI_C_SOURCES} ${UI_C_HEADERS}
|
||||
)
|
||||
set_target_properties(${MISSION_UI_QVM_TARGET} PROPERTIES QVM_FILENAME "${QVM_FILENAME}")
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(MISSIONPACK_QVM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${MISSIONPACK_QVM_INSTALL_DIR}")
|
||||
endif(MISSIONPACK_QVM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(FILES "${QVM_FILE}"
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_qvm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
422
misc/CMakeLists/renderergl1/CMakeLists.txt
Normal file
422
misc/CMakeLists/renderergl1/CMakeLists.txt
Normal file
|
@ -0,0 +1,422 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("renderer opengl1")
|
||||
|
||||
set(RENDERERGL1_TARGET "renderer_opengl1")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
option(USE_INTERNAL_LIBS "Use internal libraries (Ogg,Vorbis,Opus,zlib,JPEG,...)" ${DEFAULT_USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_JPEG "Use internal JPEG library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_SDL "Use internal SDL library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_LOCAL_HEADERS "Use local headers" ${USE_INTERNAL_LIBS})
|
||||
|
||||
option(USE_RENDERER_DLOPEN "Use renderer dynamic library opening" ${DEFAULT_USE_RENDERER_DLOPEN})
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(REL_INSTALL_DEST "${DEFAULT_REL_INSTALL_DEST}" CACHE PATH "Relative installation destination")
|
||||
set(INSTALL_DIR "${DEFAULT_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
include("${CMAKELIST_DIR}/include/libsdl_headers.cmake")
|
||||
|
||||
set(QCOMMON_SOURCES
|
||||
# "${QCOMMON_DIR}/cm_load.c"
|
||||
# "${QCOMMON_DIR}/cm_patch.c"
|
||||
# "${QCOMMON_DIR}/cm_polylib.c"
|
||||
# "${QCOMMON_DIR}/cm_test.c"
|
||||
# "${QCOMMON_DIR}/cm_trace.c"
|
||||
# "${QCOMMON_DIR}/cmd.c"
|
||||
# "${QCOMMON_DIR}/common.c"
|
||||
# "${QCOMMON_DIR}/cvar.c"
|
||||
# "${QCOMMON_DIR}/files.c"
|
||||
# "${QCOMMON_DIR}/huffman.c"
|
||||
# "${QCOMMON_DIR}/ioapi.c"
|
||||
# "${QCOMMON_DIR}/md4.c"
|
||||
# "${QCOMMON_DIR}/md5.c"
|
||||
# "${QCOMMON_DIR}/msg.c"
|
||||
# "${QCOMMON_DIR}/net_chan.c"
|
||||
# "${QCOMMON_DIR}/net_ip.c"
|
||||
"${QCOMMON_DIR}/puff.c"
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
# "${QCOMMON_DIR}/unzip.c"
|
||||
# "${QCOMMON_DIR}/vm.c"
|
||||
# "${QCOMMON_DIR}/vm_interpreted.c"
|
||||
# "${QCOMMON_DIR}/vm_none.c"
|
||||
# "${QCOMMON_DIR}/vm_powerpc.c"
|
||||
# "${QCOMMON_DIR}/vm_powerpc_asm.c"
|
||||
# "${QCOMMON_DIR}/vm_sparc.c"
|
||||
# "${QCOMMON_DIR}/vm_x86.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
# "${QCOMMON_DIR}/cm_local.h"
|
||||
# "${QCOMMON_DIR}/cm_patch.h"
|
||||
# "${QCOMMON_DIR}/cm_polylib.h"
|
||||
# "${QCOMMON_DIR}/cm_public.h"
|
||||
# "${QCOMMON_DIR}/ioapi.h"
|
||||
"${QCOMMON_DIR}/puff.h"
|
||||
# "${QCOMMON_DIR}/q_platform.h"
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
"${QCOMMON_DIR}/qcommon.h"
|
||||
"${QCOMMON_DIR}/qfiles.h"
|
||||
"${QCOMMON_DIR}/surfaceflags.h"
|
||||
"${QCOMMON_DIR}/unzip.h"
|
||||
"${QCOMMON_DIR}/vm_local.h"
|
||||
# "${QCOMMON_DIR}/vm_powerpc_asm.h"
|
||||
# "${QCOMMON_DIR}/vm_sparc.h"
|
||||
)
|
||||
list(APPEND RENDERERCOMMON_SOURCES
|
||||
"${RENDERERCOMMON_DIR}/tr_font.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_bmp.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_jpg.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_pcx.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_png.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_tga.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_noise.c"
|
||||
)
|
||||
list(APPEND RENDERERCOMMON_HEADERS
|
||||
"${RENDERERCOMMON_DIR}/iqm.h"
|
||||
"${RENDERERCOMMON_DIR}/qgl.h"
|
||||
"${RENDERERCOMMON_DIR}/tr_common.h"
|
||||
"${RENDERERCOMMON_DIR}/tr_public.h"
|
||||
"${RENDERERCOMMON_DIR}/tr_types.h"
|
||||
)
|
||||
|
||||
list(APPEND RENDERERGL1_SOURCES
|
||||
"${RENDERERGL1_DIR}/tr_animation.c"
|
||||
"${RENDERERGL1_DIR}/tr_backend.c"
|
||||
"${RENDERERGL1_DIR}/tr_bsp.c"
|
||||
"${RENDERERGL1_DIR}/tr_cmds.c"
|
||||
"${RENDERERGL1_DIR}/tr_curve.c"
|
||||
"${RENDERERGL1_DIR}/tr_flares.c"
|
||||
"${RENDERERGL1_DIR}/tr_image.c"
|
||||
"${RENDERERGL1_DIR}/tr_init.c"
|
||||
"${RENDERERGL1_DIR}/tr_light.c"
|
||||
"${RENDERERGL1_DIR}/tr_main.c"
|
||||
"${RENDERERGL1_DIR}/tr_marks.c"
|
||||
"${RENDERERGL1_DIR}/tr_mesh.c"
|
||||
"${RENDERERGL1_DIR}/tr_model.c"
|
||||
"${RENDERERGL1_DIR}/tr_model_iqm.c"
|
||||
"${RENDERERGL1_DIR}/tr_scene.c"
|
||||
"${RENDERERGL1_DIR}/tr_shade.c"
|
||||
"${RENDERERGL1_DIR}/tr_shade_calc.c"
|
||||
"${RENDERERGL1_DIR}/tr_shader.c"
|
||||
"${RENDERERGL1_DIR}/tr_shadows.c"
|
||||
"${RENDERERGL1_DIR}/tr_sky.c"
|
||||
"${RENDERERGL1_DIR}/tr_subs.c"
|
||||
"${RENDERERGL1_DIR}/tr_surface.c"
|
||||
"${RENDERERGL1_DIR}/tr_world.c"
|
||||
)
|
||||
list(APPEND RENDERERGL1_ALTIVEC_SOURCES
|
||||
"${RENDERERGL1_DIR}/tr_altivec.c"
|
||||
)
|
||||
list(APPEND RENDERERGL1_HEADERS
|
||||
"${RENDERERGL1_DIR}/tr_local.h"
|
||||
)
|
||||
|
||||
set(SDL_SOURCES
|
||||
"${SDL_DIR}/sdl_gamma.c"
|
||||
"${SDL_DIR}/sdl_glimp.c"
|
||||
# "${SDL_DIR}/sdl_input.c"
|
||||
# "${SDL_DIR}/sdl_snd.c"
|
||||
)
|
||||
set(SDL_HEADERS
|
||||
# "${SDL_DIR}/sdl_icon.h"
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win64/SDL2main.lib"
|
||||
"${LIBS_DIR}/win64/SDL2.lib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
elseif(ARCH STREQUAL "x86")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win32/SDL2main.lib"
|
||||
"${LIBS_DIR}/win32/SDL2.lib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
|
||||
endif()
|
||||
if(SDL_FOUND)
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MinGW: ${FILEPATH}")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
endif(SDL_FOUND)
|
||||
endif()
|
||||
|
||||
#Character Set, CharacterSet="0", Not Set, ASCII/SBCS (Single Byte Character Set)
|
||||
list(APPEND RENDERERGL1_DEFINITIONS "-D_SBCS")
|
||||
|
||||
#disable deprecation warnings about old functions like strcmp
|
||||
list(APPEND RENDERERGL1_DEFINITIONS "-D_CRT_SECURE_NO_WARNINGS")
|
||||
|
||||
#Randomized Base Address /DYNAMICBASE:NO
|
||||
list(APPEND RENDERERGL1_LDFLAGS "/DYNAMICBASE:NO")
|
||||
#Data Execution Prevenbtion (DEP) /NXCOMPAT:NO
|
||||
list(APPEND RENDERERGL1_LDFLAGS "/NXCOMPAT:NO")
|
||||
#Image Has Safe Exception Handlers, is no longer default no in msvc 2013 /SAFESEH:NO
|
||||
list(APPEND RENDERERGL1_LDFLAGS "/SAFESEH:NO")
|
||||
|
||||
#requires directory misc/msvc for ../quake3.ico in win_resource.rc
|
||||
list(APPEND RENDERERGL1_INCLUDE_DIRS "${SOURCE_DIR}/misc/msvc")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(MINGW AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win64/libSDL264main.a"
|
||||
"${LIBS_DIR}/win64/libSDL264.dll.a"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
elseif(ARCH STREQUAL "x86")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win32/libSDL2main.a"
|
||||
"${LIBS_DIR}/win32/libSDL2.dll.a"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
|
||||
endif()
|
||||
if(SDL_FOUND)
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MinGW: ${FILEPATH}")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
endif(SDL_FOUND)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(PLATFORM STREQUAL "darwin" AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
list(APPEND RENDERERGL1_DEFINITIONS "-DMACOS_X")
|
||||
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/macosx/libSDL2main.a"
|
||||
"${LIBS_DIR}/macosx/libSDL2-2.0.0.dylib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MacOS: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
|
||||
endif()
|
||||
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
if(COCOA_LIBRARY)
|
||||
list(APPEND RENDERERGL1_LIBRARIES "${COCOA_LIBRARY}")
|
||||
else()
|
||||
list(APPEND RENDERERGL1_LDFLAGS "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
if(ARCH STREQUAL "ppc" OR ARCH STREQUAL "ppc64")
|
||||
list(APPEND RENDERERGL1_SOURCES ${RENDERERGL1_ALTIVEC_SOURCES})
|
||||
foreach(ALTIVEC_SOURCE IN LISTS RENDERERGL1_ALTIVEC_SOURCES)
|
||||
set_source_files_properties("${ALTIVEC_SOURCE}" PROPERTIES COMPILE_FLAGS "-maltivec")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
#handled by q_shared.h
|
||||
# CHECK_C_SOURCE_COMPILES("int __attribute__((visibility(\"default\"))) foo;int main() {return(0);}" HAVE_ATTRIBUTE_VISIBILITY_DEFAULT)
|
||||
# if(HAVE_ATTRIBUTE_VISIBILITY_DEFAULT)
|
||||
# list(APPEND RENDERERGL1_DEFINITIONS "-DHAVE_ATTRIBUTE_VISIBILITY_DEFAULT")
|
||||
# endif(HAVE_ATTRIBUTE_VISIBILITY_DEFAULT)
|
||||
|
||||
endif()
|
||||
|
||||
ADD_RENDER_DEFINITIONS(RENDERERGL1_DEFINITIONS)
|
||||
ADD_RENDER_CFLAGS(RENDERERGL1_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(RENDERERGL1_LDFLAGS)
|
||||
|
||||
if(USE_INTERNAL_SDL)
|
||||
list(APPEND RENDERERGL1_DEFINITIONS "-DUSE_INTERNAL_SDL")
|
||||
|
||||
if(ARCH STREQUAL "ppc" OR ARCH STREQUAL "ppc64")
|
||||
list(APPEND SDL_INCLUDE_DIRS "${LIBSDL_DIR}/include-macppc")
|
||||
else()
|
||||
list(APPEND SDL_INCLUDE_DIRS "${LIBSDL_DIR}/include")
|
||||
endif()
|
||||
list(APPEND RENDERERGL1_C_HEADERS ${LIBSDL_HEADERS})
|
||||
|
||||
elseif(NOT SDL_FOUND)
|
||||
find_package(SDL REQUIRED)
|
||||
if(DEFINED SDL_VERSION AND NOT SDL_VERSION STREQUAL "")
|
||||
if(${SDL_VERSION} VERSION_LESS 2)
|
||||
message(FATAL_ERROR "The SDL library version is ${SDL_VERSION} but required is at least version 2.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif(USE_INTERNAL_SDL)
|
||||
|
||||
list(APPEND RENDERERGL1_DEFINITIONS ${SDL_DEFINITIONS})
|
||||
if(SDL_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL1_INCLUDE_DIRS "${SDL_INCLUDE_DIR}")
|
||||
endif(SDL_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL1_INCLUDE_DIRS ${SDL_INCLUDE_DIRS})
|
||||
list(APPEND RENDERERGL1_LIBRARIES "${SDL_LIBRARY}")
|
||||
list(APPEND RENDERERGL1_LIBRARIES ${SDL_LIBRARIES})
|
||||
|
||||
if(NOT OPENGL_FOUND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
endif(NOT OPENGL_FOUND)
|
||||
|
||||
list(APPEND RENDERERGL1_DEFINITIONS ${OPENGL_DEFINITIONS})
|
||||
if(OPENGL_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL1_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}")
|
||||
endif(OPENGL_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL1_INCLUDE_DIRS ${OPENGL_INCLUDE_DIRS})
|
||||
list(APPEND RENDERERGL1_LIBRARIES "${OPENGL_LIBRARY}")
|
||||
list(APPEND RENDERERGL1_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
|
||||
if(USE_INTERNAL_JPEG)
|
||||
list(APPEND RENDERERGL1_DEFINITIONS "-DUSE_INTERNAL_JPEG")
|
||||
if(NOT DEFINED INTERNAL_JPEG_LIBRARIES)
|
||||
add_subdirectory("${CMAKELIST_DIR}/internal_jpeg" "internal_jpeg")
|
||||
endif()
|
||||
list(APPEND RENDERERGL1_DEFINITIONS ${INTERNAL_JPEG_DEFINITIONS})
|
||||
list(APPEND RENDERERGL1_INCLUDE_DIRS ${INTERNAL_JPEG_INCLUDE_DIRS})
|
||||
list(APPEND RENDERERGL1_LIBRARIES ${INTERNAL_JPEG_LIBRARIES})
|
||||
else()
|
||||
#tr_image_jpg.c JPEG_LIB_VERSION >= 80
|
||||
find_package(JPEG REQUIRED)
|
||||
if(DEFINED JPEG_VERSION AND NOT JPEG_VERSION STREQUAL "")
|
||||
if(${JPEG_VERSION} VERSION_LESS 80)
|
||||
message(FATAL_ERROR "The JPEG library version is ${JPEG_VERSION} but required is at least version 80.")
|
||||
endif()
|
||||
endif()
|
||||
endif(USE_INTERNAL_JPEG)
|
||||
|
||||
list(APPEND RENDERERGL1_DEFINITIONS ${JPEG_DEFINITIONS})
|
||||
if(JPEG_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL1_INCLUDE_DIRS "${JPEG_INCLUDE_DIR}")
|
||||
endif(JPEG_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL1_INCLUDE_DIRS ${JPEG_INCLUDE_DIRS})
|
||||
list(APPEND RENDERERGL1_LIBRARIES "${JPEG_LIBRARY}")
|
||||
list(APPEND RENDERERGL1_LIBRARIES ${JPEG_LIBRARIES})
|
||||
|
||||
if(USE_RENDERER_DLOPEN)
|
||||
list(APPEND RENDERERGL1_DEFINITIONS "-DUSE_RENDERER_DLOPEN")
|
||||
endif(USE_RENDERER_DLOPEN)
|
||||
|
||||
if(USE_LOCAL_HEADERS)
|
||||
list(APPEND RENDERERGL1_DEFINITIONS "-DUSE_LOCAL_HEADERS")
|
||||
endif(USE_LOCAL_HEADERS)
|
||||
|
||||
if(DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
string(TIMESTAMP PRODUCT_DATE "%b %d %Y" UTC) #Nov 28 2021
|
||||
list(APPEND RENDERERGL1_DEFINITIONS "-DPRODUCT_DATE=\"${PRODUCT_DATE}\"")
|
||||
else()
|
||||
message(WARNING "Update CMake to version 3.8 or later for SOURCE_DATE_EPOCH support!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND RENDERERGL1_C_SOURCES ${RENDERERCOMMON_SOURCES} ${RENDERERGL1_SOURCES} ${SDL_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND RENDERERGL1_C_HEADERS ${RENDERERCOMMON_HEADERS} ${RENDERERGL1_HEADERS} ${SDL_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("libsdl\\Header Files" FILES ${LIBSDL_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
source_group("renderercommon\\Source Files" FILES ${RENDERERCOMMON_SOURCES})
|
||||
source_group("renderercommon\\Header Files" FILES ${RENDERERCOMMON_HEADERS})
|
||||
source_group("renderergl1\\Source Files" FILES ${RENDERERGL1_SOURCES})
|
||||
source_group("renderergl1\\Header Files" FILES ${RENDERERGL1_HEADERS})
|
||||
source_group("sdl\\Header Files" FILES ${SDL_HEADERS})
|
||||
source_group("sdl\\Source Files" FILES ${SDL_SOURCES})
|
||||
|
||||
if(USE_RENDERER_DLOPEN)
|
||||
add_library(${RENDERERGL1_TARGET} SHARED ${RENDERERGL1_C_SOURCES} ${RENDERERGL1_C_HEADERS})
|
||||
set_target_properties(${RENDERERGL1_TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties(${RENDERERGL1_TARGET} PROPERTIES OUTPUT_NAME "renderer_opengl1_${ARCH}")
|
||||
else()
|
||||
add_library(${RENDERERGL1_TARGET} STATIC ${RENDERERGL1_C_SOURCES} ${RENDERERGL1_C_HEADERS})
|
||||
endif(USE_RENDERER_DLOPEN)
|
||||
|
||||
target_compile_definitions(${RENDERERGL1_TARGET} PRIVATE ${RENDERERGL1_DEFINITIONS})
|
||||
|
||||
target_include_directories(${RENDERERGL1_TARGET} PRIVATE ${RENDERERGL1_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${RENDERERGL1_TARGET} PRIVATE ${RENDERERGL1_CFLAGS})
|
||||
|
||||
target_link_libraries(${RENDERERGL1_TARGET} ${RENDERERGL1_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${RENDERERGL1_TARGET} PRIVATE ${RENDERERGL1_LDFLAGS})
|
||||
|
||||
STRIP_TARGET(${RENDERERGL1_TARGET})
|
||||
|
||||
set(DESTINATION_DIR "${REL_INSTALL_DEST}")
|
||||
if(INSTALL_DIR)
|
||||
set(DESTINATION_DIR "${INSTALL_DIR}")
|
||||
endif(INSTALL_DIR)
|
||||
|
||||
if(USE_RENDERER_DLOPEN)
|
||||
#cmake 2.8.12 requires RUNTIME instead of LIBRARY DESTINATION
|
||||
install(TARGETS ${RENDERERGL1_TARGET}
|
||||
RUNTIME DESTINATION "${DESTINATION_DIR}"
|
||||
LIBRARY DESTINATION "${DESTINATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT renderer
|
||||
)
|
||||
endif(USE_RENDERER_DLOPEN)
|
||||
|
||||
include(CPack)
|
463
misc/CMakeLists/renderergl2/CMakeLists.txt
Normal file
463
misc/CMakeLists/renderergl2/CMakeLists.txt
Normal file
|
@ -0,0 +1,463 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("renderer opengl2")
|
||||
|
||||
set(RENDERERGL2_TARGET "renderer_opengl2")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/libsdl_headers.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
option(USE_INTERNAL_LIBS "Use internal libraries (Ogg,Vorbis,Opus,zlib,JPEG,...)" ${DEFAULT_USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_JPEG "Use internal JPEG library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_SDL "Use internal SDL library" ${USE_INTERNAL_LIBS})
|
||||
option(USE_LOCAL_HEADERS "Use local headers" ${USE_INTERNAL_LIBS})
|
||||
|
||||
option(USE_RENDERER_DLOPEN "Use renderer dynamic library opening" ${DEFAULT_USE_RENDERER_DLOPEN})
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(REL_INSTALL_DEST "${DEFAULT_REL_INSTALL_DEST}" CACHE PATH "Relative installation destination")
|
||||
set(INSTALL_DIR "${DEFAULT_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
|
||||
set(GLSL_SOURCES
|
||||
"${GLSL_DIR}/bokeh_fp.glsl"
|
||||
"${GLSL_DIR}/bokeh_vp.glsl"
|
||||
"${GLSL_DIR}/calclevels4x_fp.glsl"
|
||||
"${GLSL_DIR}/calclevels4x_vp.glsl"
|
||||
"${GLSL_DIR}/depthblur_fp.glsl"
|
||||
"${GLSL_DIR}/depthblur_vp.glsl"
|
||||
"${GLSL_DIR}/dlight_fp.glsl"
|
||||
"${GLSL_DIR}/dlight_vp.glsl"
|
||||
"${GLSL_DIR}/down4x_fp.glsl"
|
||||
"${GLSL_DIR}/down4x_vp.glsl"
|
||||
"${GLSL_DIR}/fogpass_fp.glsl"
|
||||
"${GLSL_DIR}/fogpass_vp.glsl"
|
||||
"${GLSL_DIR}/generic_fp.glsl"
|
||||
"${GLSL_DIR}/generic_vp.glsl"
|
||||
"${GLSL_DIR}/lightall_fp.glsl"
|
||||
"${GLSL_DIR}/lightall_vp.glsl"
|
||||
"${GLSL_DIR}/pshadow_fp.glsl"
|
||||
"${GLSL_DIR}/pshadow_vp.glsl"
|
||||
"${GLSL_DIR}/shadowfill_fp.glsl"
|
||||
"${GLSL_DIR}/shadowfill_vp.glsl"
|
||||
"${GLSL_DIR}/shadowmask_fp.glsl"
|
||||
"${GLSL_DIR}/shadowmask_vp.glsl"
|
||||
"${GLSL_DIR}/ssao_fp.glsl"
|
||||
"${GLSL_DIR}/ssao_vp.glsl"
|
||||
"${GLSL_DIR}/texturecolor_fp.glsl"
|
||||
"${GLSL_DIR}/texturecolor_vp.glsl"
|
||||
"${GLSL_DIR}/tonemap_fp.glsl"
|
||||
"${GLSL_DIR}/tonemap_vp.glsl"
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
# "${QCOMMON_DIR}/cm_load.c"
|
||||
# "${QCOMMON_DIR}/cm_patch.c"
|
||||
# "${QCOMMON_DIR}/cm_polylib.c"
|
||||
# "${QCOMMON_DIR}/cm_test.c"
|
||||
# "${QCOMMON_DIR}/cm_trace.c"
|
||||
# "${QCOMMON_DIR}/cmd.c"
|
||||
# "${QCOMMON_DIR}/common.c"
|
||||
# "${QCOMMON_DIR}/cvar.c"
|
||||
# "${QCOMMON_DIR}/files.c"
|
||||
# "${QCOMMON_DIR}/huffman.c"
|
||||
# "${QCOMMON_DIR}/ioapi.c"
|
||||
# "${QCOMMON_DIR}/md4.c"
|
||||
# "${QCOMMON_DIR}/md5.c"
|
||||
# "${QCOMMON_DIR}/msg.c"
|
||||
# "${QCOMMON_DIR}/net_chan.c"
|
||||
# "${QCOMMON_DIR}/net_ip.c"
|
||||
"${QCOMMON_DIR}/puff.c"
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
# "${QCOMMON_DIR}/unzip.c"
|
||||
# "${QCOMMON_DIR}/vm.c"
|
||||
# "${QCOMMON_DIR}/vm_interpreted.c"
|
||||
# "${QCOMMON_DIR}/vm_none.c"
|
||||
# "${QCOMMON_DIR}/vm_powerpc.c"
|
||||
# "${QCOMMON_DIR}/vm_powerpc_asm.c"
|
||||
# "${QCOMMON_DIR}/vm_sparc.c"
|
||||
# "${QCOMMON_DIR}/vm_x86.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
# "${QCOMMON_DIR}/cm_local.h"
|
||||
# "${QCOMMON_DIR}/cm_patch.h"
|
||||
# "${QCOMMON_DIR}/cm_polylib.h"
|
||||
# "${QCOMMON_DIR}/cm_public.h"
|
||||
# "${QCOMMON_DIR}/ioapi.h"
|
||||
"${QCOMMON_DIR}/puff.h"
|
||||
# "${QCOMMON_DIR}/q_platform.h"
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
"${QCOMMON_DIR}/qcommon.h"
|
||||
"${QCOMMON_DIR}/qfiles.h"
|
||||
"${QCOMMON_DIR}/surfaceflags.h"
|
||||
"${QCOMMON_DIR}/unzip.h"
|
||||
"${QCOMMON_DIR}/vm_local.h"
|
||||
# "${QCOMMON_DIR}/vm_powerpc_asm.h"
|
||||
# "${QCOMMON_DIR}/vm_sparc.h"
|
||||
)
|
||||
list(APPEND RENDERERCOMMON_SOURCES
|
||||
"${RENDERERCOMMON_DIR}/tr_font.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_bmp.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_jpg.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_pcx.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_png.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_image_tga.c"
|
||||
"${RENDERERCOMMON_DIR}/tr_noise.c"
|
||||
)
|
||||
list(APPEND RENDERERCOMMON_HEADERS
|
||||
"${RENDERERCOMMON_DIR}/iqm.h"
|
||||
"${RENDERERCOMMON_DIR}/qgl.h"
|
||||
"${RENDERERCOMMON_DIR}/tr_common.h"
|
||||
"${RENDERERCOMMON_DIR}/tr_public.h"
|
||||
"${RENDERERCOMMON_DIR}/tr_types.h"
|
||||
)
|
||||
|
||||
list(APPEND RENDERERGL2_SOURCES
|
||||
"${RENDERERGL2_DIR}/tr_animation.c"
|
||||
"${RENDERERGL2_DIR}/tr_backend.c"
|
||||
"${RENDERERGL2_DIR}/tr_bsp.c"
|
||||
"${RENDERERGL2_DIR}/tr_cmds.c"
|
||||
"${RENDERERGL2_DIR}/tr_curve.c"
|
||||
"${RENDERERGL2_DIR}/tr_dsa.c"
|
||||
"${RENDERERGL2_DIR}/tr_extensions.c"
|
||||
"${RENDERERGL2_DIR}/tr_extramath.c"
|
||||
"${RENDERERGL2_DIR}/tr_fbo.c"
|
||||
"${RENDERERGL2_DIR}/tr_flares.c"
|
||||
"${RENDERERGL2_DIR}/tr_glsl.c"
|
||||
"${RENDERERGL2_DIR}/tr_image.c"
|
||||
"${RENDERERGL2_DIR}/tr_image_dds.c"
|
||||
"${RENDERERGL2_DIR}/tr_init.c"
|
||||
"${RENDERERGL2_DIR}/tr_light.c"
|
||||
"${RENDERERGL2_DIR}/tr_main.c"
|
||||
"${RENDERERGL2_DIR}/tr_marks.c"
|
||||
"${RENDERERGL2_DIR}/tr_mesh.c"
|
||||
"${RENDERERGL2_DIR}/tr_model.c"
|
||||
"${RENDERERGL2_DIR}/tr_model_iqm.c"
|
||||
"${RENDERERGL2_DIR}/tr_postprocess.c"
|
||||
"${RENDERERGL2_DIR}/tr_scene.c"
|
||||
"${RENDERERGL2_DIR}/tr_shade.c"
|
||||
"${RENDERERGL2_DIR}/tr_shade_calc.c"
|
||||
"${RENDERERGL2_DIR}/tr_shader.c"
|
||||
"${RENDERERGL2_DIR}/tr_shadows.c"
|
||||
"${RENDERERGL2_DIR}/tr_sky.c"
|
||||
"${RENDERERGL2_DIR}/tr_subs.c"
|
||||
"${RENDERERGL2_DIR}/tr_surface.c"
|
||||
"${RENDERERGL2_DIR}/tr_vbo.c"
|
||||
"${RENDERERGL2_DIR}/tr_world.c"
|
||||
)
|
||||
list(APPEND RENDERERGL2_HEADERS
|
||||
"${RENDERERGL2_DIR}/tr_dsa.h"
|
||||
"${RENDERERGL2_DIR}/tr_local.h"
|
||||
"${RENDERERGL2_DIR}/tr_extramath.h"
|
||||
"${RENDERERGL2_DIR}/tr_extratypes.h"
|
||||
"${RENDERERGL2_DIR}/tr_postprocess.h"
|
||||
)
|
||||
|
||||
set(SDL_SOURCES
|
||||
"${SDL_DIR}/sdl_gamma.c"
|
||||
"${SDL_DIR}/sdl_glimp.c"
|
||||
# "${SDL_DIR}/sdl_input.c"
|
||||
# "${SDL_DIR}/sdl_snd.c"
|
||||
)
|
||||
set(SDL_HEADERS
|
||||
# "${SDL_DIR}/sdl_icon.h"
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win64/SDL264main.lib"
|
||||
"${LIBS_DIR}/win64/SDL264.lib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
elseif(ARCH STREQUAL "x86")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win32/SDL2main.lib"
|
||||
"${LIBS_DIR}/win32/SDL2.lib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
endif()
|
||||
if(SDL_FOUND)
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MinGW: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#Character Set, CharacterSet="0", Not Set, ASCII/SBCS (Single Byte Character Set)
|
||||
list(APPEND RENDERERGL2_DEFINITIONS "-D_SBCS")
|
||||
|
||||
#disable deprecation warnings about old functions like strcmp
|
||||
list(APPEND RENDERERGL2_DEFINITIONS "-D_CRT_SECURE_NO_WARNINGS")
|
||||
|
||||
#Randomized Base Address /DYNAMICBASE:NO
|
||||
list(APPEND RENDERERGL2_LDFLAGS "/DYNAMICBASE:NO")
|
||||
#Data Execution Prevenbtion (DEP) /NXCOMPAT:NO
|
||||
list(APPEND RENDERERGL2_LDFLAGS "/NXCOMPAT:NO")
|
||||
#Image Has Safe Exception Handlers, is no longer default no in msvc 2013 /SAFESEH:NO
|
||||
list(APPEND RENDERERGL2_LDFLAGS "/SAFESEH:NO")
|
||||
|
||||
#requires directory misc/msvc for ../quake3.ico in win_resource.rc
|
||||
list(APPEND RENDERERGL2_INCLUDE_DIRS "${SOURCE_DIR}/misc/msvc")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(MINGW AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win64/libSDL264main.a"
|
||||
"${LIBS_DIR}/win64/libSDL264.dll.a"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
elseif(ARCH STREQUAL "x86")
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/win32/libSDL2main.a"
|
||||
"${LIBS_DIR}/win32/libSDL2.dll.a"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
endif()
|
||||
if(SDL_FOUND)
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MinGW: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(PLATFORM STREQUAL "darwin" AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
list(APPEND RENDERERGL2_DEFINITIONS "-DMACOS_X")
|
||||
|
||||
if(NOT SDL_FOUND AND USE_INTERNAL_SDL)
|
||||
list(APPEND SDL_LIBRARIES
|
||||
"${LIBS_DIR}/macosx/libSDL2main.a"
|
||||
"${LIBS_DIR}/macosx/libSDL2-2.0.0.dylib"
|
||||
)
|
||||
set(SDL_FOUND TRUE)
|
||||
|
||||
foreach(FILEPATH ${SDL_LIBRARIES})
|
||||
if(NOT EXISTS "${FILEPATH}")
|
||||
message(WARNING "Could not find the file for MacOS: ${FILEPATH}\n")
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
|
||||
endif()
|
||||
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
if(COCOA_LIBRARY)
|
||||
list(APPEND RENDERERGL2_LIBRARIES "${COCOA_LIBRARY}")
|
||||
else()
|
||||
list(APPEND RENDERERGL2_LDFLAGS "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
#handled by q_shared.h
|
||||
# CHECK_C_SOURCE_COMPILES("int __attribute__((visibility(\"default\"))) foo;int main() {return(0);}" HAVE_ATTRIBUTE_VISIBILITY_DEFAULT)
|
||||
# if(HAVE_ATTRIBUTE_VISIBILITY_DEFAULT)
|
||||
# list(APPEND RENDERERGL2_DEFINITIONS "-DHAVE_ATTRIBUTE_VISIBILITY_DEFAULT")
|
||||
# endif(HAVE_ATTRIBUTE_VISIBILITY_DEFAULT)
|
||||
|
||||
endif()
|
||||
|
||||
ADD_RENDER_DEFINITIONS(RENDERERGL2_DEFINITIONS)
|
||||
ADD_RENDER_CFLAGS(RENDERERGL2_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(RENDERERGL2_LDFLAGS)
|
||||
|
||||
if(USE_INTERNAL_SDL)
|
||||
list(APPEND RENDERERGL2_DEFINITIONS "-DUSE_INTERNAL_SDL")
|
||||
|
||||
if(ARCH STREQUAL "ppc" OR ARCH STREQUAL "ppc64")
|
||||
list(APPEND SDL_INCLUDE_DIRS "${LIBSDL_DIR}/include-macppc")
|
||||
else()
|
||||
list(APPEND SDL_INCLUDE_DIRS "${LIBSDL_DIR}/include")
|
||||
endif()
|
||||
list(APPEND RENDERERGL2_C_HEADERS ${LIBSDL_HEADERS})
|
||||
|
||||
elseif(NOT SDL_FOUND)
|
||||
find_package(SDL REQUIRED)
|
||||
if(DEFINED SDL_VERSION AND NOT SDL_VERSION STREQUAL "")
|
||||
if(${SDL_VERSION} VERSION_LESS 2)
|
||||
message(FATAL_ERROR "The SDL library version is ${SDL_VERSION} but required is at least version 2.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif(USE_INTERNAL_SDL)
|
||||
|
||||
list(APPEND RENDERERGL2_DEFINITIONS ${SDL_DEFINITIONS})
|
||||
if(SDL_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL2_INCLUDE_DIRS "${SDL_INCLUDE_DIR}")
|
||||
endif(SDL_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL2_INCLUDE_DIRS ${SDL_INCLUDE_DIRS})
|
||||
list(APPEND RENDERERGL2_LIBRARIES "${SDL_LIBRARY}")
|
||||
list(APPEND RENDERERGL2_LIBRARIES ${SDL_LIBRARIES})
|
||||
|
||||
if(NOT OPENGL_FOUND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
endif(NOT OPENGL_FOUND)
|
||||
|
||||
list(APPEND RENDERERGL2_DEFINITIONS ${OPENGL_DEFINITIONS})
|
||||
if(OPENGL_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL2_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}")
|
||||
endif(OPENGL_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL2_INCLUDE_DIRS ${OPENGL_INCLUDE_DIRS})
|
||||
list(APPEND RENDERERGL2_LIBRARIES "${OPENGL_LIBRARY}")
|
||||
list(APPEND RENDERERGL2_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
|
||||
if(USE_INTERNAL_JPEG)
|
||||
list(APPEND RENDERERGL2_DEFINITIONS "-DUSE_INTERNAL_JPEG")
|
||||
if(NOT DEFINED INTERNAL_JPEG_LIBRARIES)
|
||||
add_subdirectory("${CMAKELIST_DIR}/internal_jpeg" "internal_jpeg")
|
||||
endif()
|
||||
list(APPEND RENDERERGL2_DEFINITIONS ${INTERNAL_JPEG_DEFINITIONS})
|
||||
list(APPEND RENDERERGL2_INCLUDE_DIRS ${INTERNAL_JPEG_INCLUDE_DIRS})
|
||||
list(APPEND RENDERERGL2_LIBRARIES ${INTERNAL_JPEG_LIBRARIES})
|
||||
else()
|
||||
find_package(JPEG REQUIRED)
|
||||
if(DEFINED JPEG_VERSION AND NOT JPEG_VERSION STREQUAL "")
|
||||
if(${JPEG_VERSION} VERSION_LESS 80)
|
||||
message(FATAL_ERROR "The JPEG library version is ${JPEG_VERSION} but required is 80.")
|
||||
endif()
|
||||
endif()
|
||||
endif(USE_INTERNAL_JPEG)
|
||||
|
||||
list(APPEND RENDERERGL2_DEFINITIONS ${JPEG_DEFINITIONS})
|
||||
if(JPEG_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL2_INCLUDE_DIRS "${JPEG_INCLUDE_DIR}")
|
||||
endif(JPEG_INCLUDE_DIR)
|
||||
list(APPEND RENDERERGL2_INCLUDE_DIRS ${JPEG_INCLUDE_DIRS})
|
||||
list(APPEND RENDERERGL2_LIBRARIES "${JPEG_LIBRARY}")
|
||||
list(APPEND RENDERERGL2_LIBRARIES ${JPEG_LIBRARIES})
|
||||
|
||||
if(USE_RENDERER_DLOPEN)
|
||||
list(APPEND RENDERERGL2_DEFINITIONS "-DUSE_RENDERER_DLOPEN")
|
||||
endif(USE_RENDERER_DLOPEN)
|
||||
|
||||
if(USE_LOCAL_HEADERS)
|
||||
list(APPEND RENDERERGL2_DEFINITIONS "-DUSE_LOCAL_HEADERS")
|
||||
endif(USE_LOCAL_HEADERS)
|
||||
|
||||
if(DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.8.0")
|
||||
string(TIMESTAMP PRODUCT_DATE "%b %d %Y" UTC) #Nov 28 2021
|
||||
list(APPEND RENDERERGL2_DEFINITIONS "-DPRODUCT_DATE=\"${PRODUCT_DATE}\"")
|
||||
else()
|
||||
message(WARNING "Update CMake to version 3.8 or later for SOURCE_DATE_EPOCH support!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND RENDERERGL2_C_SOURCES ${RENDERERCOMMON_SOURCES} ${RENDERERGL2_SOURCES} ${SDL_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND RENDERERGL2_C_HEADERS ${RENDERERCOMMON_HEADERS} ${RENDERERGL2_HEADERS} ${SDL_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
set(GLSL_DIRNAME "Generated_c${CMAKE_BUILD_TYPE}")
|
||||
set(GLSL_BDIR "${CMAKE_CURRENT_BINARY_DIR}/${GLSL_DIRNAME}")
|
||||
file(MAKE_DIRECTORY "${GLSL_BDIR}")
|
||||
|
||||
set(GLSL_C_SOURCES)
|
||||
|
||||
foreach(SOURCE ${GLSL_SOURCES})
|
||||
get_filename_component(BASE_FILENAME "${SOURCE}" NAME_WE)
|
||||
set(OUT_FILENAME "${GLSL_BDIR}/${BASE_FILENAME}.c")
|
||||
add_custom_command(OUTPUT "${OUT_FILENAME}"
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -DSHADERNAME="${BASE_FILENAME}" -DINPUT="${SOURCE}" -DOUTPUT="${OUT_FILENAME}" -P "${CMAKELIST_DIR}/include/glsl_to_c.cmake"
|
||||
DEPENDS "${SOURCE}"
|
||||
)
|
||||
list(APPEND GLSL_C_SOURCES "${OUT_FILENAME}")
|
||||
endforeach()
|
||||
|
||||
source_group("glsl" FILES ${GLSL_SOURCES})
|
||||
source_group("glsl\\Generated_c" FILES ${GLSL_C_SOURCES})
|
||||
source_group("libsdl\\Header Files" FILES ${LIBSDL_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
source_group("renderercommon\\Source Files" FILES ${RENDERERCOMMON_SOURCES})
|
||||
source_group("renderercommon\\Header Files" FILES ${RENDERERCOMMON_HEADERS})
|
||||
source_group("renderergl2\\Source Files" FILES ${RENDERERGL2_SOURCES})
|
||||
source_group("renderergl2\\Header Files" FILES ${RENDERERGL2_HEADERS})
|
||||
source_group("sdl\\Header Files" FILES ${SDL_HEADERS})
|
||||
source_group("sdl\\Source Files" FILES ${SDL_SOURCES})
|
||||
|
||||
add_library(${RENDERERGL2_TARGET} SHARED ${RENDERERGL2_C_SOURCES} ${RENDERERGL2_C_HEADERS} ${GLSL_SOURCES} ${GLSL_C_SOURCES})
|
||||
|
||||
set_target_properties(${RENDERERGL2_TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties(${RENDERERGL2_TARGET} PROPERTIES OUTPUT_NAME "renderer_opengl2_${ARCH}")
|
||||
|
||||
target_compile_definitions(${RENDERERGL2_TARGET} PRIVATE ${RENDERERGL2_DEFINITIONS})
|
||||
|
||||
target_include_directories(${RENDERERGL2_TARGET} PRIVATE ${RENDERERGL2_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${RENDERERGL2_TARGET} PRIVATE ${RENDERERGL2_CFLAGS})
|
||||
|
||||
target_link_libraries(${RENDERERGL2_TARGET} ${RENDERERGL2_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${RENDERERGL2_TARGET} PRIVATE ${RENDERERGL2_LDFLAGS})
|
||||
|
||||
STRIP_TARGET(${RENDERERGL2_TARGET})
|
||||
|
||||
set(DESTINATION_DIR "${REL_INSTALL_DEST}")
|
||||
if(INSTALL_DIR)
|
||||
set(DESTINATION_DIR "${INSTALL_DIR}")
|
||||
endif(INSTALL_DIR)
|
||||
|
||||
install(TARGETS ${RENDERERGL2_TARGET}
|
||||
RUNTIME DESTINATION "${DESTINATION_DIR}"
|
||||
LIBRARY DESTINATION "${DESTINATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT renderer
|
||||
)
|
||||
include(CPack)
|
555
misc/CMakeLists/server/CMakeLists.txt
Normal file
555
misc/CMakeLists/server/CMakeLists.txt
Normal file
|
@ -0,0 +1,555 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("server")
|
||||
|
||||
set(SERVER_TARGET "server")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/git_rev.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
include("${CMAKELIST_DIR}/include/vm_sources.cmake")
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
#cmake does append any extensions
|
||||
set(SERVER_BIN "${DEFAULT_SERVER_BIN}" CACHE STRING "binary/executable name")
|
||||
|
||||
#Note: options and build directories get cached
|
||||
option(USE_INTERNAL_LIBS "Use internal libraries (zlib)" ${DEFAULT_USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_ZLIB "Use internal zlib" ${USE_INTERNAL_LIBS})
|
||||
option(USE_LOCAL_HEADERS "Use local headers" ${USE_INTERNAL_LIBS})
|
||||
option(USE_VOIP "Use VOIP" ${DEFAULT_USE_VOIP})
|
||||
if(NOT PLATFORM STREQUAL "darwin")
|
||||
option(USE_ICON "Use window icon" ${DEFAULT_USE_ICON})
|
||||
endif()
|
||||
option(USE_AUTOUPDATER "Use Autoupdater" ${DEFAULT_USE_AUTOUPDATER})
|
||||
set(PRODUCT_VERSION "${DEFAULT_VERSION}" CACHE STRING "Product version")
|
||||
option(USE_GIT_REV "Use Git revision for version" ${DEFAULT_USE_GIT_REV})
|
||||
|
||||
option(BUILD_STANDALONE "Standalone" ${DEFAULT_BUILD_STANDALONE})
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(BIN_EXT "${DEFAULT_BIN_EXT}" CACHE STRING "Binary/executable extension")
|
||||
|
||||
set(REL_INSTALL_DEST "${DEFAULT_REL_INSTALL_DEST}" CACHE PATH "Relative installation destination")
|
||||
set(INSTALL_DIR "${DEFAULT_INSTALL_DIR}" CACHE PATH "Installation directory")
|
||||
|
||||
set(ASM_SOURCES
|
||||
|
||||
)
|
||||
|
||||
set(ASM_C_SOURCES
|
||||
"${ASM_DIR}/ftola.c"
|
||||
"${ASM_DIR}/snapvector.c"
|
||||
)
|
||||
|
||||
set(ASM_MASM_SOURCES
|
||||
"${ASM_DIR}/ftola.asm"
|
||||
"${ASM_DIR}/snapvector.asm"
|
||||
# "${ASM_DIR}/vm_x86_64.asm"
|
||||
)
|
||||
|
||||
set(ASM_S_SOURCES
|
||||
"${ASM_DIR}/matha.s"
|
||||
# "${ASM_DIR}/snd_mixa.s"
|
||||
)
|
||||
|
||||
set(ASM_HEADERS
|
||||
# "${ASM_DIR}/qasm.h"
|
||||
# "${ASM_DIR}/qasm-inline.h"
|
||||
)
|
||||
|
||||
set(BOTLIB_SOURCES
|
||||
"${BOTLIB_DIR}/be_aas_bspq3.c"
|
||||
"${BOTLIB_DIR}/be_aas_cluster.c"
|
||||
"${BOTLIB_DIR}/be_aas_debug.c"
|
||||
"${BOTLIB_DIR}/be_aas_entity.c"
|
||||
"${BOTLIB_DIR}/be_aas_file.c"
|
||||
"${BOTLIB_DIR}/be_aas_main.c"
|
||||
"${BOTLIB_DIR}/be_aas_move.c"
|
||||
"${BOTLIB_DIR}/be_aas_optimize.c"
|
||||
"${BOTLIB_DIR}/be_aas_reach.c"
|
||||
"${BOTLIB_DIR}/be_aas_route.c"
|
||||
"${BOTLIB_DIR}/be_aas_routealt.c"
|
||||
"${BOTLIB_DIR}/be_aas_sample.c"
|
||||
"${BOTLIB_DIR}/be_ai_char.c"
|
||||
"${BOTLIB_DIR}/be_ai_chat.c"
|
||||
"${BOTLIB_DIR}/be_ai_gen.c"
|
||||
"${BOTLIB_DIR}/be_ai_goal.c"
|
||||
"${BOTLIB_DIR}/be_ai_move.c"
|
||||
"${BOTLIB_DIR}/be_ai_weap.c"
|
||||
"${BOTLIB_DIR}/be_ai_weight.c"
|
||||
"${BOTLIB_DIR}/be_ea.c"
|
||||
"${BOTLIB_DIR}/be_interface.c"
|
||||
"${BOTLIB_DIR}/l_crc.c"
|
||||
"${BOTLIB_DIR}/l_libvar.c"
|
||||
"${BOTLIB_DIR}/l_log.c"
|
||||
"${BOTLIB_DIR}/l_memory.c"
|
||||
"${BOTLIB_DIR}/l_precomp.c"
|
||||
"${BOTLIB_DIR}/l_script.c"
|
||||
"${BOTLIB_DIR}/l_struct.c"
|
||||
)
|
||||
set(BOTLIB_HEADERS
|
||||
"${BOTLIB_DIR}/aasfile.h"
|
||||
"${BOTLIB_DIR}/be_aas.h"
|
||||
"${BOTLIB_DIR}/be_aas_bsp.h"
|
||||
"${BOTLIB_DIR}/be_aas_cluster.h"
|
||||
"${BOTLIB_DIR}/be_aas_debug.h"
|
||||
"${BOTLIB_DIR}/be_aas_def.h"
|
||||
"${BOTLIB_DIR}/be_aas_entity.h"
|
||||
"${BOTLIB_DIR}/be_aas_file.h"
|
||||
"${BOTLIB_DIR}/be_aas_funcs.h"
|
||||
"${BOTLIB_DIR}/be_aas_main.h"
|
||||
"${BOTLIB_DIR}/be_aas_move.h"
|
||||
"${BOTLIB_DIR}/be_aas_optimize.h"
|
||||
"${BOTLIB_DIR}/be_aas_reach.h"
|
||||
"${BOTLIB_DIR}/be_aas_route.h"
|
||||
"${BOTLIB_DIR}/be_aas_routealt.h"
|
||||
"${BOTLIB_DIR}/be_aas_sample.h"
|
||||
"${BOTLIB_DIR}/be_ai_char.h"
|
||||
"${BOTLIB_DIR}/be_ai_chat.h"
|
||||
"${BOTLIB_DIR}/be_ai_gen.h"
|
||||
"${BOTLIB_DIR}/be_ai_goal.h"
|
||||
"${BOTLIB_DIR}/be_ai_move.h"
|
||||
"${BOTLIB_DIR}/be_ai_weap.h"
|
||||
"${BOTLIB_DIR}/be_ai_weight.h"
|
||||
"${BOTLIB_DIR}/be_ea.h"
|
||||
"${BOTLIB_DIR}/be_interface.h"
|
||||
"${BOTLIB_DIR}/botlib.h"
|
||||
"${BOTLIB_DIR}/l_crc.h"
|
||||
"${BOTLIB_DIR}/l_libvar.h"
|
||||
"${BOTLIB_DIR}/l_log.h"
|
||||
"${BOTLIB_DIR}/l_memory.h"
|
||||
"${BOTLIB_DIR}/l_precomp.h"
|
||||
"${BOTLIB_DIR}/l_script.h"
|
||||
"${BOTLIB_DIR}/l_struct.h"
|
||||
"${BOTLIB_DIR}/l_utils.h"
|
||||
)
|
||||
set(NULL_SOURCES
|
||||
"${NULL_DIR}/null_client.c"
|
||||
"${NULL_DIR}/null_input.c"
|
||||
"${NULL_DIR}/null_snddma.c"
|
||||
)
|
||||
set(NULL_HEADERS
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/cm_load.c"
|
||||
"${QCOMMON_DIR}/cm_patch.c"
|
||||
"${QCOMMON_DIR}/cm_polylib.c"
|
||||
"${QCOMMON_DIR}/cm_test.c"
|
||||
"${QCOMMON_DIR}/cm_trace.c"
|
||||
"${QCOMMON_DIR}/cmd.c"
|
||||
"${QCOMMON_DIR}/common.c"
|
||||
"${QCOMMON_DIR}/cvar.c"
|
||||
"${QCOMMON_DIR}/files.c"
|
||||
"${QCOMMON_DIR}/huffman.c"
|
||||
"${QCOMMON_DIR}/ioapi.c"
|
||||
"${QCOMMON_DIR}/md4.c"
|
||||
"${QCOMMON_DIR}/md5.c"
|
||||
"${QCOMMON_DIR}/msg.c"
|
||||
"${QCOMMON_DIR}/net_chan.c"
|
||||
"${QCOMMON_DIR}/net_ip.c"
|
||||
"${QCOMMON_DIR}/puff.c"
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
"${QCOMMON_DIR}/unzip.c"
|
||||
"${QCOMMON_DIR}/vm.c"
|
||||
"${QCOMMON_DIR}/vm_interpreted.c"
|
||||
# "${QCOMMON_DIR}/vm_none.c"
|
||||
# "${QCOMMON_DIR}/vm_powerpc.c"
|
||||
# "${QCOMMON_DIR}/vm_powerpc_asm.c"
|
||||
# "${QCOMMON_DIR}/vm_sparc.c"
|
||||
# "${QCOMMON_DIR}/vm_x86.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/cm_local.h"
|
||||
"${QCOMMON_DIR}/cm_patch.h"
|
||||
"${QCOMMON_DIR}/cm_polylib.h"
|
||||
"${QCOMMON_DIR}/cm_public.h"
|
||||
"${QCOMMON_DIR}/ioapi.h"
|
||||
"${QCOMMON_DIR}/puff.h"
|
||||
"${QCOMMON_DIR}/q_platform.h"
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
"${QCOMMON_DIR}/qcommon.h"
|
||||
"${QCOMMON_DIR}/qfiles.h"
|
||||
"${QCOMMON_DIR}/surfaceflags.h"
|
||||
"${QCOMMON_DIR}/unzip.h"
|
||||
"${QCOMMON_DIR}/vm_local.h"
|
||||
# "${QCOMMON_DIR}/vm_powerpc_asm.h"
|
||||
# "${QCOMMON_DIR}/vm_sparc.h"
|
||||
)
|
||||
|
||||
set(SERVER_SOURCES
|
||||
"${SERVER_DIR}/sv_bot.c"
|
||||
"${SERVER_DIR}/sv_ccmds.c"
|
||||
"${SERVER_DIR}/sv_client.c"
|
||||
"${SERVER_DIR}/sv_game.c"
|
||||
"${SERVER_DIR}/sv_init.c"
|
||||
"${SERVER_DIR}/sv_main.c"
|
||||
"${SERVER_DIR}/sv_net_chan.c"
|
||||
# "${SERVER_DIR}/sv_rankings.c"
|
||||
"${SERVER_DIR}/sv_snapshot.c"
|
||||
"${SERVER_DIR}/sv_world.c"
|
||||
)
|
||||
set(SERVER_HEADERS
|
||||
"${SERVER_DIR}/server.h"
|
||||
)
|
||||
|
||||
set(SYS_SOURCES
|
||||
"${SYS_DIR}/con_log.c"
|
||||
# "${SYS_DIR}/con_passive.c"
|
||||
# "${SYS_DIR}/con_tty.c"
|
||||
# "${SYS_DIR}/con_win32.c"
|
||||
"${SYS_DIR}/sys_autoupdater.c"
|
||||
"${SYS_DIR}/sys_main.c"
|
||||
# "${SYS_DIR}/sys_unix.c"
|
||||
# "${SYS_DIR}/sys_win32.c"
|
||||
)
|
||||
set(SYS_HEADERS
|
||||
"${SYS_DIR}/sys_loadlib.h"
|
||||
"${SYS_DIR}/sys_local.h"
|
||||
"${SYS_DIR}/win_resource.h"
|
||||
)
|
||||
list(APPEND SYS_RC_SOURCES
|
||||
"${SYS_DIR}/win_resource.rc"
|
||||
"${SYS_DIR}/win_manifest.xml"
|
||||
)
|
||||
list(APPEND SYS_WIN_SOURCES
|
||||
"${SYS_DIR}/con_passive.c"
|
||||
"${SYS_DIR}/sys_win32.c"
|
||||
# "${SYS_DIR}/con_win32.c"
|
||||
)
|
||||
list(APPEND SYS_UNIX_SOURCES
|
||||
# "${SYS_DIR}/con_unix.c"
|
||||
"${SYS_DIR}/con_tty.c"
|
||||
"${SYS_DIR}/sys_unix.c"
|
||||
)
|
||||
list(APPEND SYS_OSX_SOURCES
|
||||
# "${SYS_DIR}/sys_osx.c"
|
||||
"${SYS_DIR}/sys_osx.m"
|
||||
)
|
||||
|
||||
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
|
||||
if(HAVE_DLFCN_H)
|
||||
list(APPEND SERVER_DEFINITIONS "-DHAVE_DLFCN_H")
|
||||
endif(HAVE_DLFCN_H)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
CHECK_C_SOURCE_COMPILES("#include <dlfcn.h>\n int main () {void *dl = dlopen(\"libm.so\", RTLD_NOW);return 0;}" HAVE_DLOPEN_IN_DLFCN_H)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
if(HAVE_DLOPEN_IN_DLFCN_H)
|
||||
list(APPEND SERVER_DEFINITIONS "-DHAVE_DLOPEN")
|
||||
list(APPEND SERVER_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
endif(HAVE_DLOPEN_IN_DLFCN_H)
|
||||
|
||||
if(WIN32)
|
||||
#requires parent directory for misc/quake3.ico in win_resource.rc
|
||||
list(APPEND SERVER_INCLUDE_DIRS "${SOURCE_DIR}")
|
||||
endif(WIN32)
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND SYS_SOURCES ${SYS_WIN_SOURCES})
|
||||
|
||||
include(CheckLanguage)
|
||||
check_language(ASM_MASM)
|
||||
if(CMAKE_ASM_MASM_COMPILER)
|
||||
enable_language(ASM_MASM)
|
||||
set(HAVE_MASM_COMPILER TRUE)
|
||||
endif(CMAKE_ASM_MASM_COMPILER)
|
||||
|
||||
set(USE_MASM_SOURCES TRUE)
|
||||
|
||||
#Character Set, CharacterSet="0", Not Set, ASCII/SBCS (Single Byte Character Set)
|
||||
list(APPEND SERVER_DEFINITIONS "-D_SBCS")
|
||||
|
||||
#disable deprecation warnings about old functions like strcmp
|
||||
list(APPEND SERVER_DEFINITIONS "-D_CRT_SECURE_NO_WARNINGS")
|
||||
|
||||
if(ARCH STREQUAL "x86")
|
||||
list(APPEND SERVER_DEFINITIONS "-D__i386__")
|
||||
endif()
|
||||
|
||||
#Enable String Pooling /GF
|
||||
list(APPEND SERVER_CFLAGS "/GF")
|
||||
#Enable Function-Level Linking /Gy
|
||||
list(APPEND SERVER_CFLAGS "/Gy")
|
||||
#Warning Level /W4
|
||||
list(APPEND SERVER_CFLAGS "/W4")
|
||||
#Floating Point Model /fp:fast
|
||||
list(APPEND SERVER_CFLAGS "/fp:fast")
|
||||
#Compile as, C Code /TC
|
||||
list(APPEND SERVER_CFLAGS "/TC")
|
||||
#Enable C++ Exceptions, No /EHa-
|
||||
list(APPEND SERVER_CFLAGS "/EHa-")
|
||||
#Whole program optimization, no /GL-
|
||||
list(APPEND SERVER_CFLAGS "/GL-")
|
||||
|
||||
#Disable specific warnings
|
||||
#list(APPEND SERVER_CFLAGS "/wd4244")
|
||||
|
||||
#Subsystem /SUBSYSTEM:CONSOLE
|
||||
list(APPEND SERVER_LDFLAGS "/SUBSYSTEM:CONSOLE")
|
||||
#Stack Reserve Size /STACK:8388608
|
||||
list(APPEND SERVER_LDFLAGS "/STACK:8388608")
|
||||
#Randomized Base Address /DYNAMICBASE:NO
|
||||
list(APPEND SERVER_LDFLAGS "/DYNAMICBASE:NO")
|
||||
#Data Execution Prevenbtion (DEP) /NXCOMPAT:NO
|
||||
list(APPEND SERVER_LDFLAGS "/NXCOMPAT:NO")
|
||||
#Image Has Safe Exception Handlers, is no longer default no in msvc 2013 /SAFESEH:NO
|
||||
list(APPEND SERVER_LDFLAGS "/SAFESEH:NO")
|
||||
|
||||
#not generating manifest, using win_manifest.xml
|
||||
list(APPEND SERVER_LDFLAGS "/MANIFEST:NO")
|
||||
|
||||
#time functions winmm.lib
|
||||
#EnumProcesses function psapi.lib
|
||||
#windows socket functions ws2_32.lib
|
||||
list(APPEND SERVER_LIBRARIES "winmm" "psapi" "ws2_32")
|
||||
|
||||
#requires directory misc/msvc for ../quake3.ico in win_resource.rc
|
||||
list(APPEND SERVER_INCLUDE_DIRS "${SOURCE_DIR}/misc/msvc")
|
||||
|
||||
endif(MSVC)
|
||||
|
||||
if(MINGW AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
list(APPEND SYS_SOURCES ${SYS_WIN_SOURCES})
|
||||
|
||||
#link the MinGW library first
|
||||
list(INSERT SERVER_LIBRARIES 0 "mingw32")
|
||||
|
||||
#time functions winmm.lib
|
||||
#EnumProcesses function psapi.lib
|
||||
#socket functions ws2_32.lib
|
||||
#ImmGetIMEFileName imm32.lib
|
||||
#GetFileVersionInfoSize Version.lib
|
||||
list(APPEND SERVER_LIBRARIES "imm32" "Version" "winmm" "psapi" "ws2_32")
|
||||
|
||||
#WINVER is the minimum operating system version the code supports for the Windows SDK.
|
||||
# 0x0501 for Windows XP, 0x0502 for Windows Server 2003,
|
||||
# 0x0600 for Windows Vista, 0x0601 for Windows 7,
|
||||
# 0x0602 for Windows 8, 0x603 for Windows 8.1 and 0x0A00 for Windows 10.
|
||||
list(APPEND SERVER_DEFINITIONS "-DWINVER=0x0501")
|
||||
|
||||
endif()
|
||||
|
||||
if(PLATFORM STREQUAL "darwin" AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
list(APPEND SYS_SOURCES ${SYS_OSX_SOURCES})
|
||||
set_source_files_properties("${SYS_DIR}/sys_osx.m" PROPERTIES LANGUAGE C)
|
||||
|
||||
list(APPEND SERVER_DEFINITIONS "-DMACOS_X")
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
if(COCOA_LIBRARY)
|
||||
list(APPEND SERVER_LIBRARIES "${COCOA_LIBRARY}")
|
||||
else()
|
||||
list(APPEND SERVER_LDFLAGS "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
if(ARCH STREQUAL "x86" OR ARCH STREQUAL "x86_64")
|
||||
set(USE_INLINE_ASM_SOURCES TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT MINGW)
|
||||
list(APPEND SYS_SOURCES ${SYS_UNIX_SOURCES})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(USE_INLINE_ASM_SOURCES)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_inline_asm")
|
||||
list(APPEND SERVER_LIBRARIES ${INTERNAL_INLINE_ASM_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(USE_MASM_SOURCES)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/internal_masm")
|
||||
list(APPEND SERVER_LIBRARIES ${INTERNAL_MASM_LIBRARIES})
|
||||
endif()
|
||||
|
||||
ADD_SERVER_DEFINITIONS(SERVER_DEFINITIONS)
|
||||
ADD_SERVER_CFLAGS(SERVER_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(SERVER_LDFLAGS)
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND SERVER_CFLAGS "-Qunused-arguments")
|
||||
endif()
|
||||
|
||||
GET_VM_SOURCES(VM_SOURCES)
|
||||
if(VM_SOURCES)
|
||||
list(APPEND QCOMMON_SOURCES ${VM_SOURCES})
|
||||
else()
|
||||
set(NO_VM_COMPILED TRUE)
|
||||
endif()
|
||||
if(NO_VM_COMPILED)
|
||||
list(APPEND SERVER_DEFINITIONS "-DNO_VM_COMPILED")
|
||||
endif()
|
||||
|
||||
if(USE_GIT_REV AND GIT_REV)
|
||||
list(APPEND SERVER_DEFINITIONS "-DPRODUCT_VERSION=\"${PRODUCT_VERSION}_GIT_${GIT_REV}\"")
|
||||
else()
|
||||
list(APPEND SERVER_DEFINITIONS "-DPRODUCT_VERSION=\"${PRODUCT_VERSION}\"")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
string(TIMESTAMP PRODUCT_DATE "%b %d %Y" UTC) #Nov 28 2021
|
||||
list(APPEND SERVER_DEFINITIONS "-DPRODUCT_DATE=\"${PRODUCT_DATE}\"")
|
||||
else()
|
||||
message(WARNING "Update CMake to version 3.8 or later for SOURCE_DATE_EPOCH support!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_INTERNAL_ZLIB)
|
||||
list(APPEND SERVER_DEFINITIONS "-DUSE_INTERNAL_ZLIB")
|
||||
if(NOT DEFINED INTERNAL_ZLIB_LIBRARIES)
|
||||
add_subdirectory("${CMAKELIST_DIR}/internal_zlib" "internal_zlib")
|
||||
endif()
|
||||
list(APPEND SERVER_DEFINITIONS ${INTERNAL_ZLIB_DEFINITIONS})
|
||||
list(APPEND SERVER_INCLUDE_DIRS ${INTERNAL_ZLIB_INCLUDE_DIRS})
|
||||
list(APPEND SERVER_LIBRARIES ${INTERNAL_ZLIB_LIBRARIES})
|
||||
else()
|
||||
find_package(ZLIB REQUIRED)
|
||||
list(APPEND SERVER_DEFINITIONS ${ZLIB_DEFINITIONS})
|
||||
list(APPEND SERVER_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
|
||||
list(APPEND SERVER_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
endif(USE_INTERNAL_ZLIB)
|
||||
|
||||
if(USE_FREETYPE)
|
||||
find_package(Freetype REQUIRED)
|
||||
if(DEFINED FREETYPE_VERSION AND NOT FREETYPE_VERSION STREQUAL "")
|
||||
if(${FREETYPE_VERSION} VERSION_LESS 2)
|
||||
message(FATAL_ERROR "The Freetype library version is ${FREETYPE_VERSION} but required is at least version 2.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND SERVER_DEFINITIONS "-DBUILD_FREETYPE")
|
||||
|
||||
list(APPEND SERVER_DEFINITIONS ${FREETYPE_DEFINITIONS})
|
||||
if(FREETYPE_INCLUDE_DIR)
|
||||
list(APPEND SERVER_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR}")
|
||||
endif(FREETYPE_INCLUDE_DIR)
|
||||
list(APPEND SERVER_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
|
||||
list(APPEND SERVER_LIBRARIES "${FREETYPE_LIBRARY}")
|
||||
list(APPEND SERVER_LIBRARIES ${FREETYPE_LIBRARIES})
|
||||
|
||||
endif(USE_FREETYPE)
|
||||
|
||||
list(APPEND SERVER_DEFINITIONS "-DBOTLIB")
|
||||
list(APPEND SERVER_DEFINITIONS "-DDEDICATED")
|
||||
|
||||
if(USE_ICON)
|
||||
list(APPEND SERVER_DEFINITIONS "-DUSE_ICON")
|
||||
endif(USE_ICON)
|
||||
|
||||
if(BUILD_STANDALONE)
|
||||
list(APPEND SERVER_DEFINITIONS "-DSTANDALONE")
|
||||
endif(BUILD_STANDALONE)
|
||||
|
||||
if(USE_LOCAL_HEADERS)
|
||||
list(APPEND SERVER_DEFINITIONS "-DUSE_LOCAL_HEADERS")
|
||||
endif(USE_LOCAL_HEADERS)
|
||||
|
||||
if(DEFAULT_BASEDIR)
|
||||
list(APPEND SERVER_DEFINITIONS "-DDEFAULT_BASEDIR=\"${DEFAULT_BASEDIR}\"")
|
||||
endif(DEFAULT_BASEDIR)
|
||||
|
||||
if(USE_VOIP)
|
||||
list(APPEND SERVER_DEFINITIONS "-DUSE_VOIP")
|
||||
endif(USE_VOIP)
|
||||
|
||||
if(USE_AUTOUPDATER)
|
||||
list(APPEND SERVER_DEFINITIONS "-DUSE_AUTOUPDATER")
|
||||
if(NOT DEFINED AUTOUPDATER_BIN)
|
||||
set(AUTOUPDATER_BIN, DEFAULT_AUTOUPDATER_BIN)
|
||||
endif()
|
||||
list(APPEND SERVER_DEFINITIONS "-DAUTOUPDATER_BIN=\"${AUTOUPDATER_BIN}\"")
|
||||
endif(USE_AUTOUPDATER)
|
||||
|
||||
list(APPEND SERVER_C_SOURCES ${NULL_SOURCES} ${SERVER_SOURCES} ${BOTLIB_SOURCES} ${QCOMMON_SOURCES} ${SYS_SOURCES})
|
||||
list(APPEND SERVER_C_HEADERS ${NULL_HEADERS} ${SERVER_HEADERS} ${BOTLIB_HEADERS} ${QCOMMON_HEADERS} ${SYS_HEADERS})
|
||||
|
||||
#IDE grouping
|
||||
source_group("asm\\Source Files" FILES ${ASM_SOURCES})
|
||||
source_group("asm\\Header Files" FILES ${ASM_HEADERS})
|
||||
source_group("botlib\\Source Files" FILES ${BOTLIB_SOURCES})
|
||||
source_group("botlib\\Header Files" FILES ${BOTLIB_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
source_group("server\\Source Files" FILES ${SERVER_SOURCES})
|
||||
source_group("server\\Header Files" FILES ${SERVER_HEADERS})
|
||||
source_group("sys\\Source Files" FILES ${SYS_SOURCES})
|
||||
source_group("sys\\Header Files" FILES ${SYS_HEADERS})
|
||||
source_group("sys" FILES ${SYS_RC_SOURCES})
|
||||
|
||||
add_executable(${SERVER_TARGET} ${SERVER_C_SOURCES} ${SERVER_C_HEADERS} ${SYS_RC_SOURCES})
|
||||
|
||||
target_compile_definitions(${SERVER_TARGET} PRIVATE ${SERVER_DEFINITIONS})
|
||||
|
||||
target_include_directories(${SERVER_TARGET} PRIVATE ${SERVER_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${SERVER_TARGET} PRIVATE ${SERVER_CFLAGS})
|
||||
|
||||
target_link_libraries(${SERVER_TARGET} ${SERVER_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${SERVER_TARGET} PRIVATE ${SERVER_LDFLAGS})
|
||||
|
||||
set_target_properties(${SERVER_TARGET} PROPERTIES RUNTIME_OUTPUT_NAME "${SERVER_BIN}${BIN_EXT}")
|
||||
|
||||
STRIP_TARGET(${SERVER_TARGET})
|
||||
|
||||
set(DESTINATION_DIR "${REL_INSTALL_DEST}")
|
||||
if(INSTALL_DIR)
|
||||
set(DESTINATION_DIR "${INSTALL_DIR}")
|
||||
endif(INSTALL_DIR)
|
||||
|
||||
install(TARGETS ${SERVER_TARGET}
|
||||
RUNTIME
|
||||
DESTINATION "${DESTINATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT server
|
||||
)
|
||||
include(CPack)
|
74
misc/CMakeLists/server/internal_inline_asm/CMakeLists.txt
Normal file
74
misc/CMakeLists/server/internal_inline_asm/CMakeLists.txt
Normal file
|
@ -0,0 +1,74 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal inline asm")
|
||||
|
||||
set(INLINE_ASM_TARGET "internal_server_inline_asm")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
set(INLINE_ASM_SOURCES
|
||||
"${ASM_DIR}/ftola.c"
|
||||
"${ASM_DIR}/snapvector.c"
|
||||
)
|
||||
set(INLINE_ASM_HEADERS
|
||||
"${ASM_DIR}/qasm.h"
|
||||
"${ASM_DIR}/qasm-inline.h"
|
||||
)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# set(FLAGS "-msse4.1" "-msse4" "-msse3" "-msse2" "-msse" "-march=k8" "-march=pentium-m" "-march=pentium3")
|
||||
# k8 so inline assembler knows about SSE
|
||||
set(FLAGS "-march=k8" "-W")
|
||||
|
||||
ADD_SUPPORTED_CFLAGS(FLAGS INLINE_ASM_CFLAGS)
|
||||
|
||||
endif()
|
||||
|
||||
#source_group("asm" FILES ${INLINE_ASM_SOURCES} ${INLINE_ASM_HEADERS})
|
||||
#source_group("asm\\Source Files" FILES ${INLINE_ASM_SOURCES})
|
||||
#source_group("asm\\Header Files" FILES ${INLINE_ASM_HEADERS})
|
||||
|
||||
add_library(${INLINE_ASM_TARGET} STATIC ${INLINE_ASM_SOURCES} ${INLINE_ASM_HEADERS})
|
||||
|
||||
target_compile_definitions(${INLINE_ASM_TARGET} PRIVATE ${INLINE_ASM_DEFINITIONS})
|
||||
|
||||
compat_target_compile_options(${INLINE_ASM_TARGET} PRIVATE ${INLINE_ASM_CFLAGS})
|
||||
|
||||
set(INTERNAL_INLINE_ASM_INCLUDE_DIRS "" PARENT_SCOPE)
|
||||
set(INTERNAL_INLINE_ASM_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_INLINE_ASM_LIBRARIES "${INLINE_ASM_TARGET}" PARENT_SCOPE)
|
68
misc/CMakeLists/server/internal_masm/CMakeLists.txt
Normal file
68
misc/CMakeLists/server/internal_masm/CMakeLists.txt
Normal file
|
@ -0,0 +1,68 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("internal masm")
|
||||
|
||||
set(MASM_TARGET "internal_server_masm")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
#microsoft macro assembler files
|
||||
set(MASM_SOURCES
|
||||
"${ASM_DIR}/ftola.asm"
|
||||
"${ASM_DIR}/snapvector.asm"
|
||||
# "${ASM_DIR}/vm_x86_64.asm"
|
||||
)
|
||||
set(MASM_x86_64_SOURCES
|
||||
"${ASM_DIR}/vm_x86_64.asm"
|
||||
)
|
||||
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
list(APPEND MASM_SOURCES ${MASM_x86_64_SOURCES})
|
||||
endif()
|
||||
|
||||
#source_group("asm" FILES ${MASM_SOURCES} ${MASM_HEADERS})
|
||||
#source_group("asm\\Source Files" FILES ${MASM_SOURCES})
|
||||
#source_group("asm\\Header Files" FILES ${MASM_HEADERS})
|
||||
|
||||
enable_language(ASM_MASM)
|
||||
|
||||
add_library(${MASM_TARGET} STATIC ${MASM_SOURCES})
|
||||
|
||||
target_compile_definitions(${MASM_TARGET} PRIVATE ${MASM_DEFINITIONS})
|
||||
|
||||
target_compile_options(${MASM_TARGET} PRIVATE ${MASM_CFLAGS})
|
||||
|
||||
set_target_properties(${MASM_TARGET} PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
set(INTERNAL_MASM_INCLUDE_DIRS "" PARENT_SCOPE)
|
||||
set(INTERNAL_MASM_DEFINITIONS "" PARENT_SCOPE)
|
||||
set(INTERNAL_MASM_LIBRARIES "${MASM_TARGET}" PARENT_SCOPE)
|
7
misc/CMakeLists/tools/CMakeLists.txt
Normal file
7
misc/CMakeLists/tools/CMakeLists.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
project("tools")
|
||||
|
||||
add_subdirectory("lburg")
|
||||
add_subdirectory("q3asm")
|
||||
add_subdirectory("q3cpp")
|
||||
add_subdirectory("q3lcc")
|
||||
add_subdirectory("q3rcc")
|
74
misc/CMakeLists/tools/lburg/CMakeLists.txt
Normal file
74
misc/CMakeLists/tools/lburg/CMakeLists.txt
Normal file
|
@ -0,0 +1,74 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("lburg")
|
||||
|
||||
set(LBURG_TARGET "lburg" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
set(LBURG_DIR "${SOURCE_DIR}/code/tools/lcc/lburg")
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(LBURG_SOURCES
|
||||
"${LBURG_DIR}/lburg.c"
|
||||
"${LBURG_DIR}/gram.c"
|
||||
)
|
||||
set(LBURG_HEADERS
|
||||
"${LBURG_DIR}/lburg.h"
|
||||
)
|
||||
|
||||
list(APPEND ${LBURG_DEFINITIONS} "$<$<CONFIG:Debug>:-DYYDEBUG=1>")
|
||||
list(APPEND ${LBURG_DEFINITIONS} "$<$<CONFIG:Debug>:-DYYERROR_VERBOSE=1>")
|
||||
|
||||
ADD_TOOLS_DEFINITIONS(LBURG_DEFINITIONS)
|
||||
ADD_TOOLS_CFLAGS(LBURG_CFLAGS)
|
||||
|
||||
#source_group("Source Files" FILES ${LBURG_SOURCES})
|
||||
#source_group("Header Files" FILES ${LBURG_HEADERS})
|
||||
|
||||
add_executable(${LBURG_TARGET} ${LBURG_SOURCES} ${LBURG_HEADERS})
|
||||
|
||||
target_compile_definitions(${LBURG_TARGET} PRIVATE ${LBURG_DEFINITIONS})
|
||||
|
||||
target_include_directories(${LBURG_TARGET} PRIVATE ${LBURG_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${LBURG_TARGET} PRIVATE ${LBURG_CFLAGS})
|
||||
|
||||
target_link_libraries(${LBURG_TARGET} ${LBURG_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${LBURG_TARGET} PRIVATE ${LBURG_LDFLAGS})
|
73
misc/CMakeLists/tools/q3asm/CMakeLists.txt
Normal file
73
misc/CMakeLists/tools/q3asm/CMakeLists.txt
Normal file
|
@ -0,0 +1,73 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("q3asm")
|
||||
|
||||
set(Q3ASM_TARGET "q3asm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
set(Q3ASM_DIR "${SOURCE_DIR}/code/tools/asm")
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(Q3ASM_SOURCES
|
||||
"${Q3ASM_DIR}/cmdlib.c"
|
||||
"${Q3ASM_DIR}/q3asm.c"
|
||||
)
|
||||
set(Q3ASM_HEADERS
|
||||
"${Q3ASM_DIR}/cmdlib.h"
|
||||
"${Q3ASM_DIR}/mathlib.h"
|
||||
"${Q3ASM_DIR}/opstrings.h"
|
||||
)
|
||||
|
||||
ADD_TOOLS_DEFINITIONS(Q3ASM_DEFINITIONS)
|
||||
ADD_TOOLS_CFLAGS(Q3ASM_CFLAGS)
|
||||
|
||||
#source_group("Source Files" FILES ${Q3ASM_SOURCES})
|
||||
#source_group("Header Files" FILES ${Q3ASM_HEADERS})
|
||||
|
||||
add_executable(${Q3ASM_TARGET} ${Q3ASM_SOURCES} ${Q3ASM_HEADERS})
|
||||
|
||||
target_compile_definitions(${Q3ASM_TARGET} PRIVATE ${Q3ASM_DEFINITIONS})
|
||||
|
||||
target_include_directories(${Q3ASM_TARGET} PRIVATE ${Q3ASM_INCLUDE_DIRS})
|
||||
|
||||
target_compile_options(${Q3ASM_TARGET} PRIVATE ${Q3ASM_CFLAGS})
|
||||
|
||||
target_link_libraries(${Q3ASM_TARGET} ${Q3ASM_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${Q3ASM_TARGET} PRIVATE ${Q3ASM_LDFLAGS})
|
87
misc/CMakeLists/tools/q3cpp/CMakeLists.txt
Normal file
87
misc/CMakeLists/tools/q3cpp/CMakeLists.txt
Normal file
|
@ -0,0 +1,87 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("q3cpp")
|
||||
|
||||
set(Q3CPP_TARGET "q3cpp" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
set(Q3CPP_DIR "${SOURCE_DIR}/code/tools/lcc/cpp")
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(Q3CPP_SOURCES
|
||||
"${Q3CPP_DIR}/cpp.c"
|
||||
"${Q3CPP_DIR}/lex.c"
|
||||
"${Q3CPP_DIR}/nlist.c"
|
||||
"${Q3CPP_DIR}/tokens.c"
|
||||
"${Q3CPP_DIR}/macro.c"
|
||||
"${Q3CPP_DIR}/eval.c"
|
||||
"${Q3CPP_DIR}/include.c"
|
||||
"${Q3CPP_DIR}/hideset.c"
|
||||
"${Q3CPP_DIR}/getopt.c"
|
||||
"${Q3CPP_DIR}/unix.c"
|
||||
)
|
||||
set(Q3CPP_HEADERS
|
||||
"${Q3CPP_DIR}/cpp.h"
|
||||
)
|
||||
|
||||
if(PLATFORM STREQUAL "darwin" AND (CMAKE_COMPILER_IS_GNUCC
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
#required to use the mac memmove function
|
||||
list(APPEND Q3CPP_DEFINITIONS "-DMACOS_X")
|
||||
|
||||
endif()
|
||||
|
||||
ADD_TOOLS_DEFINITIONS(Q3CPP_DEFINITIONS)
|
||||
ADD_TOOLS_CFLAGS(Q3CPP_CFLAGS)
|
||||
|
||||
#source_group("Source Files" FILES ${Q3CPP_SOURCES})
|
||||
#source_group("Header Files" FILES ${Q3CPP_HEADERS})
|
||||
|
||||
add_executable(${Q3CPP_TARGET} ${Q3CPP_SOURCES} ${Q3CPP_HEADERS})
|
||||
|
||||
target_compile_definitions(${Q3CPP_TARGET} PRIVATE ${Q3CPP_DEFINITIONS})
|
||||
|
||||
target_include_directories(${Q3CPP_TARGET} PRIVATE ${Q3CPP_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${Q3CPP_TARGET} PRIVATE ${Q3CPP_CFLAGS})
|
||||
|
||||
target_link_libraries(${Q3CPP_TARGET} ${Q3CPP_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${Q3CPP_TARGET} PRIVATE ${Q3CPP_LDFLAGS})
|
85
misc/CMakeLists/tools/q3lcc/CMakeLists.txt
Normal file
85
misc/CMakeLists/tools/q3lcc/CMakeLists.txt
Normal file
|
@ -0,0 +1,85 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("q3lcc")
|
||||
|
||||
set(Q3LCC_TARGET "q3lcc" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
set(Q3LCCETC_DIR "${SOURCE_DIR}/code/tools/lcc/etc")
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(DEFAULT_TEMP_DIR "$ENV{TMP}")
|
||||
if(DEFAULT_TEMP_DIR STREQUAL "")
|
||||
set(DEFAULT_TEMP_DIR "$ENV{TEMP}")
|
||||
if(DEFAULT_TEMP_DIR STREQUAL "")
|
||||
set(DEFAULT_TEMP_DIR "$ENV{TMPDIR}")
|
||||
endif()
|
||||
endif()
|
||||
set(TEMP_DIR "${DEFAULT_TEMP_DIR}" CACHE PATH "Temporary directory")
|
||||
|
||||
set(Q3LCC_SOURCES
|
||||
"${Q3LCCETC_DIR}/lcc.c"
|
||||
"${Q3LCCETC_DIR}/bytecode.c"
|
||||
)
|
||||
set(Q3LCC_HEADERS
|
||||
|
||||
)
|
||||
|
||||
if(TEMP_DIR)
|
||||
string(REPLACE "\\" "\\\\" TEMP_DIR_C_STRING "${TEMP_DIR}")
|
||||
list(APPEND Q3LCC_DEFINITIONS "-DTEMPDIR=\"${TEMP_DIR_C_STRING}\"")
|
||||
endif()
|
||||
|
||||
ADD_TOOLS_DEFINITIONS(Q3LCC_DEFINITIONS)
|
||||
ADD_TOOLS_CFLAGS(Q3LCC_CFLAGS)
|
||||
|
||||
#source_group("Source Files" FILES ${Q3LCC_SOURCES})
|
||||
#source_group("Header Files" FILES ${Q3LCC_HEADERS})
|
||||
|
||||
add_executable(${Q3LCC_TARGET} ${Q3LCC_SOURCES} ${Q3LCC_HEADERS})
|
||||
|
||||
target_compile_definitions(${Q3LCC_TARGET} PRIVATE ${Q3LCC_DEFINITIONS})
|
||||
|
||||
target_include_directories(${Q3LCC_TARGET} PRIVATE ${Q3LCC_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${Q3LCC_TARGET} PRIVATE ${Q3LCC_CFLAGS})
|
||||
|
||||
target_link_libraries(${Q3LCC_TARGET} ${Q3LCC_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${Q3LCC_TARGET} PRIVATE ${Q3LCC_LDFLAGS})
|
118
misc/CMakeLists/tools/q3rcc/CMakeLists.txt
Normal file
118
misc/CMakeLists/tools/q3rcc/CMakeLists.txt
Normal file
|
@ -0,0 +1,118 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("q3rcc")
|
||||
|
||||
set(Q3RCC_TARGET "q3rcc" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
set(Q3RCC_DIR "${SOURCE_DIR}/code/tools/lcc/src")
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(DAG_FILE "${CMAKE_CURRENT_BINARY_DIR}/dagcheck.c")
|
||||
|
||||
set(Q3RCC_SOURCES
|
||||
"${Q3RCC_DIR}/alloc.c"
|
||||
"${Q3RCC_DIR}/bind.c"
|
||||
"${Q3RCC_DIR}/bytecode.c"
|
||||
"${Q3RCC_DIR}/dag.c"
|
||||
# "${Q3RCC_DIR}/dagcheck.c"
|
||||
"${DAG_FILE}"
|
||||
"${Q3RCC_DIR}/decl.c"
|
||||
"${Q3RCC_DIR}/enode.c"
|
||||
"${Q3RCC_DIR}/error.c"
|
||||
"${Q3RCC_DIR}/event.c"
|
||||
"${Q3RCC_DIR}/expr.c"
|
||||
"${Q3RCC_DIR}/gen.c"
|
||||
"${Q3RCC_DIR}/init.c"
|
||||
"${Q3RCC_DIR}/inits.c"
|
||||
"${Q3RCC_DIR}/input.c"
|
||||
"${Q3RCC_DIR}/lex.c"
|
||||
"${Q3RCC_DIR}/list.c"
|
||||
"${Q3RCC_DIR}/main.c"
|
||||
"${Q3RCC_DIR}/null.c"
|
||||
"${Q3RCC_DIR}/output.c"
|
||||
"${Q3RCC_DIR}/prof.c"
|
||||
"${Q3RCC_DIR}/profio.c"
|
||||
"${Q3RCC_DIR}/simp.c"
|
||||
"${Q3RCC_DIR}/stmt.c"
|
||||
"${Q3RCC_DIR}/string.c"
|
||||
"${Q3RCC_DIR}/sym.c"
|
||||
"${Q3RCC_DIR}/symbolic.c"
|
||||
"${Q3RCC_DIR}/trace.c"
|
||||
"${Q3RCC_DIR}/tree.c"
|
||||
"${Q3RCC_DIR}/types.c"
|
||||
|
||||
)
|
||||
set(Q3RCC_HEADERS
|
||||
"${Q3RCC_DIR}/config.h"
|
||||
"${Q3RCC_DIR}/token.h"
|
||||
"${Q3RCC_DIR}/c.h"
|
||||
)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set_source_files_properties("${DAG_FILE}" PROPERTIES COMPILE_FLAGS "-Wno-unused")
|
||||
|
||||
endif()
|
||||
|
||||
ADD_TOOLS_DEFINITIONS(Q3RCC_DEFINITIONS)
|
||||
ADD_TOOLS_CFLAGS(Q3RCC_CFLAGS)
|
||||
|
||||
#dagcheck.c requires c.h
|
||||
list(APPEND Q3RCC_INCLUDE_DIRS "${Q3RCC_DIR}")
|
||||
|
||||
source_group("Source Files" FILES ${Q3RCC_SOURCES})
|
||||
source_group("Header Files" FILES ${Q3RCC_HEADERS})
|
||||
|
||||
add_executable(${Q3RCC_TARGET} ${Q3RCC_SOURCES} ${Q3RCC_HEADERS})
|
||||
|
||||
target_compile_definitions(${Q3RCC_TARGET} PRIVATE ${Q3RCC_DEFINITIONS})
|
||||
|
||||
target_include_directories(${Q3RCC_TARGET} PRIVATE ${Q3RCC_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${Q3RCC_TARGET} PRIVATE ${Q3RCC_CFLAGS})
|
||||
|
||||
target_link_libraries(${Q3RCC_TARGET} ${Q3RCC_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${Q3RCC_TARGET} PRIVATE ${Q3RCC_LDFLAGS})
|
||||
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dagcheck.c"
|
||||
COMMAND "$<TARGET_FILE:${LBURG_TARGET}>"
|
||||
ARGS "${Q3RCC_DIR}/dagcheck.md" "${DAG_FILE}"
|
||||
DEPENDS "${Q3RCC_DIR}/dagcheck.md" "${LBURG_TARGET}"
|
||||
)
|
14
misc/CMakeLists/vm/CMakeLists.txt
Normal file
14
misc/CMakeLists/vm/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
project("vm")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
|
||||
set(BASEGAME "${DEFAULT_BASEGAME}" CACHE STRING "Directory for the base game")
|
||||
set(MISSIONPACK "${DEFAULT_MISSIONPACK}" CACHE STRING "Directory for the missionpack")
|
||||
|
||||
add_subdirectory("${BASEGAME}")
|
||||
add_subdirectory("${MISSIONPACK}")
|
25
misc/CMakeLists/vm/baseq3/CMakeLists.txt
Normal file
25
misc/CMakeLists/vm/baseq3/CMakeLists.txt
Normal file
|
@ -0,0 +1,25 @@
|
|||
project("basegame vm")
|
||||
|
||||
add_subdirectory("cgame")
|
||||
add_subdirectory("game")
|
||||
add_subdirectory("ui")
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.3.0")
|
||||
|
||||
set(BASE_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/basegame")
|
||||
set(PK3_FILENAME "basegame_vm.pk3")
|
||||
set(PK3_FILE "${BASE_DIR}/${PK3_FILENAME}")
|
||||
|
||||
add_custom_target(dist_basegame_vm
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir "${BASE_DIR}"
|
||||
tar "cfv" "${PK3_FILE}" --format=zip
|
||||
"vm/$<TARGET_FILE_NAME:${BASE_CGAME_VM_TARGET}>"
|
||||
"vm/$<TARGET_FILE_NAME:${BASE_GAME_VM_TARGET}>"
|
||||
"vm/$<TARGET_FILE_NAME:${BASE_UI_VM_TARGET}>"
|
||||
DEPENDS ${BASE_CGAME_VM_TARGET}
|
||||
${BASE_GAME_VM_TARGET}
|
||||
${BASE_UI_VM_TARGET}
|
||||
COMMENT ${PK3_FILE}
|
||||
)
|
||||
|
||||
endif()
|
148
misc/CMakeLists/vm/baseq3/cgame/CMakeLists.txt
Normal file
148
misc/CMakeLists/vm/baseq3/cgame/CMakeLists.txt
Normal file
|
@ -0,0 +1,148 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("basegame cgame vm")
|
||||
|
||||
set(BASE_CGAME_VM_TARGET "basegame_cgame_vm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(BASEGAME_VM_INSTALL_DIR "${DEFAULT_BASEGAME_VM_INSTALL_DIR}" CACHE PATH "Basegame VM Installation directory")
|
||||
|
||||
set(CGAME_SOURCES
|
||||
"${CGAME_DIR}/cg_consolecmds.c"
|
||||
"${CGAME_DIR}/cg_draw.c"
|
||||
"${CGAME_DIR}/cg_drawtools.c"
|
||||
"${CGAME_DIR}/cg_effects.c"
|
||||
"${CGAME_DIR}/cg_ents.c"
|
||||
"${CGAME_DIR}/cg_event.c"
|
||||
"${CGAME_DIR}/cg_info.c"
|
||||
"${CGAME_DIR}/cg_localents.c"
|
||||
"${CGAME_DIR}/cg_main.c"
|
||||
"${CGAME_DIR}/cg_marks.c"
|
||||
"${CGAME_DIR}/cg_particles.c"
|
||||
"${CGAME_DIR}/cg_players.c"
|
||||
"${CGAME_DIR}/cg_playerstate.c"
|
||||
"${CGAME_DIR}/cg_predict.c"
|
||||
"${CGAME_DIR}/cg_scoreboard.c"
|
||||
"${CGAME_DIR}/cg_servercmds.c"
|
||||
"${CGAME_DIR}/cg_snapshot.c"
|
||||
"${CGAME_DIR}/cg_view.c"
|
||||
"${CGAME_DIR}/cg_weapons.c"
|
||||
|
||||
"${CGAME_DIR}/cg_syscalls.c"
|
||||
)
|
||||
set(CGAME_HEADERS
|
||||
"${CGAME_DIR}/cg_local.h"
|
||||
"${CGAME_DIR}/cg_public.h"
|
||||
)
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_pmove.c"
|
||||
"${GAME_DIR}/bg_slidemove.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
ADD_VM_DEFINITIONS(CGAME_DEFINITIONS)
|
||||
ADD_VM_CFLAGS(CGAME_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(CGAME_LDFLAGS)
|
||||
|
||||
list(APPEND CGAME_DEFINITIONS "-DCGAME")
|
||||
|
||||
list(APPEND CGAME_C_SOURCES ${CGAME_SOURCES} ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND CGAME_C_HEADERS ${CGAME_HEADERS} ${GAME_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("cgame\\Source Files" FILES ${CGAME_SOURCES})
|
||||
source_group("cgame\\Header Files" FILES ${CGAME_HEADERS})
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
add_library(${BASE_CGAME_VM_TARGET} MODULE ${CGAME_C_SOURCES} ${CGAME_C_HEADERS})
|
||||
|
||||
target_compile_definitions(${BASE_CGAME_VM_TARGET} PRIVATE ${CGAME_DEFINITIONS})
|
||||
|
||||
target_include_directories(${BASE_CGAME_VM_TARGET} PRIVATE ${CGAME_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${BASE_CGAME_VM_TARGET} PRIVATE ${CGAME_CFLAGS})
|
||||
|
||||
target_link_libraries(${BASE_CGAME_VM_TARGET} ${CGAME_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${BASE_CGAME_VM_TARGET} PRIVATE ${CGAME_LDFLAGS})
|
||||
|
||||
#no lib prefix, libcgame -> cgame
|
||||
set_target_properties(${BASE_CGAME_VM_TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties(${BASE_CGAME_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_NAME "cgame${ARCH}")
|
||||
set_target_properties(${BASE_CGAME_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/basegame/vm")
|
||||
|
||||
STRIP_TARGET(${BASE_CGAME_VM_TARGET})
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(BASEGAME_VM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${BASEGAME_VM_INSTALL_DIR}")
|
||||
endif(BASEGAME_VM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(TARGETS ${BASE_CGAME_VM_TARGET}
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_vm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
|
||||
include(CPack)
|
212
misc/CMakeLists/vm/baseq3/game/CMakeLists.txt
Normal file
212
misc/CMakeLists/vm/baseq3/game/CMakeLists.txt
Normal file
|
@ -0,0 +1,212 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("basegame game vm")
|
||||
|
||||
set(BASE_GAME_VM_TARGET "basegame_game_vm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(BASEGAME_VM_INSTALL_DIR "${DEFAULT_BASEGAME_VM_INSTALL_DIR}" CACHE PATH "Basegame VM Installation directory")
|
||||
|
||||
set(BOTLIB_HEADERS
|
||||
"${BOTLIB_DIR}/aasfile.h"
|
||||
"${BOTLIB_DIR}/be_aas.h"
|
||||
"${BOTLIB_DIR}/be_aas_bsp.h"
|
||||
"${BOTLIB_DIR}/be_aas_cluster.h"
|
||||
"${BOTLIB_DIR}/be_aas_debug.h"
|
||||
"${BOTLIB_DIR}/be_aas_def.h"
|
||||
"${BOTLIB_DIR}/be_aas_entity.h"
|
||||
"${BOTLIB_DIR}/be_aas_file.h"
|
||||
"${BOTLIB_DIR}/be_aas_funcs.h"
|
||||
"${BOTLIB_DIR}/be_aas_main.h"
|
||||
"${BOTLIB_DIR}/be_aas_move.h"
|
||||
"${BOTLIB_DIR}/be_aas_optimize.h"
|
||||
"${BOTLIB_DIR}/be_aas_reach.h"
|
||||
"${BOTLIB_DIR}/be_aas_route.h"
|
||||
"${BOTLIB_DIR}/be_aas_routealt.h"
|
||||
"${BOTLIB_DIR}/be_aas_sample.h"
|
||||
"${BOTLIB_DIR}/be_ai_char.h"
|
||||
"${BOTLIB_DIR}/be_ai_chat.h"
|
||||
"${BOTLIB_DIR}/be_ai_gen.h"
|
||||
"${BOTLIB_DIR}/be_ai_goal.h"
|
||||
"${BOTLIB_DIR}/be_ai_move.h"
|
||||
"${BOTLIB_DIR}/be_ai_weap.h"
|
||||
"${BOTLIB_DIR}/be_ai_weight.h"
|
||||
"${BOTLIB_DIR}/be_ea.h"
|
||||
"${BOTLIB_DIR}/be_interface.h"
|
||||
"${BOTLIB_DIR}/botlib.h"
|
||||
"${BOTLIB_DIR}/l_crc.h"
|
||||
"${BOTLIB_DIR}/l_libvar.h"
|
||||
"${BOTLIB_DIR}/l_log.h"
|
||||
"${BOTLIB_DIR}/l_memory.h"
|
||||
"${BOTLIB_DIR}/l_precomp.h"
|
||||
"${BOTLIB_DIR}/l_script.h"
|
||||
"${BOTLIB_DIR}/l_struct.h"
|
||||
"${BOTLIB_DIR}/l_utils.h"
|
||||
)
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/ai_chat.c"
|
||||
"${GAME_DIR}/ai_cmd.c"
|
||||
"${GAME_DIR}/ai_dmnet.c"
|
||||
"${GAME_DIR}/ai_dmq3.c"
|
||||
"${GAME_DIR}/ai_main.c"
|
||||
"${GAME_DIR}/ai_team.c"
|
||||
"${GAME_DIR}/ai_vcmd.c"
|
||||
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_pmove.c"
|
||||
"${GAME_DIR}/bg_slidemove.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
|
||||
"${GAME_DIR}/g_active.c"
|
||||
"${GAME_DIR}/g_arenas.c"
|
||||
"${GAME_DIR}/g_bot.c"
|
||||
"${GAME_DIR}/g_client.c"
|
||||
"${GAME_DIR}/g_cmds.c"
|
||||
"${GAME_DIR}/g_combat.c"
|
||||
"${GAME_DIR}/g_items.c"
|
||||
"${GAME_DIR}/g_main.c"
|
||||
"${GAME_DIR}/g_mem.c"
|
||||
"${GAME_DIR}/g_misc.c"
|
||||
"${GAME_DIR}/g_missile.c"
|
||||
"${GAME_DIR}/g_mover.c"
|
||||
"${GAME_DIR}/g_session.c"
|
||||
"${GAME_DIR}/g_spawn.c"
|
||||
"${GAME_DIR}/g_svcmds.c"
|
||||
"${GAME_DIR}/g_target.c"
|
||||
"${GAME_DIR}/g_team.c"
|
||||
"${GAME_DIR}/g_trigger.c"
|
||||
"${GAME_DIR}/g_utils.c"
|
||||
"${GAME_DIR}/g_weapon.c"
|
||||
|
||||
"${GAME_DIR}/g_syscalls.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/ai_chat.h"
|
||||
"${GAME_DIR}/ai_cmd.h"
|
||||
"${GAME_DIR}/ai_dmnet.h"
|
||||
"${GAME_DIR}/ai_dmq3.h"
|
||||
"${GAME_DIR}/ai_main.h"
|
||||
"${GAME_DIR}/ai_team.h"
|
||||
"${GAME_DIR}/ai_vcmd.h"
|
||||
"${GAME_DIR}/chars.h"
|
||||
"${GAME_DIR}/inv.h"
|
||||
"${GAME_DIR}/match.h"
|
||||
"${GAME_DIR}/syn.h"
|
||||
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
|
||||
"${GAME_DIR}/g_local.h"
|
||||
"${GAME_DIR}/g_public.h"
|
||||
|
||||
"${GAME_DIR}/g_team.h"
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
ADD_VM_DEFINITIONS(GAME_DEFINITIONS)
|
||||
ADD_VM_CFLAGS(GAME_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(GAME_LDFLAGS)
|
||||
|
||||
list(APPEND GAME_DEFINITIONS "-DQAGAME")
|
||||
|
||||
if(DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
string(TIMESTAMP PRODUCT_DATE "%b %d %Y" UTC) #Nov 28 2021
|
||||
list(APPEND GAME_DEFINITIONS "-DPRODUCT_DATE=\"${PRODUCT_DATE}\"")
|
||||
else()
|
||||
message(WARNING "Update CMake to version 3.8 or later for SOURCE_DATE_EPOCH support!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND GAME_C_SOURCES ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND GAME_C_HEADERS ${GAME_HEADERS} ${QCOMMON_HEADERS} ${BOTLIB_HEADERS})
|
||||
|
||||
source_group("botlib\\Header Files" FILES ${BOTLIB_HEADERS})
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
add_library(${BASE_GAME_VM_TARGET} MODULE ${GAME_C_SOURCES} ${GAME_C_HEADERS})
|
||||
|
||||
target_compile_definitions(${BASE_GAME_VM_TARGET} PRIVATE ${GAME_DEFINITIONS})
|
||||
|
||||
target_include_directories(${BASE_GAME_VM_TARGET} PRIVATE ${GAME_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${BASE_GAME_VM_TARGET} PRIVATE ${GAME_CFLAGS})
|
||||
|
||||
target_link_libraries(${BASE_GAME_VM_TARGET} ${GAME_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${BASE_GAME_VM_TARGET} PRIVATE ${GAME_LDFLAGS})
|
||||
|
||||
set_target_properties(${BASE_GAME_VM_TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties(${BASE_GAME_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_NAME "qagame${ARCH}")
|
||||
set_target_properties(${BASE_GAME_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/basegame/vm")
|
||||
|
||||
STRIP_TARGET(${BASE_GAME_VM_TARGET})
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(BASEGAME_VM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${BASEGAME_VM_INSTALL_DIR}")
|
||||
endif(BASEGAME_VM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(TARGETS ${BASE_GAME_VM_TARGET}
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_vm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
171
misc/CMakeLists/vm/baseq3/ui/CMakeLists.txt
Normal file
171
misc/CMakeLists/vm/baseq3/ui/CMakeLists.txt
Normal file
|
@ -0,0 +1,171 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("basegame ui vm")
|
||||
|
||||
set(BASE_UI_VM_TARGET "basegame_ui_vm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(BASEGAME_VM_INSTALL_DIR "${DEFAULT_BASEGAME_VM_INSTALL_DIR}" CACHE PATH "Basegame VM Installation directory")
|
||||
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
)
|
||||
set(Q3_UI_SOURCES
|
||||
"${Q3_UI_DIR}/ui_addbots.c"
|
||||
"${Q3_UI_DIR}/ui_atoms.c"
|
||||
"${Q3_UI_DIR}/ui_cdkey.c"
|
||||
"${Q3_UI_DIR}/ui_cinematics.c"
|
||||
"${Q3_UI_DIR}/ui_confirm.c"
|
||||
"${Q3_UI_DIR}/ui_connect.c"
|
||||
"${Q3_UI_DIR}/ui_controls2.c"
|
||||
"${Q3_UI_DIR}/ui_credits.c"
|
||||
"${Q3_UI_DIR}/ui_demo2.c"
|
||||
"${Q3_UI_DIR}/ui_display.c"
|
||||
"${Q3_UI_DIR}/ui_gameinfo.c"
|
||||
"${Q3_UI_DIR}/ui_ingame.c"
|
||||
"${Q3_UI_DIR}/ui_loadconfig.c"
|
||||
"${Q3_UI_DIR}/ui_main.c"
|
||||
"${Q3_UI_DIR}/ui_menu.c"
|
||||
"${Q3_UI_DIR}/ui_mfield.c"
|
||||
"${Q3_UI_DIR}/ui_mods.c"
|
||||
"${Q3_UI_DIR}/ui_network.c"
|
||||
"${Q3_UI_DIR}/ui_options.c"
|
||||
"${Q3_UI_DIR}/ui_playermodel.c"
|
||||
"${Q3_UI_DIR}/ui_players.c"
|
||||
"${Q3_UI_DIR}/ui_playersettings.c"
|
||||
"${Q3_UI_DIR}/ui_preferences.c"
|
||||
"${Q3_UI_DIR}/ui_qmenu.c"
|
||||
"${Q3_UI_DIR}/ui_removebots.c"
|
||||
"${Q3_UI_DIR}/ui_saveconfig.c"
|
||||
"${Q3_UI_DIR}/ui_serverinfo.c"
|
||||
"${Q3_UI_DIR}/ui_servers2.c"
|
||||
"${Q3_UI_DIR}/ui_setup.c"
|
||||
"${Q3_UI_DIR}/ui_sound.c"
|
||||
"${Q3_UI_DIR}/ui_sparena.c"
|
||||
"${Q3_UI_DIR}/ui_specifyserver.c"
|
||||
"${Q3_UI_DIR}/ui_splevel.c"
|
||||
"${Q3_UI_DIR}/ui_sppostgame.c"
|
||||
"${Q3_UI_DIR}/ui_spskill.c"
|
||||
"${Q3_UI_DIR}/ui_startserver.c"
|
||||
"${Q3_UI_DIR}/ui_team.c"
|
||||
"${Q3_UI_DIR}/ui_teamorders.c"
|
||||
"${Q3_UI_DIR}/ui_video.c"
|
||||
|
||||
)
|
||||
set(Q3_UI_HEADERS
|
||||
"${Q3_UI_DIR}/ui_local.h"
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
set(UI_SOURCES
|
||||
"${UI_DIR}/ui_syscalls.c"
|
||||
)
|
||||
set(UI_HEADERS
|
||||
|
||||
)
|
||||
|
||||
ADD_VM_DEFINITIONS(UI_DEFINITIONS)
|
||||
ADD_VM_CFLAGS(UI_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(UI_LDFLAGS)
|
||||
|
||||
list(APPEND UI_DEFINITIONS "-DUI")
|
||||
|
||||
list(APPEND UI_C_SOURCES ${Q3_UI_SOURCES} ${UI_SOURCES} ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND UI_C_HEADERS ${Q3_UI_HEADERS} ${UI_HEADERS} ${GAME_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("q3_ui\\Source Files" FILES ${Q3_UI_SOURCES})
|
||||
source_group("q3_ui\\Header Files" FILES ${Q3_UI_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
source_group("ui\\Source Files" FILES ${UI_SOURCES})
|
||||
source_group("ui\\Header Files" FILES ${UI_HEADERS})
|
||||
|
||||
add_library(${BASE_UI_VM_TARGET} MODULE ${UI_C_SOURCES} ${UI_C_HEADERS})
|
||||
|
||||
target_compile_definitions(${BASE_UI_VM_TARGET} PRIVATE ${UI_DEFINITIONS})
|
||||
|
||||
target_include_directories(${BASE_UI_VM_TARGET} PRIVATE ${UI_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${BASE_UI_VM_TARGET} PRIVATE ${UI_CFLAGS})
|
||||
|
||||
target_link_libraries(${BASE_UI_VM_TARGET} ${UI_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${BASE_UI_VM_TARGET} PRIVATE ${UI_LDFLAGS})
|
||||
|
||||
set_target_properties(${BASE_UI_VM_TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties(${BASE_UI_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_NAME "ui${ARCH}")
|
||||
set_target_properties(${BASE_UI_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/basegame/vm")
|
||||
|
||||
STRIP_TARGET(${BASE_UI_VM_TARGET})
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(BASEGAME_VM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${BASEGAME_VM_INSTALL_DIR}")
|
||||
endif(BASEGAME_VM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(TARGETS ${BASE_UI_VM_TARGET}
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_vm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
25
misc/CMakeLists/vm/missionpack/CMakeLists.txt
Normal file
25
misc/CMakeLists/vm/missionpack/CMakeLists.txt
Normal file
|
@ -0,0 +1,25 @@
|
|||
project("missionpack vm")
|
||||
|
||||
add_subdirectory("cgame")
|
||||
add_subdirectory("game")
|
||||
add_subdirectory("ui")
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.3.0")
|
||||
|
||||
set(MISSION_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/missionpack")
|
||||
set(PK3_FILENAME "missionpack_vm.pk3")
|
||||
set(PK3_FILE "${MISSION_DIR}/${PK3_FILENAME}")
|
||||
|
||||
add_custom_target(dist_missionpack_vm
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir "${MISSION_DIR}"
|
||||
tar "cfv" "${PK3_FILE}" --format=zip
|
||||
"vm/$<TARGET_FILE_NAME:${MISSION_CGAME_VM_TARGET}>"
|
||||
"vm/$<TARGET_FILE_NAME:${MISSION_GAME_VM_TARGET}>"
|
||||
"vm/$<TARGET_FILE_NAME:${MISSION_UI_VM_TARGET}>"
|
||||
DEPENDS ${MISSION_CGAME_VM_TARGET}
|
||||
${MISSION_GAME_VM_TARGET}
|
||||
${MISSION_UI_VM_TARGET}
|
||||
COMMENT ${PK3_FILE}
|
||||
)
|
||||
|
||||
endif()
|
157
misc/CMakeLists/vm/missionpack/cgame/CMakeLists.txt
Normal file
157
misc/CMakeLists/vm/missionpack/cgame/CMakeLists.txt
Normal file
|
@ -0,0 +1,157 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("missionpack cgame vm")
|
||||
|
||||
set(MISSION_CGAME_VM_TARGET "missionpack_cgame_vm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(MISSIONPACK_VM_INSTALL_DIR "${DEFAULT_MISSIONPACK_VM_INSTALL_DIR}" CACHE PATH "Missionpack VM Installation directory")
|
||||
|
||||
set(CGAME_SOURCES
|
||||
"${CGAME_DIR}/cg_consolecmds.c"
|
||||
"${CGAME_DIR}/cg_draw.c"
|
||||
"${CGAME_DIR}/cg_drawtools.c"
|
||||
"${CGAME_DIR}/cg_effects.c"
|
||||
"${CGAME_DIR}/cg_ents.c"
|
||||
"${CGAME_DIR}/cg_event.c"
|
||||
"${CGAME_DIR}/cg_info.c"
|
||||
"${CGAME_DIR}/cg_localents.c"
|
||||
"${CGAME_DIR}/cg_main.c"
|
||||
"${CGAME_DIR}/cg_marks.c"
|
||||
"${CGAME_DIR}/cg_newdraw.c"
|
||||
"${CGAME_DIR}/cg_particles.c"
|
||||
"${CGAME_DIR}/cg_players.c"
|
||||
"${CGAME_DIR}/cg_playerstate.c"
|
||||
"${CGAME_DIR}/cg_predict.c"
|
||||
"${CGAME_DIR}/cg_scoreboard.c"
|
||||
"${CGAME_DIR}/cg_servercmds.c"
|
||||
"${CGAME_DIR}/cg_snapshot.c"
|
||||
"${CGAME_DIR}/cg_view.c"
|
||||
"${CGAME_DIR}/cg_weapons.c"
|
||||
|
||||
"${CGAME_DIR}/cg_syscalls.c"
|
||||
)
|
||||
set(CGAME_HEADERS
|
||||
"${CGAME_DIR}/cg_local.h"
|
||||
"${CGAME_DIR}/cg_public.h"
|
||||
)
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_pmove.c"
|
||||
"${GAME_DIR}/bg_slidemove.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
)
|
||||
set(UI_SOURCES
|
||||
"${UI_DIR}/ui_shared.c"
|
||||
)
|
||||
set(UI_HEADERS
|
||||
"${UI_DIR}/ui_shared.h"
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
ADD_VM_DEFINITIONS(CGAME_DEFINITIONS)
|
||||
ADD_VM_CFLAGS(CGAME_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(CGAME_LDFLAGS)
|
||||
|
||||
list(APPEND CGAME_DEFINITIONS "-DCGAME")
|
||||
list(APPEND CGAME_DEFINITIONS "-DMISSIONPACK")
|
||||
|
||||
list(APPEND CGAME_C_SOURCES ${CGAME_SOURCES} ${GAME_SOURCES} ${UI_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND CGAME_C_HEADERS ${CGAME_HEADERS} ${GAME_HEADERS} ${UI_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("cgame\\Source Files" FILES ${CGAME_SOURCES})
|
||||
source_group("cgame\\Header Files" FILES ${CGAME_HEADERS})
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("ui\\Source Files" FILES ${UI_SOURCES})
|
||||
source_group("ui\\Header Files" FILES ${UI_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
add_library(${MISSION_CGAME_VM_TARGET} MODULE ${CGAME_C_SOURCES} ${CGAME_C_HEADERS})
|
||||
|
||||
target_compile_definitions(${MISSION_CGAME_VM_TARGET} PRIVATE ${CGAME_DEFINITIONS})
|
||||
|
||||
target_include_directories(${MISSION_CGAME_VM_TARGET} PRIVATE ${CGAME_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${MISSION_CGAME_VM_TARGET} PRIVATE ${CGAME_CFLAGS})
|
||||
|
||||
target_link_libraries(${MISSION_CGAME_VM_TARGET} ${CGAME_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${MISSION_CGAME_VM_TARGET} PRIVATE ${CGAME_LDFLAGS})
|
||||
|
||||
set_target_properties(${MISSION_CGAME_VM_TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties(${MISSION_CGAME_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_NAME "cgame${ARCH}")
|
||||
set_target_properties(${MISSION_CGAME_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/missionpack/vm")
|
||||
|
||||
STRIP_TARGET(${MISSION_CGAME_VM_TARGET})
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(MISSIONPACK_VM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${MISSIONPACK_VM_INSTALL_DIR}")
|
||||
endif(MISSIONPACK_VM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(TARGETS ${MISSION_CGAME_VM_TARGET}
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_vm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
|
||||
include(CPack)
|
213
misc/CMakeLists/vm/missionpack/game/CMakeLists.txt
Normal file
213
misc/CMakeLists/vm/missionpack/game/CMakeLists.txt
Normal file
|
@ -0,0 +1,213 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("missionpack game vm")
|
||||
|
||||
set(MISSION_GAME_VM_TARGET "missionpack_game_vm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(MISSIONPACK_VM_INSTALL_DIR "${DEFAULT_MISSIONPACK_VM_INSTALL_DIR}" CACHE PATH "Missionpack VM Installation directory")
|
||||
|
||||
set(BOTLIB_HEADERS
|
||||
"${BOTLIB_DIR}/aasfile.h"
|
||||
"${BOTLIB_DIR}/be_aas.h"
|
||||
"${BOTLIB_DIR}/be_aas_bsp.h"
|
||||
"${BOTLIB_DIR}/be_aas_cluster.h"
|
||||
"${BOTLIB_DIR}/be_aas_debug.h"
|
||||
"${BOTLIB_DIR}/be_aas_def.h"
|
||||
"${BOTLIB_DIR}/be_aas_entity.h"
|
||||
"${BOTLIB_DIR}/be_aas_file.h"
|
||||
"${BOTLIB_DIR}/be_aas_funcs.h"
|
||||
"${BOTLIB_DIR}/be_aas_main.h"
|
||||
"${BOTLIB_DIR}/be_aas_move.h"
|
||||
"${BOTLIB_DIR}/be_aas_optimize.h"
|
||||
"${BOTLIB_DIR}/be_aas_reach.h"
|
||||
"${BOTLIB_DIR}/be_aas_route.h"
|
||||
"${BOTLIB_DIR}/be_aas_routealt.h"
|
||||
"${BOTLIB_DIR}/be_aas_sample.h"
|
||||
"${BOTLIB_DIR}/be_ai_char.h"
|
||||
"${BOTLIB_DIR}/be_ai_chat.h"
|
||||
"${BOTLIB_DIR}/be_ai_gen.h"
|
||||
"${BOTLIB_DIR}/be_ai_goal.h"
|
||||
"${BOTLIB_DIR}/be_ai_move.h"
|
||||
"${BOTLIB_DIR}/be_ai_weap.h"
|
||||
"${BOTLIB_DIR}/be_ai_weight.h"
|
||||
"${BOTLIB_DIR}/be_ea.h"
|
||||
"${BOTLIB_DIR}/be_interface.h"
|
||||
"${BOTLIB_DIR}/botlib.h"
|
||||
"${BOTLIB_DIR}/l_crc.h"
|
||||
"${BOTLIB_DIR}/l_libvar.h"
|
||||
"${BOTLIB_DIR}/l_log.h"
|
||||
"${BOTLIB_DIR}/l_memory.h"
|
||||
"${BOTLIB_DIR}/l_precomp.h"
|
||||
"${BOTLIB_DIR}/l_script.h"
|
||||
"${BOTLIB_DIR}/l_struct.h"
|
||||
"${BOTLIB_DIR}/l_utils.h"
|
||||
)
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/ai_chat.c"
|
||||
"${GAME_DIR}/ai_cmd.c"
|
||||
"${GAME_DIR}/ai_dmnet.c"
|
||||
"${GAME_DIR}/ai_dmq3.c"
|
||||
"${GAME_DIR}/ai_main.c"
|
||||
"${GAME_DIR}/ai_team.c"
|
||||
"${GAME_DIR}/ai_vcmd.c"
|
||||
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_pmove.c"
|
||||
"${GAME_DIR}/bg_slidemove.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
|
||||
"${GAME_DIR}/g_active.c"
|
||||
"${GAME_DIR}/g_arenas.c"
|
||||
"${GAME_DIR}/g_bot.c"
|
||||
"${GAME_DIR}/g_client.c"
|
||||
"${GAME_DIR}/g_cmds.c"
|
||||
"${GAME_DIR}/g_combat.c"
|
||||
"${GAME_DIR}/g_items.c"
|
||||
"${GAME_DIR}/g_main.c"
|
||||
"${GAME_DIR}/g_mem.c"
|
||||
"${GAME_DIR}/g_misc.c"
|
||||
"${GAME_DIR}/g_missile.c"
|
||||
"${GAME_DIR}/g_mover.c"
|
||||
"${GAME_DIR}/g_session.c"
|
||||
"${GAME_DIR}/g_spawn.c"
|
||||
"${GAME_DIR}/g_svcmds.c"
|
||||
"${GAME_DIR}/g_target.c"
|
||||
"${GAME_DIR}/g_team.c"
|
||||
"${GAME_DIR}/g_trigger.c"
|
||||
"${GAME_DIR}/g_utils.c"
|
||||
"${GAME_DIR}/g_weapon.c"
|
||||
|
||||
"${GAME_DIR}/g_syscalls.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/ai_chat.h"
|
||||
"${GAME_DIR}/ai_cmd.h"
|
||||
"${GAME_DIR}/ai_dmnet.h"
|
||||
"${GAME_DIR}/ai_dmq3.h"
|
||||
"${GAME_DIR}/ai_main.h"
|
||||
"${GAME_DIR}/ai_team.h"
|
||||
"${GAME_DIR}/ai_vcmd.h"
|
||||
"${GAME_DIR}/chars.h"
|
||||
"${GAME_DIR}/inv.h"
|
||||
"${GAME_DIR}/match.h"
|
||||
"${GAME_DIR}/syn.h"
|
||||
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
|
||||
"${GAME_DIR}/g_local.h"
|
||||
"${GAME_DIR}/g_public.h"
|
||||
|
||||
"${GAME_DIR}/g_team.h"
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
ADD_VM_DEFINITIONS(GAME_DEFINITIONS)
|
||||
ADD_VM_CFLAGS(GAME_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(GAME_LDFLAGS)
|
||||
|
||||
list(APPEND GAME_DEFINITIONS "-DQAGAME")
|
||||
list(APPEND GAME_DEFINITIONS "-DMISSIONPACK")
|
||||
|
||||
if(DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
string(TIMESTAMP PRODUCT_DATE "%b %d %Y" UTC) #Nov 28 2021
|
||||
list(APPEND GAME_DEFINITIONS "-DPRODUCT_DATE=\"${PRODUCT_DATE}\"")
|
||||
else()
|
||||
message(WARNING "Update CMake to version 3.8 or later for SOURCE_DATE_EPOCH support!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND GAME_C_SOURCES ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND GAME_C_HEADERS ${GAME_HEADERS} ${QCOMMON_HEADERS} ${BOTLIB_HEADERS})
|
||||
|
||||
source_group("botlib\\Header Files" FILES ${BOTLIB_HEADERS})
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
add_library(${MISSION_GAME_VM_TARGET} MODULE ${GAME_C_SOURCES} ${GAME_C_HEADERS})
|
||||
|
||||
target_compile_definitions(${MISSION_GAME_VM_TARGET} PRIVATE ${GAME_DEFINITIONS})
|
||||
|
||||
target_include_directories(${MISSION_GAME_VM_TARGET} PRIVATE ${GAME_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${MISSION_GAME_VM_TARGET} PRIVATE ${GAME_CFLAGS})
|
||||
|
||||
target_link_libraries(${MISSION_GAME_VM_TARGET} ${GAME_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${MISSION_GAME_VM_TARGET} PRIVATE ${GAME_LDFLAGS})
|
||||
|
||||
set_target_properties(${MISSION_GAME_VM_TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties(${MISSION_GAME_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_NAME "qagame${ARCH}")
|
||||
set_target_properties(${MISSION_GAME_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/missionpack/vm")
|
||||
|
||||
STRIP_TARGET(${MISSION_GAME_VM_TARGET})
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(MISSIONPACK_VM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${MISSIONPACK_VM_INSTALL_DIR}")
|
||||
endif(MISSIONPACK_VM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(TARGETS ${MISSION_GAME_VM_TARGET}
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_vm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
134
misc/CMakeLists/vm/missionpack/ui/CMakeLists.txt
Normal file
134
misc/CMakeLists/vm/missionpack/ui/CMakeLists.txt
Normal file
|
@ -0,0 +1,134 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2022 github.com/Pan7
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("missionpack ui vm")
|
||||
|
||||
set(MISSION_UI_VM_TARGET "missionpack_ui_vm" CACHE INTERNAL "Target name")
|
||||
|
||||
if(NOT DEFINED SOURCE_DIR)
|
||||
set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(CMAKELIST_DIR "${SOURCE_DIR}/misc/CMakeLists")
|
||||
endif()
|
||||
|
||||
include("${CMAKELIST_DIR}/include/cflags.cmake")
|
||||
include("${CMAKELIST_DIR}/include/compat.cmake")
|
||||
include("${CMAKELIST_DIR}/include/default_options.cmake")
|
||||
include("${CMAKELIST_DIR}/include/directory_constants.cmake")
|
||||
include("${CMAKELIST_DIR}/include/strip.cmake")
|
||||
include("${CMAKELIST_DIR}/include/platform.cmake")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
option(GENERATE_DEPENDENCIES "Preprocessing: Generate dependencies for make outputting" ${DEFAULT_GENERATE_DEPENDENCIES})
|
||||
endif()
|
||||
option(NO_STRIP "No strip (keep all symbol table and relocation information)" ${DEFAULT_NO_STRIP})
|
||||
if(MSVC)
|
||||
option(BUILD_STATIC_CRT "Build (static) multi-threaded C runtime library" ${DEFAULT_BUILD_STATIC_CRT})
|
||||
endif()
|
||||
|
||||
set(MISSIONPACK_VM_INSTALL_DIR "${DEFAULT_MISSIONPACK_VM_INSTALL_DIR}" CACHE PATH "Missionpack VM Installation directory")
|
||||
|
||||
set(GAME_SOURCES
|
||||
"${GAME_DIR}/bg_misc.c"
|
||||
"${GAME_DIR}/bg_lib.c"
|
||||
)
|
||||
set(GAME_HEADERS
|
||||
"${GAME_DIR}/bg_local.h"
|
||||
"${GAME_DIR}/bg_public.h"
|
||||
"${GAME_DIR}/bg_lib.h"
|
||||
)
|
||||
set(UI_SOURCES
|
||||
"${UI_DIR}/ui_atoms.c"
|
||||
"${UI_DIR}/ui_main.c"
|
||||
"${UI_DIR}/ui_gameinfo.c"
|
||||
"${UI_DIR}/ui_players.c"
|
||||
"${UI_DIR}/ui_shared.c"
|
||||
|
||||
"${UI_DIR}/ui_syscalls.c"
|
||||
)
|
||||
set(UI_HEADERS
|
||||
"${UI_DIR}/ui_local.h"
|
||||
"${UI_DIR}/ui_public.h"
|
||||
|
||||
"${UI_DIR}/ui_shared.h"
|
||||
|
||||
)
|
||||
set(QCOMMON_SOURCES
|
||||
"${QCOMMON_DIR}/q_math.c"
|
||||
"${QCOMMON_DIR}/q_shared.c"
|
||||
)
|
||||
set(QCOMMON_HEADERS
|
||||
"${QCOMMON_DIR}/q_shared.h"
|
||||
)
|
||||
|
||||
ADD_VM_DEFINITIONS(UI_DEFINITIONS)
|
||||
ADD_VM_CFLAGS(UI_CFLAGS)
|
||||
ADD_STRIP_LDFLAG(UI_LDFLAGS)
|
||||
|
||||
list(APPEND UI_DEFINITIONS "-DUI")
|
||||
list(APPEND UI_DEFINITIONS "-DMISSIONPACK")
|
||||
|
||||
list(APPEND UI_C_SOURCES ${UI_SOURCES} ${GAME_SOURCES} ${QCOMMON_SOURCES})
|
||||
list(APPEND UI_C_HEADERS ${UI_HEADERS} ${GAME_HEADERS} ${QCOMMON_HEADERS})
|
||||
|
||||
source_group("game\\Source Files" FILES ${GAME_SOURCES})
|
||||
source_group("game\\Header Files" FILES ${GAME_HEADERS})
|
||||
source_group("ui\\Source Files" FILES ${UI_SOURCES})
|
||||
source_group("ui\\Header Files" FILES ${UI_HEADERS})
|
||||
source_group("qcommon\\Source Files" FILES ${QCOMMON_SOURCES})
|
||||
source_group("qcommon\\Header Files" FILES ${QCOMMON_HEADERS})
|
||||
|
||||
add_library(${MISSION_UI_VM_TARGET} MODULE ${UI_C_SOURCES} ${UI_C_HEADERS})
|
||||
|
||||
target_compile_definitions(${MISSION_UI_VM_TARGET} PRIVATE ${UI_DEFINITIONS})
|
||||
|
||||
target_include_directories(${MISSION_UI_VM_TARGET} PRIVATE ${UI_INCLUDE_DIRS})
|
||||
|
||||
compat_target_compile_options(${MISSION_UI_VM_TARGET} PRIVATE ${UI_CFLAGS})
|
||||
|
||||
target_link_libraries(${MISSION_UI_VM_TARGET} ${UI_LIBRARIES})
|
||||
|
||||
compat_target_link_options(${MISSION_UI_VM_TARGET} PRIVATE ${UI_LDFLAGS})
|
||||
|
||||
set_target_properties(${MISSION_UI_VM_TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties(${MISSION_UI_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_NAME "ui${ARCH}")
|
||||
set_target_properties(${MISSION_UI_VM_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/missionpack/vm")
|
||||
|
||||
STRIP_TARGET(${MISSION_UI_VM_TARGET})
|
||||
|
||||
set(DESTIONATION_DIR)
|
||||
if(MISSIONPACK_VM_INSTALL_DIR)
|
||||
set(DESTIONATION_DIR "${MISSIONPACK_VM_INSTALL_DIR}")
|
||||
endif(MISSIONPACK_VM_INSTALL_DIR)
|
||||
|
||||
if(DESTIONATION_DIR)
|
||||
install(TARGETS ${MISSION_UI_VM_TARGET}
|
||||
DESTINATION "${DESTIONATION_DIR}"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
|
||||
CONFIGURATIONS Release
|
||||
COMPONENT missionpack_vm
|
||||
)
|
||||
endif(DESTIONATION_DIR)
|
||||
|
||||
include(CPack)
|
Loading…
Reference in a new issue