forked from macroquest/eqlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheqlib.cmake
More file actions
108 lines (88 loc) · 3.9 KB
/
eqlib.cmake
File metadata and controls
108 lines (88 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Generated from eqlib.props
# This file should be included in CMakeLists.txt files that need these settings
# NOTE: Import order preserved from original .props file
include_guard()
set(PATH_TO_eqlib_DIR ${CMAKE_CURRENT_LIST_DIR})
macro(target_eqlib_props TARGET_NAME)
set(eqlibRoot "${PATH_TO_eqlib_DIR}/")
# ---------------------------------------------------------------------
# Import from original props file
# ---------------------------------------------------------------------
# TODO: Manual conversion required for import: ${eqlibRoot}tools/build_scripts/nasm/nasm.targets
# This import does not have a .props extension and cannot be automatically processed
# ---------------------------------------------------------------------
# Import from original props file
# ---------------------------------------------------------------------
# Depends on conversion of: ${eqlibRoot}tools/build_scripts/nasm/nasm.props
# include(${eqlibRoot}tools/build_scripts/nasm/nasm.cmake)
# target_nasm_props(${TARGET_NAME})
# ---------------------------------------------------------------------
# PropertyGroup settings
# ---------------------------------------------------------------------
set(eqlibClientTarget "Live")
if("${eqlibClientTarget}" STREQUAL "Live")
set(eqlibClientDefine "LIVE")
elseif("${eqlibClientTarget}" STREQUAL "Test")
set(eqlibClientDefine "TEST")
elseif("${eqlibClientTarget}" STREQUAL "Emu")
set(eqlibClientDefine "EMULATOR")
elseif("${eqlibClientTarget}" STREQUAL "Beta")
set(eqlibClientDefine "BETA")
endif()
if("${eqlibClientTarget}" STREQUAL "Live")
set(eqlibResourceDefine EQLIB_TARGET=\"Live\")
elseif("${eqlibClientTarget}" STREQUAL "Test")
set(eqlibResourceDefine "EQLIB_TARGET=\"Test\"")
elseif("${eqlibClientTarget}" STREQUAL "Emu")
set(eqlibResourceDefine "EQLIB_TARGET=\"Emu\"")
elseif("${eqlibClientTarget}" STREQUAL "Beta")
set(eqlibResourceDefine "EQLIB_TARGET=\"Beta\"")
elseif("${eqlibClientTarget}" STREQUAL "")
set(eqlibResourceDefine "EQLIB_TARGET=\"Unknown\"")
endif()
# ---------------------------------------------------------------------
# VS Settings
# ---------------------------------------------------------------------
# NASM targets imports
set_property(TARGET ${TARGET_NAME} PROPERTY VS_PROJECT_IMPORT
"${PATH_TO_eqlib_DIR}/tools/build_scripts/nasm/nasm.props"
"${PATH_TO_eqlib_DIR}/tools/build_scripts/nasm/nasm.targets"
)
# This is needed by the NASM target
set_property(TARGET ${TARGET_NAME} PROPERTY
VS_GLOBAL_eqlibRoot "${eqlibRoot}"
)
# ---------------------------------------------------------------------
# Compiler settings
# ---------------------------------------------------------------------
# Include directories
target_include_directories(${TARGET_NAME} PRIVATE
"${PATH_TO_eqlib_DIR}/include"
"${PATH_TO_eqlib_DIR}/src"
"${PATH_TO_eqlib_DIR}"
)
# Compiler options
target_compile_options(${TARGET_NAME} PRIVATE
"/utf-8"
)
endmacro()
macro(add_nasm_sources)
source_group("Assembly Files" FILES ${ARGN})
# Determine architecture-specific preprocessor definitions
if(CMAKE_GENERATOR_PLATFORM STREQUAL "x64")
set(_NASM_ARCH_DEFINE "ARCH_X64")
else()
set(_NASM_ARCH_DEFINE "ARCH_X86")
endif()
foreach(src_file ${ARGN})
set_source_files_properties(${src_file} PROPERTIES
VS_TOOL_OVERRIDE "NASM"
)
set_property(SOURCE ${src_file} APPEND PROPERTY
VS_SETTINGS
"IncludePaths=${PATH_TO_eqlib_DIR}/include"
"GenerateDebugInformation=true"
"PreprocessorDefinitions=${_NASM_ARCH_DEFINE}\;${eqlibClientDefine}"
)
endforeach()
endmacro()