| 1 |
# |
| 2 |
# License: Zlib |
| 3 |
# see https://gitlab.com/cam900/vgsound_emu/-/blob/main/LICENSE for more details |
| 4 |
# |
| 5 |
# Copyright holder(s): cam900 |
| 6 |
# CMake for vgsound_emu |
| 7 |
# |
| 8 |
|
| 9 |
cmake_minimum_required(VERSION 3.0...3.20) |
| 10 |
project(vgsound_emu |
| 11 |
VERSION 2.1.1 |
| 12 |
LANGUAGES CXX) |
| 13 |
|
| 14 |
enable_language(CXX) |
| 15 |
|
| 16 |
option(VGSOUND_EMU_ES5504 "Use ES5504 core" ON) |
| 17 |
option(VGSOUND_EMU_ES5505 "Use ES5505 core" ON) |
| 18 |
option(VGSOUND_EMU_ES5506 "Use ES5506 core" ON) |
| 19 |
option(VGSOUND_EMU_K005289 "Use K005289 core" ON) |
| 20 |
option(VGSOUND_EMU_K007232 "Use K007232 core" ON) |
| 21 |
option(VGSOUND_EMU_K053260 "Use K053260 core" ON) |
| 22 |
option(VGSOUND_EMU_MSM6295 "Use MSM6295 core" ON) |
| 23 |
option(VGSOUND_EMU_NAMCO_163 "Use Namco 163 core" ON) |
| 24 |
option(VGSOUND_EMU_SCC "Use SCC core" ON) |
| 25 |
option(VGSOUND_EMU_VRCVI "Use VRC VI core" ON) |
| 26 |
option(VGSOUND_EMU_X1_010 "Use X1-010 core" ON) |
| 27 |
|
| 28 |
message(STATUS "Host: ${CMAKE_HOST_SYSTEM_NAME}, ${CMAKE_HOST_SYSTEM_PROCESSOR}") |
| 29 |
message(STATUS "Target: ${CMAKE_SYSTEM_NAME}, ${CMAKE_SYSTEM_PROCESSOR}") |
| 30 |
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID}") |
| 31 |
message(STATUS "CMake version: ${CMAKE_VERSION}") |
| 32 |
message(STATUS "Generator: ${CMAKE_GENERATOR}") |
| 33 |
message(STATUS "Extra generator: ${CMAKE_EXTRA_GENERATOR}") |
| 34 |
message(STATUS "Make program: ${CMAKE_MAKE_PROGRAM}") |
| 35 |
|
| 36 |
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.1.0") |
| 37 |
message(STATUS "Generating C++11 compile features:") |
| 38 |
|
| 39 |
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.8.0") |
| 40 |
set(cxx_features cxx_std_11) |
| 41 |
else() |
| 42 |
set(cxx_features |
| 43 |
cxx_template_template_parameters |
| 44 |
cxx_alias_templates |
| 45 |
cxx_alignas |
| 46 |
cxx_alignof |
| 47 |
cxx_attributes |
| 48 |
cxx_auto_type |
| 49 |
cxx_constexpr |
| 50 |
cxx_decltype |
| 51 |
cxx_decltype_incomplete_return_types |
| 52 |
cxx_default_function_template_args |
| 53 |
cxx_defaulted_functions |
| 54 |
cxx_defaulted_move_initializers |
| 55 |
cxx_delegating_constructors |
| 56 |
cxx_deleted_functions |
| 57 |
cxx_enum_forward_declarations |
| 58 |
cxx_explicit_conversions |
| 59 |
cxx_extended_friend_declarations |
| 60 |
cxx_extern_templates |
| 61 |
cxx_final |
| 62 |
cxx_func_identifier |
| 63 |
cxx_generalized_initializers |
| 64 |
cxx_inheriting_constructors |
| 65 |
cxx_inline_namespaces |
| 66 |
cxx_lambdas |
| 67 |
cxx_local_type_template_args |
| 68 |
cxx_long_long_type |
| 69 |
cxx_noexcept |
| 70 |
cxx_nonstatic_member_init |
| 71 |
cxx_nullptr |
| 72 |
cxx_override |
| 73 |
cxx_range_for |
| 74 |
cxx_raw_string_literals |
| 75 |
cxx_reference_qualified_functions |
| 76 |
cxx_right_angle_brackets |
| 77 |
cxx_rvalue_references |
| 78 |
cxx_sizeof_member |
| 79 |
cxx_static_assert |
| 80 |
cxx_strong_enums |
| 81 |
cxx_thread_local |
| 82 |
cxx_trailing_return_types |
| 83 |
cxx_unicode_literals |
| 84 |
cxx_uniform_initialization |
| 85 |
cxx_unrestricted_unions |
| 86 |
cxx_user_literals |
| 87 |
cxx_variadic_macros |
| 88 |
cxx_variadic_templates) |
| 89 |
endif() |
| 90 |
|
| 91 |
message(STATUS "${cxx_features}") |
| 92 |
endif() |
| 93 |
|
| 94 |
set(CORE_SOURCE "") |
| 95 |
set(EMU_SOURCE "") |
| 96 |
|
| 97 |
# Core functions |
| 98 |
list(APPEND CORE_SOURCE |
| 99 |
vgsound_emu/src/core/core.hpp |
| 100 |
vgsound_emu/src/core/util.hpp |
| 101 |
vgsound_emu/src/core/util/clock_pulse.hpp |
| 102 |
vgsound_emu/src/core/util/mem_intf.hpp |
| 103 |
) |
| 104 |
|
| 105 |
# Dialogic ADPCM |
| 106 |
if(VGSOUND_EMU_MSM6295) |
| 107 |
list(APPEND CORE_SOURCE |
| 108 |
vgsound_emu/src/core/vox/vox.hpp |
| 109 |
vgsound_emu/src/core/vox/vox.cpp |
| 110 |
) |
| 111 |
message(STATUS "Using Dialogic ADPCM core") |
| 112 |
endif() |
| 113 |
|
| 114 |
# ES5504, ES5505, ES5506 |
| 115 |
if(VGSOUND_EMU_ES5504 OR VGSOUND_EMU_ES5505 OR VGSOUND_EMU_ES5506) |
| 116 |
list(APPEND EMU_SOURCE |
| 117 |
vgsound_emu/src/es550x/es550x.hpp |
| 118 |
|
| 119 |
vgsound_emu/src/es550x/es550x.cpp |
| 120 |
vgsound_emu/src/es550x/es550x_alu.cpp |
| 121 |
vgsound_emu/src/es550x/es550x_filter.cpp |
| 122 |
) |
| 123 |
|
| 124 |
if(VGSOUND_EMU_ES5504) |
| 125 |
list(APPEND EMU_SOURCE |
| 126 |
vgsound_emu/src/es550x/es5504.hpp |
| 127 |
vgsound_emu/src/es550x/es5504.cpp |
| 128 |
) |
| 129 |
message(STATUS "Using ES5504 core") |
| 130 |
endif() |
| 131 |
|
| 132 |
if(VGSOUND_EMU_ES5505) |
| 133 |
list(APPEND EMU_SOURCE |
| 134 |
vgsound_emu/src/es550x/es5505.hpp |
| 135 |
vgsound_emu/src/es550x/es5505.cpp |
| 136 |
) |
| 137 |
message(STATUS "Using ES5505 core") |
| 138 |
endif() |
| 139 |
|
| 140 |
if(VGSOUND_EMU_ES5506) |
| 141 |
list(APPEND EMU_SOURCE |
| 142 |
vgsound_emu/src/es550x/es5506.hpp |
| 143 |
vgsound_emu/src/es550x/es5506.cpp |
| 144 |
) |
| 145 |
message(STATUS "Using ES5506 core") |
| 146 |
endif() |
| 147 |
endif() |
| 148 |
|
| 149 |
# K005289 |
| 150 |
if(VGSOUND_EMU_K005289) |
| 151 |
list(APPEND EMU_SOURCE |
| 152 |
vgsound_emu/src/k005289/k005289.hpp |
| 153 |
vgsound_emu/src/k005289/k005289.cpp |
| 154 |
) |
| 155 |
message(STATUS "Using K005289 core") |
| 156 |
endif() |
| 157 |
|
| 158 |
# K007232 |
| 159 |
if(VGSOUND_EMU_K007232) |
| 160 |
list(APPEND EMU_SOURCE |
| 161 |
vgsound_emu/src/k007232/k007232.hpp |
| 162 |
vgsound_emu/src/k007232/k007232.cpp |
| 163 |
) |
| 164 |
message(STATUS "Using K007232 core") |
| 165 |
endif() |
| 166 |
|
| 167 |
# K053260 |
| 168 |
if(VGSOUND_EMU_K053260) |
| 169 |
list(APPEND EMU_SOURCE |
| 170 |
vgsound_emu/src/k053260/k053260.hpp |
| 171 |
vgsound_emu/src/k053260/k053260.cpp |
| 172 |
) |
| 173 |
message(STATUS "Using K053260 core") |
| 174 |
endif() |
| 175 |
|
| 176 |
# MSM6295 |
| 177 |
if(VGSOUND_EMU_MSM6295) |
| 178 |
list(APPEND EMU_SOURCE |
| 179 |
vgsound_emu/src/msm6295/msm6295.hpp |
| 180 |
vgsound_emu/src/msm6295/msm6295.cpp |
| 181 |
) |
| 182 |
message(STATUS "Using MSM6295 core") |
| 183 |
endif() |
| 184 |
|
| 185 |
# Namco 163 |
| 186 |
if(VGSOUND_EMU_NAMCO_163) |
| 187 |
list(APPEND EMU_SOURCE |
| 188 |
vgsound_emu/src/n163/n163.hpp |
| 189 |
vgsound_emu/src/n163/n163.cpp |
| 190 |
) |
| 191 |
message(STATUS "Using Namco 163 core") |
| 192 |
endif() |
| 193 |
|
| 194 |
# SCC |
| 195 |
if(VGSOUND_EMU_SCC) |
| 196 |
list(APPEND EMU_SOURCE |
| 197 |
vgsound_emu/src/scc/scc.hpp |
| 198 |
vgsound_emu/src/scc/scc.cpp |
| 199 |
) |
| 200 |
message(STATUS "Using SCC core") |
| 201 |
endif() |
| 202 |
|
| 203 |
# VRC VI |
| 204 |
if(VGSOUND_EMU_VRCVI) |
| 205 |
list(APPEND EMU_SOURCE |
| 206 |
vgsound_emu/src/vrcvi/vrcvi.hpp |
| 207 |
vgsound_emu/src/vrcvi/vrcvi.cpp |
| 208 |
) |
| 209 |
message(STATUS "Using VRC VI core") |
| 210 |
endif() |
| 211 |
|
| 212 |
# X1-010 |
| 213 |
if(VGSOUND_EMU_X1_010) |
| 214 |
list(APPEND EMU_SOURCE |
| 215 |
vgsound_emu/src/x1_010/x1_010.hpp |
| 216 |
vgsound_emu/src/x1_010/x1_010.cpp |
| 217 |
) |
| 218 |
message(STATUS "Using X1-010 core") |
| 219 |
endif() |
| 220 |
|
| 221 |
add_library(vgsound_emu STATIC ${CORE_SOURCE} ${EMU_SOURCE}) |
| 222 |
|
| 223 |
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.1.0") |
| 224 |
set_target_properties(vgsound_emu |
| 225 |
PROPERTIES |
| 226 |
CXX_STANDARD 11 |
| 227 |
CXX_STANDARD_REQUIRED ON |
| 228 |
CXX_EXTENSIONS OFF) |
| 229 |
target_compile_features(vgsound_emu PRIVATE ${cxx_features}) |
| 230 |
message(STATUS "C++11 Enabled") |
| 231 |
endif() |
| 232 |
|
| 233 |
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) |
| 234 |
|
| 235 |
# for Test purpose (GCC) |
| 236 |
# target_compile_options(vgsound_emu PRIVATE -Wall -Wextra -Werror) |