/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include #include #include #include #include #include int main(int argc, char* argv[]) { // Create a ComponentApplication to initialize the AZ::SystemAllocator and initialize the SettingsRegistry AZ::ComponentApplication::Descriptor desc; AZ::ComponentApplication application; application.Create(desc); AZStd::vector envVars; const char* homePath = std::getenv("HOME"); envVars.push_back(AZStd::string::format("HOME=%s", homePath)); if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr) { const char* dyldLibPathOrig = std::getenv("DYLD_LIBRARY_PATH"); AZStd::string dyldSearchPath = AZStd::string::format("DYLD_LIBRARY_PATH=%s", dyldLibPathOrig); if (AZ::IO::FixedMaxPath projectModulePath; settingsRegistry->Get(projectModulePath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectConfigurationBinPath)) { dyldSearchPath.append(":"); dyldSearchPath.append(projectModulePath.c_str()); } if (AZ::IO::FixedMaxPath installedBinariesFolder; settingsRegistry->Get(installedBinariesFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_InstalledBinaryFolder)) { if (AZ::IO::FixedMaxPath engineRootFolder; settingsRegistry->Get(engineRootFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder)) { installedBinariesFolder = engineRootFolder / installedBinariesFolder; dyldSearchPath.append(":"); dyldSearchPath.append(installedBinariesFolder.c_str()); } } envVars.push_back(dyldSearchPath); } AZStd::string commandArgs; for (int i = 1; i < argc; i++) { commandArgs.append(argv[i]); commandArgs.append(" "); } AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo; AZ::IO::Path processPath{ AZ::IO::PathView(AZ::Utils::GetExecutableDirectory()) }; processPath /= "AssetProcessor"; processLaunchInfo.m_processExecutableString = AZStd::move(processPath.Native()); processLaunchInfo.m_commandlineParameters = commandArgs; processLaunchInfo.m_environmentVariables = &envVars; processLaunchInfo.m_showWindow = true; AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo); application.Destroy(); return 0; }