From ea5a82ef743ab444bc3c4789cdae096a3ac6f556 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 20 Mar 2016 00:01:05 +1100 Subject: [PATCH] Add CMakeLists.txt --- CMakeLists.txt | 25 +++++++++++++++++++++++++ cmake/CMakeASMCompiler.cmake.in | 8 ++++++++ cmake/CMakeASMInformation.cmake | 8 ++++++++ cmake/CMakeDetermineASMCompiler.cmake | 5 +++++ cmake/CMakeTestASMCompiler.cmake | 1 + cmake/qcc.sh | 19 +++++++++++++++++++ 6 files changed, 66 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/CMakeASMCompiler.cmake.in create mode 100644 cmake/CMakeASMInformation.cmake create mode 100644 cmake/CMakeDetermineASMCompiler.cmake create mode 100644 cmake/CMakeTestASMCompiler.cmake create mode 100755 cmake/qcc.sh diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..a2008975e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.8.11) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +project(xonotic-data LANGUAGES ASM) + +add_definitions(-DWATERMARK=\"12345\") +add_definitions(-DNDEBUG=1) +include_directories(qcsrc) + +set_source_files_properties( + qcsrc/client/progs.inc + qcsrc/server/progs.inc + qcsrc/menu/progs.inc + PROPERTIES + LANGUAGE ASM + HEADER_FILE_ONLY FALSE +) + +add_executable(csprogs qcsrc/client/progs.inc) +target_compile_definitions(csprogs PRIVATE -DCSQC) + +add_executable(progs qcsrc/server/progs.inc) +target_compile_definitions(progs PRIVATE -DSVQC) + +add_executable(menu qcsrc/menu/progs.inc) +target_compile_definitions(menu PRIVATE -DMENUQC) diff --git a/cmake/CMakeASMCompiler.cmake.in b/cmake/CMakeASMCompiler.cmake.in new file mode 100644 index 000000000..e18e9edf4 --- /dev/null +++ b/cmake/CMakeASMCompiler.cmake.in @@ -0,0 +1,8 @@ +set(CMAKE_ASM_COMPILER "@CMAKE_ASM_COMPILER@") +set(CMAKE_ASM_COMPILER_LOADED 1) + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS qc;qh;inc) +set(CMAKE_ASM_OUTPUT_EXTENSION .o) +set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1) +set(CMAKE_ASM_LINKER_PREFERENCE 42) +set(CMAKE_ASM_COMPILER_ENV_VAR "QCC") diff --git a/cmake/CMakeASMInformation.cmake b/cmake/CMakeASMInformation.cmake new file mode 100644 index 000000000..8fd541b9b --- /dev/null +++ b/cmake/CMakeASMInformation.cmake @@ -0,0 +1,8 @@ +# TODO: +set(CMAKE_ASM_COMPILE_OBJECT " compile -DGMQCC ") +set(CMAKE_ASM_LINK_EXECUTABLE " link -o ") + +set(CMAKE_INCLUDE_FLAG_ASM "-I") +set(CMAKE_INCLUDE_FLAG_ASM_SEP "") +set(CMAKE_EXECUTABLE_PREFIX_ASM "") +set(CMAKE_EXECUTABLE_SUFFIX_ASM ".dat") diff --git a/cmake/CMakeDetermineASMCompiler.cmake b/cmake/CMakeDetermineASMCompiler.cmake new file mode 100644 index 000000000..e8e697645 --- /dev/null +++ b/cmake/CMakeDetermineASMCompiler.cmake @@ -0,0 +1,5 @@ +set(CMAKE_ASM_COMPILER ${PROJECT_SOURCE_DIR}/cmake/qcc.sh) + +configure_file(cmake/CMakeASMCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeASMCompiler.cmake @ONLY) +set(CMAKE_ASM_COMPILER_ENV_VAR "QCC") diff --git a/cmake/CMakeTestASMCompiler.cmake b/cmake/CMakeTestASMCompiler.cmake new file mode 100644 index 000000000..9d293a85a --- /dev/null +++ b/cmake/CMakeTestASMCompiler.cmake @@ -0,0 +1 @@ +set(CMAKE_ASM_COMPILER_WORKS 1 CACHE INTERNAL "") diff --git a/cmake/qcc.sh b/cmake/qcc.sh new file mode 100755 index 000000000..0fbd8db12 --- /dev/null +++ b/cmake/qcc.sh @@ -0,0 +1,19 @@ +#!/bin/bash +QCC=${QCC:-$(dirname "$0")/../../../gmqcc/gmqcc} +case $1 in + compile) + echo $@ + cpp ${@:3} | sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' > $2 + ;; + link) + ${QCC} \ + -std=gmqcc \ + -Ooverlap-locals \ + -O3 \ + -Werror -Wall \ + -Wno-field-redeclared \ + -flno -futf8 -fno-bail-on-werror \ + -frelaxed-switch -freturn-assignments \ + ${@:2} + ;; +esac -- 2.39.2