void VisualStudioProvider::createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir, const StringList &includeList, const StringList &excludeList) { const std::string projectFile = setup.outputDir + '/' + name + getProjectExtension(); std::ofstream project(projectFile.c_str()); if (!project) error("Could not open \"" + projectFile + "\" for writing"); project << "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n" "<VisualStudioProject\n" "\tProjectType=\"Visual C++\"\n" "\tVersion=\"" << _version << ".00\"\n" "\tName=\"" << name << "\"\n" "\tProjectGUID=\"{" << uuid << "}\"\n" "\tRootNamespace=\"" << name << "\"\n" "\tKeyword=\"Win32Proj\"\n"; project << "\tTargetFrameworkVersion=\"131072\"\n"; project << "\t>\n" "\t<Platforms>\n" "\t\t<Platform Name=\"Win32\" />\n" "\t\t<Platform Name=\"x64\" />\n" "\t</Platforms>\n" "\t<Configurations>\n"; // Check for project-specific warnings: std::map< std::string, std::list<std::string> >::iterator warningsIterator = _projectWarnings.find(name); if (setup.devTools || setup.tests || name == setup.projectName) { std::string libraries; for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) libraries += ' ' + *i + ".lib"; // Win32 outputConfiguration(project, setup, libraries, "Debug", "Win32", "", true); outputConfiguration(project, setup, libraries, "Analysis", "Win32", "", true); outputConfiguration(project, setup, libraries, "LLVM", "Win32", "", true); outputConfiguration(project, setup, libraries, "Release", "Win32", "", true); // x64 // For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and // re-create the library list, BUT since NASM doesn't link any additional libraries, we can just use the // libraries list created for IA-32. If that changes in the future, we need to adjust this part! outputConfiguration(project, setup, libraries, "Debug", "x64", "64", false); outputConfiguration(project, setup, libraries, "Analysis", "x64", "64", false); outputConfiguration(project, setup, libraries, "LLVM", "Win32", "64", false); outputConfiguration(project, setup, libraries, "Release", "x64", "64", false); } else { bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end(); bool disableEditAndContinue = find(_disableEditAndContinue.begin(), _disableEditAndContinue.end(), name) != _disableEditAndContinue.end(); std::string warnings = ""; if (warningsIterator != _projectWarnings.end()) for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i) warnings += *i + ';'; std::string toolConfig; toolConfig = (!warnings.empty() ? "DisableSpecificWarnings=\"" + warnings + "\"" : ""); toolConfig += (disableEditAndContinue ? "DebugInformationFormat=\"3\" " : ""); toolConfig += (enableLanguageExtensions ? "DisableLanguageExtensions=\"false\" " : ""); // Win32 outputConfiguration(setup, project, toolConfig, "Debug", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Analysis", "Win32", ""); outputConfiguration(setup, project, toolConfig, "LLVM", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Release", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Debug", "x64", "64"); outputConfiguration(setup, project, toolConfig, "Analysis", "x64", "64"); outputConfiguration(setup, project, toolConfig, "LLVM", "x64", "64"); outputConfiguration(setup, project, toolConfig, "Release", "x64", "64"); } project << "\t</Configurations>\n" "\t<Files>\n"; std::string modulePath; if (!moduleDir.compare(0, setup.srcDir.size(), setup.srcDir)) { modulePath = moduleDir.substr(setup.srcDir.size()); if (!modulePath.empty() && modulePath.at(0) == '/') modulePath.erase(0, 1); } if (modulePath.size()) addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix + '/' + modulePath); else addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix); // Output auto-generated test runner if (setup.tests) { project << "\t\t<File RelativePath=\"test_runner.cpp\" />\n"; } project << "\t</Files>\n" "</VisualStudioProject>\n"; }
void MSBuildProvider::createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir, const StringList &includeList, const StringList &excludeList) { const std::string projectFile = setup.outputDir + '/' + name + getProjectExtension(); std::ofstream project(projectFile.c_str()); if (!project) error("Could not open \"" + projectFile + "\" for writing"); project << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<Project DefaultTargets=\"Build\" ToolsVersion=\"" << (_version >= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" "\t<ItemGroup Label=\"ProjectConfigurations\">\n"; outputConfiguration(project, "Debug", "Win32"); outputConfiguration(project, "Debug", "x64"); outputConfiguration(project, "Analysis", "Win32"); outputConfiguration(project, "Analysis", "x64"); outputConfiguration(project, "Release", "Win32"); outputConfiguration(project, "Release", "x64"); project << "\t</ItemGroup>\n"; // Project name & Guid project << "\t<PropertyGroup Label=\"Globals\">\n" "\t\t<ProjectGuid>{" << uuid << "}</ProjectGuid>\n" "\t\t<RootNamespace>" << name << "</RootNamespace>\n" "\t\t<Keyword>Win32Proj</Keyword>\n" "\t\t<VCTargetsPath Condition=\"'$(VCTargetsPath" << _version << ")' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''\">$(VCTargetsPath" << _version << ")</VCTargetsPath>\n" "\t</PropertyGroup>\n"; // Shared configuration project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n"; outputConfigurationType(setup, project, name, "Release|Win32", _version); outputConfigurationType(setup, project, name, "Analysis|Win32", _version); outputConfigurationType(setup, project, name, "Debug|Win32", _version); outputConfigurationType(setup, project, name, "Release|x64", _version); outputConfigurationType(setup, project, name, "Analysis|x64", _version); outputConfigurationType(setup, project, name, "Debug|x64", _version); project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n" "\t<ImportGroup Label=\"ExtensionSettings\">\n" "\t</ImportGroup>\n"; outputProperties(project, "Release|Win32", setup.projectDescription + "_Release.props"); outputProperties(project, "Analysis|Win32", setup.projectDescription + "_Analysis.props"); outputProperties(project, "Debug|Win32", setup.projectDescription + "_Debug.props"); outputProperties(project, "Release|x64", setup.projectDescription + "_Release64.props"); outputProperties(project, "Analysis|x64", setup.projectDescription + "_Analysis64.props"); outputProperties(project, "Debug|x64", setup.projectDescription + "_Debug64.props"); project << "\t<PropertyGroup Label=\"UserMacros\" />\n"; // Project-specific settings (analysis uses debug properties) outputProjectSettings(project, name, setup, false, true, false); outputProjectSettings(project, name, setup, false, true, true); outputProjectSettings(project, name, setup, true, true, false); outputProjectSettings(project, name, setup, false, false, false); outputProjectSettings(project, name, setup, false, false, true); outputProjectSettings(project, name, setup, true, false, false); // Files std::string modulePath; if (!moduleDir.compare(0, setup.srcDir.size(), setup.srcDir)) { modulePath = moduleDir.substr(setup.srcDir.size()); if (!modulePath.empty() && modulePath.at(0) == '/') modulePath.erase(0, 1); } if (modulePath.size()) addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix + '/' + modulePath); else addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix); // Output references for the main project if (name == setup.projectName) writeReferences(setup, project); // Output auto-generated test runner if (setup.tests) { project << "\t<ItemGroup>\n"; project << "\t\t<ClCompile Include=\"test_runner.cpp\" />\n"; project << "\t</ItemGroup>\n"; } project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n" "\t<ImportGroup Label=\"ExtensionTargets\">\n" "\t</ImportGroup>\n"; if (setup.tests) { // We override the normal target to ignore the exit code (this allows us to have a clean output and not message about the command exit code) project << "\t\t<Target Name=\"PostBuildEvent\">\n" << "\t\t\t<Message Text=\"Description: Run tests\" />\n" << "\t\t\t<Exec Command=\"$(TargetPath)\" IgnoreExitCode=\"true\" />\n" << "\t\t</Target>\n"; } project << "</Project>\n"; // Output filter file if necessary createFiltersFile(setup, name); }
status_t BnCameraDeviceUser::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case DISCONNECT: { ALOGV("DISCONNECT"); CHECK_INTERFACE(ICameraDeviceUser, data, reply); disconnect(); reply->writeNoException(); return NO_ERROR; } break; case SUBMIT_REQUEST: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); // arg0 = request sp<CaptureRequest> request; if (data.readInt32() != 0) { request = new CaptureRequest(); request->readFromParcel(const_cast<Parcel*>(&data)); } // arg1 = streaming (bool) bool repeating = data.readInt32(); // return code: requestId (int32) reply->writeNoException(); int64_t lastFrameNumber = -1; reply->writeInt32(submitRequest(request, repeating, &lastFrameNumber)); reply->writeInt32(1); reply->writeInt64(lastFrameNumber); return NO_ERROR; } break; case SUBMIT_REQUEST_LIST: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); List<sp<CaptureRequest> > requestList; int requestListSize = data.readInt32(); for (int i = 0; i < requestListSize; i++) { if (data.readInt32() != 0) { sp<CaptureRequest> request = new CaptureRequest(); if (request->readFromParcel(const_cast<Parcel*>(&data)) != OK) { return BAD_VALUE; } requestList.push_back(request); } else { sp<CaptureRequest> request = 0; requestList.push_back(request); ALOGE("A request is missing. Sending in null request."); } } bool repeating = data.readInt32(); reply->writeNoException(); int64_t lastFrameNumber = -1; reply->writeInt32(submitRequestList(requestList, repeating, &lastFrameNumber)); reply->writeInt32(1); reply->writeInt64(lastFrameNumber); return NO_ERROR; } break; case CANCEL_REQUEST: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); int requestId = data.readInt32(); reply->writeNoException(); int64_t lastFrameNumber = -1; reply->writeInt32(cancelRequest(requestId, &lastFrameNumber)); reply->writeInt32(1); reply->writeInt64(lastFrameNumber); return NO_ERROR; } break; case DELETE_STREAM: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); int streamId = data.readInt32(); reply->writeNoException(); reply->writeInt32(deleteStream(streamId)); return NO_ERROR; } break; case CREATE_STREAM: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); status_t ret = BAD_VALUE; if (data.readInt32() != 0) { OutputConfiguration outputConfiguration(data); ret = createStream(outputConfiguration); } else { ALOGE("%s: cannot take an empty OutputConfiguration", __FUNCTION__); } reply->writeNoException(); ALOGV("%s: CREATE_STREAM: write noException", __FUNCTION__); reply->writeInt32(ret); ALOGV("%s: CREATE_STREAM: write ret = %d", __FUNCTION__, ret); return NO_ERROR; } break; case CREATE_INPUT_STREAM: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); int width, height, format; width = data.readInt32(); height = data.readInt32(); format = data.readInt32(); status_t ret = createInputStream(width, height, format); reply->writeNoException(); reply->writeInt32(ret); return NO_ERROR; } break; case GET_INPUT_SURFACE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); sp<IGraphicBufferProducer> bp; status_t ret = getInputBufferProducer(&bp); sp<IBinder> b(IInterface::asBinder(ret == OK ? bp : NULL)); reply->writeNoException(); reply->writeInt32(ret); reply->writeInt32(1); reply->writeString16(String16("camera input")); // name of surface reply->writeStrongBinder(b); return NO_ERROR; } break; case CREATE_DEFAULT_REQUEST: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); int templateId = data.readInt32(); CameraMetadata request; status_t ret; ret = createDefaultRequest(templateId, &request); reply->writeNoException(); reply->writeInt32(ret); // out-variables are after exception and return value reply->writeInt32(1); // to mark presence of metadata object request.writeToParcel(const_cast<Parcel*>(reply)); return NO_ERROR; } break; case GET_CAMERA_INFO: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); CameraMetadata info; status_t ret; ret = getCameraInfo(&info); reply->writeNoException(); reply->writeInt32(ret); // out-variables are after exception and return value reply->writeInt32(1); // to mark presence of metadata object info.writeToParcel(reply); return NO_ERROR; } break; case WAIT_UNTIL_IDLE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); reply->writeNoException(); reply->writeInt32(waitUntilIdle()); return NO_ERROR; } break; case FLUSH: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); reply->writeNoException(); int64_t lastFrameNumber = -1; reply->writeInt32(flush(&lastFrameNumber)); reply->writeInt32(1); reply->writeInt64(lastFrameNumber); return NO_ERROR; } case BEGIN_CONFIGURE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); reply->writeNoException(); reply->writeInt32(beginConfigure()); return NO_ERROR; } break; case END_CONFIGURE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); bool isConstrainedHighSpeed = data.readInt32(); reply->writeNoException(); reply->writeInt32(endConfigure(isConstrainedHighSpeed)); return NO_ERROR; } break; case PREPARE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); int streamId = data.readInt32(); reply->writeNoException(); reply->writeInt32(prepare(streamId)); return NO_ERROR; } break; case TEAR_DOWN: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); int streamId = data.readInt32(); reply->writeNoException(); reply->writeInt32(tearDown(streamId)); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } }