-- -- Copyright 2010-2020 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause -- local naclToolchain = "" local toolchainPrefix = "" if _OPTIONS['TOOLCHAIN'] then toolchainPrefix = _OPTIONS["TOOLCHAIN"] end newoption { trigger = "gcc", value = "GCC", description = "Choose GCC flavor", allowed = { { "android-arm", "Android - ARM" }, { "android-arm64", "Android - ARM64" }, { "android-mips", "Android - MIPS" }, { "android-mips64","Android - MIPS64" }, { "android-x86", "Android - x86" }, { "android-x64", "Android - x64" }, { "asmjs", "Emscripten/asm.js" }, { "freebsd", "FreeBSD" }, { "freebsd-clang", "FreeBSD (clang compiler)"}, { "linux-gcc", "Linux (GCC compiler)" }, { "linux-clang", "Linux (Clang compiler)" }, { "ios-arm", "iOS - ARM" }, { "ios-simulator", "iOS - Simulator" }, { "mingw32-gcc", "MinGW32" }, { "mingw64-gcc", "MinGW64" }, { "mingw-clang", "MinGW (clang compiler)" }, { "netbsd", "NetBSD" }, { "netbsd-clang", "NetBSD (clang compiler)"}, { "openbsd", "OpenBSD" }, { "osx", "OSX (GCC compiler)" }, { "osx-clang", "OSX (Clang compiler)" }, { "pnacl", "Native Client - PNaCl" }, { "rpi", "RaspberryPi" }, { "solaris", "Solaris" }, { "steamlink", "Steam Link" }, { "ci20", "Creator-Ci20" }, }, } newoption { trigger = "vs", value = "toolset", description = "Choose VS toolset", allowed = { { "intel-14", "Intel C++ Compiler XE 14.0" }, { "intel-15", "Intel C++ Compiler XE 15.0" }, { "vs2015-clang", "Clang 3.6" }, { "vs2015-xp", "Visual Studio 2015 targeting XP" }, { "vs2017-clang", "Clang 3.6" }, { "vs2017-xp", "Visual Studio 2017 targeting XP" }, { "clangcl", "Visual Studio 2019 using Clang/LLVM" }, { "winphone8", "Windows Phone 8.0" }, { "winphone81", "Windows Phone 8.1" }, { "winstore81", "Windows Store 8.1" }, { "winstore82", "Universal Windows App" } }, } newoption { trigger = "xcode", value = "xcode_target", description = "Choose XCode target", allowed = { { "osx", "OSX" }, { "ios", "iOS" }, } } newoption { trigger = "with-android", value = "#", description = "Set Android platform version (default: android-21).", } newoption { trigger = "with-ios", value = "#", description = "Set iOS target version (default: 8.0).", } newoption { trigger = "with-windows", value = "#", description = "Set the Windows target platform version (default: 10.0.10240.0).", } function toolchain(_buildDir, _subDir) location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION) local androidPlatform = "android-24" if _OPTIONS["with-android"] then androidPlatform = "android-" .. _OPTIONS["with-android"] elseif _OPTIONS["PLATFORM"]:find("64", -2) then androidPlatform = "android-24" end local iosPlatform = "" if _OPTIONS["with-ios"] then iosPlatform = _OPTIONS["with-ios"] end local windowsPlatform = "10.0.10240.0" if _OPTIONS["with-windows"] then windowsPlatform = _OPTIONS["with-windows"] end if _ACTION == "gmake" or _ACTION == "ninja" then if nil == _OPTIONS["gcc"] or nil == _OPTIONS["gcc_version"] then print("GCC flavor and version must be specified!") os.exit(1) end if string.find(_OPTIONS["gcc"], "android") then -- 64-bit android platform requires >= 21 if _OPTIONS["PLATFORM"]:find("64", -2) and tonumber(androidPlatform:sub(9)) < 21 then error("64-bit android requires platform 21 or higher") end if not os.getenv("ANDROID_NDK_ROOT") then print("Set ANDROID_NDK_ROOT environment variable.") end if not os.getenv("ANDROID_NDK_LLVM") then print("Set ANDROID_NDK_LLVM envrionment variable.") end platform_ndk_env = "ANDROID_NDK_" .. _OPTIONS["PLATFORM"]:upper() if not os.getenv(platform_ndk_env) then print("Set " .. platform_ndk_env .. " environment variable.") end local platformToolchainMap = { ['arm'] = "arm-linux-androideabi", ['arm64'] = "aarch64-linux-android", ['mips64'] = "mips64el-linux-android", ['mips'] = "mipsel-linux-android", ['x86'] = "i686-linux-android", ['x64'] = "x86_64-linux-android", } toolchainPrefix = os.getenv(platform_ndk_env) .. "/bin/" .. platformToolchainMap[_OPTIONS["PLATFORM"]] .. "-" premake.gcc.cc = "$(ANDROID_NDK_LLVM)/bin/clang" premake.gcc.cxx = "$(ANDROID_NDK_LLVM)/bin/clang++" premake.gcc.ar = toolchainPrefix .. "ar" premake.gcc.llvm = true location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-" .. _OPTIONS["PLATFORM"]) end if "asmjs" == _OPTIONS["gcc"] then if not os.getenv("EMSCRIPTEN") then print("Set EMSCRIPTEN enviroment variables.") end premake.gcc.cc = "$(EMSCRIPTEN)/emcc" premake.gcc.cxx = "$(EMSCRIPTEN)/em++" premake.gcc.ar = "$(EMSCRIPTEN)/emar" premake.gcc.llvm = true location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-asmjs") end if "freebsd" == _OPTIONS["gcc"] then location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-freebsd") end if "freebsd-clang" == _OPTIONS["gcc"] then location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-freebsd-clang") end if "netbsd" == _OPTIONS["gcc"] then location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-netbsd") end if "netbsd-clang" == _OPTIONS["gcc"] then location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-netbsd-clang") end if "openbsd" == _OPTIONS["gcc"] then location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-openbsd") end if "ios-arm" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-ios-arm") end if "ios-simulator" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-ios-simulator") end if "linux-gcc" == _OPTIONS["gcc"] then -- Force gcc-4.2 on ubuntu-intrepid if _OPTIONS["distro"]=="ubuntu-intrepid" then premake.gcc.cc = "@gcc -V 4.2" premake.gcc.cxx = "@g++-4.2" end premake.gcc.ar = "ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-linux") end if "solaris" == _OPTIONS["gcc"] then location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-solaris") end if "linux-clang" == _OPTIONS["gcc"] then premake.gcc.cc = "clang" premake.gcc.cxx = "clang++" premake.gcc.ar = "ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-linux-clang") end if "steamlink" == _OPTIONS["gcc"] then if not os.getenv("MARVELL_SDK_PATH") then print("Set MARVELL_SDK_PATH envrionment variable.") end premake.gcc.cc = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-gcc" premake.gcc.cxx = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-g++" premake.gcc.ar = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-steamlink") end if "rpi" == _OPTIONS["gcc"] then if not os.getenv("RASPBERRY_SDK_PATH") then print("Set RASPBERRY_SDK_PATH envrionment variable.") end premake.gcc.cc = "$(RASPBERRY_SDK_PATH)/bin/arm-linux-gnueabihf-gcc" premake.gcc.cxx = "$(RASPBERRY_SDK_PATH)/bin/arm-linux-gnueabihf-g++" premake.gcc.ar = "$(RASPBERRY_SDK_PATH)/bin/arm-linux-gnueabihf-ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-rpi") end if "ci20" == _OPTIONS["gcc"] then if not os.getenv("MIPS_LINUXGNU_ROOT") then print("Set MIPS_LINUXGNU_ROOT envrionment variable.") end premake.gcc.cc = "$(MIPS_LINUXGNU_ROOT)/bin/mips-mti-linux-gnu-gcc" premake.gcc.cxx = "$(MIPS_LINUXGNU_ROOT)/bin/mips-mti-linux-gnu-g++" premake.gcc.ar = "$(MIPS_LINUXGNU_ROOT)/bin/mips-mti-linux-gnu-ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-ci20") end if "mingw32-gcc" == _OPTIONS["gcc"] then if not os.getenv("MINGW32") then print("Set MINGW32 envrionment variable.") end if toolchainPrefix == nil or toolchainPrefix == "" then toolchainPrefix = "$(MINGW32)/bin/i686-w64-mingw32-" end premake.gcc.cc = toolchainPrefix .. "gcc" premake.gcc.cxx = toolchainPrefix .. "g++" premake.gcc.ar = toolchainPrefix .. "gcc-ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw32-gcc") end if "mingw64-gcc" == _OPTIONS["gcc"] then if not os.getenv("MINGW64") then print("Set MINGW64 envrionment variable.") end if toolchainPrefix == nil or toolchainPrefix == "" then toolchainPrefix = "$(MINGW64)/bin/x86_64-w64-mingw32-" end premake.gcc.cc = toolchainPrefix .. "gcc" premake.gcc.cxx = toolchainPrefix .. "g++" premake.gcc.ar = toolchainPrefix .. "gcc-ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw64-gcc") end if "mingw-clang" == _OPTIONS["gcc"] then premake.gcc.cc = "clang" premake.gcc.cxx = "clang++" premake.gcc.ar = "llvm-ar" premake.gcc.llvm = true location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw-clang") end if "osx" == _OPTIONS["gcc"] then if os.is("linux") then premake.gcc.cc = toolchainPrefix .. "clang" premake.gcc.cxx = toolchainPrefix .. "clang++" premake.gcc.ar = toolchainPrefix .. "ar" end location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx") end if "osx-clang" == _OPTIONS["gcc"] then premake.gcc.cc = toolchainPrefix .. "clang" premake.gcc.cxx = toolchainPrefix .. "clang++" premake.gcc.ar = toolchainPrefix .. "ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx-clang") end if "pnacl" == _OPTIONS["gcc"] then if not os.getenv("NACL_SDK_ROOT") then print("Set NACL_SDK_ROOT enviroment variables.") end naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_pnacl/bin/pnacl-" if os.is("macosx") then naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_pnacl/bin/pnacl-" elseif os.is("linux") then naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-" end premake.gcc.cc = naclToolchain .. "clang" premake.gcc.cxx = naclToolchain .. "clang++" premake.gcc.ar = naclToolchain .. "ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-pnacl") end if "rpi" == _OPTIONS["gcc"] then location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-rpi") end if "ci20" == _OPTIONS["gcc"] then location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-ci20") end elseif _ACTION == "vs2015" or _ACTION == "vs2015-fastbuild" then if (_ACTION .. "-clang") == _OPTIONS["vs"] then premake.vstudio.toolset = ("LLVM-" .. _ACTION) location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-clang") end if "winphone8" == _OPTIONS["vs"] then premake.vstudio.toolset = "v110_wp80" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-winphone8") end if "winphone81" == _OPTIONS["vs"] then premake.vstudio.toolset = "v120_wp81" platforms { "ARM" } location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-winphone81") end if "winstore81" == _OPTIONS["vs"] then premake.vstudio.toolset = "v120" premake.vstudio.storeapp = "8.1" platforms { "ARM" } location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-winstore81") end if "winstore82" == _OPTIONS["vs"] then premake.vstudio.toolset = "v140" premake.vstudio.storeapp = "8.2" -- If needed, depending on GENie version, enable file-level configuration if enablefilelevelconfig ~= nil then enablefilelevelconfig() end local action = premake.action.current() action.vstudio.windowsTargetPlatformVersion = windowsPlatform platforms { "ARM" } location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-winstore82") end if "intel-14" == _OPTIONS["vs"] then premake.vstudio.toolset = "Intel C++ Compiler XE 14.0" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-intel") end if "intel-15" == _OPTIONS["vs"] then premake.vstudio.toolset = "Intel C++ Compiler XE 15.0" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-intel") end if ("vs2015-xp") == _OPTIONS["vs"] then premake.vstudio.toolset = ("v140_xp") location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-xp") end elseif _ACTION == "vs2017" or _ACTION == "vs2017-fastbuild" then if (_ACTION .. "-clang") == _OPTIONS["vs"] then premake.vstudio.toolset = ("LLVM-" .. _ACTION) location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-clang") end if "winphone8" == _OPTIONS["vs"] then premake.vstudio.toolset = "v110_wp80" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-winphone8") end if "winphone81" == _OPTIONS["vs"] then premake.vstudio.toolset = "v120_wp81" platforms { "ARM" } location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-winphone81") end if "winstore81" == _OPTIONS["vs"] then premake.vstudio.toolset = "v120" premake.vstudio.storeapp = "8.1" platforms { "ARM" } location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-winstore81") end if "winstore82" == _OPTIONS["vs"] then premake.vstudio.toolset = "v141" premake.vstudio.storeapp = "8.2" -- If needed, depending on GENie version, enable file-level configuration if enablefilelevelconfig ~= nil then enablefilelevelconfig() end local action = premake.action.current() action.vstudio.windowsTargetPlatformVersion = windowsPlatform platforms { "ARM" } location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-winstore82") end if "intel-14" == _OPTIONS["vs"] then premake.vstudio.toolset = "Intel C++ Compiler X
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/*********************************************************************
ui/devopt.cpp
Internal menu for the device configuration.
*********************************************************************/
#include "emu.h"
#include "ui/ui.h"
#include "ui/devopt.h"
namespace ui {
/*-------------------------------------------------
device_config - handle the game information
menu
-------------------------------------------------*/
menu_device_config::menu_device_config(mame_ui_manager &mui, render_container *container, device_slot_interface *slot, device_slot_option *option) : menu(mui, container)
{
m_option = option;
m_owner = slot;
m_mounted = slot->device().subdevice(option->name()) != nullptr;
}
void menu_device_config::populate()
{
std::ostringstream str;
device_t *dev;
util::stream_format(str, "[This option is%s currently mounted in the running system]\n\n", m_mounted ? "" : " NOT");
util::stream_format(str, "Option: %s\n", m_option->name());
dev = const_cast<machine_config &>(machine().config()).device_add(&machine().config().root_device(), m_option->name(), m_option->devtype(), 0);
util::stream_format(str, "Device: %s\n", dev->name());
if (!m_mounted)
str << "\nIf you select this option, the following items will be enabled:\n";
else
str << "\nThe selected option enables the following items:\n";
// loop over all CPUs
execute_interface_iterator execiter(*dev);
if (execiter.count() > 0)
{
str << "* CPU:\n";
std::unordered_set<std::string> exectags;
for (device_execute_interface &exec : execiter)
{
if (!exectags.insert(exec.device().tag()).second)
continue;
// get cpu specific clock that takes internal multiplier/dividers into account
int clock = exec.device().clock();
// count how many identical CPUs we have
int count = 1;
const char *name = exec.device().name();
for (device_execute_interface &scan : execiter)
{
if (exec.device().type() == scan.device().type() && strcmp(name, scan.device().name()) == 0 && exec.device().clock() == scan.device().clock())
if (exectags.insert(scan.device().tag()).second)
count++;
}
// if more than one, prepend a #x in front of the CPU name
if (count > 1)
util::stream_format(str, " %d" UTF8_MULTIPLY, count);
else
str << " ";
str << name;
// display clock in kHz or MHz
if (clock >= 1000000)
util::stream_format(str, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
else
util::stream_format(str